diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4966c2b --- /dev/null +++ b/Makefile @@ -0,0 +1,710 @@ +######################################################################################################################## +# File Name : Makefile +# Description: Local main project Makefile +# Project : Vector Basic Runtime System +# Module : BrsHw for platform ArmCommon +# and Compiler LlvmTexasInstruments, +# using Vector PES MakeSupport 4.1 +# Template : This Makefile is reviewed according to Brs_Template@MakeSupport[1.02.01] +# +#----------------------------------------------------------------------------------------------------------------------- +# COPYRIGHT +#----------------------------------------------------------------------------------------------------------------------- +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +# +#----------------------------------------------------------------------------------------------------------------------- +# REVISION HISTORY +#----------------------------------------------------------------------------------------------------------------------- +# Version Date Author Change Id Description +# ---------------------------------------------------------------------------------------------------------------------- +# 01.00.00 2021-09-29 vishci Initial creation +# 01.00.01 2021-12-17 visbwa Update to Brs_Template 1.01.01, changed default compiler path to fit with chocolatey, +# removed unused code fragments, switched assembler binary to proper tiarmclang and +# adapted the default assembler options, fixed version options +# 01.00.02 2022-01-24 visbwa Added -march attribute value for Cortex-M3/M4 +# 01.00.03 2022-03-24 vismaa Removed Xlinker --scan_libraries +# 01.00.04 2022-05-16 visrgm Added CPU Switch for Cortex-M4F +# 01.01.00 2022-07-25 visbwa Changed linker option -e from brsStartupEntry to intvect_CoreExceptions, as this +# proper entry is always available since Brs_Template 1.03 and references brsStartupEntry +# 01.01.01 2022-07-26 visjhr Added EXCEPTION_TABLE_LDFLAGS +# 01.01.02 2022-07-27 visjhr Fixed EXCEPTION_TABLE_LDFLAGS +# 01.01.03 2022-08-09 visjhr Added ADDITIONAL_INCLUDES += LlvmTi +# 01.01.04 2022-08-10 visjhr Removed all ADDITIONAL_INCLUDES +# 01.01.05 2022-09-05 visdri Add ADDITIONAL_CFLAGS_FROM_VBRS to CFLAGS_VECTOR_OPTIONS +# 01.01.06 2022-09-23 visjhr Added usage of BRS_FIRST_EXECUTION_INSTANCE for selection of entry/startup label +# 01.01.07 2023-01-11 visqli Moved PROJECT_NAME to Makefile.static and included Makefile.static forwards, +# enabled generation of PROJECT_NAME and LINKER_COMMAND_FILE +# 01.01.08 2023-03-13 vishci Added -mcpu and -march value for Cortex-M0/M0plus +# 01.01.09 2023-03-14 visjhr Use BRS_CPU_CORE_x_USED variables to prevent optimization of exception tables +# (HALBE-8500 Generate additional core specific variables in Makefile.config.generated) +# 01.01.10 2023-03-15 vishci Added core specific mfloat-abi option +# 01.01.11 2023-03-20 visbwa Added --memwidth=8 to HexFlags, after user feedback +# 01.01.12 2023-07-06 visdri Compile ARMBrsHwIntTb_CortexR.c / ARMStartup_CortexR.c in ARM state even when +# Thumb state is configured for the project +# 01.01.13 2023-07-14 visbwa Added keep for FBL exception table in RAM (intvect_CoreExceptions_Ram) +# 01.01.14 2023-11-16 visbwa LDFLAG -u=intvect_CoreExceptions_Ram only for FBL UseCase +# 01.01.15 2024-03-05 virrlu Changed ARFLAGS to -r after user feedback +# 01.01.16 2024-03-28 vishci BASEENV-11520 Added forced ARM state to compiling ARMBrsHwIntTb_CortexR.c / ARMStartup_CortexR.c to +# all CORTEX_R based cores, Brs_Template 1.01.05 (Change Id) +# 01.01.17 2024-06-24 kal BASEENV-12084 Added comment clarifying default C language standard (GNU11) +# 01.02.00 2024-08-01 vishci BASEENV-12178 Unify naming of intvect_CoreExceptions_Ram_Vectortable for FBL usecase and added keep flag +# 01.02.01 2024-08-27 vishci Bugfix for intvect_CoreExceptions_Ram_Vectortable flag in Cortex M Cores +# 01.03.00 2025-06-12 visbwa BASEENV-13804 Replaced include of Makefile.config.generated and Makefile.project.part.defines in Makefile.static +# by new Makefile.wrapper; added usage of new parameter TEMPDATA_DIR for LINKER_COMMAND_FILE; +# review to Brs_Template 1.02.00; fixed LNK_SUFFIX +# 01.03.01 2025-07-31 visbwa TAR-93253 Added LDFLAGS_RESPONSE_FILE value in Makefile.static +# 01.03.02 2025-07-31 visbwa TAR-93253 Introduced RESPONSE_FILE_MULTILINE in Makefile.static and set to '1'; +# feature was introduced with zBrs_MakeSupport@Implementation[4.01.65] +# 01.04.00 2025-09-02 kal BASEENV-14399 Added support for Cortex-R52 (TI Arm Clang Compiler Tools >= 4.03.00 LTS) +# 01.04.01 2025-10-16 visbwa Set 4.0.3.LTS as default compiler for Cortex-R52 +######################################################################################################################## + +######################################################################################################################## +# EXAMPLE CODE ONLY +#----------------------------------------------------------------------------------------------------------------------- +# This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. +# The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither +# intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or +# implementations must be tested with diligent care and must comply with all quality requirements which are necessary +# according to the state of the art before their use. +######################################################################################################################## + +#------------------------------------------------------------------------------ +# Static settings placed inside separate file +#------------------------------------------------------------------------------ +include Makefile.static + +#------------------------------------------------------------------------------ +# Name of linker file +# +# If BRS_LINKER_COMMAND_FILE_POSTFIX (derived from referenced vLinGen variant +# vBRS/vBRSGeneral/vBRSVariantUsageOfvLinkGen) was generated into +# Makefile.config.generated (by vBRS Cfg5 generator), use that file. +#------------------------------------------------------------------------------ +ifeq ($(BRS_LINKER_COMMAND_FILE_POSTFIX),) +LINKER_COMMAND_FILE = $(TEMPDATA_DIR)/vLinkGen_Template.$(LNK_SUFFIX) +else +LINKER_COMMAND_FILE = $(TEMPDATA_DIR)/vLinkGen_Template_$(BRS_LINKER_COMMAND_FILE_POSTFIX).$(LNK_SUFFIX) +endif + +#------------------------------------------------------------------------------ +# Define Compiler path, e.g. +# COMPILER_BASE_WIN = D:\uti\%vendor%\%platform%\%version% (\ can be used) +# COMPILER_BASE := $(subst \,/,$(COMPILER_BASE_WIN)) (\ is converted to /) +# COMPILER_BIN = $(COMPILER_BASE)/bin +# COMPILER_INC = $(COMPILER_BASE)/inc +# COMPILER_LIB = $(COMPILER_BASE)/lib +# +# If BRS_COMPILER_PATH (vBRS/vBRSHwConfig/vBRSCompilerPath) was generated into +# Makefile.config.generated (by vBRS Cfg5 generator), use that path. +#------------------------------------------------------------------------------ +ifeq ($(BRS_COMPILER_PATH),) + ifeq ($(CPU_CORE),CORTEX_R52) + #TI Arm Clang Compiler Tools 4.0.3 LTS now offers basic support for R52 + COMPILER_BASE_WIN = D:\uti\TI\LLVMARM\ccs\tools\compiler\ti-cgt-armllvm_4.0.3.LTS + else + COMPILER_BASE_WIN = D:\uti\TI\LLVMARM\ccs\tools\compiler\ti-cgt-armllvm_1.3.0.LTS + endif +else +COMPILER_BASE_WIN = $(BRS_COMPILER_PATH) +endif +COMPILER_BASE := $(subst \,/,$(COMPILER_BASE_WIN)) +COMPILER_BIN = $(COMPILER_BASE)/bin +COMPILER_INC = $(COMPILER_BASE)/include +COMPILER_LIB = $(COMPILER_BASE)/lib + +#------------------------------------------------------------------------------ +# Build Options Selection: VECTOR / CUSTOMER +#------------------------------------------------------------------------------ +ASFLAGS_SELECTOR = VECTOR +CFLAGS_SELECTOR = VECTOR +LDFLAGS_SELECTOR = VECTOR + +#------------------------------------------------------------------------------ +# Define Emulator path +# E.g.: EMU_PATH = C:/UTI/HITOPWIN/P6811 +# +# This parameter is not mandatory. It is used for some platforms, to provide +# e.g. debug connect scripts (e.g. multi within RH850). +#------------------------------------------------------------------------------ +EMU_PATH = + +#------------------------------------------------------------------------------ +# Set $(NANT_USED) to '1', to enable the usage of NAnt support within +# Global Makefile. If this is enabled, the MakeSupport will include the +# NAnt support from an internal link and the NAnt build targets can be used. +#------------------------------------------------------------------------------ +#NANT_USED = 1 + +#------------------------------------------------------------------------------ +# Set MKVERBOSE to a various value, to enable enhanced debug output from +# MakeSupport. To disable this afterwards, set MKVERBOSE to nothing +# (comment out this line and type "set MKVERBOSE=" in command window) +#------------------------------------------------------------------------------ +#MKVERBOSE = 1 + +#------------------------------------------------------------------------------ +# Set $(BRSVINFO_USED) to 1 to enable the generation of BrsVInfo.h within the +# GenData folder by the MakeSupport. +# The BrsVInfo.h will contain e.g. kBrsCompilerVersion, to use this +# information within the embedded code. +#------------------------------------------------------------------------------ +#BRSVINFO_USED = 1 + +#------------------------------------------------------------------------------ +# Set $(USE_RESPONSE_FILE_FOR_LINKAGE) to '1' to pass object files in a response file +# to the linker instead of using the command line. +# +# Use it if you hit the limit of maximum length command line length under Windows. +# +# See e.g. the following link regarding some information on response files: +# https://gcc.gnu.org/wiki/Response_Files +# +# If you enable 'USE_RESPONSE_FILE_FOR_LINKAGE', you also need to define +# 'LDFLAGS_RESPONSE_FILE' in Makefile.static. +#------------------------------------------------------------------------------ +#USE_RESPONSE_FILE_FOR_LINKAGE=1 + +#------------------------------------------------------------------------------ +# Functions used within Assembler/Compiler/Linker options. +# +# Common functionality is encapsulated in the following functions: +# - obj2err +# - obj2lst +# +# Example: +# --list-file=$(call obj2lst,$@) +# --error-file=$(call obj2err,$@) +# +# Please have a look at Makefile_functions.mk for further detailed information. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Extra dependency defines +# The DEPEND tool which is normally a preprocessor +# is called with $(EXTRA_DEPENDFLAGS) and $(CPPFLAGS). +# +# The cross compiler adds its own defines which DEPEND +# doesn't know. +# +# Add cross options set by compiler and other options +# for the preprocessor here. +# e.g.: EXTRA_DEPENDFLAGS += -D__CTC__ +# +# For normal build defines use $(CPPFLAGS_VECTOR_MAKESUPPORT). +#------------------------------------------------------------------------------ +EXTRA_DEPENDFLAGS += + +#-------------------------------------- +# CPU-core-specific CFLAGS option list +#-------------------------------------- +CPU_SWITCH_CORTEX_M0 = Cortex-M0 +CPU_SWITCH_CORTEX_M0PLUS = Cortex-M0plus +CPU_SWITCH_CORTEX_M3 = Cortex-M3 +CPU_SWITCH_CORTEX_M4 = Cortex-M4 +CPU_SWITCH_CORTEX_M4F = Cortex-M4 +CPU_SWITCH_CORTEX_R5F = Cortex-R5 +CPU_SWITCH_CORTEX_R52 = Cortex-R52 + +ifeq ($(CPU_SWITCH_$(CPU_CORE)),) + $(error COMPILERFLAGERROR: The compiler option (-mcpu=) is not defined!) +endif + +#-------------------------------------------------- +# CPU-core-architecture specific CFLAGS option list +#-------------------------------------------------- +ARCHITECTURE_SWITCH_CORTEX_M0 = armv6-m +ARCHITECTURE_SWITCH_CORTEX_M0PLUS = armv6-m +ARCHITECTURE_SWITCH_CORTEX_M3 = armv7-m +ARCHITECTURE_SWITCH_CORTEX_M4 = armv7-m +ARCHITECTURE_SWITCH_CORTEX_M4F = armv7-m +ARCHITECTURE_SWITCH_CORTEX_R5F = armv7-r + +ifeq ($(ARCHITECTURE_SWITCH_$(CPU_CORE)),) + # -march=armv8-r not (yet) supported in tiarmclang 4.0.3 LTS + ifneq ($(CPU_CORE),CORTEX_R52) + $(error COMPILERFLAGERROR: The compiler option (-march=) is not defined!) + endif +endif + + +#------------------------------------------------------------------------------ +# CPU-core-specific FPU option list +#------------------------------------------------------------------------------ +ifeq ($(FPU_USED),1) + CFLAGS_FPU_CORTEX_R5F = vfpv3-d16 -mfloat-abi=hard + CFLAGS_FPU_CORTEX_M4F = fpv4-sp-d16 -mfloat-abi=hard + # CFLAGS_FPU_CORTEX_R52: neon-fp-armv8 FPU is enabled by default +else + CFLAGS_FPU_$(CPU_CORE) = none -mfloat-abi=soft +endif + +ifeq ($(CFLAGS_FPU_$(CPU_CORE)),) + $(error COMPILERFLAGERROR: The compiler option (-mfpu=) is not defined!) +endif + +#------------------------------------------------------------------------------ +# $(AS_ENV) is the environment necessary to run the assembler +# $(AS) defines the path to the assembler +# $(ASFLAGS_VECTOR_MAKESUPPORT) defines all assembler switches, mandatory for +# the Vector build environment (MakeSupport/BrsHw) +# $(ASFLAGS_VECTOR_OPTIONS) defines the Vector default assembler switches +# $(ASFLAGS_CUSTOMER_OPTIONS) defines the customer requested assembler switches +# Depending of ASFLAGS_SELECTOR, ASFLAGS_VECTOR_OPTIONS or ASFLAGS_CUSTOMER_OPTIONS +# are used together with $(ASFLAGS_VECTOR_MAKESUPPORT) for build. +#------------------------------------------------------------------------------ +AS_ENV = +AS = $(COMPILER_BIN)/tiarmclang + +#------------------------------------------------------------------------------ +# Please add only absolutely mandatory options below +#------------------------------------------------------------------------------ +ASFLAGS_VECTOR_MAKESUPPORT = -c \ + -o $@ + +#------------------------------------------------------------------------------ +# $(ASFLAGS_VECTOR_PREPROCESS) defines the options in preprocessing +# just before assembler starts. This flag is used only if +# AS_VECTOR_PREPROCESS (located in Makefile.static) is enabled. +# +# $(CPPFLAGS_CORE) can be added here. +#------------------------------------------------------------------------------ +ASFLAGS_VECTOR_PREPROCESS = $(CPPFLAGS_CORE) + +#------------------------------------------------------------------------------ +# Please add any other option below (Vector default options) +# +# Use $(ASFLAGS_VECTOR_OPTIONS) if assembler supports preprocessing by default. +# In case of assembler does not support preprocessing and preprocessing is +# enabled by $(ASFLAGS_VECTOR_PREPROCESS) in a prestep +# $(CPPFLAGS_CORE) must be set in $(ASFLAGS_VECTOR_PREPROCESS) +#------------------------------------------------------------------------------ +ASFLAGS_VECTOR_OPTIONS = $(CFLAGS_VECTOR_OPTIONS) + +#------------------------------------------------------------------------------ +# Please enter all customer options below +#------------------------------------------------------------------------------ +ASFLAGS_CUSTOMER_OPTIONS = + +#------------------------------------------------------------------------------ +# $(ASVERSION) defines the assembler switch for version report. +# E.g.: ASVERSION = -V +#------------------------------------------------------------------------------ +ASVERSION = --version + +#------------------------------------------------------------------------------ +# $(AS_LC) defines the number of lines used for assembler version information. +# $(AS_OFF) defines the offset of lines used for assembler version information +# in BrsVinfo.h and Deliverydescription (default is 5). +#------------------------------------------------------------------------------ +AS_OFF = +AS_LC = 1 + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# $(CC_ENV) is the environment necessary to run the compiler +# $(CC) defines the path to the C-Compiler +# $(CFLAGS_VECTOR_MAKESUPPORT) defines all compiler switches, mandatory for +# the Vector build environment (Makesupport/BrsHw) +# $(CFLAGS_VECTOR_OPTIONS) defines the Vector default compiler switches +# $(CFLAGS_CUSTOMER_OPTIONS) defines the customer requested compiler switches +# Depending $(CFLAGS_SELECTOR), $(CFLAGS_VECTOR_OPTIONS) or +# $(CFLAGS_CUSTOMER_OPTIONS) is used together with $(CFLAGS_VECTOR_MAKESUPPORT) +# for build. +# +# Avoid $(OBJ_SUFFIX) to filter use $(basename $@) because +# ECO has a preprocess using CFLAGS_xx and the target is of type source. +#------------------------------------------------------------------------------ +CC_ENV = +CC = $(COMPILER_BIN)/tiarmclang + +#------------------------------------------------------------------------------ +# Please add only absolutely mandatory options below +# +# BRS values: +# -DBRS_COMP_$(COMPILER_MANUFACTURER) +# -DBRS_PLATFORM_$(PLATFORM) +# +# Avoid $(OBJ_SUFFIX) to filter. Use $(basename $@) because +# ECO has a preprocess using CFLAGS_xx and the target is of type source. +#------------------------------------------------------------------------------ +CPPFLAGS_VECTOR_MAKESUPPORT = -DBRS_PLATFORM_$(PLATFORM) \ + -DBRS_COMP_$(COMPILER_MANUFACTURER) + +CFLAGS_VECTOR_MAKESUPPORT = -c \ + -o $@ + +CFLAGS_ARM = -marm +CFLAGS_THUMB = -mthumb + +ifeq ($(CFLAGS_$(INSTRUCTION_SET)),) + $(error COMPILERFLAGERROR: The compiler option for the instruction set is not defined!) +endif + +#------------------------------------------------------------------------------ +# Add depend options here. +# It is separated because of the option to overwrite +# $(COMPILER_SUPPORTS_DEPEND) or have different compile without +# path length problem in command line. +# +# Pay attention below if $(MAKESUPPORT_POST_COMPILE_CMD) is +# used in context of depend file creation. +# +# Example: +# CFLAGS_VECTOR_MAKESUPPORT += -MMD -MF $(@:.o=.dt) +# MAKESUPPORT_POST_COMPILE_CMD += $(SED) -Ef $(MAKESUPPORT_DIR_U)/util/fix_dos_dep_file.sed < $(@:.o=.dt) > $(@:.o=.d); +# MAKESUPPORT_POST_COMPILE_CMD += $(RM) $(@:.o=.dt); +#------------------------------------------------------------------------------ +ifeq ($(COMPILER_SUPPORTS_DEPEND),1) + CFLAGS_VECTOR_MAKESUPPORT += -MD + MAKESUPPORT_POST_COMPILE_CMD += + + #----------------------------------------------------------------------------- + # If $(CC) shall create dependency file as well, fill the following variables. + # Otherwise, 'clang' does the task without using a floating license. + #----------------------------------------------------------------------------- + #DEPEND = $(CC_ENV) $(CC) + #DEPENDFLAGS = +endif + +#------------------------------------------------------------------------------ +# $(REUSE_CPP_DEPEND) is set because compiler has a path length problem +#------------------------------------------------------------------------------ +#REUSE_CPP_DEPEND = 1 +ifeq ($(COMPILER_SUPPORTS_DEPEND)+$(REUSE_CPP_DEPEND),1+1) + $(error Can not set both: COMPILER_SUPPORTS_DEPEND and REUSE_CPP_DEPEND) +endif + +#------------------------------------------------------------------------------ +# Post compile command to cleanup anything during compilation process +# +# Calling convention: +# $(call MAKESUPPORT_POST_COMPILE_CMD,$@,$<) +#------------------------------------------------------------------------------ +MAKESUPPORT_POST_COMPILE_CMD += + +#------------------------------------------------------------------------------ +# Please add any other option below (Vector default options) +# Avoid $(OBJ_SUFFIX) to filter use $(basename $@) because +# ECO has a preprocess using CFLAGS_xx and the target is of type source. +#------------------------------------------------------------------------------ +# If no -std option is specified when compiling a C source file, gnu11 is assumed by default. +CFLAGS_VECTOR_OPTIONS = -Wall \ + -mcpu=$(CPU_SWITCH_$(CPU_CORE)) \ + -mfpu=$(CFLAGS_FPU_$(CPU_CORE)) \ + -mlittle-endian \ + -O1 \ + -g \ + $(CFLAGS_$(INSTRUCTION_SET)) \ + $(ADDITIONAL_CFLAGS_FROM_VBRS) \ + $(CPU_MARCH_FLAGS) + +# Only set -march if CPU_CORE is not R52 +ifeq ($(CPU_CORE),CORTEX_R52) +CPU_MARCH_FLAGS = +else +CPU_MARCH_FLAGS = -march=$(ARCHITECTURE_SWITCH_$(CPU_CORE)) +endif + +#------------------------------------------------------------------------------ +# Please enter all customer options below +# Avoid $(OBJ_SUFFIX) to filter use $(basename $@) because +# ECO has a preprocess using CFLAGS_xx and the target is of type source. +#------------------------------------------------------------------------------ +CFLAGS_CUSTOMER_OPTIONS = + +#------------------------------------------------------------------------------ +# $(CVERSION) defines the compiler switch for version report +# E.g.: CVERSION = -V +#------------------------------------------------------------------------------ +CVERSION = --version + +#------------------------------------------------------------------------------ +# $(CC_LC) defines the number of lines used for compiler version information +# $(CC_OFF) defines the offset of lines used for compiler version information +# in BrsVinfo.h and Deliverydescription (default is 5) +#------------------------------------------------------------------------------ +CC_OFF = +CC_LC = 1 + +#------------------------------------------------------------------------------ +# Filter out section +# Add flags which must be filtered out for specific files +# +# Examples: +# FILTER_Os=-g # no debug option for file Os.c +# FILTER_COMPONENT_Det=-g # no debug option for component Det +#------------------------------------------------------------------------------ +#FILTER_ = +#FILTER_COMPONENT_ = + +# Note: +# The exception table and the init of exc table using the backup exc table are +# implmented in ARM mode => (ARMBrsHwIntTb_CortexR.c, ARMStartup_CortexR.c) +# must be compiled in ARM mode even when Thumb mode instruction set is configured. +ifeq ($(CPU_CORE), $(filter $(CPU_CORE), CORTEX_R4 CORTEX_R4F CORTEX_R5 CORTEX_R5F CORTEX_R52 CORTEX_R7)) + ifeq ($(INSTRUCTION_SET),THUMB) + FILTER_ARMBrsHwIntTb_CortexR = $(CFLAGS_THUMB) + CFLAGS_ARMBrsHwIntTb_CortexR = $(CFLAGS_ARM) + FILTER_ARMStartup_CortexR = $(CFLAGS_THUMB) + CFLAGS_ARMStartup_CortexR = $(CFLAGS_ARM) + endif +endif + +#------------------------------------------------------------------------------ +# Additional file specific compiler options +#------------------------------------------------------------------------------ +#CFLAGS_ = +#CFLAGS_COMPONENT_ = + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# $(LD_ENV) is the environment necessary to run the linker +# $(LD) defines the path to the linker +# $(LDFLAGS_VECTOR_MAKESUPPORT) defines all linker switches, mandatory for the +# Vector build environment (MakeSupport/BrsHw) +# $(LDFLAGS_VECTOR_OPTIONS) defines the Vector default linker switches +# $(LDFLAGS_CUSTOMER_OPTIONS) defines the customer requested linker switches +# Depending on $(LDFLAGS_SELECTOR), $(LDFLAGS_VECTOR_OPTIONS) or +# $(LDFLAGS_CUSTOMER_OPTIONS)is used together with $(LDFLAGS_VECTOR_MAKESUPPORT) +# for build. +#------------------------------------------------------------------------------ +LD_ENV = +LD = $(COMPILER_BIN)/tiarmclang + +ifeq ($(BRS_FIRST_EXECUTION_INSTANCE),1) + ifeq ($(CPU_CORE),$(filter $(CPU_CORE),CORTEX_M0 CORTEX_M0PLUS CORTEX_M3 CORTEX_M33 CORTEX_M4 CORTEX_M4F CORTEX_M7)) + LDFLAGS_ENTRY = brsStartupEntry + else + LDFLAGS_ENTRY = intvect_CoreExceptions + endif +else + LDFLAGS_ENTRY = Brs_ApplicationEntry +endif + +#------------------------------------------------------------------------------ +# Please add only absolutely mandatory options below +# +# Please use $(PROJECT_NAME).$(BINARY_SUFFIX) or $(TARGET) instead of $@ and +# $(PROJECT_NAME) instead of $* because flags +# are used in delivery description. +# +# Linker script file name : $(LINKER_COMMAND_FILE) +#------------------------------------------------------------------------------ +LDFLAGS_VECTOR_MAKESUPPORT = -Xlinker -c \ + -Xlinker -e=$(LDFLAGS_ENTRY) \ + -Xlinker -m$(PROJECT_NAME).map \ + -o $(TARGET) + +#------------------------------------------------------------------------------ +# Set $(PREPROCESS_LINKER_COMMAND_FILE) to 1 to preprocess +# linker command file. $(USER_LINKER_COMMAND_FILE) can be set manually +# but is $(PROJECT_NAME).$(LNK_SUFFIX) by default. +#------------------------------------------------------------------------------ +#PREPROCESS_LINKER_COMMAND_FILE = 1 + +#------------------------------------------------------------------------------ +# Post link command to cleanup anything during linking process +# +# Calling convention: +# $(call MAKESUPPORT_POST_LINK_CMD,$@,$<) +#------------------------------------------------------------------------------ +MAKESUPPORT_POST_LINK_CMD += + +#------------------------------------------------------------------------------ +# Please add any other option below (Vector default options) +# +# Please use $(PROJECT_NAME).$(BINARY_SUFFIX) or $(TARGET) instead of +# $@ and $(PROJECT_NAME) instead of $* because flags +# are used in delivery description. +# +# Linker script file name : $(LINKER_COMMAND_FILE) +#------------------------------------------------------------------------------ +# --diag_suppress=10063-D is to suppress linker warning for +# "entry-point symbol other than "_c_int00" specified: "intvect_CoreExceptions"" +# +# --diag_suppress=10068-D is to suppress linker warning for +# "no matching section" +# +# --diag_suppress=10247-D is to suppress linker warning for +# "creating output section ".cinit" without a SECTIONS specification" +#------------------------------------------------------------------------------ +ifeq ($(CPU_CORE),CORTEX_R5F) + EXCEPTION_TABLE_LDFLAGS = -Xlinker -u=intvect_CoreExceptions_vectortable \ + -Xlinker -u=intvect_CoreExceptions_vectortable_backup + + ifeq ($(BRS_CPU_CORE_1_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core1Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core1Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_2_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core2Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core2Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_3_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core3Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core3Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_4_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core4Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core4Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_5_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core5Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core5Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_6_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core6Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core6Exceptions_vectortable_backup + endif + ifeq ($(BRS_CPU_CORE_7_USED),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core7Exceptions_vectortable + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_Core7Exceptions_vectortable_backup + endif + ifeq ($(BRS_FBL_EXCEPTIONTABLE_IN_RAM),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_CoreExceptions_Ram + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_CoreExceptions_Ram_Vectortable + endif +endif + +ifeq ($(BRS_ENABLE_FBL_SUPPORT),1) + ifeq ($(CPU_CORE),$(filter $(CPU_CORE),CORTEX_R4 CORTEX_R4F CORTEX_R5 CORTEX_R5F CORTEX_R52 CORTEX_R7)) + ifeq ($(BRS_FBL_EXCEPTIONTABLE_IN_RAM),1) + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_CoreExceptions_Ram + EXCEPTION_TABLE_LDFLAGS += -Xlinker -u=intvect_CoreExceptions_Ram_Vectortable + endif + endif +endif + +LDFLAGS_VECTOR_OPTIONS = -Xlinker -q \ + -Xlinker --warn_sections \ + -Xlinker --unused_section_elimination=on \ + -Xlinker --compress_dwarf=on \ + -Xlinker --copy_compression=rle \ + -Xlinker --reread_libs \ + -Xlinker --display_error_number \ + -Xlinker --priority \ + $(ADDITIONAL_LDFLAGS_FROM_VBRS) \ + -Xlinker $(LINKER_COMMAND_FILE) \ + -Xlinker --diag_suppress=10063-D \ + -Xlinker --diag_suppress=10068-D \ + -Xlinker --diag_suppress=10247-D \ + $(EXCEPTION_TABLE_LDFLAGS) + +#------------------------------------------------------------------------------ +# Please enter all customer options below +# +# Please use $(PROJECT_NAME).$(BINARY_SUFFIX) instead of $@ and +# $(PROJECT_NAME) instead of $*, because flags +# are used in delivery description. +#------------------------------------------------------------------------------ +LDFLAGS_CUSTOMER_OPTIONS = + +#------------------------------------------------------------------------------ +# Please add additional system libraries below +# +# For some compilers, it is necessary to add additional system libraries. +# E.g. the ARM GCC Gnu compiler may need libc for memcpy or libgcc for modulo +# +# To add additional libraries use: +# -lgcc (libgcc: e.g. support for modulo operation) +# -lc (libc: e.g. support for memcpy function) +#------------------------------------------------------------------------------ +SYSLIBS += + +#------------------------------------------------------------------------------ +# $(LDVERSION) defines the linker switch for version report +# E.g.: LDVERSION = -v +#------------------------------------------------------------------------------ +LDVERSION = --version + +#------------------------------------------------------------------------------ +# $(LD_LC) defines the number of lines used for linker version information +# $(LD_OFF) defines the offset of lines used for linker version information +# in BrsVinfo.h and Delivery Description (default is 5) +#------------------------------------------------------------------------------ +LD_OFF = +LD_LC = 1 + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out if used ------------------------- +# $(HEX_ENV) is the environment necessary to run the hexfile generator +# $(HEX) defines the path to the hex converter, e.g. $(COMPILER_BIN)/gsrec +# $(HEXFLAGS) contains options for HEX tool, e.g. -nos5 -skip .tdata $< -o $@ +#------------------------------------------------------------------------------ +HEX_ENV = $(CC_ENV) +HEX = $(COMPILER_BIN)/tiarmhex + +HEXFLAGS = --intel $(PROJECT_NAME).$(BINARY_SUFFIX) --memwidth=8 --outfile=$(PROJECT_NAME).hex + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out if used ------------------------- +# $(AR_ENV) is the environment necessary to run the librarian +# $(AR) defines the path to the C-librarian +# $(ARFLAGS) defines all librarian switches +# +# Don't add $@. It is added in rule because AR rule is dynamically generated. +#------------------------------------------------------------------------------ +AR_ENV = +AR = $(COMPILER_BIN)/tiarmar + +ARFLAGS = -r + +#------------------------------------------------------------------------------ +# $(ARVERSION) defines the archiver switch for version report +# E.g.: ARVERSION = -v +#------------------------------------------------------------------------------ +ARVERSION = --version + +#------------------------------------------------------------------------------ +# $(AR_LC) defines the number of lines used for librarian version information +# $(AR_OFF) defines the offset of lines used for archiver version information +# in BrsVinfo.h +#------------------------------------------------------------------------------ +AR_OFF = +AR_LC = 1 + +#------------------------------------------------------------------------------ +# Additional includes essentially for compilation +#------------------------------------------------------------------------------ +ADDITIONAL_INCLUDES += + +#------------------------------------------------------------------------------ +# Additional objects essentially for linking +# E.g.: ADDITIONAL_OBJECTS = $(OBJ_PATH)/myobject.$(OBJ_SUFFIX) +#------------------------------------------------------------------------------ +ADDITIONAL_OBJECTS += + +#------------------------------------------------------------------------------ +# Additional libraries essentially for linking +# E.g.: ADDITIONAL_LIBRARIES = $(LIB_PATH)/mylib.$(LIB_SUFFIX) +#------------------------------------------------------------------------------ +ADDITIONAL_LIBRARIES += + +#------------------------------------------------------------------------------ +# List of assembler source files +# E.g.: ASM_SOURCES = source/startup.$(ASM_SUFFIX) +#------------------------------------------------------------------------------ +ASM_SOURCES += + +#------------------------------------------------------------------------------ +# Add Startup code to application source list +# E.g.: APP_SOURCE_LST += source/startup.c +#------------------------------------------------------------------------------ +APP_SOURCE_LST += + +#------------------------------------------------------------------------------ +# Check if all necessary variables are set +# (Checks that are not possible to be performed within Makefile.static) +#------------------------------------------------------------------------------ + +############################################################################### +######### DO NOT remove these lines from the end of the Makefile!!! ########### +############################################################################### + +#------------------------------------------------------------------------------ +# Include the main makefile where all the targets are defined +#------------------------------------------------------------------------------ +include $(MAKESUPPORT_DIR)/Global.Makefile.target.$(VERSION).mk + +# End of Makefile diff --git a/Makefile.static b/Makefile.static new file mode 100644 index 0000000..d7b3015 --- /dev/null +++ b/Makefile.static @@ -0,0 +1,352 @@ +######################################################################################################################## +# File Name : Makefile.static +# Description: This makefile contains the platform/compiler specific static settings (will be included by Makefile) +# Project : Vector Basic Runtime System +# Module : BrsHw for platform ArmCommon +# and Compiler LlvmTexasInstruments, +# using Vector PES MakeSupport 4.1 +# +#----------------------------------------------------------------------------------------------------------------------- +# COPYRIGHT +#----------------------------------------------------------------------------------------------------------------------- +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +# +#----------------------------------------------------------------------------------------------------------------------- +# REVISION HISTORY +#----------------------------------------------------------------------------------------------------------------------- +# Refer to Makefile. +######################################################################################################################## + +######################################################################################################################## +# EXAMPLE CODE ONLY +#----------------------------------------------------------------------------------------------------------------------- +# This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. +# The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither +# intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or +# implementations must be tested with diligent care and must comply with all quality requirements which are necessary +# according to the state of the art before their use. +######################################################################################################################## + +#------------------------------------------------------------------------------ +# Include the wrapper to support DaVinci Cfg5 and Cfg6 folder structures +# (this file is platform/compiler independent and part of vBaseEnv@MakeSupport) +#------------------------------------------------------------------------------ +include Makefile.wrapper + +#------------------------------------------------------------------------------ +# Name of this project. +# +# If BRS_PROJECT_NAME (vBRS/vBRSHwConfig/vBRSProjectName) was generated into +# Makefile.config.generated (by vBRS Cfg5 generator), use that name. +#------------------------------------------------------------------------------ +ifeq ($(BRS_PROJECT_NAME),) +PROJECT_NAME = TestSuit +else +PROJECT_NAME = $(BRS_PROJECT_NAME) +endif + +#------------------------------------------------------------------------------ +# Version of MakeSupport used (current version is 4.1) +#------------------------------------------------------------------------------ +VERSION = 4 +SUB_VERSION = 1 + +############################################################################### +# Platform/compiler/derivative/emulator are relevant for the include of +# linker and symbol preprocessor command file identified by name. +# Vector standard names have to be used +############################################################################### +#------------------------------------------------------------------------------ +# Compiler Manufacturer used in this project +# E.g.: ARM5, ARM6, LLVMDIAB, GHS, GNU, GCCHIGHTEC, IAR, RENESAS, TASKING, TI +#------------------------------------------------------------------------------ +COMPILER_MANUFACTURER = LLVMTEXASINSTRUMENTS + +#------------------------------------------------------------------------------ +# Platform used for this project +# E.g.: ARM, AURIX, POWERPC, RH850 +#------------------------------------------------------------------------------ +PLATFORM = ARM + +#------------------------------------------------------------------------------ +# Emulator used for this project +# E.g.: GHSPROBE, ISYSTEMS, LAUTERBACH, MULTI +# ALL is special for "all derivatives are supported in this file" +#------------------------------------------------------------------------------ +EMULATOR = ALL + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# Suffix of generated object files. Generated objects are then *.$(OBJ_SUFFIX) +#------------------------------------------------------------------------------ +OBJ_SUFFIX = o + +#------------------------------------------------------------------------------ +# Suffix of assembler files. +# The suffixes s, asm, 850 and arm are already considered by MakeSupport +# and do not need to be added. +#------------------------------------------------------------------------------ +ASM_SUFFIX = + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# Suffix of generated list files. Generated list files are then *.$(LST_SUFFIX) +#------------------------------------------------------------------------------ +LST_SUFFIX = lst + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# Suffix linker command file. +#------------------------------------------------------------------------------ +LNK_SUFFIX = ld + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# Suffix binary output file. +#------------------------------------------------------------------------------ +BINARY_SUFFIX = out + +#------------------------------------------------------------------------------ +#------------------------- MUST be filled out --------------------------------- +# Suffix of generated library files. Generated objects are then *.$(LIB_SUFFIX) +#------------------------------------------------------------------------------ +LIB_SUFFIX = lib + +#------------------------------------------------------------------------------ +# Suffixes of generated error files which are placed in $(ERR_PATH) +# (necessary for Visual Studio / Codewright project file generation) +# Default (nothing entered) is err +# E.g. ERR_SUFFIX_LIST = err +#------------------------------------------------------------------------------ +ERR_SUFFIX_LIST = err +ERR_SUFFIX = err + +#------------------------------------------------------------------------------ +# Suffixes of generated asm/list files which are placed in $(LST_PATH) +# (necessary for Visual Studio / Codewright project file generation) +# Default (nothing entered) is lst +# E.g. LST_SUFFIX_LIST = lst asm +#------------------------------------------------------------------------------ +LST_SUFFIX_LIST = + +#------------------------------------------------------------------------------ +# Path of MakeSupport folder relative to main Makefile +#------------------------------------------------------------------------------ +MAKESUPPORT_DIR_MAK=make_support_var.mk +ifeq ($(MAKESUPPORT_DIR),) + -include $(MAKESUPPORT_DIR_MAK) +endif + +ifeq ($(MAKESUPPORT_DIR),) + # Find first on Delivery structure and then in enhanced directory structure + # Stop after first occurance + $(info Looking for MakeSupport in current structure. This could take a while for first invocation.) + MAKESUPPORT_DIR:=$(shell find ../.. ../../.. -name MakeSupport -print -quit) + ifeq ($(MAKESUPPORT_DIR),) + $(error No MakeSupport directory found. Please set 'MAKESUPPORT_DIR' environment variable manually.) + endif + $(info Found MAKESUPPORT_DIR='$(MAKESUPPORT_DIR)'. Save it to '$(MAKESUPPORT_DIR_MAK)' for next invocation.) + $(file >$(MAKESUPPORT_DIR_MAK),MAKESUPPORT_DIR=$(MAKESUPPORT_DIR)) +endif + +distclean:: + @echo "DISTCLEAN $(MAKESUPPORT_DIR_MAK)" + $(Q)$(RM) $(MAKESUPPORT_DIR_MAK) + +#------------------------------------------------------------------------------ +# $(ERR_OUTPUT) defines the way how to generate error files +# It should be one of: +# PIPE - Error will be printed to sterr/stdout and redirected to +# $(ERR_PATH) +# FLAGS - Compiler supports error file generation with or without path +# definition. Therefore, e.g. $(CFLAGS_VECTOR_MAKESUPPORT) +# and $(LDFLAGS_VECTOR_MAKESUPPORT) have to be adjusted. +# It depends on compiler flags whether output is written to +# console as well. +# CONSOLE - No compiler flags handling in MakeSupport (default). +#------------------------------------------------------------------------------ +ERR_OUTPUT = CONSOLE + +#------------------------------------------------------------------------------ +# Add compiler specific redirection flags here +# +# Uncomment V=1 if compiler has redirection options like @E, @O +# +# Example: +# --error-file=$(call obj2err,$@) +#------------------------------------------------------------------------------ +#ifneq ($(V),1) + ifeq ($(ERR_OUTPUT),FLAGS) + ASFLAGS_VECTOR_MAKESUPPORT += + endif +#endif + +#------------------------------------------------------------------------------ +# $(AS_VECTOR_PREPROCESS) enables the preprocessing +# just before assembler starts. +# +# In case of assembler does not support preprocessing by default, preprocessing +# can be enabled by setting $(ASFLAGS_VECTOR_PREPROCESS) to 1 +#------------------------------------------------------------------------------ +#AS_VECTOR_PREPROCESS = 1 + +#------------------------------------------------------------------------------ +# Enable if cross-compiler supports depend. Additional options +# have to be set. +# Attention: +# Some cross-compilers' depend file can have the problem +# of incompatible depend file for cygwin. They could contain +# "" around filepath or ':' when used absolute file spec. +#------------------------------------------------------------------------------ +COMPILER_SUPPORTS_DEPEND = 1 + +#------------------------------------------------------------------------------ +# Used only when USE_RESPONSE_FILE_FOR_LINKAGE is set to 1. +# +# LDFLAGS_RESPONSE_FILE defines the command-line flag used to specify a +# response file. +# For example, with GCC, response files can be passed using "gcc @linker_options". +# In that case, set this variable to "@". +#------------------------------------------------------------------------------ +LDFLAGS_RESPONSE_FILE=-Xlinker + +#------------------------------------------------------------------------------ +# Used only if USE_RESPONSE_FILE_FOR_LINKAGE is set to 1. +# +# If RESPONSE_FILE_MULTILINE is enabled, the response file will be reformatted +# from a single-line to a multi-line format. This is required by certain +# compilers, such as the TI ARM LLVM compiler. +#------------------------------------------------------------------------------ +RESPONSE_FILE_MULTILINE=1 + +#------------------------------------------------------------------------------ +# Add compiler specific redirection flags here +# +# Uncomment V=1 if compiler has redirection options like @E, @O +# +# Example: +# --error-file=$(call obj2err,$@) +#------------------------------------------------------------------------------ +#ifneq ($(V),1) + ifeq ($(ERR_OUTPUT),FLAGS) + CFLAGS_VECTOR_MAKESUPPORT += + endif +#endif + +#------------------------------------------------------------------------------ +# Add linker specific redirection flags here +# +# Uncomment V=1 if compiler has redirection options like @E, @O +# +# Example: +# --error-file=$(call obj2err,$@) +#------------------------------------------------------------------------------ +#ifneq ($(V),1) + ifeq ($(ERR_OUTPUT),FLAGS) + LDFLAGS_VECTOR_MAKESUPPORT += + endif +#endif + +#------------------------------------------------------------------------------ +# $(AR_COMMAND_WITHOUT_SPACE) enables the usage of an archiver command without +# space between the output flag and the target library name. +# +# E.g. this is necessary for the Renesas archiver: -output=$(TARGET_LIBRARY) +#------------------------------------------------------------------------------ +#AR_COMMAND_WITHOUT_SPACE = 1 + +#------------------------------------------------------------------------------ +# hex target might be added like the following template. +# Variable TARGET can not be used here, because TARGET is set in +# Global.Makefile.target.$(VERSION).mk. VERSION is set in Makefile.static. +# Add hex target to default: +#------------------------------------------------------------------------------ +.PHONY: hex +hex: $(PROJECT_NAME).hex + +$(PROJECT_NAME).hex: $(PROJECT_NAME).$(BINARY_SUFFIX) + @$(ECHO) "HEX $@" + $(Q)$(HEX_ENV) $(HEX) $(HEXFLAGS) + +clean:: + @$(ECHO) "CLEAN hex" + $(Q)$(RM) $(PROJECT_NAME).hex + +#------------------------------------------------------------------------------ +# ASSEMBLE_RULE/COMPILE_RULE/LINK_RULE are obsolete now +# +# In previous deliveries *_RULES were overwritten to add or delete +# options to compile/link. +# +# MakeSupport 4 has the general enhancement to add or delete options for a +# specific file. Please add the following variables to your Makefile to control, +# filter out or add specific: +# +# FILTER_=-any -option -to -filter -out +# CFLAGS_=-any -option -to -add +# +# For another option to add a post compile command, please have a look +# at MAKESUPPORT_POST_COMPILE_CMD in Global.Makefile.target.$(VERSION).mk. +# +# If all of these MakeSupport 4 enhancements do not work, please add +# static pattern rule which is a make feature. +# +# Makefile documentation: +# https://www.gnu.org/software/make/manual/html_node/Static-Usage.html#Static-Usage +# +# Example: +# copy & paste from MakeSupport 4 and add your specific file in front with the second ':' : +# my_c_file.c: $(OBJ_PATH)/%.$(OBJ_SUFFIX): $(PRJROOT_U)/%.c +# ... here are your specific rules... +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# make builds the whole project by default +# To make another target, you have to add it to the prerequisites of default. +# E.g.: default: all $(PROJECT_NAME).opt +# Here hex target might be added. +#------------------------------------------------------------------------------ +.PHONY: default +default: all hex + +#------------------------------------------------------------------------------ +# If platform specific rules exist, they can be described here to be shown +# in the usage output of the help target +#help:: +# $(ECHO) "m mytarget ................ -- build mytarget" +# $(ECHO) " nextline" +#------------------------------------------------------------------------------ +#help:: + +#------------------------------------------------------------------------------ +# Check if all necessary variables are set +#------------------------------------------------------------------------------ +ifeq ($(MAKESUPPORT_DIR),) + $(error Variable MAKESUPPORT_DIR is not defined.) +endif + +ifeq ($(PLATFORM),) + $(error Variable PLATFORM is not defined.) +endif + +ifeq ($(COMPILER_MANUFACTURER),) + $(error Variable COMPILER_MANUFACTURER is not defined.) +endif + +ifeq ($(EMULATOR),) + $(error Variable EMULATOR is not defined.) +endif + +ifeq ($(VERSION),) + $(error Variable VERSION is not defined.) +endif + +#------------------------------------------------------------------------------ +# List of variables which are required and must be set within +# Makefile.config.generated. Check is performed by global makefile +#------------------------------------------------------------------------------ +REQUIRED_MK_CONF_VARS = DERIVATIVE \ + CPU_CORE \ + INSTRUCTION_SET + +# End of Makefile.static diff --git a/Makefile.wrapper b/Makefile.wrapper new file mode 100644 index 0000000..80c0a00 --- /dev/null +++ b/Makefile.wrapper @@ -0,0 +1,192 @@ +######################################################################################################################## +# File Name : Makefile.wrapper +# Description: This makefile is a wrapper to support DaVinci Cfg5 and Cfg6 folder structures +# Project : Vector Basic Runtime System +# Module : vBaseEnv +# using Vector PES MakeSupport 4.1 +# +#----------------------------------------------------------------------------------------------------------------------- +# COPYRIGHT +#----------------------------------------------------------------------------------------------------------------------- +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +# +#----------------------------------------------------------------------------------------------------------------------- +# REVISION HISTORY +#----------------------------------------------------------------------------------------------------------------------- +# Version Date Author Change Id Description +# ---------------------------------------------------------------------------------------------------------------------- +# 00.05.00 2025-06-13 visbwa BASEENV-13947 Initial creation for DaVinci Configurator 6 support of PES MakeSupport +# 2025-06-18 visbwa Added support for "custom gendata environment", e.g. used by TscFwHlp +# 00.05.01 2025-06-25 visbwa Fixed CFG5_TEMPDATA_DIR (key sensitive!) +# 01.00.00 2025-07-23 visbwa Final release; changed most warning to info +# 01.01.00 2025-10-14 visbwa Workaround to support CANbedded Make include structure +######################################################################################################################## + +######################################################################################################################## +# EXAMPLE CODE ONLY +#----------------------------------------------------------------------------------------------------------------------- +# This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. +# The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither +# intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or +# implementations must be tested with diligent care and must comply with all quality requirements which are necessary +# according to the state of the art before their use. +######################################################################################################################## + +#------------------------------------------------------------------------------ +# Path to the Cfg6 GenData and Template folders. They are configurable in General.json. +# The paths are relative to the location of the Makefile. +# The default is set to fit with the Cfg6 default folder structure. It needs to be adapted, if this is changed. +# These values are not used within a Cfg5 environment. +#------------------------------------------------------------------------------ +CFG6_GENDATA_DIR = ../Output/Source/GenData +CFG6_TEMPDATA_DIR = ../Output/Source/Templates + +#------------------------------------------------------------------------------ +# Path to the Cfg5 Template folder. It is configurable in Cfg5 Project Settings. +# The path is relative to the location of the Makefile. +# The default is set to fit with the Cfg5 default folder structure. It needs to be adapted, if this is changed. +# This value is not used within a Cfg6 environment. +# The GenData folder for Cfg5 environments is set within Makefile.project.part.defines. +#------------------------------------------------------------------------------ +CFG5_TEMPDATA_DIR = Source + +#------------------------------------------------------------------------------ +# Try to include the project specific settings from DaVinci Cfg5 folder structure +# +# root +# |- Appl (Makefile, Makefile.config.generated) +# |- GenData +# |- Source (LinkerScriptFile) +#------------------------------------------------------------------------------ +-include Makefile.config.generated + +ifeq ($(BRS_GENERATED_HW_CONFIG_VERSION),) + $(info BUILDENVIRONMENT: No Cfg5 environment detected) +else + $(info BUILDENVIRONMENT: Cfg5 environment detected) + CFG5_ENVIRONMENT_DETECTED = 1 +endif + +#------------------------------------------------------------------------------ +# Try to include the project specific settings from DaVinci Cfg6 folder structure +# +# root +# |- Appl (Makefile) +# |- Output +# |- Source +# |- GenData +# |- Make (Makefile.config.generated) +# |- Templates (LinkerScriptFile) +#------------------------------------------------------------------------------ +-include $(CFG6_GENDATA_DIR)/Make/Makefile.config.generated + +ifeq ($(BRS_GENERATED_CFG6_HW_CONFIG_VERSION),) + $(info BUILDENVIRONMENT: No Cfg6 environment detected) +else + $(info BUILDENVIRONMENT: Cfg6 environment detected) + CFG6_ENVIRONMENT_DETECTED = 1 +endif + +#------------------------------------------------------------------------------ +# Workaround for CANbedded TLM to include Os_Core.mak in Os_rules.mak correctly +# because BSW_MAKE_DIR is not yet set in this case. +# (with CANbedded, OS Makefiles are included in MPPD directly and need BSW_MAKE_DIR!) +#------------------------------------------------------------------------------ +ifeq ($(BSW_MAKE_DIR),) + # check for the CANbedded TLM use case using the internal/external structure + # and set the BSW_MAKE_DIR varaible according to the detected folder structure + ifneq ("$(wildcard ../../../internal/external/Components/Os/Make)","") + $(info BUILDENVIRONMENT: CANbedded TLM detected! Workaround for OS Makefile usage in MPPD necessary...) + $(info BUILDENVIRONMENT: BSW_MAKE_DIR set to Make (component based folder structure)) + BSW_MAKE_DIR = Make + else ifneq ("$(wildcard ../../../internal/external/BSW/Os/mak)","") + $(info BUILDENVIRONMENT: CANbedded TLM detected! Workaround for OS Makefile usage in MPPD necessary...) + $(info BUILDENVIRONMENT: BSW_MAKE_DIR set to mak (legacy folder structure)) + BSW_MAKE_DIR = mak + endif +endif + +#------------------------------------------------------------------------------ +# Include of SWCP created MPPD file +#------------------------------------------------------------------------------ +include Makefile.project.part.defines + +#------------------------------------------------------------------------------ +# If neither Cfg5 nor Cfg6 environment was detected, check as fallback case +# if the GENDATA_DIR variable was set in MPPD file and the configured path exists. +# If it exists, use GENDATA_DIR in the following. +#------------------------------------------------------------------------------ +ifeq ($(CFG6_ENVIRONMENT_DETECTED),) + ifeq ($(CFG5_ENVIRONMENT_DETECTED),) + ifneq ($(GENDATA_DIR),) + ifeq ("$(wildcard $(GENDATA_DIR))","") + $(warning BUILDENVIRONMENT: No gendata environment detected. The path, set in GENDATA_DIR, does not exist: $(GENDATA_DIR)) + else + $(info BUILDENVIRONMENT: Custom gendata environment detected via MPPD. GENDATA_DIR: $(GENDATA_DIR)) + CUSTOM_GENDATA_ENVIRONMENT_DETECTED = 1 + endif + else + $(warning BUILDENVIRONMENT: No GENDATA_DIR variable is set. Not able to detect a custom gendata environment) + endif + endif +endif + +#------------------------------------------------------------------------------ +# Plausibility checks +#------------------------------------------------------------------------------ +ifeq ($(CFG6_ENVIRONMENT_DETECTED),) + ifeq ($(CFG5_ENVIRONMENT_DETECTED),) + ifeq ($(CUSTOM_GENDATA_ENVIRONMENT_DETECTED),) + $(error BUILDENVIRONMENT: Neither Cfg5, Cfg6 nor custom environment detected! Check your environment) + endif + endif +else + ifeq ($(CFG5_ENVIRONMENT_DETECTED),1) + $(error BUILDENVIRONMENT: Both environments detected in parallel, Cfg5 and Cfg6! Check your environment) + endif +endif + +#------------------------------------------------------------------------------ +# Static setting of path variables +#------------------------------------------------------------------------------ +ifeq ($(CFG5_ENVIRONMENT_DETECTED),1) + TEMPDATA_DIR = $(CFG5_TEMPDATA_DIR) + $(info BUILDENVIRONMENT: For Cfg5 environment, GENDATA_DIR is set in Makefile.project.part.defines: $(GENDATA_DIR)) + $(info BUILDENVIRONMENT: TEMPDATA_DIR set to Cfg5 supposed value: $(CFG5_TEMPDATA_DIR)) + $(info BUILDENVIRONMENT: To change this path, edit the following file: Makefile.wrapper) +endif + +ifeq ($(CFG6_ENVIRONMENT_DETECTED),1) + GENDATA_DIR = $(CFG6_GENDATA_DIR) + TEMPDATA_DIR = $(CFG6_TEMPDATA_DIR) + ADDITIONAL_INCLUDES += $(TEMPDATA_DIR) + $(info BUILDENVIRONMENT: GENDATA_DIR set to Cfg6 supposed value: $(CFG6_GENDATA_DIR)) + $(info BUILDENVIRONMENT: TEMPDATA_DIR set to Cfg6 supposed value: $(CFG6_TEMPDATA_DIR) and added to ADDITIONAL_INCLUDES) + $(info BUILDENVIRONMENT: To change these paths, edit the following file: Makefile.wrapper) +endif + +ifeq ($(CUSTOM_GENDATA_ENVIRONMENT_DETECTED), 1) + # GENDATA_DIR is taken from Makefile.project.part.defines + # Try to set TEMPDATA_DIR correctly based on subfolder existence in gendata folder + ifneq ("$(wildcard $(GENDATA_DIR)/../Source)","") + TEMPDATA_DIR = $(GENDATA_DIR)/../Source + $(info BUILDENVIRONMENT: TEMPDATA_DIR set to value: $(TEMPDATA_DIR)) + $(info BUILDENVIRONMENT: Custom Cfg5 environment expected. Try to include Makefile.config.generated...) + include $(GENDATA_DIR)/../Makefile.config.generated + else ifneq ("$(wildcard $(GENDATA_DIR)/../Templates)","") + TEMPDATA_DIR = $(GENDATA_DIR)/../Templates + ADDITIONAL_INCLUDES += $(TEMPDATA_DIR) + $(info BUILDENVIRONMENT: TEMPDATA_DIR set to value: $(TEMPDATA_DIR) and added to ADDITIONAL_INCLUDES) + $(info BUILDENVIRONMENT: Custom Cfg6 environment expected. Try to include Makefile.config.generated...) + include $(GENDATA_DIR)/Make/Makefile.config.generated + else + TEMPDATA_DIR = $(GENDATA_DIR) + $(info BUILDENVIRONMENT: TEMPDATA_DIR set to GENDATA_DIR value: $(TEMPDATA_DIR)) + $(info BUILDENVIRONMENT: Complete custom environment expected. Try to include Makefile.config.generated...) + include $(GENDATA_DIR)/Makefile.config.generated + endif + + $(info BUILDENVIRONMENT: To change these paths, edit GENDATA_DIR in Makefile.project.part.defines) +endif + +$(info ********************************************************************************) diff --git a/Source/appl/ARMBrsHwIntTb_CortexR.c b/Source/appl/ARMBrsHwIntTb_CortexR.c new file mode 100644 index 0000000..08a53fb --- /dev/null +++ b/Source/appl/ARMBrsHwIntTb_CortexR.c @@ -0,0 +1,674 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: ARMBrsHwIntTb_CortexR.c + * Project: Vector Basic Runtime System + * Module: BrsHw for all platforms with ARM core Cortex-R + * Template: This file is reviewed according to Brs_Template@Implementation[1.03.12] + * + * \brief Description: This is a global, hardware-independent file for the ARM-BRS. + * It consists of the core exception table for Startup and a 2nd one to be copied into RAM + * for FBL projects. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to ARMBrsHw_CortexR.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define ARMBRSHWINTTB_CORTEXR_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "ARMBrsHw_CortexR.h" + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + +#else + #error "Unknown compiler specified!" +#endif + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +BRS_ISR_KEYWORD void BrsHw_CoreExceptionHandler(void); +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +BRS_ISR_KEYWORD void BrsHw_MultiCoreExceptionHandler(void); +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core1Exceptions) +# if (BRS_CPU_CORE_AMOUNT > 2) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core2Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 3) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core3Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 4) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core4Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 5) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core5Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 6) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core6Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 7) +BRS_LOCAL_FUNCTION_PROTOTYPE(intvect_Core7Exceptions) +# endif +# if (BRS_CPU_CORE_AMOUNT > 8) + #error "More than 8 cores actually not supported by ARMBrsHwIntTb_CortexR.c!" +# endif +#endif /*BRS_ENABLE_OS_MULTICORESUPPORT*/ + +#if defined (BRS_ENABLE_FBL_SUPPORT) && defined (BRS_FBL_EXCEPTIONTABLE_IN_RAM) +BRS_ISR_KEYWORD void BrsHw_CoreExceptionHandler_Ram(void); +#endif + +extern void brsStartupEntry(void); + +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance/executable in the system */ + +/******************************************************************************************** + * * + * Startup Core Exception Handler * + * * + ********************************************************************************************/ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +BRS_ISR_KEYWORD void BrsHw_CoreExceptionHandler(void) +{ +#if defined (BRSHW_BRSHW_COREEXCEPTIONHANDLER_CALLOUT) + BrsTestsuite_BrsHw_CoreExceptionHandler(); +#endif + + volatile uint8 Brs_Continue; + Brs_Continue = 0; + + while (Brs_Continue == 0) + { + /* Set BrsMain_Continue to 1 to continue here. + * If the debugger is not able to show the stack properly, this mechanism can be used to find the + * source of the exception. */ + } +} +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" + +/******************************************************************************************** + * * + * Startup Core Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect" +__attribute__((naked)) void intvect_CoreExceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVectConst"))) void (* const intvect_CoreExceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_CoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_CoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_CoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_CoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_CoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_CoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_CoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVectConst"))) void (* const intvect_CoreExceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_CoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_CoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_CoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_CoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_CoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_CoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_CoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +#endif /*BRS_FIRST_EXECUTION_INSTANCE*/ + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +const ARMBrsHw_PhysicalCoreId_CoreExceptions_MappingType BrsHw_intvect_CoreExceptions_list[BRS_CPU_CORE_AMOUNT-1] = { + {1, intvect_Core1Exceptions} +# if (BRS_CPU_CORE_AMOUNT > 2) + ,{2, intvect_Core2Exceptions} +# endif +# if (BRS_CPU_CORE_AMOUNT > 3) + ,{3, intvect_Core3Exceptions} +# endif +# if (BRS_CPU_CORE_AMOUNT > 4) + ,{4, intvect_Core4Exceptions} +# endif +# if (BRS_CPU_CORE_AMOUNT > 5) + ,{5, intvect_Core5Exceptions} +# endif +# if (BRS_CPU_CORE_AMOUNT > 6) + ,{6, intvect_Core6Exceptions} +# endif +# if (BRS_CPU_CORE_AMOUNT > 7) + ,{7, intvect_Core7Exceptions} +# endif +}; + +/******************************************************************************************** + * * + * MultiCore Exception Handler * + * * + ********************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif +BRS_ISR_KEYWORD void BrsHw_MultiCoreExceptionHandler(void) +{ +#if defined (BRSHW_BRSHW_MULTICOREEXCEPTIONHANDLER_CALLOUT) + BrsTestsuite_BrsHw_MultiCoreExceptionHandler(); +#endif + + volatile uint8 Brs_Continue; + Brs_Continue = 0; + + while (Brs_Continue == 0) + { + /* Set Brs_Continue to 1 to continue here. + * If the debugger is not able to show the stack properly, this mechanism can be used to find the + * source of the exception. */ + } +} +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif + +/******************************************************************************************** + * * + * Core 1 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect1" +__attribute__((naked)) void intvect_Core1Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect1Const"))) void (* const intvect_Core1Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect1Const"))) void (* const intvect_Core1Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + + +# if (BRS_CPU_CORE_AMOUNT > 2) +/******************************************************************************************** + * * + * Core 2 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect2" +__attribute__((naked)) void intvect_Core2Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect2Const"))) void (* const intvect_Core2Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect2Const"))) void (* const intvect_Core2Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 2*/ + +# if (BRS_CPU_CORE_AMOUNT > 3) +/******************************************************************************************** + * * + * Core 3 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect3" +__attribute__((naked)) void intvect_Core3Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect3Const"))) void (* const intvect_Core3Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect3Const"))) void (* const intvect_Core3Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 3*/ + +# if (BRS_CPU_CORE_AMOUNT > 4) +/******************************************************************************************** + * * + * Core 4 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect4" +__attribute__((naked)) void intvect_Core4Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect4Const"))) void (* const intvect_Core4Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect4Const"))) void (* const intvect_Core4Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 4*/ + +# if (BRS_CPU_CORE_AMOUNT > 5) +/******************************************************************************************** + * * + * Core 5 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect5" +__attribute__((naked)) void intvect_Core5Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect5Const"))) void (* const intvect_Core5Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect5Const"))) void (* const intvect_Core5Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 5*/ + +# if (BRS_CPU_CORE_AMOUNT > 6) +/******************************************************************************************** + * * + * Core 6 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect6" +__attribute__((naked)) void intvect_Core6Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect6Const"))) void (* const intvect_Core6Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect6Const"))) void (* const intvect_Core6Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 6*/ + +# if (BRS_CPU_CORE_AMOUNT > 7) +/******************************************************************************************** + * * + * Core 7 Exception Table * + * * + ********************************************************************************************/ + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVect7" +__attribute__((naked)) void intvect_Core7Exceptions(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVect7Const"))) void (* const intvect_Core7Exceptions_vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; + + /* Backup Exception Vectors */ + __attribute__((section(".brsExcVect7Const"))) void (* const intvect_Core7Exceptions_vectortable_backup[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_MultiCoreExceptionHandler, /* Exception 1: Undefined Instruction */ + BrsHw_MultiCoreExceptionHandler, /* Exception 2: SVCall */ + BrsHw_MultiCoreExceptionHandler, /* Exception 3: Abort Prefetch */ + BrsHw_MultiCoreExceptionHandler, /* Exception 4: Abort Data */ + BrsHw_MultiCoreExceptionHandler, /* Exception 5: Reserved */ + BrsHw_MultiCoreExceptionHandler, /* Exception 6: IRQ */ + BrsHw_MultiCoreExceptionHandler /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +# endif /*BRS_CPU_CORE_AMOUNT > 7*/ +#endif /*BRS_ENABLE_OS_MULTICORESUPPORT*/ + +#if defined (BRS_ENABLE_FBL_SUPPORT) && defined (BRS_FBL_EXCEPTIONTABLE_IN_RAM) +/******************************************************************************************** + * * + * Core Exception Handler in RAM * + * * + ********************************************************************************************/ +#define BRS_START_SEC_RAM_CODE +#include "Brs_MemMap.h" +BRS_ISR_KEYWORD void BrsHw_CoreExceptionHandler_Ram(void) +{ +#if defined (BRSHW_BRSHW_COREEXCEPTIONHANDLER_RAM_CALLOUT) + BrsTestsuite_BrsHw_CoreExceptionHandler_Ram(); +#endif + + volatile uint8 Brs_Continue; + Brs_Continue = 0; + + while (Brs_Continue == 0) + { + /* Set Brs_Continue to 1 to continue here. + * If the debugger is not able to show the stack properly, this mechanism can be used to find the + * source of the exception. */ + } +} +#define BRS_STOP_SEC_RAM_CODE +#include "Brs_MemMap.h" + +/******************************************************************************************** + * * + * Core Exception Table in RAM * + * * + ********************************************************************************************/ +# if !defined (BRS_FIRST_EXECUTION_INSTANCE) + #error "If this executable is not first execution instance, reset vector must be manually set in RAM exception table to entry address!" +/* Replace brsStartupEntry in the RAM exception table with, e.g., 0x80, as this linker symbol will not exist in this case. Then, comment out the error message above. */ +# endif + + + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# pragma clang section text = ".brsExcVectRam" +__attribute__((naked)) void intvect_CoreExceptions_Ram(void) +{ + /* Exception Table */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 0: Reset */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 1: Undefined Instruction */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 2: SVCall */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 3: Abort Prefetch */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 4: Abort Data */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 5: Reserved */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 6: IRQ */ + __asm(" ldr pc,[pc,#0x18] "); /* Exception 7: FIQ */ +} +# pragma clang section text = "" + + /* Exception Vectors */ + __attribute__((section(".brsExcVectRamConst"))) void (* const intvect_CoreExceptions_Ram_Vectortable[])(void) = { + brsStartupEntry, /* Exception 0: Reset */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 1: Undefined Instruction */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 2: SVCall */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 3: Abort Prefetch */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 4: Abort Data */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 5: Reserved */ + BrsHw_CoreExceptionHandler_Ram, /* Exception 6: IRQ */ + BrsHw_CoreExceptionHandler_Ram /* Exception 7: FIQ */ + }; +# endif /*BRS_COMP_LLVMDIAB||BRS_COMP_LLVMTEXASINSTRUMENTS*/ + + + +#endif /*BRS_ENABLE_FBL_SUPPORT&&BRS_FBL_EXCEPTIONTABLE_IN_RAM*/ diff --git a/Source/appl/ARMBrsHw_CortexR.c b/Source/appl/ARMBrsHw_CortexR.c new file mode 100644 index 0000000..c774fa1 --- /dev/null +++ b/Source/appl/ARMBrsHw_CortexR.c @@ -0,0 +1,296 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: ARMBrsHw_CortexR.c + * Project: Vector Basic Runtime System + * Module: BrsHw for all platforms with ARM core Cortex-R + * Template: This file is reviewed according to Brs_Template@Implementation[1.03.12] + * + * \brief Description: This is a global, platform-independent file for the ARM-BRS. + * This file includes all non-platform dependent functions. + * All the (platform depending) rest needs to be defined in BrsHw.c + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to ARMBrsHw_CortexR.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define ARMBRSHW_CORTEXR_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsHw.h" + +#if !defined (BRS_DISABLE_OS_USAGE) + /* BootManager, FlashBootLoader, HSM-Updater and HypervisorMaster execution instances do not use an OS. Define is set in BrsMain.h */ + #include "Os.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (ARMBRSHW_CORTEXR_VERSION != 0x0205u) + #error "Header and source file are inconsistent!" +#endif +#if (ARMBRSHW_CORTEXR_BUGFIX_VERSION != 0x05u) + #error "Different versions of bugfix in Header and Source used!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + +#else + #error "Unknown compiler specified!" +#endif + +#if !defined (BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0) && !defined (BRS_FIRST_EXECUTION_INSTANCE) +# if !defined (BRSHW_COREEXCEPTIONS_ADDRESS_OF_INIT_CORE) + /* As intvect_CoreExceptions is not available within non-First-Execution-Instance binaries, it is necessary to + hardly configure the address of intvect_CoreExceptions for your platform additionally. + This is needed for the exception vector change within BrsHw_ExceptionTable_Init(). */ + #error "BRSHW_COREEXCEPTIONS_ADDRESS_OF_INIT_CORE needs to be defined in BrsHw.h of your platform!" +# endif +#endif + +#if (BRSMAIN_VERSION < 0x0221u) + /* At least BrsMain 2.21.00 is needed for Hypervisor support and definition of BRS_DISABLE_OS_USAGE */ + #error "BrsMain of at least version 2.21.00 is needed for this BrsHw package!" +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES AND LOCAL HW REGISTERS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CONTROLLER CONFIGURATION REGISTERS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +extern void intvect_CoreExceptions(void); +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +extern ARMBrsHw_PhysicalCoreId_CoreExceptions_MappingType BrsHw_intvect_CoreExceptions_list[BRS_CPU_CORE_AMOUNT-1]; +#endif + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* @brief Disable the global system interrupt. + * @pre Must be the first function call in main@BrsMain + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main@BrsMain at power on initialization + *****************************************************************************/ +void BrsHwDisableInterruptAtPowerOn(void) +{ + /* Disable IRQ, FIQ */ + __asm(" MRS R0, CPSR "); /* Read CPSR Register */ + __asm(" ORR R0, R0, #0x040 "); /* Set Asynchronous FIQ Mask bit */ + __asm(" ORR R0, R0, #0x080 "); /* Set Asynchronous IRQ Mask bit */ + __asm(" MSR CPSR_c, R0 "); /* Write CPSR Register (only bits [7:0]) */ + +#if defined (BRSHW_DISABLE_INTERRUPT_AT_POWERON_HOOK_AVAILABLE) + /* used to configure additional, platform specific registers (e.g. VIC) + BRSHW_DISABLE_INTERRUPT_AT_POWERON_HOOK_AVAILABLE to be defined in BrsHw.h */ + BrsHwDisableInterruptAtPowerOn_Hook(); +#endif +} + +/*****************************************************************************/ +/* @brief Copy exception vectors to active exception table + * @pre - + * @param[in] ExcVecLabel - address of the core exception table + * IntVecLabel - address of the interrupt vector table + * Use BRS_DEFINE_ADDRESS_UNUSED for unused values + * @param[out] - + * @return - + * @context Function is called from main@BrsMain at power on initialization + *****************************************************************************/ +void BrsHw_ExceptionTable_Init(Brs_AddressOfConstType ExcVecLabel, Brs_AddressOfConstType IntVecLabel) +{ + /* VBAR is Undefined/not available on ARMv7-R implementations -> + Exception vector change is done via overwriting the exception vectors, + which are placed at an offset of 0x20 bytes just behind the exception table start. + See ARMv7_Cortex-R_BRS_Exception_Handling.pdf for details of the mechanism! + */ + int i; + uint32 addressOfActiveExceptionTable; + +#if !defined (BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0) + uint32 runningCoreId; +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + uint32 coreFound; +#endif + +#if defined (BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0) + addressOfActiveExceptionTable = 0x0; + +#else + runningCoreId = BrsHw_GetCore(); + if (runningCoreId == BRSHW_INIT_CORE_ID) + { +# if defined (BRS_FIRST_EXECUTION_INSTANCE) + addressOfActiveExceptionTable = ((uint32)&intvect_CoreExceptions); +# else + addressOfActiveExceptionTable = BRSHW_COREEXCEPTIONS_ADDRESS_OF_INIT_CORE; +# endif + } + else + { +# if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + coreFound = 0; + for (i=0; i < (BRS_CPU_CORE_AMOUNT-1); i++) + { + if (BrsHw_intvect_CoreExceptions_list[i].PhysicalCoreId == runningCoreId) + { + addressOfActiveExceptionTable = (uint32)(BrsHw_intvect_CoreExceptions_list[i].CoreExceptions); + coreFound = 1; + break; + } + } + if (coreFound == 0) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSHW, (uint16)(__LINE__)); + } +# else + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSHW, (uint16)(__LINE__)); +# endif /*BRS_ENABLE_OS_MULTICORESUPPORT*/ + } +#endif /*else BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0*/ + + if(ExcVecLabel!=BRS_DEFINE_ADDRESS_UNUSED) + { + for (i=0; i<8; i++) + { + *((uint32*)(addressOfActiveExceptionTable+0x20+i*4)) = *(uint32*)(((uint32)ExcVecLabel)+0x20+i*4); + } + } + +#if defined (BRSHW_ECXEPTIONTABLE_INIT_POSTHOOK_AVAILABLE) + BrsHw_ExceptionTable_Init_PostHook(ExcVecLabel, IntVecLabel); +#endif +} + +/*****************************************************************************/ +/* @brief This API is used for the BRS time measurement support to get a + * default time value for all measurements with this platform to + * be able to compare time measurements on different dates based + * on this time result. + * @pre Should be called with interrupts global disabled + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from e.g. component testsuits for calibration + *****************************************************************************/ +void BrsHwTime100NOP(void) +{ + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); + BRSHWNOP10(); +} + +#if !defined (BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE) +/*****************************************************************************/ +/* @brief This API is used to read the core ID of the actual running core + * @pre - + * @param[in] - + * @param[out] - + * @return Core ID of the actual running core + * @context Function is e.g. called from main@BrsMain, to only call HW-init + * code once, on the boot core. + * In MultiCore setups, additional BRSHW_INIT_CORE_ID must be + * declared inside BrsHw.h, to configure the proper core ID value + * of that boot core. + *****************************************************************************/ +uint32 BrsHw_GetCore(void) +{ +#if (BRS_CPU_CORE_AMOUNT>1) + uint32 id = 0; + /* Read out the physical processor number (Multiprocessor affinity register (MPIDR)) + * 0 for Core0, Cluster0 + * 1 for Core1, Cluster0 + * 2 for Core0, Cluster1 + * 3 for Core1, Cluster1 + * 4 for Core0, Cluster2 + * 5 for Core1, Cluster2 + */ + brsHwGetMpidr(id); + + return (((id & 0x0000FF00ul) >> 7) | (id & 3ul)); + +#else + /* Stub for SingleCore environments, always returns 0 */ + return 0u; +#endif /*BRS_CPU_CORE_AMOUNT*/ +} +#endif /*!BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE*/ diff --git a/Source/appl/ARMStartup_CortexR.c b/Source/appl/ARMStartup_CortexR.c new file mode 100644 index 0000000..9e711a8 --- /dev/null +++ b/Source/appl/ARMStartup_CortexR.c @@ -0,0 +1,754 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: ARMStartup_CortexR.c + * Project: Vector Basic Runtime System + * Module: BrsHw for all platforms with ARM core Cortex-R + * Template: This file is reviewed according to Brs_Template@Implementation[1.03.12] + * + * \brief Description: This file contains the assembler part of the BRS StartUpCode. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to ARMBrsHw_CortexR.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define ARMSTARTUP_CORTEXR_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsHw.h" + +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance/executable in the system */ + +#include "vBrs_Lcfg.h" +#include "vLinkGen_Lcfg.h" + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + +#else + #error "Unknown compiler specified!" +#endif + +#if (VLINKGEN_CFG_MAJOR_VERSION != 2u) + #error "This StartUpCode is dependent to the vLinkGen version! vLinkGen major version does not fit!" +#else +# if (VLINKGEN_CFG_MINOR_VERSION < 5u) + #error "This StartUpCode is dependent to the vLinkGen version! Your vLinkGen minor version is too old!" +# endif +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +extern void intvect_CoreExceptions(void); +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +extern ARMBrsHw_PhysicalCoreId_CoreExceptions_MappingType BrsHw_intvect_CoreExceptions_list[BRS_CPU_CORE_AMOUNT-1]; +#endif + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +/* used 32bit values for less assembler differences in accessing code */ +const uint32 BrsHw_InitCoreID = (uint32) BRSHW_INIT_CORE_ID; +const uint32 BrsHw_CpuCoreAmountMinus1 = (uint32) (BRS_CPU_CORE_AMOUNT-1); +#endif + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ +BRS_LOCAL_PROTOTYPE(_start) +BRS_LOCAL_PROTOTYPE(brsStartupEntry) +BRS_LOCAL_PROTOTYPE(brsStartupInvalidateCache) +BRS_LOCAL_PROTOTYPE(brsStartupZeroInitLoop) +BRS_LOCAL_PROTOTYPE(brsStartupStackSearch) +BRS_LOCAL_PROTOTYPE(coreRegisterInit) +BRS_LOCAL_PROTOTYPE(coreRegisterInit2) +BRS_LOCAL_PROTOTYPE(coreRegisterInit3) +BRS_LOCAL_PROTOTYPE(stackPointerInit) +BRS_LOCAL_PROTOTYPE(brsPreAsmStartupHook) + + +/* =========================================================================== */ +/* */ +/* Description: Entry point for all cores */ +/* */ +/* =========================================================================== */ + +BRS_SECTION_CODE(brsStartup) + +/* Alternativ entry point from OS default config */ + BRS_GLOBAL(_start) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(_start) +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + + BRS_GLOBAL(brsStartupEntry) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(brsStartupEntry) +#if defined (BRSHW_PRE_ASM_STARTUP_HOOK_AVAILABLE) +#endif + + BRS_BRANCH(brsPreAsmStartupHook) +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Optional hook for platform specific tasks */ +/* */ +/* =========================================================================== */ +#if !defined (BRSHW_PRE_ASM_STARTUP_HOOK_AVAILABLE) + BRS_GLOBAL(brsPreAsmStartupHook) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(brsPreAsmStartupHook) +/* Nothing to do here */ + + BRS_BRANCH(coreRegisterInit) +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() +#endif /*!BRSHW_PRE_ASM_STARTUP_HOOK_AVAILABLE*/ + +/* =========================================================================== */ +/* */ +/* Description: Initialize core ID independent core registers */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(coreRegisterInit) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(coreRegisterInit) + +/* Note: ARMStartup_CortexR.c must be compiled in ARM mode, since + * the exception table is implemented in ARM mode only + */ + __as1(LDR r0, =BrsStartupInstSetInit) + +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ORR r0 ,r0, 0) +#else + __as2(ORR r0 ,r0, #0) +#endif + ___asm(BX r0) + + +BRS_LABEL(BrsStartupInstSetInit) + +#if defined (BRS_FPU_USED) + /* Allow full access to coprocessors 10,11 */ + /* r0 gets the content of the Coprocessor Access Control Register */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as5(MRC p15, 0, r0, c1, c0, 2) +# else + __as5(MRC p15, #0x00, r0, c1, c0, #0x02) +# endif + + __as2(ORR r0, r0, #0x00F00000) + /* Write Coprocessor Access Control Register to set access rights for coprocessor cp10, cp11 to full access + Note: Coprocessors cp10 and cp11 support floating-point and vector operations, and the control and configuration of + the Floating-point and Advanced SIMD architecture extensions. */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as5(MCR p15, 0, r0, c1, c0, 2) +# else + __as5(MCR p15, #0x00, r0, c1, c0, #0x02) +# endif + +/* Enable Advanced SIMD and Floating-point Extensions */ + __as1(VMRS r0, FPEXC) + __as1(MOV r1, #0x40000000) + __as2(ORR r0, r0, r1) + __as1(VMSR FPEXC, r0) +#endif /*BRS_FPU_USED*/ + +/* Switch to System Mode */ + __as1(MRS r0, CPSR) +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ORR r0, r0, 0x1f) + __as1(MSR CPSR, r0) +#else + __as2(ORR r0, r0, #0x1f) + __as1(MSR cpsr_cxsf, r0) +#endif + + BRS_BRANCH(coreRegisterInit2) +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Initialize all core ID dependent core registers */ +/* Setup exception table */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(coreRegisterInit2) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(coreRegisterInit2) + +#if defined (BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0) +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R2, 0) +# else + __as1(MOV R2, #0) +# endif + +#else /*(BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0)*/ +# if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + __as1(LDR R1, =BrsHw_InitCoreID) + __as1(LDR R3, [R1]) + /* ==> R3 = BrsHw_InitCoreID */ + + BRS_READ_COREID(R0) + /* ==> R0 = BRS_READ_COREID */ + + /* If actual running core is init core, directly jump to implemantation for init core. + (ExceptionTable of init core is not part of BrsHw_intvect_CoreExceptions_list[]) */ + BRS_BRANCH_EQUAL(R0, R3, set_exception_table_location_on_init_core) + + __as1(LDR R1, =BrsHw_CpuCoreAmountMinus1) + __as1(LDR R5, [R1]) + /* ==> R5 = BrsHw_CpuCoreAmountMinus1 */ + + __as1(LDR R4, =BrsHw_intvect_CoreExceptions_list) + /* ==> R4 = BrsHw_intvect_CoreExceptions_list */ + +/* Use R6 as count register in the loop. Initialize with zero. */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R6, 0) +# else + __as1(MOV R6, #0) +# endif + +BRS_LABEL(get_exception_table_location_for_this_core_loop) + + __as1(LDR R7, [R4]) + /* ==> R7 = BrsHw_intvect_CoreExceptions_list[R6].PhysicalCoreId */ + + BRS_READ_COREID(R0) + /* ==> R0 = BRS_READ_COREID */ + + /* Check, if BrsHw_intvect_CoreExceptions_list entry of actual running core is reached */ + BRS_BRANCH_EQUAL(R0, R7, get_exception_table_location_for_this_core) + +/* Increase count register by one. */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R6, R6, 1) +# else + __as2(ADD R6, R6, #1) +# endif + +/* Set R4 to point to next entry of BrsHw_intvect_CoreExceptions_list. */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R4, R4, 8) +# else + __as2(ADD R4, R4, #8) +# endif + +/* Check if end of BrsHw_intvect_CoreExceptions_list has been reached. */ + BRS_BRANCH_NOT_EQUAL(R6, R5, get_exception_table_location_for_this_core_loop) +/* If no Exception Table address for running core has been found -> BrsMainExceptionStartup. */ + BRS_BRANCH(get_exception_table_location_error) + +BRS_LABEL(get_exception_table_location_for_this_core) + +/* Set R4 to point to next attribute of the current (R6) + struct ARMBrsHw_PhysicalCoreId_CoreExceptions_MappingType: CoreExceptions + */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R4, R4, 4) +# else + __as2(ADD R4, R4, #4) +# endif + + __as1(LDR R2, [R4]) + /* ==> R2 = BrsHw_intvect_CoreExceptions_list[R6].CoreExceptions */ + + BRS_BRANCH(get_exception_table_location_end) + +BRS_LABEL(set_exception_table_location_on_init_core) +# endif /*BRS_ENABLE_OS_MULTICORESUPPORT*/ + +# if defined (BRS_FIRST_EXECUTION_INSTANCE) + __as1(LDR R2, =intvect_CoreExceptions) + +# else +/* init core should be configured, but no 1st execution instance! -> BrsMainExceptionStartup. */ + BRS_BRANCH(get_exception_table_location_error) +# endif /*BRS_FIRST_EXECUTION_INSTANCE*/ + +BRS_LABEL(get_exception_table_location_end) +#endif /*else BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0*/ + +/* Copy backup exception vectors over exception vectors at address "intvect_CoreExceptions" + See ARMv7_Cortex-R_BRS_Exception_Handling.pdf for details of the mechanism! + R2 = destination address / R3 = source address / R6 = index / R4,R5 = data buffer +*/ + __as1(MOV R3, R2) + __as1(MOV R7, R2) /* save Exception Table address in R7 */ + +/* Use R6 as count register in the loop. Initialize with zero. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R6, 0) + __as2(ADD R2, R2, 32) + __as2(ADD R3, R3, 64) +#else + __as1(MOV R6, #0) + __as2(ADD R2, R2, #32) + __as2(ADD R3, R3, #64) +#endif + +BRS_LABEL(copy_exception_vectors_backup_to_active_start) + + __as3(LDRD R4, R5, [R3], #+8) + __as3(STRD R4, R5, [R2], #+8) + +/* Increase count register by one. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R6, R6, 1) +#else + __as2(ADD R6, R6, #1) +#endif + +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + BRS_BRANCH_EQUAL(R6, 4, copy_exception_vectors_backup_to_active_end) +#else + BRS_BRANCH_EQUAL(R6, #4, copy_exception_vectors_backup_to_active_end) +#endif + + BRS_BRANCH(copy_exception_vectors_backup_to_active_start) + +BRS_LABEL(copy_exception_vectors_backup_to_active_end) + +/* Set Exception Table code for all 8 Exceptions to the default "LDR PC, [PC,0x18]" + using R7 = Exception Table address. + Use R6 as count register in the loop. Initialize with zero. +*/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R6, 0) + __as1(MOVW R2, 0xF018) + __as1(MOVT R2, 0xE59F) +#else + __as1(MOV R6, #0) + __as1(MOVW R2, #0xF018) + __as1(MOVT R2, #0xE59F) +#endif + +BRS_LABEL(restore_exception_table_start) + + __as2(STR R2, [R7], #+4) + +/* Increase count register by one. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R6, R6, 1) +#else + __as2(ADD R6, R6, #1) +#endif + +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + BRS_BRANCH_EQUAL(R6, 8, restore_exception_table_end) +#else + BRS_BRANCH_EQUAL(R6, #8, restore_exception_table_end) +#endif + + BRS_BRANCH(restore_exception_table_start) + +BRS_LABEL(restore_exception_table_end) + +/* The exception table is implemented for ARM instrcutions -> The exception must be entered in ARM state + * -> Set SCTLR.TE bit for ARM state + */ + __as5(MRC p15, #0, r0, c1, c0, #0) /* read SCTLR register */ + __as2(BIC r0, r0, #(1 << 30)) /* clear the TE bit to enter Exc in ARM mode */ + __as5(MCR p15, #0, r0, c1, c0, #0) /* write SCTLR register */ + + /* Assure V-Bit is cleard and low exception vectors at 0x00000000 were set + * -> Set SCTLR.V bit for low exception base + */ + __as5(MRC p15, #0x00, r0, c1, c0, #0x0) /* Read SCTLR (System Control Register)*/ + __as2(BIC r0, r0, #(1 << 13)) /* clear the V-bit */ + __as5(MCR p15, #0x00, r0, c1, c0, #0x0) /* Write SCTLR (System Control Register) */ + + BRS_BRANCH(brsStartupInvalidateCache) + +BRS_LABEL(get_exception_table_location_error) + +BRS_MULTILINE_ASM_END() + +/* Branch to BrsMainExceptionStartup if no Exception Table address can be found. */ + BRS_EXTERN_BRANCH(BrsMainExceptionStartup) +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Invalidate cache memory */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(brsStartupInvalidateCache) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(brsStartupInvalidateCache) + +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as5(MRC p15, 1, r0, c0, c0, 0) /* read cache size id */ + __as1(MOVW r3, 0x01ff) + __as1(MOVT r3, 0x0000) + __as3(AND r0, r3, r0, lsr #13) + __as1(MOV r1, 0) +BRS_LABEL(way_loop) + __as1(MOV r3, 0) +BRS_LABEL(set_loop) + __as2(MOV r2, r1, lsl #30) + __as3(ORR r2, r2, r3, lsl #5) +BRS_LABEL(format) + __as5(MCR p15, 0, r2, c7, c6, 2) /* invalidate */ + ___asm(DSB) + ___asm(ISB) + __as2(ADD r3, r3, 1) + BRS_BRANCH_GREATER_THAN(r0, r3, set_loop) + __as2(ADD r1, r1, 1) + BRS_BRANCH_NOT_EQUAL(r1, 4, way_loop) + +#else + __as5(MRC p15, #1, r0, c0, c0, #0) /* read cache size id */ + __as1(MOVW r3, #0x01ff) + __as1(MOVT r3, #0x0000) + __as3(AND r0, r3, r0, lsr #13) + __as1(MOV r1, #0) +BRS_LABEL(way_loop) + __as1(MOV r3, #0) +BRS_LABEL(set_loop) + __as2(MOV r2, r1, lsl #30) + __as3(ORR r2, r2, r3, lsl #5) +BRS_LABEL(format) + __as5(MCR p15, #0, r2, c7, c6, #2) /* invalidate */ + ___asm(DSB) + ___asm(ISB) + __as2(ADD r3, r3, #1) + BRS_BRANCH_GREATER_THAN(r0, r3, set_loop) + __as2(ADD r1, r1, #1) + BRS_BRANCH_NOT_EQUAL(r1, #4, way_loop) +#endif /*BRS_COMP_x*/ + + BRS_BRANCH(brsStartupZeroInitLoop) + +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Initialize memory blocks and groups with zero */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(brsStartupZeroInitLoop) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(brsStartupZeroInitLoop) + +/* Initialize memory sections blocks with zeros */ +#if defined (VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_BLOCKS) +# if (VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_BLOCKS>1uL) + __as1(LDR R1, =vLinkGen_ZeroInit_Early_Blocks) + + BRS_READ_COREID(R0) + +BRS_LABEL(startup_block_zero_init_start) + __as1(MOV R2, R1) + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R1, R1, 16) +# else + __as2(ADD R1, R1, #16) +# endif + + __as1(LDR R3, [R2]) /* vLinkGen_ZeroInit_Early_Blocks->start */ + __as2(LDR R4, [R2, #4]) /* vLinkGen_ZeroInit_Early_Blocks->end */ + __as2(LDR R5, [R2, #8]) /* vLinkGen_ZeroInit_Early_Blocks->core */ + __as2(LDR R6, [R2, #12]) /* vLinkGen_ZeroInit_Early_Blocks->alignment */ + +/* Verify if the end of struct vLinkGen_ZeroInit_Early_Blocks is reached, by checking if start == 0, end == 0 and core == 0 */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R7, 0) +# else + __as1(MOV R7, #0) +# endif + + __as2(ORR R7, R7, R3) /* Or with vLinkGen_ZeroInit_Early_Blocks->start */ + __as2(ORR R7, R7, R4) /* Or with vLinkGen_ZeroInit_Early_Blocks->end */ + __as2(ORR R7, R7, R5) /* Or with vLinkGen_ZeroInit_Early_Blocks->core */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + BRS_BRANCH_EQUAL(R7, 0, startup_block_zero_init_end) /* If start address, end address and core are equal to zero -> Finished */ +# else + BRS_BRANCH_EQUAL(R7, #0, startup_block_zero_init_end) /* If start address, end address and core are equal to zero -> Finished */ +# endif + + BRS_BRANCH_NOT_EQUAL(R0, R5, startup_block_zero_init_start) /* If InitCore is not running -> go to the next array entry */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R7, 0) /* set R7 to '0', as value to write in memory later */ + __as1(MOV R8, 0) /* set R8 to '0', as value to write in memory later */ +# else + __as1(MOV R7, #0) /* set R7 to '0', as value to write in memory later */ + __as1(MOV R8, #0) /* set R8 to '0', as value to write in memory later */ +# endif + + BRS_BRANCH_EQUAL(R6, #8, startup_block_zero_init_8byte_loop_start) /* if block is 8-Byte aligned, use specific init loop */ + +BRS_LABEL(startup_block_zero_init_loop_start) + BRS_BRANCH_GREATER_THAN_OR_EQUAL(R3, R4, startup_block_zero_init_start) /* if start address is same with or higher than end address-> Finished. */ + + __as1(STR R7, [R3]) /* write value of R7 ('0') to address of R3 (4-byte access); must be an aligned memory access! */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R3, R3, 4) /* increase address value of R3 by '4' */ +# else + __as2(ADD R3, R3, #4) /* increase address value of R3 by '4' */ +# endif + +/* End address of this block was not yet reached. Run through the loop again */ + BRS_BRANCH(startup_block_zero_init_loop_start) + +/* ================================================================ */ +/* 8-Byte aligned initialization, to support 8-Byte aligned ECC RAM */ +/* ================================================================ */ +BRS_LABEL(startup_block_zero_init_8byte_loop_start) + BRS_BRANCH_GREATER_THAN_OR_EQUAL(R3, R4, startup_block_zero_init_start) /* if start address is same with or higher than end address-> Finished. */ + +/* Address stored in R3 must be 8 Byte aligned at this point! */ + __as2(STMIA R3!, {R7, R8}) /* 8 Byte alignment store for ECC, R3 would be automatically updated after the write */ + +/* End address of this block was not yet reached. Run through the loop again */ + BRS_BRANCH(startup_block_zero_init_8byte_loop_start) + +/* Zero-Init loop of blocks end label */ +BRS_LABEL(startup_block_zero_init_end) +# endif /*VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_BLOCKS>1uL*/ + +#else + #error "Mandatory define VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_BLOCKS missing within vLinkGen configuration!" +#endif /*VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_BLOCKS*/ + +/* Initialize memory sections groups with zeros */ +#if defined (VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_GROUPS) +# if (VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_GROUPS>1uL) + __as1(LDR R1, =vLinkGen_ZeroInit_Early_Groups) + +BRS_LABEL(startup_group_zero_init_start) + __as1(MOV R2, R1) + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R1, R1, 16) +# else + __as2(ADD R1, R1, #16) +# endif + + __as1(LDR R3, [R2]) /* vLinkGen_ZeroInit_Early_Groups->start */ + __as2(LDR R4, [R2, #4]) /* vLinkGen_ZeroInit_Early_Groups->end */ + __as2(LDR R5, [R2, #8]) /* vLinkGen_ZeroInit_Early_Groups->core */ + __as2(LDR R6, [R2, #12]) /* vLinkGen_ZeroInit_Early_Groups->alignment */ + +/* Verify if the end of struct vLinkGen_ZeroInit_Early_Groups is reached, by checking if start == 0, end == 0 and core == 0 */ +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R7, 0) +# else + __as1(MOV R7, #0) +# endif + + __as2(ORR R7, R7, R3) /* Or with vLinkGen_ZeroInit_Early_Groups->start */ + __as2(ORR R7, R7, R4) /* Or with vLinkGen_ZeroInit_Early_Groups->end */ + __as2(ORR R7, R7, R5) /* Or with vLinkGen_ZeroInit_Early_Groups->core */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + BRS_BRANCH_EQUAL(R7, 0, startup_group_zero_init_end) /* If start address, end address and core are equal to zero -> Finished */ +# else + BRS_BRANCH_EQUAL(R7, #0, startup_group_zero_init_end) /* If start address, end address and core are equal to zero -> Finished */ +# endif + + BRS_BRANCH_NOT_EQUAL(R0, R5, startup_group_zero_init_start) /* If InitCore is not running -> go to the next array entry */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R7, 0) /* set R7 to '0', as value to write in memory later */ + __as1(MOV R8, 0) /* set R8 to '0', as value to write in memory later */ +# else + __as1(MOV R7, #0) /* set R7 to '0', as value to write in memory later */ + __as1(MOV R8, #0) /* set R8 to '0', as value to write in memory later */ +# endif + + BRS_BRANCH_EQUAL(R6, #8, startup_group_zero_init_8byte_loop_start) /* if group is 8-Byte aligned, use specific init loop */ + +BRS_LABEL(startup_group_zero_init_loop_start) + BRS_BRANCH_GREATER_THAN_OR_EQUAL(R3, R4, startup_group_zero_init_start) /* if start address is same with or higher than end address-> Finished. */ + + __as1(STR R7, [R3]) /* write value of R7 ('0') to address of R3 (4-byte access); must be an aligned memory access! */ + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R3, R3, 4) /* increase address value of R3 by '4' */ +# else + __as2(ADD R3, R3, #4) /* increase address value of R3 by '4' */ +# endif + +/* End address of this group was not yet reached. Run through the loop again */ + BRS_BRANCH(startup_group_zero_init_loop_start) + +/* ================================================================ */ +/* 8-Byte aligned initialization, to support 8-Byte aligned ECC RAM */ +/* ================================================================ */ +BRS_LABEL(startup_group_zero_init_8byte_loop_start) + BRS_BRANCH_GREATER_THAN_OR_EQUAL(R3, R4, startup_group_zero_init_start) /* if start address is same with or higher than end address-> Finished. */ + +/* Address stored in R3 must be 8 Byte aligned at this point! */ + __as2(STMIA R3!, {R7, R8}) /* 8 Byte alignment store for ECC, R3 would be automatically updated after the write */ + +/* End address of this group was not yet reached. Run through the loop again */ + BRS_BRANCH(startup_group_zero_init_8byte_loop_start) + +/* Zero-Init loop of groups end label */ +BRS_LABEL(startup_group_zero_init_end) +# endif /*VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_GROUPS>1uL*/ + +#else + #error "Mandatory define VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_GROUPS missing within vLinkGen configuration!" +#endif /*VLINKGEN_CFG_NUM_ZERO_INIT_EARLY_GROUPS*/ + +/* Jump to routine to search for valid startup stack pointer of actual running core */ + BRS_BRANCH(brsStartupStackSearch) +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Search for valid startup stack pointer of actual running core */ +/* (vBRS is genearing the core specific configuration into the */ +/* struct BrsMain_CoreConfig in vBrs_Lcfg.c) */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(brsStartupStackSearch) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(brsStartupStackSearch) + + __as1(LDR R1, =BrsMain_CoreConfig_Size) + +BRS_LABEL(core_config_size_init) + __as1(LDR R5, [R1]) /* R5 = BrsMain_CoreConfig_Size */ + + __as1(LDR R1, =BrsMain_CoreConfig) + + BRS_READ_COREID(R0) + +BRS_LABEL(core_config_init_start) + +/* Use R2 as count register in the loop. Initialize with zero. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as1(MOV R2, 0) +#else + __as1(MOV R2, #0) +#endif + +BRS_LABEL(brs_coreconfig_loop) + + __as2(LDR R4, [R1,#4]) /* BrsMain_CoreConfig->PhysicalCoreId */ +/* Check if core id (R0) matches to physical core id of BrsMain_CoreConfig entry (R4). */ + BRS_BRANCH_EQUAL(R0, R4, stackPointerInit) + +/* Increase count register by one. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R2, R2, 1) +#else + __as2(ADD R2, R2, #1) +#endif + +/* Set R1 to point to next entry of BrsMain_CoreConfig. */ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + __as2(ADD R1, R1, 28) +#else + __as2(ADD R1, R1, #28) +#endif + +/* Check if end of BrsMain_CoreConfig has been reached. */ + BRS_BRANCH_NOT_EQUAL(R2, R5, brs_coreconfig_loop) + +BRS_MULTILINE_ASM_END() + +/* Branch to BrsMainExceptionStartup if there are no more entries in the array. */ + BRS_EXTERN_BRANCH(BrsMainExceptionStartup) +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Initialize all core registers of actual running core with */ +/* specific init values */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(stackPointerInit) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(stackPointerInit) + __as2(LDR R4, [R1,#8]) /* BrsMain_CoreConfig->StartupStackEndLabel */ + __as1(MOV SP, R4) + + BRS_BRANCH(coreRegisterInit3) + +BRS_MULTILINE_ASM_END() +BRS_GLOBAL_END() + +/* =========================================================================== */ +/* */ +/* Description: Initialize additional core registers */ +/* */ +/* =========================================================================== */ + BRS_GLOBAL(coreRegisterInit3) +BRS_MULTILINE_ASM_BEGIN() +BRS_LABEL(coreRegisterInit3) +BRS_MULTILINE_ASM_END() + +/* =========================================================================== */ +/* */ +/* Description: Jump to Brs_PreMainStartup() (BrsMainStartup.c) */ +/* */ +/* =========================================================================== */ + BRS_EXTERN_BRANCH(Brs_PreMainStartup) + +/* =========================================================================== */ +/* */ +/* Description: Jump to BrsMainExceptionStartup() in case of an unexpected */ +/* return from PreMain/main */ +/* */ +/* =========================================================================== */ + BRS_EXTERN_BRANCH(BrsMainExceptionStartup) + +BRS_GLOBAL_END() + + +#endif /*BRS_FIRST_EXECUTION_INSTANCE*/ diff --git a/Source/appl/BrsHw.c b/Source/appl/BrsHw.c new file mode 100644 index 0000000..e7d6377 --- /dev/null +++ b/Source/appl/BrsHw.c @@ -0,0 +1,845 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsHw.c + * Project: Vector Basic Runtime System + * Module: BrsHw for platform TexasInstruments Sitara AM263x + * Template: This file is reviewed according to Brs_Template@Implementation[1.03.14] + * + * \brief Description: This is the hardware specific code file for Vector Basic Runtime System (BRS). + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsHw.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define _BRSHW_C_ +#define BRSHW_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsHw.h" + +#if !defined (BRS_DISABLE_OS_USAGE) + /* + * BootManager, FlashBootLoader, HSM-Updater and HypervisorMaster execution instances do not use an OS. + * Define is set in BrsMain.h + */ + #include "Os.h" +#endif +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + void Dpl_init(void); + void Dpl_deinit(void); +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (BRSHW_MAJOR_VERSION != 1u) || (BRSHW_MINOR_VERSION != 0u) + #error "Header and source file are inconsistent!" +#endif +#if (BRSHW_PATCH_VERSION != 3u) + #error "Different versions of patch in Header and Source used!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + +#else + #error "Unknown compiler specified!" +#endif + +#if !defined (BRSMAIN_VERSION_COMBINED) +/* BRSMAIN_VERSION_COMBINED was introduced in BrsMain 2.24.00 - no check needed */ +# if (BRSMAIN_VERSION < 0x0221u) + /* At least BrsMain 2.21.00 is needed for Hypervisor support and definition of BRS_DISABLE_OS_USAGE */ + #error "BrsMain of at least version 2.21.00 is needed for this BrsHw package!" +# endif +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES AND LOCAL HW REGISTERS + *********************************************************************************************************************/ +/* part of ArmCommon */ + +/********************************************************************************************************************** + * CONTROLLER CONFIGURATION REGISTERS + *********************************************************************************************************************/ +/* R5FSS Vector Interrupt Manager (VIM) */ +#define BRSHW_VIM_BASEADDR 0x50F00000UL +/* IRQ vector address register. */ +#define BRSHW_INTC_VIM_IRQVEC BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x18UL)) +/* FIQ vector address register. */ +#define BRSHW_INTC_VIM_FIQVEC BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x1CUL)) +/* Raw status/set register. */ +#define BRSHW_INTC_VIM_RAW_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x0400UL + (n) * 0x20UL)) +/* Interrupt enable set register. */ +#define BRSHW_INTC_VIM_INTR_EN_SET_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x0408UL + (n) * 0x20UL)) +/* Interrupt enable clear register. */ +#define BRSHW_INTC_VIM_INTR_EN_CLR_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x040CUL + (n) * 0x20UL)) +/* IRQ interrupt enable status/clear register. */ +#define BRSHW_INTC_VIM_IRQSTS_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x0410UL + (n) * 0x20UL)) +/* FIQ interrupt enable status/clear register. */ +#define BRSHW_INTC_VIM_FIQSTS_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x0414UL + (n) * 0x20UL)) +/* Interrupt map register. */ +#define BRSHW_INTC_VIM_INTMAP_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x0418UL + (n) * 0x20UL)) +/* Interrupt priority register. */ +#define BRSHW_INTC_VIM_PRI_INT_J(n) BRSHW_IOS(uint32, (BRSHW_VIM_BASEADDR + 0x1000UL + (n) * 0x04UL)) + +/* Master subsystem reset, clock management registers */ +#define BRSHW_MSS_CTRL_BASEADDR 0x50D00000UL +#define BRSHW_MSS_CTRL_MSS_RTI0_HALTEN BRSHW_IOS(uint32, (BRSHW_MSS_CTRL_BASEADDR + 0x454UL)) +//#define BRSHW_MSS_CTRL_MSS_DBG_ACK_CTL1 BRSHW_IOS(uint32, (BRSHW_MSS_CTRL_BASEADDR + 0x168UL))/*TODO*/ +#define BRSHW_MSS_CTRL_MSS_R5_ROM_ECLIPSE BRSHW_IOS(uint32, (BRSHW_MSS_CTRL_BASEADDR + 0x804UL))/*TODO*/ +#define BRSHW_MSS_CTRL_LOCK0_KICK0 BRSHW_IOS(uint32, (BRSHW_MSS_CTRL_BASEADDR + 0x1008UL))/*TODO*/ +#define BRSHW_MSS_CTRL_LOCK0_KICK1 BRSHW_IOS(uint32, (BRSHW_MSS_CTRL_BASEADDR + 0x100CUL))/*TODO*/ + +#define BRSHW_MSS_RTIA_BASEADDR 0x52181000UL +#define BRSHW_MSS_RTIA_RTIGCTRL BRSHW_IOS(uint32, (BRSHW_MSS_RTIA_BASEADDR + 0x0UL)) + +#if defined (BRS_ENABLE_PORT) + #define BRSHW_CPSW_CONTROL BRSHW_IOS(uint32, 0x0212016CUL) + + #define CPSW_CONTROL_PORT1_MODE_SEL_GMII_MII (0x00000000uL) + #define CPSW_CONTROL_PORT1_MODE_SEL_RMII (0x00000001uL) + #define CPSW_CONTROL_PORT1_MODE_SEL_RGMII (0x00000002uL) + #define CPSW_CONTROL_CLK_SEL_PAD (0x00000100uL) +#endif /*BRS_ENABLE_PORT*/ + +/* Top-level reset, clock management registers */ +#define BRSHW_CSL_MSS_TOPRCM_BASE 0x53208000UL +#define BRSHW_CSL_MSS_TOPRCM_SYS_RST_CAUSE BRSHW_IOS(uint32, (BRSHW_CSL_MSS_TOPRCM_BASE + 0x10U)) +#define BRSHW_CSL_MSS_TOPRCM_SYS_RST_CAUSE_CLR BRSHW_IOS(uint32, (BRSHW_CSL_MSS_TOPRCM_BASE + 0x14U)) +#define BRSHW_CSL_MSS_TOPRCM_WARM_RESET_CONFIG BRSHW_IOS(uint32, (BRSHW_CSL_MSS_TOPRCM_BASE + 0x100U))/*TODO*/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ +void PowerClock_init(void); + +/********************************************************************************************************************** + * GLOBAL CONST DEFINITIONS + *********************************************************************************************************************/ +#define BOOT_DATA __attribute__((retain,section(".startupData"))) + +/* ----------- HwiP ----------- */ +const HwiP_Config gHwiConfig BOOT_DATA = { + .intcBaseAddr = 0x50F00000u, +}; + +/* ----------- ClockP ----------- */ +#define RTI0_CLOCK_SRC_MUX_ADDR (0x53208118u) +#define RTI0_CLOCK_SRC_WUCPUCLK (0x0u) +#define RTI0_BASE_ADDR (0x52181000u) + +const ClockP_Config gClockConfig BOOT_DATA = { + .timerBaseAddr = RTI0_BASE_ADDR, + .timerHwiIntNum = 91, + .timerInputClkHz = 25000000, + .timerInputPreScaler = 1, + .usecPerTick = 1000, +}; + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief This function can be used to initialize controller specific + * stuff that should be handled by the first execution instance, + * even before the memory initialization took place (e.g. + * everything that is necessary to access the memory or to handle + * exceptions). This function is called at the beginning of + * BrsMainStartup(), immediately after the stackpointer was + * initialized in StartupCode + * (if BRSHW_EARLYINIT_AVAILABLE is set in BrsHw.h). + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() at power on + * initialization + *****************************************************************************/ +void BrsHwEarlyInitPowerOn(void) +{ + /* Micro Processor Unit initialization from TI SDK */ + __mpu_init(); +} +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +/*****************************************************************************/ +/* @brief This function can be used to initialize controller specific + * stuff that is not related to one of the other InitPowerOn + * functions (e.g. code that is always mandatory, also if MCAL + * and/or OS is used). This function is called from BrsMain + * immediately after BrsHwDisableInterruptAtPowerOn() during + * initialization (if BRSHW_PREINIT_AVAILABLE is set in BrsHw.h) or + * from the BrsMain_MemoryInit_StageHardReset_Hook() during + * initialization (if BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT is set). + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwPreInitPowerOn(void) +{ + /* This code is needed to stop the RTIA counter/timer, whenever a break signal from the debugger occurs. + * The following fields need to be set to suspend the RTI on halting of the processor. + * This enables setting of breakpoints, while the OS timer is running. + */ + BRSHW_MSS_CTRL_LOCK0_KICK0 = 0x01234567; + BRSHW_MSS_CTRL_LOCK0_KICK1 = 0x0FEDCBA8; + BRSHW_MSS_CTRL_MSS_RTI0_HALTEN |= (0x7<<4); /*MSS_DBG_ACK_CTL1_RTI*/ + + //BRSHW_MSS_RTIA_RTIGCTRL &= ~(0x1<<15); /* Clear COS bit of RTIA timer, to stop the counter in halting debug mode */ +} + +#if defined (BRS_ENABLE_WATCHDOG) +/*****************************************************************************/ +/* @brief This function must be used to initialize the Watchdog. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwWatchdogInitPowerOn(void) +{ + /* Nothing to be done here, Watchdogs disabled after boot from SBL */ +} +#endif /* BRS_ENABLE_WATCHDOG */ + +#if defined (BRS_ENABLE_PLLCLOCKS) +/*****************************************************************************/ +/* @brief This function must be used to initialize the PLL. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwPllInitPowerOn(void) +{ + /* TI SBL image powers up the timers and clock sources. + According to TI, the following frequencies are configured: + XTALCLK: 40MHz + Cortex-R5 CORE clock: 400MHz + SYSCLK: 200MHz + RTI1: 25MHz + I2C2: 200MHz + MCAN0,MCAN2: 80MHz + CPSW, CPTS: 200MHz + LIN1: 196MHz + */ + /* Initialize the configured modules and clocks*/ + PowerClock_init(); + +#if defined (BRS_ENABLE_ETHERNET_SUPPORT) + #error "There is no PLL/clocks handling for DrvEth supported by vBaseEnv on this platform! It is expected to always use the 3rd-party MCAL DrvEth, togehther with DrvMcu." +#endif +} +#endif /*BRS_ENABLE_PLLCLOCKS*/ + +#if defined (BRS_ENABLE_PORT) +/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ + +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +/*****************************************************************************/ +/* @brief This function sets the output level of a port pin. + * @pre Port pin configurations available within BrsHw_Ports.h, + * no DrvPort used for port pin initialization and + * transferred port pin has to be initialized as output pin with + * GPIO functionality. + * @param[in] p - brsHw_Port_PortType, to be set, + * Level - level, port pin has to be set to + * (BRSHW_PORT_LOGIC_LOW or BRSHW_PORT_LOGIC_HIGH). + * @param[out] - + * @return - + * @context Function is called from BrsHwPortInitPowerOn() and + * provided to external modules (e.g. BrsMainTogglePin()). + *****************************************************************************/ +#define GPIO_LED_PIN (1) + +void BrsHwPort_SetLevel(brsHw_Port_PortType p, uint8 Level) +{ + if(BRSHW_PORT_LOGIC_LOW == Level) + { + GPIO_pinWriteLow((uint32_t) AddrTranslateP_getLocalAddr(CSL_GPIO0_U_BASE), GPIO_LED_PIN); + } + else + { + GPIO_pinWriteHigh((uint32_t) AddrTranslateP_getLocalAddr(CSL_GPIO0_U_BASE), GPIO_LED_PIN); + } +} + +/*****************************************************************************/ +/* @brief This function reads the input level of a port pin. + * @pre Port pin configurations available within BrsHw_Ports.h, + * no DrvPort used for port pin initialization and + * transferred port pin has to be initialized as input pin with + * GPIO functionality. + * @param[in] p - brsHw_Port_PortType, to be read. + * @param[out] - + * @return Level, read from port pin + * (BRSHW_PORT_LOGIC_LOW or BRSHW_PORT_LOGIC_HIGH). + * @context Function is provided to external modules. + *****************************************************************************/ +uint8 BrsHwPort_GetLevel(brsHw_Port_PortType p) +{ + uint8 pinVal; + pinVal = (uint8) GPIO_pinRead(CSL_GPIO0_U_BASE, p.portNumber); + if(pinVal==0x1U) + { + return BRSHW_PORT_LOGIC_HIGH; + } + else + { + return BRSHW_PORT_LOGIC_LOW; + } +} +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif + +#define SOC_MODULES_END (0xFFFFFFFFu) + +typedef struct { + + uint32_t moduleId; + uint32_t clkId; + uint32_t clkRate; + +} SOC_ModuleClockFrequency; + +uint32_t gSocModules[] = { +# if defined (BRS_ENABLE_CAN_SUPPORT) + #if defined (BRS_ENABLE_CAN_CHANNEL_0) + SOC_RcmPeripheralId_MCAN0, + #endif + #if defined (BRS_ENABLE_CAN_CHANNEL_2) + SOC_RcmPeripheralId_MCAN2, + #endif +# endif +# if defined (BRS_ENABLE_I2C_SUPPORT) + SOC_RcmPeripheralId_I2C, +# endif +# if defined (BRS_ENABLE_LIN_SUPPORT) + #if defined (BRS_ENABLE_LIN_CHANNEL_1) + SOC_RcmPeripheralId_LIN1_UART1, + #endif +# endif + SOC_MODULES_END, +}; + +SOC_ModuleClockFrequency gSocModulesClockFrequency[] = { +# if defined (BRS_ENABLE_CAN_SUPPORT) + #if defined (BRS_ENABLE_CAN_CHANNEL_0) + { SOC_RcmPeripheralId_MCAN0, SOC_RcmPeripheralClockSource_DPLL_CORE_HSDIV0_CLKOUT0, 80000000 }, + #endif + #if defined (BRS_ENABLE_CAN_CHANNEL_2) + { SOC_RcmPeripheralId_MCAN2, SOC_RcmPeripheralClockSource_DPLL_CORE_HSDIV0_CLKOUT0, 80000000 }, + #endif +# endif +# if defined (BRS_ENABLE_I2C_SUPPORT) + { SOC_RcmPeripheralId_I2C, SOC_RcmPeripheralClockSource_DPLL_PER_HSDIV0_CLKOUT1, 96000000 }, +# endif +# if defined (BRS_ENABLE_LIN_SUPPORT) + #if defined (BRS_ENABLE_LIN_CHANNEL_1) + { SOC_RcmPeripheralId_LIN1_UART1, SOC_RcmPeripheralClockSource_DPLL_PER_HSDIV0_CLKOUT1, 192000000 }, + #endif +# endif + { SOC_MODULES_END, SOC_MODULES_END, SOC_MODULES_END }, +}; + +void Module_clockSetFrequency(void) +{ + int32_t status; + uint32_t i = 0; + + while(gSocModulesClockFrequency[i].moduleId!=SOC_MODULES_END) + { + status = SOC_moduleSetClockFrequency( + gSocModulesClockFrequency[i].moduleId, + gSocModulesClockFrequency[i].clkId, + gSocModulesClockFrequency[i].clkRate + ); + DebugP_assertNoLog(status == SystemP_SUCCESS); + i++; + } +} + +void Module_clockEnable(void) +{ + int32_t status; + uint32_t i = 0; + + while(gSocModules[i]!=SOC_MODULES_END) + { + status = SOC_moduleClockEnable(gSocModules[i], 1); + DebugP_assertNoLog(status == SystemP_SUCCESS); + i++; + } +} + +void PowerClock_init(void) +{ + Module_clockEnable(); + Module_clockSetFrequency(); +} + +# if defined (BRS_ENABLE_ETHERNET_SUPPORT) + #define SOC_CONTROLSS_CTRL (0x502F0000U) + #define MSS_IOCFGKICK0 (0x00001008U) + #define MSS_IOCFGKICK1 (0x0000100CU) + + #define SOC_MSS_CTRL_BASE (0x50D00000U) + #define MSS_CPSW_CONTROL_REG (0x810U) + + #define MSS_CPSW_CONTROL_REG_P1_MODE_SEL_SHIFT (0x0U) + #define MSS_CPSW_CONTROL_REG_P1_MODE_SEL_MASK (0x00000003U) + + #define MSS_CPSW_CONTROL_REG_P2_MODE_SEL_SHIFT (0x10U) + #define MSS_CPSW_CONTROL_REG_P2_MODE_SEL_MASK (0x00000030U) + + #define KICK0_UNLOCK_VAL_MCU (0x01234567U) + #define KICK1_UNLOCK_VAL_MCU (0x0FEDCBA8U) + + #define ETH_GMII_SEL_GMII_MODE (0x0U) + #define ETH_GMII_SEL_RMII_MODE (0x1U) + #define ETH_GMII_SEL_RGMII_MODE (0x2U) + + typedef enum + { + ETH_MAC_CONN_TYPE_MII_10 = 0x00U, + /**< MAC connection type for 10Mbps MII mode */ + ETH_MAC_CONN_TYPE_MII_100 = 0x01U, + /**< MAC connection type for 100Mbps MII mode */ + ETH_MAC_CONN_TYPE_RMII_10 = 0x02U, + /**< MAC connection type for 10Mbps RMII mode */ + ETH_MAC_CONN_TYPE_RMII_100 = 0x03U, + /**< MAC connection type for 100Mbps RMII mode */ + ETH_MAC_CONN_TYPE_RGMII_FORCE_100_HALF = 0x04U, + /**< MAC connection type for forced half-duplex 100Mbps RGMII mode */ + ETH_MAC_CONN_TYPE_RGMII_FORCE_100_FULL = 0x05U, + /**< MAC connection type for forced full-duplex 100Mbps RGMII mode */ + ETH_MAC_CONN_TYPE_RGMII_FORCE_1000 = 0x06U, + /**< MAC connection type for forced 1000Mbps RGMII mode */ + ETH_MAC_CONN_TYPE_RGMII_DETECT_INBAND = 0x07U, + /**< MAC connection type for RGMII inband detection mode (speed determined + * based on received RGMII Rx clock) */ + } Eth_MacConnectionType; + + void Eth_EnableTransceiver(Eth_MacConnectionType type) + { + uint32 val; + + switch (type) + { + case ETH_MAC_CONN_TYPE_MII_10: + case ETH_MAC_CONN_TYPE_MII_100: + /* MII modes */ + /* Eth mode select */ + val = ETH_GMII_SEL_GMII_MODE; + break; + case ETH_MAC_CONN_TYPE_RMII_10: + case ETH_MAC_CONN_TYPE_RMII_100: + /* RMII modes */ + val = ETH_GMII_SEL_RMII_MODE; + break; + case ETH_MAC_CONN_TYPE_RGMII_FORCE_100_HALF: + case ETH_MAC_CONN_TYPE_RGMII_FORCE_100_FULL: + case ETH_MAC_CONN_TYPE_RGMII_FORCE_1000: + case ETH_MAC_CONN_TYPE_RGMII_DETECT_INBAND: + /* RGMII modes */ + val = ETH_GMII_SEL_RGMII_MODE; + break; + default: + /* Wrong configuration */ + break; + } + + /* Set MAC port interface in MMR */ + HW_WR_REG32((SOC_CONTROLSS_CTRL +MSS_IOCFGKICK0),KICK0_UNLOCK_VAL_MCU); + HW_WR_REG32((SOC_CONTROLSS_CTRL +MSS_IOCFGKICK1),KICK1_UNLOCK_VAL_MCU); + HW_WR_FIELD32(SOC_MSS_CTRL_BASE + MSS_CPSW_CONTROL_REG, + MSS_CPSW_CONTROL_REG_P1_MODE_SEL,(val)); + HW_WR_FIELD32(SOC_MSS_CTRL_BASE + MSS_CPSW_CONTROL_REG, + MSS_CPSW_CONTROL_REG_P2_MODE_SEL,(val)); +} +# endif /* BRS_ENABLE_ETHERNET_SUPPORT */ + +/*****************************************************************************/ +/* @brief This function must be used to initialize the used ports. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwPortInitPowerOn(void) +{ + /* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ + + /* GPIO initialization */ + /* Initialize USER_LED1 and USER_LED0 JWADD */ + +Pinmux_PerCfg_t gGpioPinCfg[] = +{ +# if defined (BRS_ENABLE_SUPPORT_LEDS) + /* GPIO1 -> QSPI_CSn1 (R3) */ + { + PIN_QSPI_CSN1, + ( PIN_MODE(7) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW | PIN_QUAL_SYNC | PIN_GPIO_R5SS0_0 ) + }, +# endif +# if defined (BRS_ENABLE_CAN_SUPPORT) + /* MCAN0 pin config */ + /* MCAN0_RX -> MCAN0_RX (M1) */ + { + PIN_MCAN0_RX, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + /* MCAN0_TX -> MCAN0_TX (L1) */ + { + PIN_MCAN0_TX, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + /* MCAN2 pin config */ + /* MCAN2_RX -> MCAN2_RX (A12) */ + { + PIN_MCAN2_RX, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + /* MCAN2_TX -> MCAN2_TX (B12) */ + { + PIN_MCAN2_TX, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, +# endif +# if defined (BRS_ENABLE_I2C_SUPPORT) + /* I2C2 pin config */ + /* I2C2_SCL -> UART0_RTSn (C7) */ + { + PIN_UART0_RTSN, + ( PIN_MODE(1) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + /* I2C2_SDA -> UART0_CTSn (B7) */ + { + PIN_UART0_CTSN, + ( PIN_MODE(1) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, +# endif +# if defined (BRS_ENABLE_LIN_SUPPORT) + { + PIN_LIN1_RXD, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + /* LIN1_TXD -> LIN_TXD (B9) */ + { + PIN_LIN1_TXD, + ( PIN_MODE(0) | PIN_PULL_DISABLE | PIN_SLEW_RATE_LOW ) + }, + +# endif + {PINMUX_END, PINMUX_END} +}; + + Pinmux_config(gGpioPinCfg, PINMUX_DOMAIN_ID_MAIN); + + uint32_t gpioBaseAddr, pinNum; + + #define GPIO_LED_PIN (1) + + gpioBaseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GPIO0_U_BASE); + pinNum = GPIO_LED_PIN; + + GPIO_setDirMode(gpioBaseAddr, pinNum, GPIO_DIRECTION_OUTPUT); + +# if defined (BRS_ENABLE_SUPPORT_LEDS) + /* Set LED on EVB demo board to show the system is alive */ + BrsMainTogglePin(BRSMAIN_TOGGLEPIN_LED); +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) + /* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ + #error "Implementation for initialization of specific pin must be added here. See LED pin as reference." +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) + /* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ + #error "Implementation for initialization of specific pin must be added here. See LED pin as reference." +# endif + +/******************************************************************************* + * CAN driver + *******************************************************************************/ +# if defined (BRS_ENABLE_CAN_SUPPORT) +//Can_PlatformInit(); +# endif /*BRS_ENABLE_CAN_SUPPORT*/ + +/******************************************************************************* + * LIN driver + *******************************************************************************/ +# if defined (BRS_ENABLE_LIN_SUPPORT) +/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ +# endif /*BRS_ENABLE_LIN_SUPPORT*/ + +/******************************************************************************* + * ETHERNET driver + *******************************************************************************/ +# if defined (BRS_ENABLE_ETHERNET_SUPPORT) +/* Currently selecting connection RMII 10 by default */ + Eth_EnableTransceiver(ETH_MAC_CONN_TYPE_RMII_10); + #error "There is no portpin handling for DrvEth supported by vBaseEnv on this platform! It is expected to always use the 3rd-party MCAL DrvEth, togehther with DrvPort." +# endif /*BRS_ENABLE_ETHERNET_SUPPORT*/ +} +#endif /*BRS_ENABLE_PORT*/ + +/* BrsHwDisableInterruptAtPowerOn() is part of ArmCommon */ + +/* BrsHw_ExceptionTable_Init() is part of ArmCommon */ + +/*****************************************************************************/ +/* @brief Restart ECU (issue a software reset or jump to startup code) + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from e.g. ECU state handling + *****************************************************************************/ +void BrsHwSoftwareResetECU(void) +{ + BrsMain_SoftwareResetECU_Hook(); + +#if !defined (BRS_ENABLE_FBL_SUPPORT) /* FBL is always running in polling mode with interrupts disabled */ + /*DisableAllInterrupts(); call removed by TI */ +#endif + + SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0); + /* Clear reset Reason*/ + HW_WR_REG32(0x53208014, 0x7); + /* R5SS0_RST_WFICHECK */ + HW_WR_REG32(0x53208024, 0x7000707); + /* R5SS1_RST_WFICHECK */ + HW_WR_REG32(0x53208044, 0x7000707); + /* R5SS1_CORE0_LRST_CTRL */ + HW_WR_REG32(0x5320851C, 0x7); + /* R5SS0_CORE0_LRST_CTRL */ + HW_WR_REG32(0x53208518, 0x7); + + while (1) + { + /* Wait until reset/watchdog reset occurs */ + } +} + +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance/executable in the system */ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Get reset reason + * @pre - + * @param[in] - + * @param[out] - + * @return Reset reason + * @context Function is called from BrsMainStartup to determine if reset + * was triggered through software call (BrsHwSoftwareResetECU()). + * The result is stored by BrsMainStartup in the global variable + * brsMain_ResetReason. It should only be called once, during + * startup. The old API name BrsHwGetResetReason() is remapped + * to BrsMainGetResetReason. + *****************************************************************************/ +brsMain_ResetReasonType BrsHwGetResetReasonStartup(void) +{ + volatile uint32 rst_cause; + uint32 sw_reset = 0x00000020U; + rst_cause = BRSHW_CSL_MSS_TOPRCM_SYS_RST_CAUSE; /*HW_RD_REG32(0x53208010UL);*/ + rst_cause = rst_cause & 0x000000FF; + if(rst_cause == sw_reset) + /* 000 0000 0001 - POR; + 000 0000 0010 - WARM RESET + 000 0000 0100 - STC + 000 0000 1000 - Reset for CORE0 and MSS_CORE00_VIM using MSS_RCM::MSS_CR5SSA0_RST_CTRL + 000 0001 0000 - Reset for CORE1 and MSS_CORE10_VIM using MSS_RCM::MSS_CR5SSB0_RST_CTRL + 000 0010 0000 - Reset for CORE0 only using MSS_RCM::MSS_CORE00_RST_CTRL + 000 0100 0000 - Reset for CORE1 only using using MSS_RCM::MSS_CORE10_RST_CTRL + 000 1000 0000 - Reset for CORE0 and MSS_CORE00_VIM caused because of reset request by debugger in CORE00 + 001 0000 0000 - Reset for CORE10 and MSS_CORE10_VIM caused because of reset request by debugger in CORE10 + 010 0000 0000 - Reset for CR5SS0 by the RESET FSM using MSS_CTRL::R5SS0_CONTROL_RESET_FSM_TRIGGER + 100 0000 0000 - MSS_RCM.MSS_CR5SS_POR_RST_CTRL0 */ + { + return BRSMAIN_RESET_SW; + } + else + { + return BRSMAIN_RESET_OTHER; + } +} +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +/* BrsHwTime100NOP() is part of ArmCommon */ + +#if defined (BRS_ENABLE_SAFECTXSUPPORT) +/*****************************************************************************/ +/* @brief This API is used to enable hardware access in untrusted mode + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function must be called after all depending peripheral modules + * are supplied by proper clocks AND before the OS is started. + *****************************************************************************/ +void BrsHw_EnableHwAccess(void) +{ + /* nothing to be done for this platform yet (or never tested) */ + #error "Hardware access in UserMode not yet supported for your specific derivative!" +} +#endif /* BRS_ENABLE_SAFECTXSUPPORT */ + +/* BrsHw_GetCore() is part of ArmCommon */ + +/*****************************************************************************/ +/* @brief This API is used to enable an interrupt source in the core + * interrupt controller. + * @pre - + * @param[in] Source to be enabled. + * @param[in] Priority level to be set. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_EnableInterrupt(uint32 Source, uint8 Priority) +{ + /* Clear pending interrupt. */ + if(((BRSHW_INTC_VIM_INTMAP_J(Source / 32U)) >> (Source % 32U)) & (uint32)0x01) + { + BRSHW_INTC_VIM_FIQSTS_J(Source / 32U)= (uint32)(1UL << (Source % 32U)); + BRSHW_INTC_VIM_FIQVEC = 0x01UL; + } + else + { + BRSHW_INTC_VIM_IRQSTS_J(Source / 32U)= (uint32)(1UL << (Source % 32U)); + BRSHW_INTC_VIM_IRQVEC = 0x01UL; + } + /* Set interrupt priority. */ + BRSHW_INTC_VIM_PRI_INT_J(Source) = Priority; + /* Enable interrupt handling. */ + BRSHW_INTC_VIM_INTR_EN_SET_J(Source / 32U) |= (uint32)(1UL << (Source % 32U)); +} + +/*****************************************************************************/ +/* @brief This API is used to disable an interrupt source in the core + * interrupt controller. + * @pre - + * @param[in] Source to be disabled. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_DisableInterrupt(uint32 Source) +{ + BRSHW_INTC_VIM_INTR_EN_CLR_J(Source / 32U) |= (uint32)(1UL << (Source % 32U)); +} + +/*****************************************************************************/ +/* @brief This API is used to trigger the given software interrupt source. + * @pre - + * @param[in] Source to be triggered. + * Some derivatives only support few software triggerable sources, + * check for their validity. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_TriggerSoftwareInterrupt(uint32 Source) +{ + BRSHW_INTC_VIM_RAW_J(Source / 32U) |= (uint32)(1UL << (Source % 32U)); +} + + #define BOOT_CODE __attribute__((section(".startupCode"))) + + void Dpl_deinit(void) + { + } + + void putchar_(char character) + { + (void)character; + } diff --git a/Source/appl/BrsMain.c b/Source/appl/BrsMain.c new file mode 100644 index 0000000..aa11085 --- /dev/null +++ b/Source/appl/BrsMain.c @@ -0,0 +1,954 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain.c + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Main file of BRS contains + * - Main function (called from StartUpCode and calls stack entry EcuM_Init()) + * - Call of BrsHw HW initialization routines + * - 1ms handler, with support of cycle functions with several cycle times + * - Default_Init_Task, Main and Background Task which can be used by the operating system + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define _BRSMAIN_C_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsMain.h" + +#if !defined (VVIRTUALTARGET) + #include "vBrs_Lcfg.h" +#else + #include "CANoeApi.h" + #include + #include "Os.h" +#endif + +#if defined (BRS_ENABLE_TESTSUITE_SUPPORT) + #include "BrsTestsuite.h" +#endif + +#include "BrsMain_Appl.h" + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (BRSMAIN_MAJOR_VERSION != 2u) || (BRSMAIN_MINOR_VERSION != 27u) + #error "Header and source file are inconsistent!" +#endif +#if (BRSMAIN_PATCH_VERSION != 0u) + #error "Different versions of patch in Header and Source used!" +#endif + +/* BRS_GENERATED_HW_CONFIG_VERSION is generated into vBrsCfg.h by Cfg5/Cfg6 vBrs generator */ +#if (BRS_GENERATED_HW_CONFIG_VERSION < 406U) + #error "Version of vBrs Generator too old! Please update it." +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if !defined (VVIRTUALTARGET) +/* BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED was introduced in Brs_Template 1.04.00 - no check needed */ +# if !defined (BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED) +# if (BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0103u) + #error "This BrsMain version requires a BrsHw package with a minimum template version of 1.03.00!" +# endif +# endif +#endif + +#if defined (BRS_ENABLE_OS_INTERRUPT_ONLY) && defined (BRS_ENABLE_OS_MULTICORESUPPORT) + #error "OS MultiCore support is not supported together with OS INTERRUPT_ONLY UseCase!" +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + #error "This file was filtered for SingleCore UseCase, but MultiCore UseCase is configured!" +#endif + +#if defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) +# if !defined (BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED) +/* BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED was introduced in Brs_Template_HSM 1.05.00 - no check needed */ +# if (BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0104u) + #error "HSM Updater functionality requires a BrsHw package with a minimum template version of 1.04.00!" +# endif +# endif +#endif + +#if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) || defined (BRS_HYPERVISOR_GUEST_EXECUTION_INSTANCE) +# if !defined (BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED) +/* BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED was introduced in Brs_Template 1.04.00 - no check needed */ +# if (BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0103u) || ((BRSHW_SOURCECODE_TEMPLATE_VERSION == 0x0103u) && \ + (BRSHW_SOURCECODE_TEMPLATE_BUGFIX_VERSION < 0x12u)) + #error "Hypervisor functionality requires a BrsHw package with a minimum template version of 1.03.12!" +# endif +# endif +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ +#if defined (BRS_ENABLE_1MS_HANDLER) +# if !defined (BRSMAIN_CYCLIC_MAX_CALLBACKS) + #define BRSMAIN_CYCLIC_MAX_CALLBACKS 2u +# endif + + #define START_SEC_VAR_NOINIT_UNSPECIFIED + #include "MemMap.h" + typedef struct + { + void (*FunctionPointer[BRSMAIN_CYCLIC_MAX_CALLBACKS]) (void); + uint8 FunctionCounter; + } brsMain_Cyclic_Callbacks; + #define STOP_SEC_VAR + #include "MemMap.h" +#endif /* BRS_ENABLE_1MS_HANDLER */ + +#if !defined (VVIRTUALTARGET) +#define BRS_START_SEC_SHARED_VAR +#include "Brs_MemMap.h" +extern volatile brsMain_ResetReasonType brsMain_ResetReason; +#define BRS_STOP_SEC_SHARED_VAR +#include "Brs_MemMap.h" +#endif + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ +#if defined (BRS_ENABLE_1MS_HANDLER) + #define START_SEC_VAR_NOINIT_16BIT + #include "MemMap.h" + /* + * \var brsMain_CallCounter1ms + * Counter for calls of the function BrsMainCyclic1ms + */ + static volatile uint16 brsMain_CallCounter1ms; + + /* + * \var brsMain_CallCounter1sec + * Counter for 1000 calls of the function BrsMainCyclic1ms + */ + static volatile uint16 brsMain_CallCounter1sec; + #define STOP_SEC_VAR + #include "MemMap.h" + + #define START_SEC_VAR_NOINIT_UNSPECIFIED + #include "MemMap.h" + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_Background; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_1ms; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_10ms; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_100ms; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_250ms; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_500ms; + static brsMain_Cyclic_Callbacks brsMain_Cyclic_Callbacks_1000ms; + #define STOP_SEC_VAR + #include "MemMap.h" +#endif /* BRS_ENABLE_1MS_HANDLER */ + +#if defined (BRS_ENABLE_OS_INTERRUPT_ONLY) + #define START_SEC_VAR_NOINIT_32BIT + #include "MemMap.h" + static volatile uint32 brsMain_SuspendAllCounter; + #define STOP_SEC_VAR + #include "MemMap.h" +#endif + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ +# if defined (VVIRTUALTARGET) + #define BRSMAIN_ERRORBUFFERSIZE 120 +#endif + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if defined (BRS_FBL_NO_ECUMINIT) +extern void FblMain(void); +#endif + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ +#if !defined (VVIRTUALTARGET) +# if defined (BRS_ENABLE_SUPPORT_LEDS) +void BrsMainWrapperTogglePinLED(void) +{ + BrsMainTogglePin(BRSMAIN_TOGGLEPIN_LED); +} +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) +void BrsMainWrapperTogglePinWD(void) +{ + BrsMainTogglePin(BRSMAIN_TOGGLEPIN_WD); +} +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) +void BrsMainWrapperTogglePinCustom(void) +{ + BrsMainTogglePin(BRSMAIN_TOGGLEPIN_CUSTOM); +} +# endif +#endif /* !VVIRTUALTARGET */ + +/*****************************************************************************/ +/* @brief Main initialization routine. + * Contains configuration specific initialization of BrsHw parts + * and BrsMain specific mechanisms. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main + *****************************************************************************/ +void BrsMainInit(void) +{ +#if defined (BRSMAIN_BRSMAININIT_CALLOUT) + BrsTestsuite_BrsMain_BrsMainInit(); +#endif + + BrsMain_Appl_Init(); + +#if (!defined (BRS_FBL_NO_ECUMINIT)) && (!defined (VVIRTUALTARGET)) +# if !defined (BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT) + /* If preferred feature is acivated, initialization will take place in BrsMain_MemoryInit_StageOne_Hook(). */ +# if defined (BRSHW_PREINIT_AVAILABLE) + BrsHwPreInitPowerOn(); +# endif + +# if defined (BRS_ENABLE_WATCHDOG) + BrsHwWatchdogInitPowerOn(); +# endif + +# if defined (BRS_ENABLE_PLLCLOCKS) + BrsHwPllInitPowerOn(); +# endif +# endif /* !BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT */ + +# if defined (BRS_ENABLE_PORT) + BrsHwPortInitPowerOn(); +# endif + +# if defined (BRS_ENABLE_FBL_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) +# if defined (BRSHW_DISABLE_ECC_AVAILABLE) + BrsHwDisableEccErrorReporting(); +# endif +# endif +#endif /* !BRS_FBL_NO_ECUMINIT&&!VVIRTUALTARGET */ + +#if defined (BRS_ENABLE_1MS_HANDLER) + brsMain_CallCounter1ms = 0u; + brsMain_CallCounter1sec = 0u; + + brsMain_Cyclic_Callbacks_Background.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_1ms.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_10ms.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_100ms.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_250ms.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_500ms.FunctionCounter = 0u; + brsMain_Cyclic_Callbacks_1000ms.FunctionCounter = 0u; +#endif /* BRS_ENABLE_1MS_HANDLER */ + +#if !defined (VVIRTUALTARGET) +# if defined (BRS_ENABLE_SUPPORT_LEDS) + BrsMainRegisterCyclic(&BrsMainWrapperTogglePinLED, BRSMAIN_CYCLETIME_500MS); +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) + BrsMainRegisterCyclic(&BrsMainWrapperTogglePinWD, BRSMAIN_CYCLETIME_250MS); +# endif + +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) + BrsMainRegisterCyclic(&BrsMainWrapperTogglePinCustom, BRSMAIN_CYCLETIME_1000MS); +# endif +#endif /* !VVIRTUALTARGET */ + +#if defined (BRS_ENABLE_OS_INTERRUPT_ONLY) + brsMain_SuspendAllCounter = 0u; +#endif +} + +#if defined (BRS_ENABLE_1MS_HANDLER) +/*****************************************************************************/ +/* @brief Routine to register cyclic callbacks. + * @pre Initialization of BrsMain was done threw call of BrsMainInit(). + * @param[in] FunctionPointer has to be a pointer to a function of type + * void function(void). + * @param[in] Cycletime described the cycletime, the callback should be triggered. + * @param[out] - + * @return - + * @context Function is called from modules that need cyclic callbacks. + *****************************************************************************/ +void BrsMainRegisterCyclic(void (*FunctionPointer)(void), brsMain_Cyclic_Cycletime Cycletime) +{ +#if defined (BRSMAIN_BRSMAINREGISTERCYCLIC_CALLOUT) + BrsTestsuite_BrsMain_BrsMainRegisterCyclic(FunctionPointer, Cycletime); +#endif + + switch (Cycletime) + { + case BRSMAIN_CYCLETIME_BACKGROUND: + if (brsMain_Cyclic_Callbacks_Background.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_Background.FunctionPointer[ + brsMain_Cyclic_Callbacks_Background.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_Background.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_1MS: + if (brsMain_Cyclic_Callbacks_1ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_1ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_1ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_1ms.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_10MS: + if (brsMain_Cyclic_Callbacks_10ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_10ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_10ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_10ms.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_100MS: + if (brsMain_Cyclic_Callbacks_100ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_100ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_100ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_100ms.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_250MS: + if (brsMain_Cyclic_Callbacks_250ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_250ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_250ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_250ms.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_500MS: + if (brsMain_Cyclic_Callbacks_500ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_500ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_500ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_500ms.FunctionCounter++; + break; + + case BRSMAIN_CYCLETIME_1000MS: + if (brsMain_Cyclic_Callbacks_1000ms.FunctionCounter >= BRSMAIN_CYCLIC_MAX_CALLBACKS) + { + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + } + brsMain_Cyclic_Callbacks_1000ms.FunctionPointer[ + brsMain_Cyclic_Callbacks_1000ms.FunctionCounter] = FunctionPointer; + brsMain_Cyclic_Callbacks_1000ms.FunctionCounter++; + break; + + default: + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + break; + } +} +#endif /* BRS_ENABLE_1MS_HANDLER */ + +#if (!defined (BRS_DISABLE_OS_USAGE)) && (!defined (BRS_ENABLE_OS_INTERRUPT_ONLY)) +/*****************************************************************************/ +/* @brief InitTask to call EcuM_StartupTwo() on the MasterCore. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context The task is started once by the OS. + *****************************************************************************/ +TASK(Default_Init_Task) +{ +#if defined (BRSMAIN_DEFAULT_INIT_TASK_CALLOUT) + BrsTestsuite_BrsMain_Default_Init_Task(); +#endif + +#if defined (BRS_ENABLE_TESTSUITE_SUPPORT) + BrsTestsuiteInit(); +#endif + +#if defined (BRS_ENABLE_HSM_SUPPORT) + vHsm_StartupTwo(); +#else + EcuM_StartupTwo(); +#endif + +#if defined (BRS_ENABLE_1MS_HANDLER) + (void)SetRelAlarm(BrsMainCyclicAlarm_1ms, OS_MS2TICKS_SystemTimer(1), OS_MS2TICKS_SystemTimer(1)); +#endif + + (void)TerminateTask(); +} + +/*****************************************************************************/ +/* @brief InitTask to call Os_InitialEnableInterruptSources() on the MasterCore. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context The task is started once by the OS. It is separated from + * Default_Init_Task() to allow the SafeContext partitioning UseCase. + *****************************************************************************/ +TASK(Default_Init_Task_Trusted) +{ +#if defined (BRSMAIN_DEFAULT_INIT_TASK_TRUSTED_CALLOUT) + BrsTestsuite_BrsMain_Default_Init_Task_Trusted(); +#endif + + Os_InitialEnableInterruptSources(FALSE); + + (void)TerminateTask(); +} + +#endif /* !BRS_DISABLE_OS_USAGE&&!BRS_ENABLE_OS_INTERRUPT_ONLY */ + +#if defined (BRS_ENABLE_1MS_HANDLER) +/*****************************************************************************/ +/* @brief One millisecond handler for BrsMain + * - Executes retransmission of BRS TCC messages + * - Toggling of LED (alive signal) + * - BRS Test code (1s cyclic negative TCC response message) + * @pre Initialization of BrsMain was done threw call of BrsMainInit(). + * @param[in] - + * @param[out] - + * @return - + * @context Function is called each millisecond either from the main loop + * or from the BRS main task (TASK(mainTask)) + *****************************************************************************/ +void BrsMainCyclic1ms(void) +{ + uint8 cycliccounter; + +#if defined (BRSMAIN_BRSMAINCYCLIC1MS_CALLOUT) + BrsTestsuite_BrsMain_BrsMainCyclic1ms(); +#endif + + brsMain_CallCounter1ms++; + + for (cycliccounter = 0u; cycliccounter < brsMain_Cyclic_Callbacks_1ms.FunctionCounter; cycliccounter++) + { + brsMain_Cyclic_Callbacks_1ms.FunctionPointer[cycliccounter](); + } + + if ((brsMain_CallCounter1ms % 10u) == 0u) + { + for (cycliccounter = 0u; cycliccounter1) + if (coreID == BRSHW_INIT_CORE_ID) +# endif +#endif /* !VVIRTUALTARGET */ + { + BrsMainInit(); + } + +#if defined (BRSMAIN_POSTBRSMAININIT_CALLOUT) + BrsTestsuite_BrsMain_PostBrsMainInit(); +#endif + +#if defined (BRS_FBL_NO_ECUMINIT) + FblMain(); /* never returns */ + +#else +# if (!defined (BRS_ENABLE_FBL_SUPPORT)) && (!defined (BRS_ENABLE_HSM_UPDATER_SUPPORT)) || (defined (VVIRTUALTARGET)) +# if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) + BrsMain_Appl_HypervisorStartCoreApi(coreID); + + vHyp_InitMemory(); + vHyp_Init(); + +# elif defined (BRS_ENABLE_OS_INTERRUPT_ONLY) + /* OS is configured for UseCase Interrupt Only (/MICROSAR/Os/OsOS/OsUseCase) */ + Os_InitInterruptOnly(); + +# else + Os_InitMemory(); + Os_Init(); +# endif +# endif /* (!BRS_ENABLE_FBL_SUPPORT && !BRS_ENABLE_HSM_UPDATER_SUPPORT) || VVIRTUALTARGET */ + +# if defined (BRS_ENABLE_OS_MULTICORESUPPORT) && (!defined (VVIRTUALTARGET)) && \ + (!defined (BRS_ENABLE_HYPERVISOR_SUPPORT)) + if (triggerNonAsrHook) + { /* + * New callout API for non-Autosar-Cores that are not FBL/HSM-Updater related (core configured as non-ASR core + * in OS) + */ + BrsMain_NonAsrCore_Hook(); + } +# endif + +# if defined (BRS_ENABLE_HSM_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) + vHsm_Init(); /* never returns */ + +# elif defined (BRS_ENABLE_HYPERVISOR_SUPPORT) + BrsMain_Appl_HypervisorApi(coreID); + + vHyp_Start(); /* never returns */ + +# else + EcuM_Init(); /* never returns */ +# endif +#endif /* else BRS_FBL_NO_ECUMINIT */ + + BrsMainExceptionHandler(kBrsIllegalReturnFromMain, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); + + return 0; +} diff --git a/Source/appl/BrsMainStartup.c b/Source/appl/BrsMainStartup.c new file mode 100644 index 0000000..1c2323a --- /dev/null +++ b/Source/appl/BrsMainStartup.c @@ -0,0 +1,584 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMainStartup.c + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Vector Basic Runtime System module source for startup routines. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define _BRSMAINSTARTUP_C_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsMain.h" + +#include "vLinkGen_Lcfg.h" + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (BRSMAIN_MAJOR_VERSION != 2u) || (BRSMAIN_MINOR_VERSION != 27u) + #error "Header and source file are inconsistent!" +#endif +#if (BRSMAIN_PATCH_VERSION != 0u) + #error "Different versions of patch in Header and Source used!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if (!defined (BRS_INIT_PATTERN_BLOCKS)) || \ + (!defined (BRS_INIT_PATTERN_HARDRESET_BLOCKS)) || \ + (!defined (BRS_INIT_PATTERN_AREAS)) || \ + (!defined (BRS_INIT_PATTERN_HARDRESET_AREAS)) + #error "Your environment is missing the mandatory init pattern. They should be generated out of vBRS in Configurator5." +#endif + +#if (VLINKGEN_CFG_MAJOR_VERSION != 2u) + #error "This StartUpCode is dependent to the vLinkGen version! vLinkGen major version does not fit!" +#else +# if (VLINKGEN_CFG_MINOR_VERSION < 16u) + #error "This StartUpCode is dependent to the vLinkGen version! Your vLinkGen minor version is too old!" +# endif +#endif + +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + #error "This file was filtered for SingleCore UseCase, but MultiCore UseCase is configured!" +#endif + +/* +* Starting with Brs_Template 01.03.13, BrsHw_UnlockCores() is only present if respective macro "BRSHW_CORES_AUTOSTART" +* is defined. Older versions have BrsHw_UnlockCores() as unconditional callout. +*/ +/* BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED was introduced in Brs_Template 1.04.00 - no check needed */ +#if !defined (BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED) +# if (BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0103) || ((BRSHW_SOURCECODE_TEMPLATE_VERSION == 0x0103) && \ + (BRSHW_SOURCECODE_TEMPLATE_BUGFIX_VERSION < 0x13)) + #define BRSHW_CORES_AUTOSTART +# endif +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ +#if defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) +typedef uint64 BrsAddressType; +#else +typedef uint32 BrsAddressType; +#endif + +#if defined (BRS_ENABLE_64BIT_INIT_PATTERN) +typedef uint64 BrsInitType; +#else +typedef uint32 BrsInitType; +#endif + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ +#define BRS_START_SEC_SHARED_VAR +#include "Brs_MemMap.h" +volatile brsMain_ResetReasonType brsMain_ResetReason; +#define BRS_STOP_SEC_SHARED_VAR +#include "Brs_MemMap.h" + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ +BRSMAIN_MEMINIT_FUNC_PREFIX void Brs_MemoryZeroInit(const vLinkGen_MemAreaSet *memAreaSet, + BrsInitType InitPattern, uint32 coreId); +#if !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) +BRSMAIN_MEMINIT_FUNC_PREFIX void Brs_MemoryInit(const vLinkGen_RamMemAreaSet *memAreaSet, uint32 coreId); +#endif +#if !defined (BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE) +BRSMAIN_MEMINIT_FUNC_PREFIX void BrsHw_AsmMemoryZeroInitLoop_64bit(volatile uint64 *memPtr64, + BrsAddressType memAreaEnd, + BrsInitType InitPattern); +#endif +#if defined (BRSMAINSTARTUP_64BIT_MEMORYINIT) || defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) +BRSMAIN_MEMINIT_FUNC_PREFIX void BrsHw_AsmMemoryInitLoop_64bit(uint64 *memPtr64, uint64 *romPtr64, + BrsAddressType memAreaEnd); +#endif + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance in the system */ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Unified routine for Pre Main() Startup. + * @pre Stack pointer needs to be initilialized in StartUpCode before. + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from assembler startup code. + * Called by all cores from the booting execution instance. + * Through Brs_MemMap.h, the API is mapped into section + * brsMainStartup, which allows a fix memory allocation. + *****************************************************************************/ +void Brs_PreMainStartup(void) +{ +#if defined (BRSHW_EARLYINIT_AVAILABLE) + BrsHwEarlyInitPowerOn(); +#endif + +#if (BRS_CPU_CORE_AMOUNT>1) + if (BrsHw_GetCore() == BRSHW_INIT_CORE_ID) +#endif + { + brsMain_ResetReason = BrsHwGetResetReasonStartup(); + } + + Brs_ApplicationEntry(); + + BrsMainExceptionStartup(); /* Illegal return from main */ +} +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +#define BRS_START_SEC_BRSAPPLENTRY_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Unified application entry for Pre Main() Startup. + * @pre Stack pointer needs to be initilialized in StartUpCode before, + * brsMain_ResetReason needs to be initialized by booting execution + * instance (see Brs_PreMainStartup()). + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() of the booting + * execution instance or is the direct application entry of + * non-booting execution instances (e.g. FBL, with a previously + * running BootManager). Through Brs_MemMap.h, the API is mapped + * into section brsApplicationEntry, which allows a fix memory + * allocation. All APIs are called with current Core ID. + *****************************************************************************/ +void Brs_ApplicationEntry(void) +{ + uint32 coreID; + +#if defined (BRSHW_APPLICATIONINIT_AVAILABLE) + BrsHwApplicationInit(); +#endif + + coreID = BrsHw_GetCore(); + + BrsMain_MemoryInit_StageZero_Hook(coreID); + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_ZERO_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_Zero_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "ZERO_INIT" and + * Init Stage "ZERO" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_Zero_GroupsSet, BRS_INIT_PATTERN_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_ZERO_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_Zero_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "INIT" and + * Init Stage "ZERO" + */ + Brs_MemoryInit(&vLinkGen_Init_Zero_GroupsSet, coreID); +#endif + + BrsMain_MemoryInit_StageHardReset_Hook(coreID); + + if (brsMain_ResetReason != BRSMAIN_RESET_SW) + { +#if (VLINKGEN_CFG_NUM_ZERO_INIT_HARD_RESET_BLOCKS > 1uL) + /* + * vLinkGen_ZeroInit_HardReset_BlocksSet contains vLinkGen memory region blocks, configured with + * Init Stage "HARD_RESET_ONLY" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_HardReset_BlocksSet, BRS_INIT_PATTERN_HARDRESET_BLOCKS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_HARD_RESET_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_HardReset_GroupsSet contains vLinkGen VarSectionGroups, configured with + * Init Policy "ZERO_INIT" and Init Stage "HARD_RESET_ONLY" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_HardReset_GroupsSet, BRS_INIT_PATTERN_HARDRESET_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_HARD_RESET_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_HardReset_GroupsSet contains vLinkGen VarSectionGroups, configured with + * Init Policy "INIT" and Init Stage "HARD_RESET_ONLY" + */ + Brs_MemoryInit(&vLinkGen_Init_HardReset_GroupsSet, coreID); +#endif + } + + BrsMain_MemoryInit_StageOne_Hook(coreID); + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_ONE_BLOCKS > 1uL) + /* vLinkGen_ZeroInit_One_BlocksSet contains vLinkGen memory region blocks, configured with Init Stage "ONE" */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_One_BlocksSet, BRS_INIT_PATTERN_BLOCKS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_ONE_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_One_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "ZERO_INIT" and + * Init Stage "ONE" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_One_GroupsSet, BRS_INIT_PATTERN_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_ONE_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_One_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "INIT" and + * Init Stage "ONE" + */ + Brs_MemoryInit(&vLinkGen_Init_One_GroupsSet, coreID); +#endif + + BrsMain_MemoryInit_StageTwo_Hook(coreID); + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_TWO_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_Two_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "ZERO_INIT" and + * Init Stage "TWO" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_Two_GroupsSet, BRS_INIT_PATTERN_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_TWO_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_Two_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "INIT" and + * Init Stage "TWO" + */ + Brs_MemoryInit(&vLinkGen_Init_Two_GroupsSet, coreID); +#endif + + BrsMain_MemoryInit_StageThree_Hook(coreID); + +#if (VLINKGEN_CFG_NUM_ZERO_INIT_THREE_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_Three_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "ZERO_INIT" and + * Init Stage "THREE" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_Three_GroupsSet, BRS_INIT_PATTERN_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_THREE_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_Three_GroupsSet contains vLinkGen VarSectionGroups, configured with Init Policy "INIT" and + * Init Stage "THREE" + */ + Brs_MemoryInit(&vLinkGen_Init_Three_GroupsSet, coreID); +#endif + + BrsMain_MemoryInit_StagePowerOn_Hook(coreID); + +/* +* --------------------------------------------------------------------------------------------------------------------- +* As there is no general condition available for POWER_ON initialization configured memory, these areas are always +* initialized as default. A project specific condition could be added here! +* +* Explanation from AR21-11 SWS_MemoryMapping: +* POWER_ON_CLEARED, used for variables that are not explicitly initialized (cleared) during normal start-up. +* Instead, these are cleared only after either a power on reset of the microcontroller or a power on reset of +* a battery backup memory itself after battery loss. +* --------------------------------------------------------------------------------------------------------------------- +*/ +#if (VLINKGEN_CFG_NUM_ZERO_INIT_POWER_ON_GROUPS > 1uL) + /* + * vLinkGen_ZeroInit_PowerOn_GroupsSet contains vLinkGen VarSectionGroups, configured with + * Init Policy "ZERO_INIT" and Init Stage "POWER_ON" + */ + Brs_MemoryZeroInit(&vLinkGen_ZeroInit_PowerOn_GroupsSet, BRS_INIT_PATTERN_AREAS, coreID); +#endif + +#if (VLINKGEN_CFG_NUM_INIT_POWER_ON_GROUPS > 1uL) && !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) + /* + * vLinkGen_Init_PowerOn_GroupsSet contains vLinkGen VarSectionGroups, configured with + * Init Policy "INIT" and Init Stage "POWER_ON" + */ + Brs_MemoryInit(&vLinkGen_Init_PowerOn_GroupsSet, coreID); +#endif + + BrsMain_PreMainHook(coreID); + + main(); + + BrsMainExceptionHandler(kBrsIllegalReturnFromMain, BRSERROR_MODULE_BRSMAIN, (uint16)(__LINE__)); +} +#define BRS_STOP_SEC_BRSAPPLENTRY_CODE +#include "Brs_MemMap.h" + +#if !defined (BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE) +/* +* This helper API is necessary, to get native 64-bit access on the HW (e.g. by getting "ldrd" and "strd" +* (or even "ldmia" and "stmia") assembly command on Arm Cortex-M platforms) reliable. +* That functionality is essential for memory areas with 8-byte aligned ECC! +*/ +BRSMAIN_MEMINIT_FUNC_PREFIX void BrsHw_AsmMemoryZeroInitLoop_64bit(volatile uint64 *memPtr64, + BrsAddressType memAreaEnd, + BrsInitType InitPattern) +{ + volatile uint64 InitPattern_64bit; + volatile const uint64 *memAreaEndPtr = (volatile uint64 *)(memAreaEnd); + + InitPattern_64bit = InitPattern; +# if !defined (BRS_ENABLE_64BIT_INIT_PATTERN) + InitPattern_64bit = (InitPattern_64bit << 32) | InitPattern; +# endif + + while (memPtr64 < memAreaEndPtr) + { + *memPtr64 = InitPattern_64bit; + memPtr64++; + } +} +#endif /* !BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE */ + +/*****************************************************************************/ +/* @brief Generic routine for RAM zeroing. + * @pre - + * @param[in] memAreaSet shall point to the first element of a vLinkGen_MemAreaSet struct array + * @param[in] InitPattern describes the pattern, to be used for the memory initialization + * @param[in] coreId shall describe the ID of the current CPU + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() to initialize memory ares, + * generated out of vLinkGen configuration + *****************************************************************************/ +BRSMAIN_MEMINIT_FUNC_PREFIX void Brs_MemoryZeroInit(const vLinkGen_MemAreaSet *memAreaSet, + BrsInitType InitPattern, + uint32 coreId) +{ + uint32 i; +#if !defined (BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE) +# if !defined (BRS_ENABLE_64BIT_INIT_PATTERN) + volatile BrsAddressType *memPtr; +# endif + volatile uint64 *memPtr64; + volatile uint32 alignment; +#endif + + for (i=0; iNum; i++) + { + if ((memAreaSet->Areas[i].Core == coreId) && ((memAreaSet->Areas[i].End - memAreaSet->Areas[i].Start) > 0u)) + { +#if defined (BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE) + BrsHw_AsmMemoryZeroInitLoop(memAreaSet->Areas[i].Start, memAreaSet->Areas[i].End, InitPattern); + +#else + alignment = (uint32)memAreaSet->Areas[i].Alignment; + if ((alignment != 0u) && (alignment != 4u) && (alignment != 8u)) + { /* Handling for the configured alignment is not supported yet */ + BrsMainExceptionHandler(kBrsMissingFunctionality, BRSERROR_MODULE_BRSMAINSTARTUP, (uint16)(__LINE__)); + } + +# if !defined (BRS_ENABLE_64BIT_INIT_PATTERN) + if ((alignment == 0u) || (alignment == 4u)) + { /* 32-bit/4Byte default alignment */ + memPtr = (BrsAddressType*)memAreaSet->Areas[i].Start; + while ((BrsAddressType)memPtr < memAreaSet->Areas[i].End) + { + *memPtr = InitPattern; + memPtr++; + } + } + if (alignment == 8u) +# endif /* !BRS_ENABLE_64BIT_INIT_PATTERN */ + { /* 64-bit/8Byte alignment or 64-Bit Init Pattern enabled */ + memPtr64 = (uint64*)memAreaSet->Areas[i].Start; + BrsHw_AsmMemoryZeroInitLoop_64bit((volatile uint64*)memPtr64, memAreaSet->Areas[i].End, InitPattern); + } +#endif /* else BRSHW_ASM_MEMORY_ZERO_INIT_LOOP_AVAILABLE */ + } + } +} + +/* +* To prevent issues with not 8-Byte aligned memory areas, the 64-bit memory initialization is disabled per default. +* If you want to use it, take care about the alignment and enable BRSMAINSTARTUP_64BIT_MEMORYINIT. +* Or enable the 64-bit addressing in vLinkGen. +* For ECC-RAM with 8-Byte aligned ECC, the memory should be handled by ZeroInit in advance +*/ +#if defined (BRSMAINSTARTUP_64BIT_MEMORYINIT) || defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) +/* +* This helper API is necessary, to get native 64-bit access on the HW (e.g. by getting "ldrd" and "strd" +* (or even "ldmia" and "stmia") assembly commands on Arm Cortex-M platforms) reliable. +* That functionality is essential for memory areas with 8-byte aligned ECC! +*/ +BRSMAIN_MEMINIT_FUNC_PREFIX void BrsHw_AsmMemoryInitLoop_64bit(uint64 *memPtr64, + uint64 *romPtr64, + BrsAddressType memAreaEnd) +{ + while ((uint64)romPtr64 < memAreaEnd) + { + *memPtr64 = *romPtr64; + memPtr64++; + romPtr64++; + } +} +#endif /* BRSMAINSTARTUP_64BIT_MEMORYINIT || VLINKGEN_CFG_64BIT_MODE_ENABLED */ + +#if !defined (BRS_DISABLE_MEMORY_INIT_GLOBALLY) +/*****************************************************************************/ +/* @brief Generic routine for ROM to RAM initialization. + * @pre - + * @param[in] memAreasSet shall point to the first element of a vLinkGen_RamMemAreaSet struct array + * @param[in] coreId shall describe the ID of the current CPU + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() to initialize memory ares, + * generated out of vLinkGen configuration + *****************************************************************************/ +BRSMAIN_MEMINIT_FUNC_PREFIX void Brs_MemoryInit(const vLinkGen_RamMemAreaSet *memAreasSet, uint32 coreId) +{ +#if !defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) + volatile uint32 *memPtr32; + volatile const uint32 *romPtr32; +#endif + uint32 i; + volatile uint32 alignment; + +#if defined (BRSMAINSTARTUP_64BIT_MEMORYINIT) || defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) + volatile uint64 *memPtr64; + volatile const uint64 *romPtr64; +#endif + + for (i = 0; i < memAreasSet->Num; i++) + { + if ((memAreasSet->Areas[i].Core == coreId) && + ((memAreasSet->Areas[i].Romend - memAreasSet->Areas[i].Romstart) > 0u)) + { + if ((memAreasSet->Areas[i].End - memAreasSet->Areas[i].Start) < + (memAreasSet->Areas[i].Romend - memAreasSet->Areas[i].Romstart)) + { /* Defined size in RAM is smaller than the ROM size -> data will not fit */ + BrsMainExceptionHandler(kBrsIllegalParameter, BRSERROR_MODULE_BRSMAINSTARTUP, (uint16)(__LINE__)); + } + + alignment = (uint32)memAreasSet->Areas[i].Alignment; + if ((alignment != 0u) && (alignment != 4u) && (alignment != 8u)) + { /* Handling for the configured alignment is not supported yet */ + BrsMainExceptionHandler(kBrsMissingFunctionality, BRSERROR_MODULE_BRSMAINSTARTUP, (uint16)(__LINE__)); + } + +#if defined (VLINKGEN_CFG_64BIT_MODE_ENABLED) + /* 64-Bit Init Pattern enabled */ + memPtr64 = (uint64*)memAreasSet->Areas[i].Start; + romPtr64 = (uint64*)memAreasSet->Areas[i].Romstart; + BrsHw_AsmMemoryInitLoop_64bit((uint64*)memPtr64, (uint64*)romPtr64, memAreasSet->Areas[i].Romend); + +#else +# if defined (BRSMAINSTARTUP_64BIT_MEMORYINIT) + if ((alignment == 0u) || (alignment == 4u)) + { /* 32-bit/4Byte default alignment */ +# endif + + memPtr32 = (uint32*)memAreasSet->Areas[i].Start; + romPtr32 = (uint32*)memAreasSet->Areas[i].Romstart; + + while ((BrsAddressType)romPtr32 < memAreasSet->Areas[i].Romend) + { + *memPtr32 = *romPtr32; + memPtr32++; + romPtr32++; + } + +# if defined (BRSMAINSTARTUP_64BIT_MEMORYINIT) + } + if (alignment == 8u) + { /* 64-bit/8Byte alignment */ + memPtr64 = (uint64*)memAreasSet->Areas[i].Start; + romPtr64 = (uint64*)memAreasSet->Areas[i].Romstart; + BrsHw_AsmMemoryInitLoop_64bit((uint64*)memPtr64, (uint64*)romPtr64, memAreasSet->Areas[i].Romend); + } +# endif /* BRSMAINSTARTUP_64BIT_MEMORYINIT */ +#endif /* VLINKGEN_CFG_64BIT_MODE_ENABLED */ + } + } +} +#endif /* !BRS_DISABLE_MEMORY_INIT_GLOBALLY */ + +#if !defined (VVIRTUALTARGET) +# if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance in the system */ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief This is the central exeption/issue handler of BRS, in startup + * phase. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context This function implements an endless loop. The recommendation is + * to set a breakpoint on top of this function to see if any check + * has failed during the startup code execution. + *****************************************************************************/ +void BrsMainExceptionStartup(void) +{ + volatile uint8 BrsMainStartup_Continue; + BrsMainStartup_Continue = 0; + while (BrsMainStartup_Continue == 0u) + { + /* + * Set BrsMainStartup_Continue to 1 to continue here. + * If the debugger is not able to show the stack properly, this mechanism can be used to find the + * source of the exception. + */ + } +} +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +# endif /* BRS_FIRST_EXECUTION_INSTANCE */ +#endif /* VVIRTUALTARGET */ diff --git a/Source/appl/BrsMain_Appl.c b/Source/appl/BrsMain_Appl.c new file mode 100644 index 0000000..a5f987b --- /dev/null +++ b/Source/appl/BrsMain_Appl.c @@ -0,0 +1,892 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_Appl.c + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Additional, Application-specific, implementation + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define _BRSMAIN_APPL_C_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsMain_Appl.h" + +#if defined (BRS_ENABLE_SCHM_STUB_GENERATION) +/* needed for SuspendAllInterrupts() and ResumeAllInterrupts() of SchM stub wrapper APIs + * BrsMain_Appl_SuspendAllInterrupts() and BrsMain_Appl_ResumeAllInterrupts() */ + #include "Os.h" +#endif + +#if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) && defined (BRS_ENABLE_OS_MULTICORESUPPORT) + /* Needed for BrsMain_CoreConfig[] and BrsMain_CoreConfig_Size */ + #include "vBrs_Lcfg.h" +#endif + +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) && defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + /* with vCan drivers, only Can_30_Core.h needs to be included (see BrsMain_Appl.h) */ + #include BRS_DRVCAN_HEADER_FILENAME +# if defined (BRS_DRVCAN1_HEADER_FILENAME) + #include BRS_DRVCAN1_HEADER_FILENAME +# endif +# endif +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (BRSMAIN_MAJOR_VERSION != 2u) || (BRSMAIN_MINOR_VERSION != 27u) + #error "Header and source file are inconsistent!" +#endif +#if (BRSMAIN_PATCH_VERSION != 0u) + #error "Different versions of patch in Header and Source used!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +/* COMPILER CHECK */ +/* Check if the DaVinci configured compiler fits to the used buildenvironment */ +#if defined (VVIRTUALTARGET) + /* For vVirtualTarget, the compier should always be configured to Ansi. + This is related to BRS_COMPILER_DFDD3B47_BB56_4B45_BEC9_BE0B2C58DC11. + But, as no MakeSupport is used for vVirtualTarget, we do not need to check this here. */ +#else +# if defined (BRS_COMPILER_UNDEFINED) + #error "No compiler is configured in DaVinci!" + #error "As several parts of vBaseEnv are compiler dependent, proper usage without a compiler selection is not possible." +# endif +# if defined (BRS_COMP_ARM5) && !defined (BRS_COMPILER_ACA8C365_6D1E_49FA_97F8_792D81C79C74) + #error "Buildenvironment for Arm5 compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_ARM6) && !defined (BRS_COMPILER_89D464F1_ECCF_4306_A854_BF45FB1D7441) + #error "Buildenvironment for Arm6 compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_ARMTFE) && !defined (BRS_COMPILER_B052FFB3_EA77_4E0B_ACB8_A77A4A0F24E8) + #error "Buildenvironment for ArmTfE compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_CCAC) && !defined (BRS_COMPILER_2526EC26_414A_4091_91D0_0442AF47D241) + #error "Buildenvironment for Ccac compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_DIABDATA) && !defined (BRS_COMPILER_44266E21_0E8C_4DDA_B800_91CE20104931) + #error "Buildenvironment for DiabData compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_GCCHIGHTEC) && !defined (BRS_COMPILER_E7BC1F6B_0DF4_4345_BE50_A9AE95AF99A7) + #error "Buildenvironment for GccHighTec compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_GCCNXP) && !defined (BRS_COMPILER_E832C52E_6625_4C6A_96D2_0BD6FFD35ECE) + #error "Buildenvironment for GccNxp compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_GHS) && !defined (BRS_COMPILER_BBC47DF5_C78B_4E8E_8F86_0EF503FD3198) + #error "Buildenvironment for GreenHills compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_GNU) && !defined (BRS_COMPILER_1350F673_6EFC_4394_917C_52F584E83ACE) + #error "Buildenvironment for GccGnu compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_IAR) && !defined (BRS_COMPILER_FA51A718_3ADB_438D_98F3_245101681392) + #error "Buildenvironment for Iar compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_LLVMDIAB) && !defined (BRS_COMPILER_E0E70C27_10E6_4169_9D2C_B9CAA4649C65) + #error "Buildenvironment for LlvmDiabData compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_LLVMHIGHTEC) && !defined (BRS_COMPILER_BEBEB212_6307_4BD8_A274_A517B187644E) + #error "Buildenvironment for LlvmHighTec compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) && !defined (BRS_COMPILER_051C3D73_B474_4677_9754_FBA372BF80EC) + #error "Buildenvironment for LlvmTexasInstruments compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_MICROCHIP) && !defined (BRS_COMPILER_82CA3A19_9A7A_49D6_9EFE_39486D0F6510) + #error "Buildenvironment for MicroChip compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_RENESAS) && !defined (BRS_COMPILER_5BCBEFDE_F5D2_49AA_B4DD_04AC02CE5A9A) + #error "Buildenvironment for Renesas compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_TASKING) && !defined (BRS_COMPILER_8DB6C5C5_6807_4601_B7B7_68A4A5B277F6) + #error "Buildenvironment for Tasking compiler is used, but DaVinci is configured for a different compiler!" +# endif +# if defined (BRS_COMP_TI) && !defined (BRS_COMPILER_B961F280_648C_45FF_A994_700EDE3B9F78) + #error "Buildenvironment for TexasInstruments compiler is used, but DaVinci is configured for a different compiler!" +# endif +#endif /* VVIRTUALTARGET */ + +/* If the template version for BrsHw is not at least 01.03.13, Hypervisor Multicore configuration is not supported. */ +#if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) && defined (BRS_ENABLE_OS_MULTICORESUPPORT) +/* BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED was introduced in Brs_Template 1.04.00 - no check needed */ +# if !defined (BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED) +# if (BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0103) || ((BRSHW_SOURCECODE_TEMPLATE_VERSION == 0x0103) && \ + (BRSHW_SOURCECODE_TEMPLATE_BUGFIX_VERSION < 0x13)) + #error "Hypervisor Multicore is only supported with Brs_Template[01.03.13] onwards." +# endif +# endif +#endif + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) && (!defined (BRS_ENABLE_FBL_SUPPORT)) +# if defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + #define CAN_START_SEC_VAR_NOINIT_8BIT + /* + * to support CAN driver name infix, vBRS generator provides a wrapper + * for usage of the driver specific MemMap.h define in vBrsCfg.h + */ + #include "vBrsCfg.h" + static uint8 BrsAsrApplCanInterruptLockCtr; + #define CAN_STOP_SEC_VAR_NOINIT_8BIT + /* + * to support CAN driver name infix, vBRS generator provides a wrapper + * for usage of the driver specific MemMap.h define in vBrsCfg.h + */ + #include "vBrsCfg.h" +# endif /* BRS_ENABLE_CAN_CLASSIC_SUPPORT */ +# endif /* BRS_ENABLE_CAN_SUPPORT && !BRS_ENABLE_FBL_SUPPORT */ +#endif /* !BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING */ + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ +#if defined (BRS_FBL_INSTANCE_FBL) +/********************************************************************************************************************** + * FBL Instance Presence Pattern + * This presence pattern is only required when downloading the FBL with debugger. When using an updater (or an EOL + * programmer), this presence pattern is not required as part of the .hex file and should be removed. + *********************************************************************************************************************/ +#define BRS_START_SEC_FBL_PP_CONST +#include "Brs_MemMap.h" +const uint8 FblPresencePatternArray[4] = {0x73u, 0x6Au, 0x29u, 0x3Eu}; +#define BRS_STOP_SEC_FBL_PP_CONST +#include "Brs_MemMap.h" +#endif /* BRS_FBL_INSTANCE_FBL */ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ +/*****************************************************************************/ +/* @brief Main initialization routine. + * Contains configuration specific initialization of BrsHw parts + * and BrsMain specific mechanisms. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main + *****************************************************************************/ +void BrsMain_Appl_Init(void) +{ +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) && (!defined (BRS_ENABLE_FBL_SUPPORT)) +# if defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + /* UserDefined ExclusiveArea handling for CAN channels, according to AN-ISC-8-1149_ErrorHook_E_OS_DISABLED_INT.pdf */ + BrsAsrApplCanInterruptLockCtr = 0u; +# endif +# endif +#endif +} + +#if defined (BRS_ENABLE_SCHM_STUB_GENERATION) +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +/*****************************************************************************/ +/* @brief Suspend all interrupts via OS call + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is used for SchM_Enter_* defines in vBrs generated + * SchM stub module specific header files. This allows the user to + * add project specific code. As default, SuspendAllInterrupts() is + * defined empty within BrsMain provided Os.h stub for delieveries + * w/o OS (no interrupt locking needed in polling environments) + *****************************************************************************/ +void BrsMain_Appl_SuspendAllInterrupts(void) +{ + SuspendAllInterrupts(); +} + +/*****************************************************************************/ +/* @brief Resume all interrupts via OS call + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is used for SchM_Exit_* defines in vBrs generated + * SchM stub module specific header files. This allows the user to + * add project specific code. As default, ResumeAllInterrupts() is + * defined empty within BrsMain provided Os.h stub for delieveries + * w/o OS (no interrupt locking needed in polling environments) + *****************************************************************************/ +void BrsMain_Appl_ResumeAllInterrupts(void) +{ + ResumeAllInterrupts(); +} +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +#endif /* BRS_ENABLE_SCHM_STUB_GENERATION */ + +#if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) +/*****************************************************************************/ +/* @brief Callout to let the additional configured cores started by the + * boot core, if necessary. This is just an initial template and + * may need project specific adaptions. It's called by every core. + * @pre - + * @param[in] coreID is the physical core ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from main, previously to vHyp_Init() + *****************************************************************************/ +void BrsMain_Appl_HypervisorStartCoreApi(uint32 coreID) +{ +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) && (!defined (BRSHW_CORES_AUTOSTART)) + /* + * If additional cores need to be started by the boot core, this needs to be done previously to the call of + * vHyp_Init(), to prevent issues, if boot core is not the same as vHyp init core (VHYP_CORE_INIT). + * As vHyp_RegisterCore() will wait until the additional core reaches a sync barrier, all configured cores should be + * started as early as possible. + */ + /* Check, if the actual running core is the boot core */ + if (coreID == BRSHW_INIT_CORE_ID) + { + for (uint32 i = 0u; i < BrsMain_CoreConfig_Size; i++) + { + if (BrsMain_CoreConfig[i].PhysicalCoreId != BRSHW_INIT_CORE_ID) + { + BrsHw_StartCore(BrsMain_CoreConfig[i].PhysicalCoreId); + } + } + } +#endif /* BRS_ENABLE_OS_MULTICORESUPPORT && !BRSHW_CORES_AUTOSTART */ +} + +/*****************************************************************************/ +/* @brief Callout to implement user code previous to the call of + * vHyp_Start(). This is just an initial template and may need + * project specific adaptions. It's called by every core. + * @pre - + * @param[in] coreID is the physical core ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from main, previously to vHyp_Start() + *****************************************************************************/ +void BrsMain_Appl_HypervisorApi(uint32 coreID) +{ +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) + /* Check, if the actual running core is the vHyp init core */ + if ((vHyp_CoreIdType)coreID == VHYP_CORE_INIT) + { + vHyp_CoreIdType core; + for (core = 0; core < VHYP_CORE_COUNT; core++) + { + if (core != VHYP_CORE_INIT) + { + vHyp_RegisterCore(core); + } + } + } +#endif /* BRS_ENABLE_OS_MULTICORESUPPORT */ +} +#endif /* BRS_ENABLE_HYPERVISOR_SUPPORT */ + +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) +# if defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) +/********************************************************************************************************************** + * A classic (non-Gen3) DrvCan is part of the configuration. "Oldschool" implementation is needed + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * UserDefined ExclusiveArea handling for CAN channels, according to AN-ISC-8-1149_ErrorHook_E_OS_DISABLED_INT.pdf + *********************************************************************************************************************/ +/* +* Macro is generated in vBrsCfg.h, to support drivers with infix. +* Sample w/o infix: void SchM_Enter_Can_CAN_EXCLUSIVE_AREA_0(void) +* Can_DisableControllerInterrupts(0u); +* Sample w/ infix: void SchM_Enter_Can_30_Mcan_CAN_30_MCAN_EXCLUSIVE_AREA_0(void) +* Can_30_Mcan_DisableControllerInterrupts(0u); +*/ + +#define CAN_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + if (++BrsAsrApplCanInterruptLockCtr == 1u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Disable)(0u); + } +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + if (--BrsAsrApplCanInterruptLockCtr == 0u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Enable)(0u); + } +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_6) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + if (++BrsAsrApplCanInterruptLockCtr == 1u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Disable)(0u); + } +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_6) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + if (--BrsAsrApplCanInterruptLockCtr == 0u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Enable)(0u); + } +#endif +} +#define CAN_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" + +# if !defined (BRS_ENABLE_FBL_SUPPORT) +#define CANIF_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanIf_CANIF_EXCLUSIVE_AREA_0(void) +{ + if (++BrsAsrApplCanInterruptLockCtr == 1u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Disable)(0u); + } +} + +void SchM_Exit_CanIf_CANIF_EXCLUSIVE_AREA_0(void) +{ + if (--BrsAsrApplCanInterruptLockCtr == 0u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Enable)(0u); + } +} +#define CANIF_STOP_SEC_CODE +#include "MemMap.h" + +#define CANSM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_4(void) +{ + if (++BrsAsrApplCanInterruptLockCtr == 1u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Disable)(0u); + } +} + +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_4(void) +{ + if (--BrsAsrApplCanInterruptLockCtr == 0u) + { + BRS_DRVCAN_ControllerInterrupts_INFIX(Enable)(0u); + } +} + +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} + +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} +#define CANSM_STOP_SEC_CODE +#include "MemMap.h" + +#define COMM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_ComM_COMM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} + +void SchM_Exit_ComM_COMM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} +#define COMM_STOP_SEC_CODE +#include "MemMap.h" +# endif /* !BRS_ENABLE_FBL_SUPPORT */ +# endif /* BRS_ENABLE_CAN_CLASSIC_SUPPORT */ + +# if defined (BRS_ENABLE_CAN_CORE_SUPPORT) +/********************************************************************************************************************** + * A new (Gen3) DrvCan is part of the configuration. New implementation is needed + *********************************************************************************************************************/ +# if (Can_30_Core_IsHardwareCancelByApplOfGeneralFeature(0u) && Can_30_Core_IsHardwareLoopCheckOfGeneralFeature(0u)) + /* If these do not exist, maybe Can_30_Core/Can/CanGeneral/CanConstantDataToDefine is deactivated. If so, please + choose the suitable implementation manually */ + +# if !defined (BRS_ENABLE_FBL_SUPPORT) + /* Within a FBL project, depending APIs are already available within Fbl_cw.c */ +/********************************************************************************************************************** + * Hardware Loop Check / Timeout Monitoring for CAN Driver, according to TechnicalReference_Can_30_Core.pdf, + * chapter 2.8.2 + *********************************************************************************************************************/ +#define CAN_30_CORE_START_SEC_VAR_NOCACHE_INIT_32 +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +static uint32 BrsAsrApplCanTimerCount; +#define CAN_30_CORE_STOP_SEC_VAR_NOCACHE_INIT_32 +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) +#include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif + +#define CAN_30_CORE_START_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +void Appl_30_CoreCanTimerStart(uint8 Controller, uint8 source) +{ + BrsAsrApplCanTimerCount = 0u; +} + +void Appl_30_CoreCanTimerEnd(uint8 Controller, uint8 source) +{ + /* nothing to be done here; BrsAsrApplCanTimerCount will be set to 0 by next call of Appl_30_CoreCanTimerStart() */ +} + +Can_ReturnType Appl_30_CoreCanTimerLoop(uint8 Controller, uint8 source) +{ + BrsAsrApplCanTimerCount++; + + if (BrsAsrApplCanTimerCount > 10000u) + { + /* timeout detected! Something seems to block the DrvCan */ + return CAN_NOT_OK; + } else + return CAN_OK; +} +#define CAN_30_CORE_STOP_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +# endif /* !BRS_ENABLE_FBL_SUPPORT */ + +# else + #error "Can_30_Core/Can/CanGeneral/CanHardwareCancelByAppl and/or Can_30_Core/Can/CanGeneral/CanHardwareLoopCheck are deactivated! If you really want to use customer specific exclusive area handling, implement them controller and project specific. The following APIs are only a generic sample and need to be adapted." + +/*********************************************************************************************************************** + * UserDefined ExclusiveArea handling for CAN Driver Core, according to TechnicalReference_Can_30_Core.pdf, Note within + * chapter 3.2 + **********************************************************************************************************************/ +/* +* BE AWARE, THIS IS ONLY A SAMPLE IMPLEMENTATION! +* To get a suitable implementation for your project, take account to the technical reference of Can_30_Core +* and implement them according to your specific project settings. +* The suitable implementation is highly configuration specific, e.g. amount of channels, postbuild, ... +*/ + +#define CAN_30_CORE_START_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +void SchM_Enter_Can_30_Core_CAN_30_CORE_EXCLUSIVE_AREA_6(void) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +#endif +} + +void SchM_Exit_Can_30_Core_CAN_30_CORE_EXCLUSIVE_AREA_6(void) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_EnableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_EnableControllerInterrupts(ch); + */ +#endif +} +#define CAN_30_CORE_STOP_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif + +# if !defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + /* + * If vCan and classic CAN is mixed within one config, the "old" DrvCan is expected to be the 1st one. So, the + * exclusive areas are already implemented earlier in this file + */ +/********************************************************************************************************************** + * UserDefined ExclusiveArea handling for vCAN Driver, according to TechnicalReference_vCan_30_Mcan.pdf, Note within + * chapter 3.2 + *********************************************************************************************************************/ +/* +* BE AWARE, THIS IS ONLY A SAMPLE IMPLEMENTATION! +* To get a suitable implementation for your project, take account to the technical reference of your specific DrvCan +* and implement them according to your specific project settings. +* The suitable implementation is highly configuration specific, e.g. amount of channels, postbuild, ... +*/ + +#define CAN_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_1) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_1) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +#endif +} +#define CAN_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +# endif /* !BRS_ENABLE_CAN_CLASSIC_SUPPORT */ + +# if defined (BRS_DRVCAN1_HEADER_FILENAME) + /* 2nd DrvCan instance detected */ +#define CAN1_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_0) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_1) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +#endif +} + +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_1) +{ +#if !defined (BRS_ENABLE_FBL_SUPPORT) + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +#endif +} +#define CAN1_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +# endif /* BRS_DRVCAN1_HEADER_FILENAME */ + +# if !defined (BRS_ENABLE_FBL_SUPPORT) +# if !defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + /* + * If vCan and classic CAN is mixed within one config, these exclusive areas are already implemented earlier + * in this file + */ +#define CANIF_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanIf_CANIF_EXCLUSIVE_AREA_0(void) +{ + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +} + +void SchM_Exit_CanIf_CANIF_EXCLUSIVE_AREA_0(void) +{ + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +} +#define CANIF_STOP_SEC_CODE +#include "MemMap.h" + +#define CANSM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_4(void) +{ + /* + * sample for singlechannel configuration: + * Can_30_Core_DisableControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_DisableControllerInterrupts(ch); + */ +} + +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_4(void) +{ + /* + * sample for singlechannel configuration: + * Can_30_Core_RestoreControllerInterrupts(0u); + */ + + /* + * sample for multichannel configuration (be aware, this will have an effect on the runtime!): + * uint8 ch; + * for (ch = 0; ch < Can_30_Core_GetSizeOfControllerConfig(); ch++) { + * Can_30_Core_RestoreControllerInterrupts(ch); + */ +} + +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} + +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} +#define CANSM_STOP_SEC_CODE +#include "MemMap.h" + +#define COMM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_ComM_COMM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} + +void SchM_Exit_ComM_COMM_EXCLUSIVE_AREA_1(void) +{ + /* Protects against task interruptions -> no locking needed, because all main functions are on same task */ +} +#define COMM_STOP_SEC_CODE +#include "MemMap.h" +# endif /* !BRS_ENABLE_CAN_CLASSIC_SUPPORT */ +# endif /* !BRS_ENABLE_FBL_SUPPORT */ +# endif /* Can_30_Core_IsHardwareCancelByApplOfGeneralFeature(0u) && + Can_30_Core_IsHardwareLoopCheckOfGeneralFeature(0u) */ +# endif /* BRS_ENABLE_CAN_CORE_SUPPORT */ +# endif /* BRS_ENABLE_CAN_SUPPORT */ +#endif /* !BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING */ diff --git a/Source/appl/BrsMain_Callout_Stubs.c b/Source/appl/BrsMain_Callout_Stubs.c new file mode 100644 index 0000000..3240e53 --- /dev/null +++ b/Source/appl/BrsMain_Callout_Stubs.c @@ -0,0 +1,255 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_Callout_Stubs.c + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: UseCase specific implementation templates for several hooks out of BrsMain. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsMain.h" + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ +#if (BRSMAIN_MAJOR_VERSION != 2u) || (BRSMAIN_MINOR_VERSION != 27u) + #error "Header and source file are inconsistent!" +#endif +#if (BRSMAIN_PATCH_VERSION != 0u) + #error "Different versions of patch in Header and Source used!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage zero. + *****************************************************************************/ +void BrsMain_MemoryInit_StageZero_Hook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage hard reset. + *****************************************************************************/ +void BrsMain_MemoryInit_StageHardReset_Hook(uint32 coreId) +{ +#if defined (BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT) + /* If preferred feature is not acivated, initialization will take place in BrsMainInit(). */ +# if (BRS_CPU_CORE_AMOUNT > 1) + if (coreId == BRSHW_INIT_CORE_ID) +# endif + { +# if defined (BRSHW_PREINIT_AVAILABLE) + BrsHwPreInitPowerOn(); +# endif + +# if defined (BRS_ENABLE_WATCHDOG) + BrsHwWatchdogInitPowerOn(); +# else + #error "To use the feature of preferred PLL and Watchdog initialization, add your DrvWd initialization here manually." +# endif + +# if defined (BRS_ENABLE_PLLCLOCKS) + BrsHwPllInitPowerOn(); +# else + #error "To use the feature of preferred PLL and Watchdog initialization, add your DrvMcu initialization here manually." +# endif + } +#endif /* BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage one. + *****************************************************************************/ +void BrsMain_MemoryInit_StageOne_Hook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage two. + *****************************************************************************/ +void BrsMain_MemoryInit_StageTwo_Hook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage three. + *****************************************************************************/ +void BrsMain_MemoryInit_StageThree_Hook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage Power_On. + *****************************************************************************/ +void BrsMain_MemoryInit_StagePowerOn_Hook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * after the memory initialization was done. + *****************************************************************************/ +void BrsMain_PreMainHook(uint32 coreId) +{ + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsHwSoftwareResetECU(), before a + * SW reset is triggered. Implement code here to also reset + * peripherals, if necessary for your UseCase. + *****************************************************************************/ +void BrsMain_SoftwareResetECU_Hook(void) +{ +#if defined (BRS_HYPERVISOR_GUEST_EXECUTION_INSTANCE) && !defined (BRS_FIRST_EXECUTION_INSTANCE) +# if defined (BRS_COMP_TASKING) + #pragma message "#warning: As a hypervisor guest instance, the SW-Reset needs to be handled differently. Check the implementation project specific!" +# else + #warning "As a hypervisor guest instance, the SW-Reset needs to be handled differently. Check the implementation project specific!" +# endif +#endif + + /* nothing to be done up to now */ +} + +/*****************************************************************************/ +/* @brief This API is mandatory callout, if non-ASR cores are configured in OS. + * Project specific implementation for non-ASR cores should be added here. + * @pre non-ASR cores are configured in OS + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main() for non-Autosar-cores. + *****************************************************************************/ +void BrsMain_NonAsrCore_Hook(void) +{ + /* nothing to be done up to now */ + volatile uint8 NonAsrCoreContinue; + NonAsrCoreContinue = 0; + + while (NonAsrCoreContinue == 0u) + { + /* This is the end of the preliminary non-Asr-Implementation */ + } +} diff --git a/Source/appl/BrsMain_FblOsStub.c b/Source/appl/BrsMain_FblOsStub.c new file mode 100644 index 0000000..2ff8135 --- /dev/null +++ b/Source/appl/BrsMain_FblOsStub.c @@ -0,0 +1,148 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_FblOsStub.c + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: FBL OS stub for usage of MSR4 modules, referencing several OS APIs + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to Os.h. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * EXAMPLE CODE ONLY + * ------------------------------------------------------------------------------------------------------------------- + * This Example Code is only intended for illustrating an example of a possible BSW integration and BSW configuration. + * The Example Code has not passed any quality control measures and may be incomplete. The Example Code is neither + * intended nor qualified for use in series production. The Example Code as well as any of its modifications and/or + * implementations must be tested with diligent care and must comply with all quality requirements which are necessary + * according to the state of the art before their use. + *********************************************************************************************************************/ + +#define _BRSMAIN_FBLOSSTUB_C_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Os.h" +#include "BrsHw.h" + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * DEFINITION + MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ +static volatile TickType currentCounterValue; + +/********************************************************************************************************************** + * GLOBAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONST VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * PROTOTYPES OF LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FUNCTION DEFINITIONS + *********************************************************************************************************************/ +StatusType GetCounterValue(CounterType CounterID, TickRefType Value) +{ + while(1) + { + /* + * This part is not yet implemented. If you are stuck here, please implement these functions to provide the + * respective functionality to the caller. + * This can be done e.g. by using a free running timer or FblLookForWatchdog logic + */ + } + +#if 0 /* SAMPLE */ + currentCounterValue = 0; + *Value = 0; + return (StatusType) E_OK; +#endif +} + +StatusType GetElapsedValue(CounterType CounterID, TickRefType Value, TickRefType ElapsedValue) +{ + while(1) + { + /* + * This part is not yet implemented. If you are stuck here, please implement these functions to provide the + * respective functionality to the caller. + * This can be done e.g. by using a free running timer or FblLookForWatchdog logic + */ + } + +#if 0 /*SAMPLE */ + /* Check the OS_*_SystemTimer() macros in Os.h, they may need adaptions as well */ + if (FBL_TM_TRIGGERED == (FblLookForWatchdog() & FBL_TM_TRIGGERED)) + { + currentCounterValue += OS_TICKS2US_SystemTimer(1); + } + + *ElapsedValue = currentCounterValue; + + return (StatusType) E_OK; +#endif +} + +#define BRS_START_SEC_RAM_CODE +#include "Brs_MemMap.h" +void Appl_30_CoreCanInterruptDisable(uint8 Controller) +{ + /* + * As FBL is running in polling mode anyway, the controller specific + * interrupt disable/enable functionality is not needed at all + */ + DisableAllInterrupts() +} + +void Appl_30_CoreCanInterruptRestore(uint8 Controller) +{ + /* + * As FBL is running in polling mode anyway, the controller specific + * interrupt disable/enable functionality is not needed at all + */ + EnableAllInterrupts() +} +#define BRS_STOP_SEC_RAM_CODE +#include "Brs_MemMap.h" diff --git a/Source/appl/bm_ap.c b/Source/appl/bm_ap.c new file mode 100644 index 0000000..1d771d3 --- /dev/null +++ b/Source/appl/bm_ap.c @@ -0,0 +1,1032 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Application dependent routines + * + * \note Please note, that this file contains a collection of callback functions to be used with the + * Flash Bootloader. These functions may influence the behavior of the bootloader in principle. + * Therefore, great care must be taken to verify the correctness of the implementation. + * The contents of the originally delivered files are only examples resp. implementation proposals. + * With regard to the fact that these functions are meant for demonstration purposes only, Vector + * Informatik's liability shall be expressly excluded in cases of ordinary negligence, to the extent + * admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-01-28 visrie - Initial version + * 01.01.00 2019-02-18 vismvi ESCAN00102171 Variable declared but never referenced + * visrie ESCAN00102310 Added callout to check reprogramming flag + * 01.01.01 2019-03-07 visrie ESCAN00102386 Fixed compiler error in ApplFbl_DetEntryHandler + * ESCAN00102399 Check NvPattern only for non-RAM blocks + * 02.00.00 2019-05-02 visrie ESCAN00102518 Added support to read block/application validity from NV-Memory + * ESCAN00102761 Added support for 3rd Party Tricore HSM + * ESCAN00103026 Provide BmHeader instead of StartAddress to ApplFblBmStartSoftware + * 03.00.00 2019-07-17 visrie ESCAN00103750 Removed target order list configuration + * 03.01.00 2019-08-14 visrie FBL-487 Exclude callouts if overwritten by OEM/HW layer + * 03.01.01 2019-09-04 visrcn ESCAN00103607 Memory qualifier mismatch + * 04.00.00 2019-12-04 visrie FBL-456 Updated to new LibSecBoot interface + * ESCAN00105135 Added support for new BRS API + * 04.01.00 2020-01-16 visrie FBL-524 Added support for vHsm SecBoot library + * 05.00.00 2020-04-09 visrie FBL-1016 Support new vBaseEnv, added support for VTT + * 05.01.00 2020-04-29 vistmo FBL-1584 Added OTA startup support + * 05.02.00 2020-08-13 vistmo FBL-1489 Added support for OTA swap activation + * 05.02.01 2021-03-17 vishor ESCAN00108386 ApplFblBmIsValidBlock implementation does not consider + * all possible use cases + * FBL-3018 No changes + * 05.03.00 2021-08-11 visrie FBL-3394 Move default implementation of CheckReprogFlag into FblBm_Ap + * 05.04.00 2021-09-17 visjdn FBL-3865 Add default SecBoot implementation for GHS/Escrypt + * 05.04.01 2022-04-06 vismix FBL-4773 Support THUMB mode + * 05.05.00 2022-04-07 vishor FBL-4822 Add support for new MagicFlag value and Swap API + * 05.05.01 2022-06-23 vismix ESCAN00111879 Boot manager does not wait for HSM update recovery + * 05.06.00 2022-07-13 vismix FBL-5391 Add callout for missing optional dependency + * 05.06.01 2022-11-29 vishor ESCAN00112986 Compiler error: Undefined symbols + * ApplFblPreMemDriver/ApplFblPostMemDriver + * 05.07.00 2023-06-29 vistbe FBL-7052 Add evaluation of ActivationPending + * 05.07.01 2023-12-18 visrie ESCAN00104829 Compiler error: Det.h missing in GENy based standalone BM + * ESCAN00111036 Compiler error: 'kFblApplicationValid' may be undeclared + * ESCAN00115752 No changes + * 05.08.00 2024-05-16 vishor FBL-8602 Add support for OEM updater solution + * 05.09.00 2025-05-23 dganesh FBL-9715 Extend presence pattern to connect validity information + **********************************************************************************************************************/ + +#define BM_AP_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ +#include "bm_ap.h" +#include "bm_main.h" +#include "fbl_inc.h" + +#include "fbl_main_types.h" + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +# include "Csm.h" +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +# if defined( FBLBM_ENABLE_STANDALONE_MODE ) +# include "Det.h" +# endif +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# include "fbl_secboot.h" +# include "Csm.h" +# include "Crypto_30_vHsm.h" +#endif /* FBLBM_AP_ENABLE_3RD_PARTY_TRICORE_HSM_USED */ + +# include "BrsHw.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLBM_AP_VERSION != 0x0509u ) || \ + ( FBLBM_AP_RELEASE_VERSION != 0x00u ) +# error "Error in bm_ap.c: Source and Header file are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( _MICROSOFT_C_VTT_ ) +# define FBLBM_AP_ENABLE_VTT_USECASE +#endif /* _MICROSOFT_C_VTT_ */ + +/* If no explicit LB for the LBT exists use the bootloader LB */ +#if !defined( FBL_MTAB_LBT_BLOCK_NUMBER ) +# define FBL_MTAB_LBT_BLOCK_NUMBER FBL_MTAB_BOOTLOADER_BLOCK_NUMBER +#endif /* FBL_MTAB_LBT_BLOCK_NUMBER */ + +/* Helper macro to get number of array entries */ +#if defined( FBLBMAP_ARRAY_SIZE ) +#else +# define FBLBMAP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +#endif + +#if defined( FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY ) && \ + !defined( FBL_ENABLE_PRESENCE_PATTERN ) +/** Compatibility define in case OEM layer uses different macro scheme */ +# if !defined( kFblApplicationValid ) +# if defined( kEepApplConsistent ) +# define kFblApplicationValid kEepApplConsistent +# else +# error "kFblApplicationValid not defined or can't be mapped to an equivalent define/value." +/* TODO_CUSTOMER: Adjust the following define to map kFblApplicationValid to the correct value/define used by the OEM */ +/* #define kFblApplicationValid */ +# endif +# endif /* !kFblApplicationValid */ +#endif /* FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY && !FBL_ENABLE_PRESENCE_PATTERN */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +/** Key size of signed presence pattern */ +# define FBLBM_SIGNED_PP_KEY_SIZE 0x10u +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLBMAP_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) +V_MEMRAM0 static V_MEMRAM1 vuintx V_MEMRAM2 g_ApplFblBmSearchUpdaterHeaderIndex; +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#define FBLBMAP_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# define FBLBMAP_RAMCODE_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +static void ApplFblBmWaitForHsm(void); +# define FBLBMAP_RAMCODE_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# define FBLBMAP_RAMCODE_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * ApplFblBmWaitForHsm + **********************************************************************************************************************/ +/*! \brief Wait until vHSM is ready + **********************************************************************************************************************/ +static void ApplFblBmWaitForHsm(void) +{ + Std_ReturnType retVal; + uint32 keyLength; + uint32 hsm2host; + uint32 host2hsm; + + /* Wait until vHsm has been started */ + do + { + keyLength = 4u; + retVal = Csm_KeyElementGet(0u, CRYPTO_KE_CUSTOM_VHSM_STATUS_HSM2HOST, (uint8 *)&hsm2host, &keyLength); + assertFblUser(retVal == E_OK, kFblSysAssertDet); + } while (hsm2host == 0u); + + /* When a vHsmUpd is pending */ + if ((hsm2host & (1uL << CRYPTO_30_VHSM_HSM2HOST_UPDATERRUNNING)) == (1uL << CRYPTO_30_VHSM_HSM2HOST_UPDATERRUNNING)) + { + keyLength = 4u; +# error "Comment this line if vHsmUpdater is not used. If vHsmUpdater is used, please assign the value configured in the vHsm-updater to host2hsm below" + host2hsm = 0x80000000u; + /* Set configured Bit pattern to signalize the vHsmUpd that update can be started */ + retVal = Csm_KeyElementSet(0u, CRYPTO_KE_CUSTOM_VHSM_STATUS_HOST2HSM, (uint8 *)&host2hsm, keyLength); + assertFblUser(retVal == E_OK, kFblSysAssertDet); + + /* Wait until vHsmUpd has been finished */ + do + { + FblLookForWatchdogVoid(); + + keyLength = 4u; + retVal = Csm_KeyElementGet(0u, CRYPTO_KE_CUSTOM_VHSM_STATUS_HSM2HOST, (uint8 *)&hsm2host, &keyLength); + assertFblUser(retVal == E_OK, kFblSysAssertDet); + } while ((hsm2host & ((1u << CRYPTO_30_VHSM_HSM2HOST_READY) | (1u << CRYPTO_30_VHSM_HSM2HOST_ACTIVE))) != ((1u << CRYPTO_30_VHSM_HSM2HOST_READY) | (1u << CRYPTO_30_VHSM_HSM2HOST_ACTIVE))); + } + + /* Wait until vHsm is ready */ + Crypto_30_vHsm_WaitForHsmRam(); +} +# define FBLBMAP_RAMCODE_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#define FBLBMAP_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * ApplFblBmPowerOnPre + **********************************************************************************************************************/ +/*! \brief Initialization callout + **********************************************************************************************************************/ +void ApplFblBmPowerOnPre( void ) +{ + +} + +/*********************************************************************************************************************** + * ApplFblBmPowerOnPost + **********************************************************************************************************************/ +/*! \brief Initialization callout + **********************************************************************************************************************/ +void ApplFblBmPowerOnPost( void ) +{ +#if defined( FBL_ENABLE_OTA ) + vOtaM_InitMemory(); +#endif /* FBL_ENABLE_OTA */ +} + +/*********************************************************************************************************************** + * ApplFblBmInitPre + **********************************************************************************************************************/ +/*! \brief Initialization callout + **********************************************************************************************************************/ +void ApplFblBmInitPre( void ) +{ +# if defined( BRS_FBL_LEGACY ) +# if defined( BRSHW_PREINIT_AVAILABLE ) + /* HW specific pre-initialization. */ + BrsHwPreInitPowerOn(); +# endif /* BRSHW_PREINIT_AVAILABLE */ + +# if defined( BRS_ENABLE_WATCHDOG ) + /* Disable Watchdog */ + BrsHwWatchdogInitPowerOn(); +# endif /* BRS_ENABLE_WATCHDOG */ + +# if defined( BRS_ENABLE_PLLCLOCKS ) + /* Initialize the PLLs. */ + BrsHwPllInitPowerOn(); +# endif /* BRS_ENABLE_PLLCLOCKS */ + +# if defined( BRSHW_DISABLE_ECC_AVAILABLE ) + /* Disable Flash ECC error reporting. */ + BrsHwDisableEccErrorReporting(); +# endif /* BRSHW_DISABLE_ECC_AVAILABLE */ + +# if defined( FBL_ENABLE_PRE_TIMERINIT ) + /* Timer is stopped by mode switch and has to be re-initialized. */ + FblTimerInit(); +# endif /* FBL_ENABLE_PRE_TIMERINIT */ +# endif /* BRS_FBL_LEGACY */ +} + +/*********************************************************************************************************************** + * ApplFblBmInitPost + **********************************************************************************************************************/ +/*! \brief Initialization callout + **********************************************************************************************************************/ +void ApplFblBmInitPost( void ) +{ +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + volatile vuint8 executeTestcode = kFblOk; + + /* Wait until vHSM is ready */ + ApplFblBmWaitForHsm(); + + if (executeTestcode == kFblOk) /* Testcode to initialize RAM key, to simulate written key */ + { + Std_ReturnType retVal; + uint8 version[3u] = {0u}; + uint32 versionLength = sizeof( version ); + Crypto_VerifyResultType result = CRYPTO_E_VER_NOT_OK; + const uint8 key[16u] = {0u}; + uint8 mac[16u] = {0u}; + const uint8 data[16u] = {0u}; + uint32 length = sizeof( mac ); + + /* Get the Version of the vHsm Firmware */ + retVal = Crypto_30_vHsm_KeyElementGet( CryptoConf_CryptoKey_vHsm_Info, CRYPTO_KE_CUSTOM_VHSM_VERSION, version, &versionLength ); + + /* Fill the key used for the CMAC and set it to valid */ + retVal |= Csm_KeyElementSet( CsmConf_CsmKey_CsmKey_SymmetricKey, CRYPTO_KE_MAC_KEY, key, sizeof( key ) ); + retVal |= Csm_KeySetValid( CsmConf_CsmKey_CsmKey_SymmetricKey ); + + /* Generate the CMAC with the software implementation on the vHsm */ + retVal |= Csm_MacGenerate( CsmConf_CsmJob_CsmJob_MacGen_Key1, CRYPTO_OPERATIONMODE_SINGLECALL, data, sizeof( data ), mac, &length ); + retVal |= Csm_MacVerify( CsmConf_CsmJob_CsmJob_MacVer_Key1, CRYPTO_OPERATIONMODE_SINGLECALL, data, sizeof( data ), mac, sizeof( mac ) * 8u, &result ); + + if (retVal != E_OK) + { + while (1u) + { + ; + } + } + } +#endif /* FBLBM_ENABLE_SECURE_BOOT */ +#if defined( FBL_ENABLE_OTA ) + if (vOtaM_Init() != E_OK) + { + /* PRQA S 2741, 4558 1 */ /* MD_FblBmAp_2741_4558 */ + assertFblUser(0u, kFblSysAssertInitializationFailed); + } +#endif /* FBL_ENABLE_OTA */ +} + +#if defined( FBLBM_AP_CALLOUT_RESET ) +/*********************************************************************************************************************** + * ApplFblBmReset + **********************************************************************************************************************/ +/*! \brief Issue Reset + **********************************************************************************************************************/ +void ApplFblBmReset(void) +{ + /* Reset ECU */ + BrsHwSoftwareResetECU(); +} +#endif /* FBLBM_AP_CALLOUT_RESET */ + +#if defined( FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY ) +/*********************************************************************************************************************** + * ApplFblBmCheckTargetValidity + **********************************************************************************************************************/ +/*! \brief Checks the validity of the target (Usually: Is the Application Validity Presence Pattern set) + * \param[in] targetHandle Target handle (e.g. Bootloader, Application, Updater) + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +tFblResult ApplFblBmCheckTargetValidity(tFblBmHdrTargetHandle targetHandle) +{ + tFblResult result; +# if defined( FBL_ENABLE_PRESENCE_PATTERN ) + vuint8 blockNo; + tBlockDescriptor blockDescriptor; + vuint8 device; +# else + vuint8 applValidity; +# endif + + /* Check overall application validity for Application target */ + if (targetHandle == FBLBMHDR_TARGET_APPL) + { + result = kFblFailed; + +# if defined( FBL_ENABLE_PRESENCE_PATTERN ) + /* Check if any PP for appl validity is set */ + blockNo = 0u; + + while ((blockNo < FblLbtGetBlockCount()) && (result != kFblOk)) + { + if (kFblOk == FblLbtGetBlockDescriptorByNr(blockNo, &blockDescriptor)) + { + if (kFblOk == FblMemGetDeviceByRange(blockDescriptor.blockStartAddress, blockDescriptor.blockLength, &device)) + { +# if defined( kMioDeviceRam ) + /* Do not check the presence pattern for RAM */ + if (device != kMioDeviceRam) +# endif + { + result = FblNvPatternGet(&blockDescriptor, kFblNvPatternId_ApplValidity); + } + } + } + + /* Prepare index for next loop */ + blockNo++; + } +# else + /* Read validity from NV-memory */ + if (ApplFblNvReadApplValidity(&applValidity) == kFblOk) + { + if (applValidity == kFblApplicationValid) + { + result = kFblOk; + } + } +# endif + } + else + { + /* For all other targets, no overall validity is necessary */ + result = kFblOk; + } + + return result; +} +#endif /* FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY */ + + +#if defined( FBLBM_AP_CALLOUT_IS_VALIDBLOCK ) +/*********************************************************************************************************************** + * ApplFblBmIsValidBlock + **********************************************************************************************************************/ +/*! \brief Checks the preconditions of a specific target + * \param[in] targetHandle Target handle (e.g. Bootloader, Application) + * \param[in] pLogicalBlock Pointer to current logical block + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmIsValidBlock(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock) +{ + tFblResult result; +# if defined( FBL_ENABLE_PRESENCE_PATTERN ) || defined( FBLBM_ENABLE_STANDALONE_MODE ) + vuint8 device; +# endif /* FBL_ENABLE_PRESENCE_PATTERN || FBLBM_ENABLE_STANDALONE_MODE */ +# if !defined( FBL_ENABLE_PRESENCE_PATTERN ) + vuint8 validityFlags[kEepSizeValidityFlags]; + vuint8 validityMask; + vuint8 byteIdx; +# endif /* !FBL_ENABLE_PRESENCE_PATTERN */ + +# if (!defined( FBLBM_ENABLE_STANDALONE_MODE ) || defined( FBL_ENABLE_PRESENCE_PATTERN )) +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)targetHandle; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ +# endif /* ( !FBLBM_ENABLE_STANDALONE_MODE || FBL_ENABLE_PRESENCE_PATTERN ) */ + + result = kFblFailed; + +# if defined( FBLBM_ENABLE_STANDALONE_MODE ) && !defined( FBL_ENABLE_PRESENCE_PATTERN) +# error "If presence pattern is disabled special handling must be configured for the FBL because \ + validity flags are not available for the FBL." + /* Perform presence pattern check only for FBL, use NV validity flags for other blocks */ + if (targetHandle == FBLBMHDR_TARGET_FBL) +# endif /* FBLBM_ENABLE_STANDALONE_MODE && !FBL_ENABLE_PRESENCE_PATTERN */ +# if defined( FBL_ENABLE_PRESENCE_PATTERN ) || defined( FBLBM_ENABLE_STANDALONE_MODE ) + { + /* Check the presence pattern value */ + if (kFblOk == FblMemGetDeviceByRange(pLogicalBlock->blockStartAddress, pLogicalBlock->blockLength, &device)) + { +# if defined( kMioDeviceRam ) + /* Do not check the presence pattern for RAM */ + if (device != kMioDeviceRam) +# endif /* kMioDeviceRam */ + { + result = FblNvPatternGetByBlockDescriptor(pLogicalBlock, kFblNvPatternId_BlockValidity ); + } + } + } +# endif /* FBL_ENABLE_PRESENCE_PATTERN || FBLBM_ENABLE_STANDALONE_MODE */ +# if !defined( FBL_ENABLE_PRESENCE_PATTERN ) +# if defined( FBLBM_ENABLE_STANDALONE_MODE ) + /* Check NV validity flags if block other than FBL is checked */ + else +# endif /* FBLBM_ENABLE_STANDALONE_MODE */ + { + /* Calculate index and mask for validity bit of logical block */ + byteIdx = (pLogicalBlock->blockNr >> 0x03u); + validityMask = (vuint8)(0x01u << (pLogicalBlock->blockNr & 0x07u)); + + /* Read validity information from non-volatile memory */ + if (ApplFblNvReadValidityFlags(validityFlags) == kFblOk) + { + if ((validityFlags[byteIdx] & validityMask) == 0u) + { + /* Block is valid */ + result = kFblOk; + } + } + } +# endif /* !FBL_ENABLE_PRESENCE_PATTERN */ + + return result; +} +#endif /* FBLBM_AP_CALLOUT_IS_VALIDBLOCK */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +# if defined( FBLBM_AP_CALLOUT_IS_VALIDPATTERN ) +/*********************************************************************************************************************** + * ApplFblBmCheckPresencePattern + **********************************************************************************************************************/ +/*! \brief Explicitly checks the presence pattern(excluding the CMAC) validity of the target + * \param[in] targetHandle Target handle (e.g. Bootloader, Application) + * \param[in] pLogicalBlock Pointer to current logical block + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmCheckPresencePattern(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock) +{ + tFblResult result; + + vuint8 device; + IO_PositionType patternAddress; + IO_SizeType patternLength; + tFblNvPatternState patternState; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)targetHandle; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + result = kFblFailed; + + /* Check the presence pattern value of Target */ + if (kFblOk == FblMemGetDeviceByRange(pLogicalBlock->blockStartAddress, pLogicalBlock->blockLength, &device)) + { +# if defined( kMioDeviceRam ) + /* Do not check the presence pattern for RAM */ + if (device != kMioDeviceRam) +# endif /* kMioDeviceRam */ + { + /* Check state of Target pattern */ + patternState = FblNvPatternGetPatternState(pLogicalBlock, kFblNvPatternId_BlockValidity, &patternAddress, &patternLength); + if ((patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED)) + { + result = kFblOk; + } + } + } + + return result; +} +# endif /* FBLBM_AP_CALLOUT_IS_VALIDPATTERN */ + +# if defined( FBLBM_AP_CALLOUT_GET_PP_SIGN_KEYEMPTY ) +/*********************************************************************************************************************** + * ApplFblBmGetPresPattSignInitStatus + **********************************************************************************************************************/ +/*! \brief Checks if now keys has been programmed so far Presence pattern + * \return FBLBM_KEY_IS_AVAILABLE if the keys are already programmed + FBLBM_KEY_IS_NOT_AVAILABLE else + **********************************************************************************************************************/ +tFblBmKeyEmptyResult ApplFblBmGetPresPattSignInitStatus( void ) +{ + /* TODO_CUSTOMER: implement check if key is available here. This can be done by querying the HSM/SHE (depending + * on the used hardware) or e.g. by checking a pattern in the flash which indicates that the FBL has written the key + * into the Crypto. + */ + tFblBmKeyEmptyResult result; + vuint8 key[FBLBM_SIGNED_PP_KEY_SIZE]; + vuint32 keyLength; + + if (Csm_KeyElementGet(FblNvPattern_GetCsmKeyIdMac, CRYPTO_KE_CIPHER_KEY, key, (uint32*)&keyLength) != CRYPTO_E_KEY_NOT_AVAILABLE) + { + result = FBLBM_KEY_IS_AVAILABLE; + } + else + { + result = FBLBM_KEY_IS_NOT_AVAILABLE; + } + + return result; +} +# endif /* FBLBM_AP_CALLOUT_GET_PP_SIGN_KEYEMPTY */ +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + +#if defined( FBLBM_CALLOUT_IS_OPTIONALBLOCK ) +/*********************************************************************************************************************** + * ApplFblBmIsOptionalBlock + **********************************************************************************************************************/ +/*! \brief Callout when logical block is optional and not present + * \param[in] targetHandle Target handle (e.g. Bootloader, Application) + * \param[in] pLogicalBlock Pointer to current logical block + **********************************************************************************************************************/ +void ApplFblBmIsOptionalBlock(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock) +{ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)targetHandle; + (void)pLogicalBlock; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ +} +#endif /* FBLBM_CALLOUT_IS_OPTIONALBLOCK */ + +#if defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +/*********************************************************************************************************************** + * ApplFblBmStartSoftware + **********************************************************************************************************************/ +/*! \brief This function is called to start a software (e.g. Bootloader) + * \details Please note: The function will never return because control is handed over to the running software. + * \param[in] bmHeader Pointer to the targets BM Header structure, which shall be started + **********************************************************************************************************************/ +void ApplFblBmStartSoftware(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader) +{ +# if defined( BRS_INSTRUCTION_SET_THUMB ) + JSR(bmHeader->bmEntryAddress | 1u); /* PRQA S 0305 */ /* MD_FblBmAp_0305 */ +# else + JSR(bmHeader->bmEntryAddress); /* PRQA S 0305 */ /* MD_FblBmAp_0305 */ +# endif + +# if defined( FBL_ENABLE_SYSTEM_CHECK ) + /* Code should never be reached */ + while (1u) + { + ; + } +# endif /* FBL_ENABLE_SYSTEM_CHECK */ +} +#endif /* FBLBM_AP_CALLOUT_START_SOFTWARE* */ + +#if defined( FBLBM_AP_CALLOUT_FAILSAFE_UPDATER_USER_CHECK ) && defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +/*********************************************************************************************************************** + * ApplFblBmFailsafeUpdaterUserCheck + **********************************************************************************************************************/ +/*! \brief This function can be used to implement a user-defined updater and provide its entry address + * \details This function will be called if the user-defined updater feature is enabled and will control the rest + * of the bootmanager program flow + * \param[out] bmHeader Pointer to the BM Header structure whose jump address must be updated in case updater is found + * \return kFblOk: User-defined updater is available, jump to address given by bmHeader->bmEntryAddress + * kFblFailed: User-defined updater is not available, proceed to next state (failed state) + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +tFblResult ApplFblBmFailsafeUpdaterUserCheck(V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader) +{ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)bmHeader; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + /* TODO_CUSTOMER: Implement user updater check here. If the user updater is valid, set bmHeader->bmEntryAddress + * to the jump address of the updater entry function and set return value to kFblOk */ + + return kFblFailed; +} +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) +# if defined( FBLBM_AP_CALLOUT_GET_KEYEMPTY ) +/*********************************************************************************************************************** + * ApplFblBmGetKeyEmpty + **********************************************************************************************************************/ +/*! \brief Checks if now keys has been programmed so far + * \return FBLBM_KEY_IS_AVAILABLE if the keys are already programmed + FBLBM_KEY_IS_NOT_AVAILABLE else + **********************************************************************************************************************/ +tFblBmKeyEmptyResult ApplFblBmGetKeyEmpty( void ) +{ + /* TODO_CUSTOMER: implement check if key is available here. This can be done by querying the HSM/SHE (depending + * on the used hardware) or e.g. by checking a pattern in the flash which indicates that the FBL has written the key + * into the Crypto. + */ + tFblBmKeyEmptyResult result; + +# error "No default implementation for this variant available." + /* Per default assume that the key is available */ + result = FBLBM_KEY_IS_AVAILABLE; + + return result; +} +# endif /* FBLBM_AP_CALLOUT_GET_KEYEMPTY */ +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ + +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +# if defined( FBLBM_AP_CALLOUT_GET_FBL_CMACERASED ) +/*********************************************************************************************************************** + * ApplFblBmGetFblCmacErased + **********************************************************************************************************************/ +/*! \brief Checks if MACs for the FBL has been programmed so far + * \return FBLBM_MAC_IS_AVAILABLE If the MACs of the FBL are already written + * FBLBM_MAC_IS_NOT_AVAILABLE Else. E.g. because the FBL is just flashed by a debugger + **********************************************************************************************************************/ +tFblBmMacEmptyResult ApplFblBmGetFblCmacErased( const tFblBmBlockInfo * fblBlockInfo ) +{ + /* TODO_CUSTOMER: implement check if CMAC is available here. This can be done by checking the CMAC content or e.g. + * by checking a pattern in the flash which indicates that the FBL CMAC was already written + */ + + tFblBmMacEmptyResult result; + + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)fblBlockInfo; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + if (ApplFblSbIsInitialStartup() == kFblOk) + { + /* This is the first startup, the SecureBootSegments needs to be updated */ + result = FBLBM_MAC_IS_NOT_AVAILABLE; + } + else + { + result = FBLBM_MAC_IS_AVAILABLE; + } + + return result; +} +# endif /* FBLBM_AP_CALLOUT_GET_FBL_CMACERASED */ +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( FBLBM_AP_CALLOUT_CHECKREPROGFLAG ) +/*********************************************************************************************************************** + * ApplFblBmCheckReprogFlag + **********************************************************************************************************************/ +/*! \brief Checks if a reprogramming request flag is set. + * \return Result of operation + * kFblOk when reprogramming request flag is set + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmCheckReprogFlag( void ) +{ + tFblResult result = kFblFailed; +# if !defined( FBL_ENABLE_FBL_START ) + vuint8 progReqFlag = 0u; +# endif + +# if defined( FBL_ENABLE_FBL_START ) + if (FblBmChkFblStartMagicFlag()) + { + /* FblStart magic flag is set, do not clear flag as the Bootloader requires it as well */ + result = kFblOk; + } +# else + /* Check the reprogramming request flag */ + if (ApplFblNvReadProgReqFlag(&progReqFlag) == kFblOk) + { + if (progReqFlag == kEepFblReprogram) + { + /* UDS-Reprogramming flag is set, do not clear flag as the Bootloader requires it as well */ + result = kFblOk; + } +# if defined( FBL_ENABLE_XCP ) + else if (progReqFlag == kEepFblXcpProgram) + { + /* XCP-Reprogramming flag is set, do not clear flag as the Bootloader requires it as well */ + result = kFblOk; + } +# endif +# if defined( FBL_ENABLE_OTA ) + else if (progReqFlag == kEepFblOtaReprogram) + { + /* OTA-Reprogramming flag is set, do not clear flag as the Bootloader requires it as well */ + result = kFblOk; + } +# endif + else + { + /* Nothing to do */ + } + } +# endif /* FBL_ENABLE_FBL_START */ + +# if defined( FBLBM_MAIN_ENABLE_MAGICFLAG ) && \ + defined( FBLBM_ENABLE_SECURE_BOOT ) && \ + defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP ) + if (FblBmChkSBUpdateMagicFlag()) + { + /* Start FBL in case of secure boot update */ + result = kFblOk; + } +# endif + +# if defined( FBL_ENABLE_OTA ) + if (vOtaM_GetState() == vOtaM_State_OtaRequest) + { + /* OTA request is pending -> bootloader should be started */ + result = kFblOk; + } +# endif /* FBL_ENABLE_OTA */ + + return result; +} +#endif /* FBLBM_AP_CALLOUT_CHECKREPROGFLAG */ + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT ) +/*********************************************************************************************************************** + * ApplFblBmSearchUpdaterHeaderInit + **********************************************************************************************************************/ +/*! \brief Prepare search for updater BmHeader location + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmSearchUpdaterHeaderInit(void) +{ + g_ApplFblBmSearchUpdaterHeaderIndex = 0u; + return kFblOk; +} +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT */ + +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS ) +/*********************************************************************************************************************** + * ApplFblBmSearchUpdaterHeaderAddress + **********************************************************************************************************************/ +/*! \brief Get address of possible location of a BmHeader for the Failsafe Updater + * \param[out] headerAddress Address where the BmHeader could possible be located + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmSearchUpdaterHeaderAddress(vuint32 * headerAddress) +{ + vuint32 offset = 0u; + (* headerAddress) = FlashBlock[g_ApplFblBmSearchUpdaterHeaderIndex].begin + offset; + return kFblOk; +} +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS */ + +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT ) +/*********************************************************************************************************************** + * ApplFblBmSearchUpdaterHeaderNext + **********************************************************************************************************************/ +/*! \brief Get (next) possible location of a BmHeader for the Failsafe Updater + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult ApplFblBmSearchUpdaterHeaderNext(void) +{ + tFblResult result; + + g_ApplFblBmSearchUpdaterHeaderIndex++; + + if (g_ApplFblBmSearchUpdaterHeaderIndex < kNrOfFlashBlock) + { + result = kFblOk; + } + else + { + result = kFblFailed; + } + + return result; +} +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT */ +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if defined( FBLBM_AP_CALLOUT_FATAL_ERROR ) +/*********************************************************************************************************************** + * ApplFblBmFatalError + **********************************************************************************************************************/ +/*! \brief This function is called in case no valid starting software was found + * \details Provide here some final tasks which shall be executed + **********************************************************************************************************************/ +void ApplFblBmFatalError(tFblBmError error) +{ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)error; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + +# if defined( FBL_ENABLE_SYSTEM_CHECK ) + /* Code should never be reached */ + while (1u) + { + ; + } +# endif /* FBL_ENABLE_SYSTEM_CHECK */ +} +#endif /* FBLBM_AP_CALLOUT_FATAL_ERROR */ + +/*-- Other callout functions -----------------------------------------------------------------------------------------*/ + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) +# if defined( FBL_ENABLE_ASSERTION ) +/*********************************************************************************************************************** + * ApplFblFatalError + **********************************************************************************************************************/ +/*! \brief Will be called in case of an urecoverable error + **********************************************************************************************************************/ +void ApplFblFatalError( FBL_DECL_ASSERT_EXTENDED_INFO(vuint8 errorCode) ) +{ + /* Change this variable in debugger in order to return to caller */ + volatile vuint8 stayInWhile = 1u; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)errorCode; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + while (0u != stayInWhile) + { + FblLookForWatchdogVoid(); + } +} +# endif /* FBL_ENABLE_ASSERTION */ + +# if (DET_ENABLED == STD_ON) +/*********************************************************************************************************************** + * ApplFbl_DetEntryHandler + **********************************************************************************************************************/ +/*! \brief Called by DET module to check if a DET error is intended bootloader behavior or not. + * \param[in] ModuleId Code number of the encountered assertion + * \param[in] InstanceId Name of the affected module (Only if extended info is enabled) + * \param[in] ApiId Line number where the assertion occurred (Only if extended info is enabled) + * \param[in] ErrorId Line number where the assertion occurred (Only if extended info is enabled) + * \return Report if error should be handed over to DET or not + **********************************************************************************************************************/ +# if ((DET_AR_RELEASE_MAJOR_VERSION >= 4u) && (DET_AR_RELEASE_MINOR_VERSION >= 3u)) +FUNC(Std_ReturnType, DET_CODE) ApplFbl_DetEntryHandler( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ) +# else +FUNC(boolean, DET_APPL_CODE) ApplFbl_DetEntryHandler( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ) +# endif /* DET_AR_RELEASE_ */ +{ +# if ((DET_AR_RELEASE_MAJOR_VERSION >= 4u) && (DET_AR_RELEASE_MINOR_VERSION >= 3u)) + Std_ReturnType result = E_OK; + /* Use result value of E_NOT_OK to ignore the DET */ +# else + boolean result = FALSE; + /* Use result value of TRUE to ignore the DET */ +# endif /* DET_AR_RELEASE_ */ + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)ModuleId; + (void)InstanceId; + (void)ApiId; + (void)ErrorId; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + return result; +} +# endif /* DET_ENABLED == STD_ON */ + +# if defined( FBL_MIO_ENABLE_HOOKS ) +/*********************************************************************************************************************** + * ApplFblPreMemDriver + **********************************************************************************************************************/ +/*! \brief Function is called before the memory driver is executed. + * \param[in] device Memory device, which is going to be used. + * \param[in] function Function of the memory device, which is going to be called. + **********************************************************************************************************************/ +void ApplFblPreMemDriver( vuint8 device, vuint8 function ) +{ + uint8 opMode; + Std_ReturnType retVal; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)device; + (void)function; +# endif + /* TODO_CUSTOMER: Adapt this example implementation to project-specific needs/requirements */ + /* Suspend vHSM operations in data flash */ + opMode = CRYPTO_30_VHSM_DATAFLASH_START; + retVal = Csm_KeyElementSet(CsmConf_CsmKey_CsmKey_vHsm_Hardware, CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION, &opMode, 1u); + /* Suspend vHSM operations in code flash -> send it to RAM loop */ + opMode = CRYPTO_30_VHSM_CODEFLASH_START; + retVal |= Csm_KeyElementSet(CsmConf_CsmKey_CsmKey_vHsm_Hardware, CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION, &opMode, 1u); + + /* Simulate DET functionality in case of any error */ + assertFblUser(retVal == E_OK, kFblSysAssertDet); +} + +/*********************************************************************************************************************** + * ApplFblPostMemDriver + **********************************************************************************************************************/ +/*! \brief Function is called after the memory driver has finished the operation. + * \param[in] device Memory device, which is going to be used. + * \param[in] function Function of the memory device, which is going to be called. + **********************************************************************************************************************/ +void ApplFblPostMemDriver( vuint8 device, vuint8 function ) +{ + uint8 opMode; + Std_ReturnType retVal; +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)device; + (void)function; +# endif + /* TODO_CUSTOMER: Adapt this example implementation to project-specific needs/requirements */ + /* Get vHSM back from RAM loop */ + opMode = CRYPTO_30_VHSM_CODEFLASH_STOP; + retVal = Csm_KeyElementSet(CsmConf_CsmKey_CsmKey_vHsm_Hardware, CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION, &opMode, 1u); + /* Give vHSM access to data flash operations */ + opMode = CRYPTO_30_VHSM_DATAFLASH_STOP; + retVal |= Csm_KeyElementSet(CsmConf_CsmKey_CsmKey_vHsm_Hardware, CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION, &opMode, 1u); + + /* Simulate DET functionality in case of any error */ + assertFblUser(retVal == E_OK, kFblSysAssertDet); +} +# endif /* FBL_MIO_ENABLE_HOOKS */ +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + +#define FBLBMAP_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblBmAp_0305: + Reason: Boot manager needs to jump to a memory location to start a target/software. + Risk: Unintended jump to wrong memory location. + Prevention: No prevention possible, address is defined by the corresponding target. + + MD_FblBmAp_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation-defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. The correctness of the respective implementation is verified by runtime tests. + + MD_FblBmAp_2741_4558: + Reason: Assertion macros have to be disabled in production code and are used only for development. + Risk: Assertion code may be enabled in production code unintentionally. If a assertion condition is unexpectedly + false, the code is active. A problem may occur if the Macro is additionally changed from single statement + to multiple statement. + Prevention: Macro is not allowed to be changed without review. Development code is automatically disabled via + configuration of project state "Production". + +*/ + +/*********************************************************************************************************************** + * END OF FILE: BM_AP.C + **********************************************************************************************************************/ diff --git a/Source/appl/fbl_secboot_ap.c b/Source/appl/fbl_secboot_ap.c new file mode 100644 index 0000000..fe6f688 --- /dev/null +++ b/Source/appl/fbl_secboot_ap.c @@ -0,0 +1,232 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief SecureBoot implementation callback file + * + * \note Please note, that this file contains a collection of callback functions to be used with the + * Flash Bootloader. These functions may influence the behavior of the bootloader in principle. + * Therefore, great care must be taken to verify the correctness of the implementation. + * The contents of the originally delivered files are only examples resp. implementation proposals. + * With regard to the fact that these functions are meant for demonstration purposes only, Vector + * Informatik's liability shall be expressly excluded in cases of ordinary negligence, to the extent + * admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2020-01-07 visrie FBL-524 Initial release + * 01.00.01 2020-04-27 visrie FBL-1773 No changes + * 02.00.00 2020-05-19 vistbe FBL-1016 No changes + * 02.01.00 2021-01-19 visrie FBL-2648 No changes + * FBL-2641 No changes + * 02.02.00 2021-09-03 visjdn FBL-3352 Support different default locations of the signature + * 02.03.00 2023-06-21 vistbe FBL-4814 Add support for OTA + * 02.03.01 2024-05-16 viswmo ESCAN00117059 No changes + * 02.04.00 2024-11-18 vismix FBL-9654 No changes + * 02.05.00 2025-01-30 vikatya PIO-1340 SecureBoot for selected blocks + * 02.06.00 2025-02-19 visrie FBL-10209 No changes + **********************************************************************************************************************/ + +#define FBL_SECBOOT_AP_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "bm_main.h" +#include "Csm.h" +#include "fbl_secboot_ap.h" + + /*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define FBLSB_INITIAL_STARTUP_SET_VALUE 0xA5u + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ +#define FBLSB_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * ApplFblSbStartup + **********************************************************************************************************************/ +/*! \brief Secure boot initialization callback + * \details This function is called during Bootloader initialization to set up secure boot + **********************************************************************************************************************/ +void ApplFblSbStartup( void ) +{ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +# if defined( FBLBM_INSTANCE_BOOTLOADER ) + if (FblBmChkInitCmacMagicFlag()) + { + /* Clear the flag */ + FblBmClrMagicFlag(); + + /* Update the SecureBootSegments by using SecureBoot-ForceSequential */ + assertFbl(FblSb_UpdateInitialSegments() == kFblOk, 0u); + + /* Clear the initial startup flag */ + ApplFblSbClrInitialStartup(); + + /* Perform reset to enable secure boot on next startup */ + ApplFblReset(); + } +# endif /* FBLBM_INSTANCE_BOOTLOADER */ +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +} + +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +# if defined( FBLBM_INSTANCE_BOOTMANAGER ) +/*********************************************************************************************************************** + * ApplFblSbIsInitialStartup + **********************************************************************************************************************/ +/*! \brief Checks if this is an initial (first) startup of the ECU + * \return kFblOk if this is the first startup, otherwise kFblFailed + **********************************************************************************************************************/ +tFblResult ApplFblSbIsInitialStartup(void) +{ + tFblResult result = kFblFailed; + uint8 writeOnceKeyValue = 0u; + uint32 writeOnceKeyLength = 1u; + + /* Reads a write once key from the vHsm */ + if (Csm_KeyElementGet(FblSb_GetCsmKeyOfInitialStartup(), 1u, &writeOnceKeyValue, &writeOnceKeyLength) == E_OK) + { + /* Check if the key was already written */ + if (writeOnceKeyValue != FBLSB_INITIAL_STARTUP_SET_VALUE) + { + result = kFblOk; + } + } + + return result; +} +#endif /* FBLBM_INSTANCE_BOOTMANAGER */ + +/*********************************************************************************************************************** + * ApplFblSbClrInitialStartup + **********************************************************************************************************************/ +/*! \brief Clears the initial startup condition flag + **********************************************************************************************************************/ +void ApplFblSbClrInitialStartup(void) +{ + tFblResult result = kFblFailed; + uint8 writeOnceKeyValue = FBLSB_INITIAL_STARTUP_SET_VALUE; + uint32 writeOnceKeyLength = 1u; + + /* Reads a write once key from the vHsm */ + if (Csm_KeyElementSet(FblSb_GetCsmKeyOfInitialStartup(), 1u, &writeOnceKeyValue, writeOnceKeyLength) == E_OK) + { + if (Csm_KeySetValid(FblSb_GetCsmKeyOfInitialStartup()) == E_OK) + { + result = kFblOk; + } + } + + /* Writing of the key was not successful, which should not happen */ + assertFblUser((result == kFblOk), 1u); +} +#endif + +/*********************************************************************************************************************** + * ApplFblSbGetSignatureInfo + **********************************************************************************************************************/ +/*! \brief Gets the information of the signature + * \param[in] bmHdrHeader Pointer to the FblBmHdrHeader structure + * \param[in] macId ID of MacOperation + * \param[out] signatureAddress Address of the signature + * \param[out] signatureLength Length of the signature + **********************************************************************************************************************/ +tFblResult ApplFblSbGetSignatureInfo(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader, vuint32 macId, + V_MEMRAM1 vuint32 V_MEMRAM2 V_MEMRAM3 * signatureAddress, + V_MEMRAM1 vuint32 V_MEMRAM2 V_MEMRAM3 * signatureLength) +{ + tFblResult result = kFblOk; + + /* Check if mac operation is configured. */ + if (macId != FBLBMHDR_MAC_OP_REF_NOT_USED) + { + *signatureLength = FblSb_GetSignatureLengthOfMacOperation(macId); + + switch (FblSb_GetSignaturePositionOfMacOperation(macId)) + { + case FBLSB_SIGPOSITION_FRONT_SEGMENT_LIST: + { + *signatureAddress = bmHdrHeader->bmAuthenticationHeaderAddress - FblSb_GetSignatureLengthOfMacOperation(macId); + break; + } + case FBLSB_SIGPOSITION_START_LOGICAL_BLOCK: + { + *signatureAddress = bmHdrHeader->bmBlockStartAddress; + break; + } + case FBLSB_SIGPOSITION_END_LOGICAL_BLOCK: + { + *signatureAddress = bmHdrHeader->bmBlockStartAddress + bmHdrHeader->bmBlockLength - FblSb_GetSignatureLengthOfMacOperation(macId); + break; + } + case FBLSB_SIGPOSITION_END_SEGMENT_LIST: + { + /* This function should not be called for this signature position as vHsm handles this internally + --> This can be considered an error */ + result = kFblFailed; + break; + } + default: + { + /* TODO_CUSTOMER: A user specific signature position can be implemented here. */ + result = kFblFailed; + break; + } + } + } + + return result; +} + +#define FBLSB_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_SECBOOT_AP.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Common/Can_GeneralTypes.h b/Source/bsw/Common/Can_GeneralTypes.h new file mode 100644 index 0000000..ff410f4 --- /dev/null +++ b/Source/bsw/Common/Can_GeneralTypes.h @@ -0,0 +1,80 @@ +/******************************************************************************************************************** +| File Name: Can_GeneralTypes.H +| +| Description: Type definitions of the AUTOSAR CAN components Can, CanIf, CanTrcv +|-------------------------------------------------------------------------------------------------------------------- +| C O P Y R I G H T +|-------------------------------------------------------------------------------------------------------------------- +| Copyright (c) 1996-2012 by Vector Informatik GmbH. All rights reserved. +| +| This software is copyright protected and proprietary +| to Vector Informatik GmbH. Vector Informatik GmbH +| grants to you only those rights as set out in the +| license conditions. All other rights remain with +| Vector Informatik GmbH. +| +|-------------------------------------------------------------------------------------------------------------------- +| A U T H O R I D E N T I T Y +|-------------------------------------------------------------------------------------------------------------------- +| Initials Name Company +| -------- --------------------- ------------------------------------- +| visbir Holger Birke Vector Informatik GmbH +|-------------------------------------------------------------------------------------------------------------------- +| R E V I S I O N H I S T O R Y +|-------------------------------------------------------------------------------------------------------------------- +| Date Version Author Description +| ---------- -------- ------ ------------------------------------------------------------------------------------- +| 2012-05-31 1.00.00 visbir - Add Can types +| 2012-07-27 1.00.01 visbir - Add Trcv switch for include +| 2013-02-20 1.01.00 visbir - ESCAN00061193: Use static Trcv types +|*******************************************************************************************************************/ +#ifndef CAN_GENERAL_TYPES +#define CAN_GENERAL_TYPES + +/* Version of Can_GeneralTypes header */ +#define CAN_GENERAL_TYPES_MAJOR_VERSION 0x01 +#define CAN_GENERAL_TYPES_MINOR_VERSION 0x01 +#define CAN_GENERAL_TYPES_PATCH_VERSION 0x00 + +#include "ComStack_Types.h" + +/* CAN Transceiver Driver also available as generated file "CanTrcv_GeneralTypes.h" */ +/* !!! please remove this types when you use no Vector CAN Transceiver Driver */ +typedef enum CanTrcv_TrcvModeTypeTag +{ + CANTRCV_TRCVMODE_NORMAL = 0u, + CANTRCV_TRCVMODE_SLEEP, + CANTRCV_TRCVMODE_STANDBY +} CanTrcv_TrcvModeType; + +typedef enum CanTrcv_TrcvWakeupModeTypeTag +{ + CANTRCV_WUMODE_ENABLE = 0u, + CANTRCV_WUMODE_CLEAR, + CANTRCV_WUMODE_DISABLE +} CanTrcv_TrcvWakeupModeType; + +typedef enum CanTrcv_TrcvWakeupReasonTypeTag +{ + CANTRCV_WU_ERROR = 0u, + CANTRCV_WU_BY_BUS, + CANTRCV_WU_BY_PIN, + CANTRCV_WU_INTERNALLY, + CANTRCV_WU_NOT_SUPPORTED, + CANTRCV_WU_POWER_ON, + CANTRCV_WU_RESET, + CANTRCV_WU_BY_SYSERR +} CanTrcv_TrcvWakeupReasonType; +/* CAN Transceiver Driver end */ + + +/* CAN Driver generated File */ +#include "Can_DrvGeneralTypes.h" + + +/* CAN Interface generated File */ +#include "CanIf_GeneralTypes.h" + + + +#endif /* CAN_GENERAL_TYPES */ diff --git a/Source/bsw/Common/ComStack_Types.h b/Source/bsw/Common/ComStack_Types.h new file mode 100644 index 0000000..bc7a50e --- /dev/null +++ b/Source/bsw/Common/ComStack_Types.h @@ -0,0 +1,284 @@ +/*********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------ + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** + * File: ComStack_Types.h + * Component: - + * Module: - + * Generator: - + * + * Description: Provision of Comunication Stack Types + * + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2007-08-01 Jk Initial creation + * 03.00.00 2007-09-14 Jk Addaption for AUTOSAR 3.0 / NetworkHandleType added + * 03.00.01 2007-11-20 Jk Version defines for CFG management added + * 03.01.00 2008-03-18 Jk Version defines changed to specification version + * 03.01.01 2008-04-18 Ms ESCAN00026158 Support more than 255 Pdus per component + * Ms ESCAN00026165 COMSTACKTYPE_VENDOR_ID + * Ms ESCAN00028208 Remove non ISO-5.2.1 Characters + * 03.02.00 2008-07-16 Jk BUSTRCV_E_OK added (specification inconsistency ComStackTypes <-> + * FrTrcv) + * 03.02.01 2008-10-30 Lo Fixed COMSTACKTYPE_AR_MAJOR_VERSION + * 03.02.02 2009-06-15 Ht ESCAN00035189 Compiler Error due to storage qualifier used in struct definition + * 03.03.00 2010-03-23 Ht ESCAN00041756 support TPParameterType + * 03.03.01 2010-05-11 Ht ESCAN00042906 correct version defines COMMONASR__COMMON_IMPL_COMSTACKTYPES.. + * 03.04.00 2011-03-04 Ht support ASR 4.0R1 + * 03.04.01 2011-02-28 visht ESCAN00049578 incorrect BSW version scan information + * 03.04.02 2011-04-15 visht support TP_NORETRY for TpDataStateType (used in CANTP and PDURouter) + * 04.00.00 2012-07-19 visht ESCAN00058421 support ASR 4.0 R3 (support TPParameterType as enum, include generated + * ComStack_Cfg.h) + * 04.00.01 2012-08-31 visht version define corrected - replace PATCH by REVISION - + * (COMSTACKTYPE_AR_RELEASE_REVISION_VERSION, + * COMSTACKTYPE_AR_RELEASE_REVISION_VERSION) + * 2012-10-23 visseu Add COMSTACKTYPE_MODULE_ID as specified in + * "AUTOSAR_TR_BSWModuleList.pdf" (R4.0 Rev 3) + * 04.00.02 2013-01-10 visseu MISRA deviation comments added + * 04.00.03 2013-05-29 visseu ESCAN00067745 Add general defines with prefix: COMTYPE + * 04.01.00 2019-07-25 visdfe MSR4-28981 Change PNCHandleType to uint16 + * 04.02.00 2023-04-12 visbwa HALBE-7488 Removed outdated fragments of ASR3.x/ASR4.0.1 and file filtering, + * fixed copyright header, removed author identity, codestyle review + * 05.00.00 2023-11-30 virmfr OSHAL-723 Support PduInfoType with MetaData + * 2024-01-29 virrlu OSHAL-800 Rework return codes for NotifResultType + * 05.01.00 2024-04-17 visdep OSHAL-1410 Introduce ComStack Type definitions related to time stamping (AR23-11) + * 2024-05-27 virjas OSHAL-1410 Enter correct ASR version defines for 4.0 R3 + * 05.02.00 2024-10-22 visdep OSHAL-2156 Added #define TIME_STAMP_TYPE to indicate the availability of TimeStampType. + * 2024-11-05 virjas OSHAL-1715 Fix Misra warnings with BusTrcvErrorType defines. + * 05.03.00 2025-05-06 virjas OSHAL-2921 Add ListElemStructType to support R23-11 and R24-11. + * 05.03.01 2025-05-09 virjas OSHAL-3046 Fix definition of ListElemStructType. + * 05.03.02 2025-05-13 virjas OSHAL-3057 Fix definition of ListElemStructType. + **********************************************************************************************************************/ + +#ifndef COMSTACK_TYPES_H +# define COMSTACK_TYPES_H + +/* PRQA S 3453 COMSTACK_TYPES_3453_TAG */ /* MD_MSR_19.7 */ +/* PRQA S 0850 COMSTACK_TYPES_0850_TAG */ /* MD_MSR_19.8 */ + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ +# include "Std_Types.h" + +# include "ComStack_Cfg.h" + +/*********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + **********************************************************************************************************************/ +/* ##V_CFG_MANAGEMENT ##CQProject : CommonAsr__Common CQComponent : Impl_ComStackTypes */ +# define COMMONASR__COMMON_IMPL_COMSTACKTYPES_VERSION 0x0503 +# define COMMONASR__COMMON_IMPL_COMSTACKTYPES_RELEASE_VERSION 0x02 + +/* AUTOSAR Software Specification Version Information */ +/* AUTOSAR Classic Platform Release R24-11 */ +# define COMSTACKTYPE_AR_RELEASE_MAJOR_VERSION (4u) +# define COMSTACKTYPE_AR_RELEASE_MINOR_VERSION (10u) +# define COMSTACKTYPE_AR_RELEASE_REVISION_VERSION (0u) + +# if defined COMSTACKTYPE_AR_RELEASE_REVISION_VERSION +# define COMSTACKTYPE_AR_RELEASE_PATCH_VERSION COMSTACKTYPE_AR_RELEASE_REVISION_VERSION +/* ESCAN00067745 */ +# define COMTYPE_AR_RELEASE_MAJOR_VERSION COMSTACKTYPE_AR_RELEASE_MAJOR_VERSION +# define COMTYPE_AR_RELEASE_MINOR_VERSION COMSTACKTYPE_AR_RELEASE_MINOR_VERSION +# define COMTYPE_AR_RELEASE_REVISION_VERSION COMSTACKTYPE_AR_RELEASE_REVISION_VERSION +# define COMTYPE_AR_RELEASE_PATCH_VERSION COMSTACKTYPE_AR_RELEASE_REVISION_VERSION +# endif + +/* Component Version Information */ +# define COMSTACKTYPE_SW_MAJOR_VERSION (5u) +# define COMSTACKTYPE_SW_MINOR_VERSION (3u) +# define COMSTACKTYPE_SW_PATCH_VERSION (2u) + +/* ESCAN00067745 */ +# define COMTYPE_SW_MAJOR_VERSION COMSTACKTYPE_SW_MAJOR_VERSION +# define COMTYPE_SW_MINOR_VERSION COMSTACKTYPE_SW_MINOR_VERSION +# define COMTYPE_SW_PATCH_VERSION COMSTACKTYPE_SW_PATCH_VERSION + +# define COMSTACKTYPE_VENDOR_ID (30u) /* SREQ00015385, SREQ00015364, SREQ00015372 */ +# define COMSTACKTYPE_MODULE_ID (196u) /* SREQ00015385, SREQ00015364, SREQ00015372 */ + +/* ESCAN00067745 */ +# define COMTYPE_VENDOR_ID COMSTACKTYPE_VENDOR_ID +# define COMTYPE_MODULE_ID COMSTACKTYPE_MODULE_ID + +/*General return codes for NotifResultType*/ + +# define NTFRSLT_OK 0x00u /* Action has been successfully finished: + - message sent out (in case of confirmation), + - message received (in case of indication) */ +# define NTFRSLT_E_NOT_OK 0x01u /* Error notification: + - message not successfully sent out (in case of confirmation), + - message not successfully received (in case of indication) */ +# define NTFRSLT_E_TIMEOUT_A 0x02u /* Error notification: + - timer N_Ar/N_As (according to ISO specification [ISONM]) has passed its time-out value N_Asmax/N_Armax. + This value can be issued to service user on both the sender and receiver side. */ +# define NTFRSLT_E_TIMEOUT_BS 0x03u /* Error notification: + - timer N_Bs has passed its time-out value N_Bsmax (according to ISO specification [ISONM]). + This value can be issued to the service user on the sender side only. */ +# define NTFRSLT_E_TIMEOUT_CR 0x04u /* Error notification: + - timer N_Cr has passed its time-out value N_Crmax. + This value can be issued to the service user on the receiver side only. */ +# define NTFRSLT_E_WRONG_SN 0x05u /* Error notification: + - unexpected sequence number (PCI.SN) value received. + This value can be issued to the service user on the receiver side only. */ +# define NTFRSLT_E_INVALID_FS 0x06u /* Error notification: + - invalid or unknown FlowStatus value has been received in a flow control (FC) N_PDU. + This value can be issued to the service user on the sender side only. */ +# define NTFRSLT_E_UNEXP_PDU 0x07u /* Error notification: + - unexpected protocol data unit received. + This value can be issued to the service user on both the sender and receiver side. */ +# define NTFRSLT_E_WFT_OVRN 0x08u /* Error notification: + - flow control WAIT frame that exceeds the maximum counter N_WFTmax received. + This value can be issued to the service user on the receiver side. */ +# define NTFRSLT_E_ABORT 0x09u /* Error notification: + - Flow control (FC) N_PDU with FlowStatus = ABORT received. + It indicates an abort of a transmission. A possible reason for this is that the receiver is currently busy and + can not take the request at that point in time. */ +# define NTFRSLT_E_NO_BUFFER 0x0Au /* Error notification: + - flow control (FC) N_PDU with FlowStatus = OVFLW received. + It indicates that the buffer on the receiver side of a segmented message transmission + cannot store the number of bytes specified by the FirstFrame DataLength (FF_DL) parameter + in the FirstFrame and therefore the transmission of the 19 of 23 AUTOSAR_SWS_ComStackTypes + segmented message was aborted. + - no buffer within the TP available to transmit the segmented I-PDU. + This value can be issued to the service user on both the sender and receiver side. */ +# define NTFRSLT_E_CANCELATION_OK 0x0Bu /* Action has been successfully finished: + - Requested cancellation has been executed. */ +# define NTFRSLT_E_CANCELATION_NOT_OK 0x0Cu /* Error notification: + - Due to an internal error the requested cancelation has not been executed. This will happen e.g., if the to be canceled transmission has been executed already. */ + +/* extension since R4.0 R1 */ +# define NTFRSLT_PARAMETER_OK 0x0Du /* The parameter change request has been successfully executed */ +# define NTFRSLT_E_PARAMETER_NOT_OK 0x0Eu /* The request for the change of the parameter did not complete successfully */ +# define NTFRSLT_E_RX_ON 0x0Fu /* The parameter change request not executed successfully due to an ongoing reception */ +# define NTFRSLT_E_VALUE_NOT_OK 0x10u /* The parameter change request not executed successfully due to a wrong value */ + +/* 0x11-0x1E Reserved values for future usage. */ + +/* General return codes for BusTrcvErrorType */ +# define BUSTRCV_OK 0x00u +/* BUSTRCV_E_OK needed by FrTrcv specification inconcistency between ComStackTypes and FrTrcv */ +# define BUSTRCV_E_OK 0x00u +# define BUSTRCV_E_ERROR 0x01u + +/* PduInfoType MetaData handling */ +#define PDUINFOTYPE_INIT {NULL_PTR, NULL_PTR, 0} +#define PDUINFOTYPE_VERSION 43 + +/*********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ +typedef P2VAR(uint8, TYPEDEF, AUTOSAR_COMSTACKDATA) SduDataPtrType; +typedef P2VAR(uint8, TYPEDEF, AUTOSAR_COMSTACKDATA) MetaDataPtrType; +typedef struct +{ + SduDataPtrType SduDataPtr; + MetaDataPtrType MetaDataPtr; + PduLengthType SduLength; +} PduInfoType; + +typedef enum +{ + BUFREQ_OK = 0u, /* Buffer request accomplished successful. */ + BUFREQ_E_NOT_OK = 1u, /* Buffer request not successful. Buffer cannot be accessed. */ + BUFREQ_E_BUSY = 2u, /* Temporarily no buffer available. It's up the requestor to retry request for a certain time. */ + BUFREQ_E_OVFL = 3u /* No Buffer of the required length can be provided. */ +} BufReq_ReturnType; + +typedef uint8 NotifResultType; + +typedef uint8 BusTrcvErrorType; + +typedef uint8 NetworkHandleType; + +typedef uint16 PNCHandleType; /* Neccessary for partial network. Deviation from SWS_COMTYPE_00036 for ASR Version <= 4.4.0 */ + +typedef enum +{ + TP_DATACONF = 0u, /* TP_DATACONF indicates that all data, that have been copied so far, are confirmed and can be + removed from the TP buffer. Data copied by this API call are excluded and will be confirmed later. */ + TP_DATARETRY = 1u, /* TP_DATARETRY indicates that this API call shall copy already copied data in order to recover from + an error. In this case TxTpDataCnt specifies the offset of the first byte to be copied by the API call. */ + TP_CONFPENDING = 2u +} TpDataStateType; + +typedef struct +{ + TpDataStateType TpDataState; /* The enum type to be used to store the state of Tp buffer. */ + PduLengthType TxTpDataCnt; /* Offset from the current position which identifies the number of bytes to be retransmitted. */ +} RetryInfoType; + +typedef enum +{ + TP_STMIN = 0u, /* Separation Time */ + TP_BS = 1u, /* Block Size */ + TP_BC = 2u /* The Band width control parameter used in FlexRay transport protocol module. */ +} TPParameterType; + +typedef struct +{ + uint32 nanoseconds; /* Nanoseconds part of the time */ + uint32 seconds; /* 32 bit LSB of the 48 bits Seconds part of the time */ + uint16 secondsHi; /* 16 bit MSB of the 48 bits Seconds part of the time */ +} TimeStampType; /* ASR CP R23-11 */ + +/* Define TIME_STAMP_TYPE to indicate that TimeStampType is available. */ +# define TIME_STAMP_TYPE + +typedef enum +{ + VALID = 0u, /* Timestamp is valid */ + INVALID = 1u, /* Timestamp is invalid */ + UNCERTAIN = 2u /* Status of timestamp is uncertain */ +} TimeStampQualType; /* ASR CP R23-11 */ + +typedef struct +{ + TimeStampType timestampClockValue; /* Value of the clock, which is used of ingress/egress timestamping */ + TimeStampType disciplinedClockValue; /* Value of the adjustable HW clock */ + TimeStampQualType timeQuality; /* Status of time tuple */ +} TimeTupleType; /* ASR CP R23-11 */ + +typedef struct ListElemStructType +{ + uint16 DataLength; /* Represents length of data */ + uint8* DataPtr; /* Represents pointer to data */ + struct ListElemStructType* NextListElemPtr; /* Pointer to next list element */ +} ListElemStructType; /* ASR CP R23-11 */ + +/*********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +/* PRQA L:COMSTACK_TYPES_3453_TAG */ +/* PRQA L:COMSTACK_TYPES_0850_TAG */ + +#endif /* COMSTACK_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: ComStack_Types.h + **********************************************************************************************************************/ diff --git a/Source/bsw/Common/Compiler.h b/Source/bsw/Common/Compiler.h new file mode 100644 index 0000000..59e1540 --- /dev/null +++ b/Source/bsw/Common/Compiler.h @@ -0,0 +1,191 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------- + * File: Compiler.h + * Component: - + * Module: - + * Generator: - + * + * Description: This file provides the AUTOSAR compiler abstraction for the Texas Instruments LLVM compiler + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2021-09-29 vishci HALBE-5003 Created initial version. + * 01.01.00 2023-07-18 virrlu HALBE-10062 Update to AUTOSAR Release 21-11 + * 01.01.01 2024-02-01 virmid OSHAL-990 Updated copyright year. + **********************************************************************************************************************/ + +#ifndef COMPILER_H +#define COMPILER_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Compiler_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* ##V_CFG_MANAGEMENT ##CQProject : CommonAsr_Arm32 CQComponent : Impl_CompAbstract_LlvmTexasInstruments */ +#define COMMONASR_ARM32_IMPL_COMPABSTRACT_VERSION 0x0101 +#define COMMONASR_ARM32_IMPL_COMPABSTRACT_RELEASE_VERSION 0x00 + +#define COMPILER_VENDOR_ID 30u /* Vendor ID of Vector */ +#define COMPILER_MODULE_ID 198u /* 198 is the ID of compiler abstraction */ + +/* AUTOSAR Software Specification Release Version Information */ +/* AUTOSAR Release 21-11 */ +#define COMPILER_AR_RELEASE_MAJOR_VERSION (4u) +#define COMPILER_AR_RELEASE_MINOR_VERSION (7u) +#define COMPILER_AR_RELEASE_REVISION_VERSION (0u) + +/* Component Version Information */ +#define COMPILER_SW_MAJOR_VERSION (1u) +#define COMPILER_SW_MINOR_VERSION (1u) +#define COMPILER_SW_PATCH_VERSION (1u) + +#define _TEXASINSTRUMENTS_LLVM_C_ARM32_ + +/* AUTOMATIC used for the declaration of local pointers */ +#define AUTOMATIC + +/* TYPEDEF shall be used within type definitions, where no memory qualifier can be specified.*/ +#define TYPEDEF + +/* NULL_PTR define with a void pointer to zero definition*/ +#ifndef NULL_PTR +# define NULL_PTR ((void *)0) +#endif + +/* INLINE define for abstraction of the keyword inline*/ +#ifndef INLINE +# define INLINE __inline__ +#endif + +/* LOCAL_INLINE define for abstraction of the keyword inline in functions with "static" scope. + Different compilers may require a different sequence of the keywords "static" and "inline" + if this is supported at all. */ +#ifndef LOCAL_INLINE +# define LOCAL_INLINE static __inline__ +#endif + +/* FUNC macro for the declaration and definition of functions, that ensures correct syntax of function declarations + rettype return type of the function + memclass classification of the function itself*/ +#define FUNC(rettype, memclass) rettype /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* FUNC_P2CONST macro for declaration and definition of functions returning a pointer to a constant, that ensures + correct syntax of function declarations. + rettype return type of the function + ptrclass defines the classification of the pointer�s distance + memclass classification of the function itself*/ +#define FUNC_P2CONST(rettype, ptrclass, memclass) const rettype* /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* FUNC_P2VAR macro for the declaration and definition of functions returning a pointer to a variable, that ensures + correct syntax of function declarations + rettype return type of the function + ptrclass defines the classification of the pointer�s distance + memclass classification of the function itself*/ +#define FUNC_P2VAR(rettype, ptrclass, memclass) rettype* /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* P2VAR macro for the declaration and definition of pointers in RAM, pointing to variables + ptrtype type of the referenced variable memory class + memclass classification of the pointer variable itself + ptrclass defines the classification of the pointer�s distance + */ +#define P2VAR(ptrtype, memclass, ptrclass) ptrtype* /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* P2CONST macro for the declaration and definition of pointers in RAM pointing to constants + ptrtype type of the referenced data + memclass classification of the pointer variable itself + ptrclass defines the classification of the pointer distance + */ +#define P2CONST(ptrtype, memclass, ptrclass) const ptrtype* /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* CONSTP2VAR macro for the declaration and definition of constant pointers accessing variables + ptrtype type of the referenced data + memclass classification of the pointer variable itself + ptrclass defines the classification of the pointer distance + */ +#define CONSTP2VAR(ptrtype, memclass, ptrclass) ptrtype* const /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* CONSTP2CONST macro for the declaration and definition of constant pointers accessing constants + ptrtype type of the referenced data + memclass classification of the pointer variable itself + ptrclass defines the classification of the pointer distance + */ +#define CONSTP2CONST(ptrtype, memclass, ptrclass) const ptrtype* const /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* P2FUNC macro for the type definition of pointers to functions + rettype return type of the function + ptrclass defines the classification of the pointer distance + fctname function name respectively name of the defined type + */ +#define P2FUNC(rettype, ptrclass, fctname) rettype (* fctname) /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* CONSTP2FUNC macro for the type definition of pointers to functions + rettype return type of the function + ptrclass defines the classification of the pointer distance + fctname function name respectively name of the defined type + Example (PowerPC): #define CONSTP2FUNC(rettype, ptrclass, fctname) rettype (* const fctname) + Example (IAR, R32C): #define CONSTP2FUNC(rettype, ptrclass, fctname) rettype (ptrclass * const fctname) + */ +#define CONSTP2FUNC(rettype, ptrclass, fctname) rettype (* const fctname) /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* CONST macro for the declaration and definition of constants + type type of the constant + memclass classification of the constant itself + */ +#define CONST(type, memclass) const type /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/* VAR macro for the declaration and definition of variables + vartype type of the variable + memclass classification of the variable itself + */ +#define VAR(vartype, memclass) vartype /* PRQA S 3410 */ /* MD_Compiler_19.10 */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/****************************************************************************/ +/* MISRA deviations */ +/****************************************************************************/ +/* Justification for module-specific MISRA deviations: +MD_Compiler_19.10: + Reason: Macro used in structures, which depend on used compiler and which do not allow brackets e.g. declaration of functions and variables. + Risk: None atomic parameter lead to compile errors. + Prevention: Used parameter is always atomic. +*/ +#endif /* COMPILER_H */ + +/********************************************************************************************************************** + * END OF FILE: Compiler.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/Compiler_Cfg.h b/Source/bsw/Common/Compiler_Cfg.h new file mode 100644 index 0000000..0a30681 --- /dev/null +++ b/Source/bsw/Common/Compiler_Cfg.h @@ -0,0 +1,1014 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------- + * File: _Compiler_Cfg.h + * Component: - + * Module: - + * Generator: - + * + * Description: This File is a template for the Compiler_Cfg.h + * This file has to be extended with the memory and pointer classes for all BSW modules + * which where used. + * + * ------------------------------------------------------------------------------------------------------------------- + * MISRA VIOLATIONS + * ------------------------------------------------------------------------------------------------------------------- + * + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2007-08-01 Jk Initial creation + * 01.01.00 2007-12-14 Jk Component specific defines filtering added + * 01.01.01 2008-12-17 Ht Improve list of components (Tp_AsrTpCan,Tp_AsrTpFr,DrvMcu,DrvIcu added) + * 01.01.02 2009-04-27 Ht support OEM specific _compiler_cfg.inc file, improve list of components + * (Cp_XcpOnCanAsr, Il_AsrIpduM, If_VxFblDcm, If_VxFblVpm_Volvo_ab, DrvFls added) + * 01.01.03 2009-04-24 Msr Renamed J1939_AsrBase as TpJ1939_AsrBase + * 01.01.04 2009-06-03 Ht Improve list of components (Adc, Dio, Gpt, Pwm, Spi, Wdg, Fls, Port, Fim) + * 01.02.00 2009-08-01 Ht Improve list of components (Fee_30_Inst2, Can, ...Sub) + * Support filtering for RTE + * 01.02.01 2009-09-02 Lo add external Flash driver support + * 01.02.02 2009-09-21 Lo add DrvFls_Mcs12xFslftm01ExtVx + * Ht Improve list of components (CanTrcv_30_Tja1040dio, + * Eth, EthTrcv, EthIf, SoAd, TcpIp, EthSM) + * 01.03.00 2009-10-30 Ht support R8: change EthTrcv to EthTrcv_30_Canoeemu + * support EthTrcv_30_Dp83848 + * change CanTrcv_30_Xdio to CanTrcv_30___Your_Trcv__ + * change CanTrcv_30_Tja1040dio to CanTrcv_30_Tja1041 + * change name FrTrcv to FrTrcv_30_Tja1080dio + * Lo add Cp_AsrXcp + * Ht add Cp_XcpOnFrAsr + * 01.03.01 2010-01-13 Ht support SysService_AsrCal + * 01.03.02 2010-02-15 Ht support SysService_SswRcs_Daimler, SysService_Tls, Tp_Http, + * SysService_Dns, SysService_Json, DrvTrans_GenericLindioAsr + * Lo add Diag_AsrDem for all OEMs + * rename internal variables and filter methods + * 01.04.00 2010-03-04 Ht change name FrTrcv_30_Tja1080dio to FrTrcv_30_Tja1080 + * 01.04.01 2010-03-10 Ht support DrvTrans_GenericFrAsr, DrvTrans_As8223FrspiAsr, DrvEep and If_AsrIfEa + * 01.04.02 2010-04-07 Lo change IfFee to real components and add If_AsrIfWdV85xNec01Sub + * 01.04.03 2010-06-11 Ht add CanTrcv_30_Tja1043 + * Lo add Il_AsrIpduMEbBmwSub + * 01.04.04 2010-08-24 Ht add CanTrcv_30_Tle62512G, DrvEep_XAt25128EAsr, Tp_AsrTpFrEbBmwSub + * 01.05.00 2010-08-24 Ht support R10: + * change LinTrcv_30_Tle7259dio to LinTrcv_30_Tle7259 + * 01.05.01 2010-10-14 Ht add VStdLib, SysService_SswScc, SysService_IpBase, SysService_Crypto + * 01.05.02 2010-10-20 Ht support comments for Package Merge Tool + * 01.05.03 2010-11-03 Ht add SysService_E2eLibTttechSub, SysService_E2ePwTttechSub + * 01.05.04 2010-11-16 Ht add SysService_Exi, DrvTrans_Int6400EthAsr, Cdd_AsrCdd_Fiat, Diag_AsrDem_Fiat, + * 01.05.05 2010-12-17 Ht add SysService_AsrSchM, DrvEep_XXStubAsr, DrvIcu_Tms570Tinhet01ExtVx + * DrvWd_XTle4278gEAsr, DrvWd_XXStubAsr + * 01.05.06 2011-02-17 Ht add DrvEed, SysService_AsrBswM + * 01.05.07 2011-03-04 Ht add DrvTrans_Tja1055CandioAsr + * rename CanTrcv_30_Tja1040dio to CanTrcv_30_Tja1040 + * add SysService_XmlEngine + * 01.06.00 2011-03-04 Ht support ASR4.0 + * add Ccl_Asr4ComM, Ccl_Asr4SmCan, Nm_Asr4NmIf, Nm_AsrNmDirOsek + * 01.06.01 2011-04-15 Ht add Diag_AsrDcm_ + * 01.06.02 2011-06-17 Ht correct Diag_AsrDcm_ + * add Monitoring_AsrDlt and Monitoring_GenericMeasurement + * 01.06.03 2011-09-01 Ht add DrvTrans_Tja1145CanSpiAsr, DrvTrans_E52013CanspiAsr, DrvFls_XXStubAsr, + * If_AsrIfFeeV85xNec05Sub, If_AsrIfFeeV85xNec06Sub, If_AsrIfFeeV85xNec07Sub + * SysService_AsrWdMTttechSub and If_AsrIfWdTttechSub + * 01.06.04 2011-10-20 Ht ESCAN00054334: add If_AsrIfFeeTiSub + * ESCAN00054719: add Cdd_AsrCdd + * 01.06.05 2011-12-09 Ht add Tp_IpV4, Tp_IpV6 + * 01.06.06 2011-12-14 Ht add Monitoring_RuntimeMeasurement + * 01.06.07 2012-01-03 Ht add DrvI2c, SysService_Asr4BswM + * 01.06.08 2012-01-31 Ht add DrvTrans_Ar7000EthAsr, DrvTrans_GenericEthmiiAsr + * 01.06.09 2012-03-06 Ht add If_AsrIfFeeMb9df126Fuji01Sub, + * Infineon_Tc1767Inf01Sub, Infineon_Tc178xInf01Sub, Infineon_Tc1797Inf01Sub, Infineon_Tc1797Inf02Sub + * 01.06.10 2012-03-13 Ht add Gw_AsrPduRCfg5, Il_AsrComCfg5, Il_AsrIpduMCfg5, Cdd_AsrCddCfg5, + * Tp_Asr4TpCan, Diag_Asr4Dcm, Diag_Asr4Dem + * 01.06.11 2012-03-20 Ht add Cp_AsrCcp, Cp_XcpOnTcpIpAsr + * 01.07.00 2012-07-26 Ht add Nm_Asr4NmCan, Nm_Asr4NmFr, Infineon_Xc2000Inf01Sub, Ccl_Asr4ComMCfg5, SysService_Asr4BswMCfg5, SysService_Asr4EcuM, SysService_AsrRamTst, + * Ccl_Asr4SmLin + * add define REGSPACE - add support for ASR specification 4.0 R3 + * 01.07.01 2012-10-23 Seu add SysService_XmlSecurity + * 01.07.02 2013-12-16 Seu MISRA compliance: usage of character "'" removed, typos corrected + * 01.08.00 2025-10-13 virjas OSHAL-3696 Adaption for changed infrastructure (veHub) + *********************************************************************************************************************/ +#ifndef COMPILER_CFG_H +#define COMPILER_CFG_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +/* Package Merger: Start Section CompilerCfgIncludes */ + + + +/* Package Merger: Stop Section CompilerCfgIncludes */ + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +#define AUTOSAR_COMSTACKDATA + +#define MSR_REGSPACE REGSPACE + +/* Configurable memory class for pointers to registers (e.g. static volatile CONSTP2VAR(uint16, PWM_CONST, REGSPACE)). */ +#define REGSPACE + + +/* due to compatibility to ASR 2.1 */ +#define _STATIC_ STATIC +#define _INLINE_ INLINE + +/* Package Merger: Start Section CompilerCfgModuleList */ + + + +/********************************************************************************************************************** + * Cdd_AsrCdd START + *********************************************************************************************************************/ + +/* Copy the compiler abstraction defines for each of your configured CDDs and replace the prefix _CDD with the MSN of your configured CDD as higher case. */ + +#define _CDD_CODE +#define _CDD_APPL_DATA + +/* Add additional compiler abstraction defines for each of you configured CDDs here. */ + +/********************************************************************************************************************** + * Cdd_AsrCdd END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * CAN_30_CORE START + *********************************************************************************************************************/ + +#define CAN_30_CORE_CODE /* units public code */ +#define CANXL_30_CORE_CODE +#define CAN_30_CORE_STATIC_CODE /* units private code */ +#define CANXL_30_CORE_STATIC_CODE + +#define CAN_30_CORE_CONST +#define CAN_30_CORE_PBCFG + +#define CAN_30_CORE_VAR_INIT +#define CAN_30_CORE_VAR_NO_INIT +#define CAN_30_CORE_VAR_CLEARED + +#define CAN_30_CORE_APPL_CODE +#define CAN_30_CORE_APPL_VAR +#define CAN_30_CORE_VAR_PBCFG + +/********************************************************************************************************************** + * CAN_30_CORE END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * VCAN_30_MCAN START + **********************************************************************************************************************/ + +#define VCAN_30_MCAN_CODE /* should be same as CAN_30_CORE_CODE */ +#define VCAN_30_MCAN_CODE_ISR +#define VCAN_30_MCAN_REGSPACE +#define VCAN_30_MCAN_CONST +#define VCAN_30_MCAN_PBCFG + +#define VCAN_30_MCAN_APPL_CODE + +#define VCAN_30_MCAN_VAR_INIT +#define VCAN_30_MCAN_VAR_NO_INIT +#define VCAN_30_MCAN_VAR_ZERO_INIT +#define VCAN_30_MCAN_VAR_PBCFG + +#define VCAN_30_MCAN_MESSAGERAM + +/********************************************************************************************************************** + * VCAN_30_MCAN END + **********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CRYPTO_30_LIBCV START + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_CODE +#define CRYPTO_30_LIBCV_APPL_CODE + +#define CRYPTO_30_LIBCV_CONST + +#define CRYPTO_30_LIBCV_VAR_NOINIT +#define CRYPTO_30_LIBCV_VAR_ZERO_INIT +#define CRYPTO_30_LIBCV_APPL_VAR +#define CRYPTO_30_LIBCV_APPL_DATA + +#define CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR + +/********************************************************************************************************************** + * CRYPTO_30_LIBCV END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * CRYPTO_30_VHSM START + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_CODE +#define CRYPTO_30_VHSM_APPL_CODE +#define CRYPTO_30_VHSM_CONST + +#define CRYPTO_30_VHSM_VAR_NOINIT +#define CRYPTO_30_VHSM_VAR_INIT +#define CRYPTO_30_VHSM_VAR_ZERO_INIT +#define CRYPTO_30_VHSM_APPL_VAR +#define CRYPTO_30_VHSM_APPL_DATA + +/********************************************************************************************************************** + * CRYPTO_30_VHSM END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * MEM_30_FBLHIS START + *********************************************************************************************************************/ + +#define MEM_30_FBLHIS_VAR_NOINIT + +#define MEM_30_FBLHIS_CONST + +/********************************************************************************************************************** + * MEM_30_FBLHIS END + *********************************************************************************************************************/ + + +/*********************************************************************************************************************** + * MEM_30_LEGACYADAPTER START + **********************************************************************************************************************/ + +#define MEM_30_LEGACYADAPTER_CODE +#define MEM_30_LEGACYADAPTER_CONST + +#define MEM_30_LEGACYADAPTER_VMEM_CODE +#define MEM_30_LEGACYADAPTER_VMEM_CONST + +#define MEM_30_LEGACYADAPTER_VAR_CLEARED + +#define MEM_30_LEGACYADAPTER_APPL_VAR +#define MEM_30_LEGACYADAPTER_APPL_VAR_NOINIT + +/*********************************************************************************************************************** + * MEM_30_LEGACYADAPTER END + **********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CANTRCV_30_GENERICCAN START + *********************************************************************************************************************/ + +#define CANTRCV_30_GENERICCAN_CODE +#define CANTRCV_30_GENERICCAN_CODE_FAST +#define CANTRCV_30_GENERICCAN_CODE_ISR + +#define CANTRCV_30_GENERICCAN_CONST +#define CANTRCV_30_GENERICCAN_CONST_FAST +#define CANTRCV_30_GENERICCAN_PBCFG + +#define CANTRCV_30_GENERICCAN_VAR_PBCFG /* ESCAN00065502 */ + +#define CANTRCV_30_GENERICCAN_VAR_INIT +#define CANTRCV_30_GENERICCAN_VAR_NOINIT +#define CANTRCV_30_GENERICCAN_APPL_VAR +#define CANTRCV_30_GENERICCAN_APPL_CODE +#define CANTRCV_30_GENERICCAN_VAR_ZERO_INIT +#define CANTRCV_30_GENERICCAN_VAR_INIT_FAST +#define CANTRCV_30_GENERICCAN_VAR_NOINIT_FAST +#define CANTRCV_30_GENERICCAN_VAR_ZERO_INIT_FAST + +#define CANTRCV_30_GENERICCAN_VAR_INIT_NOCACHE +#define CANTRCV_30_GENERICCAN_VAR_NOINIT_NOCACHE +#define CANTRCV_30_GENERICCAN_VAR_ZERO_INIT_NOCACHE + + + +/********************************************************************************************************************** + * CANTRCV_30_GENERICCAN END + *********************************************************************************************************************/ /* PRQA S 0883 */ /* Appears only while testing */ + + + +/********************************************************************************************************************** + * BSWSTUB-COMM START + *********************************************************************************************************************/ + +#define COMM_CODE + +/********************************************************************************************************************** + * BSWSTUB-COMM END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * FBLBM_HDR START + *********************************************************************************************************************/ + +#define FBLBMHDR_CONST +#define FBLBMHDR_CODE + +/********************************************************************************************************************** + * FBLBM_HDR END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * FBLBM_MAIN START + *********************************************************************************************************************/ + +#define FBLBM_CONST +#define FBLBM_HEADER_CONST + +/********************************************************************************************************************** + * FBLBM_MAIN END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * FBLLIB_SECBOOT START + *********************************************************************************************************************/ + +#define FBLSB_CONST +#define FBLSB_CODE + +/********************************************************************************************************************** + * FBLLIB_SECBOOT END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * FblCw START + *********************************************************************************************************************/ + +/* Module Constant Data */ +#define FBLCW_CONST +/* Module Constant Data of the Postbuild Configuration */ +#define FBLCW_PBCFG +/* Module Var Data of the Postbuild Configuration */ +#define FBLCW_VAR_PBCFG + + +/* Module Implementation */ +#define FBLCW_CODE + +/* Module Variables which are initialized by the startup code or by the call of FblCw_InitMemory() */ +#define FBLCW_VAR_NO_INIT +/* Module Variables which are initialized by call of FblCw_Init() */ +#define FBLCW_VAR_CLEARED +/* Module Variables which are initialized by call of FblCw_Init() */ +#define FBLCW_VAR_INIT + +/* Application Code Implementation (e.g. Callbacks) */ +#define FBLCW_APPL_CODE +/* Application Buffer which is located in RAM */ +#define FBLCW_APPL_VAR +/* Application Buffer which is located in ROM or RAM */ +#define FBLCW_APPL_DATA + +/********************************************************************************************************************** + * FblCw END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * PDUR START + *********************************************************************************************************************/ + +#define PDUR_CODE +#define PDUR_VAR_NO_INIT +#define PDUR_VAR_CLEARED +#define PDUR_VAR +#define PDUR_CONST +#define PDUR_PBCFG +#define PDUR_VAR_PBCFG +#define PDUR_APPL_DATA +#define PDUR_APPL_CODE + +/********************************************************************************************************************** + * PDUR END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * CANIF START + *********************************************************************************************************************/ + +#define CANIF_CODE +#define CANIF_CODE_FAST +#define CANIF_CODE_ISR + + +#define CANIF_CONST +#define CANIF_CONST_FAST +#define CANIF_PBCFG + +#define CANIF_VAR_PBCFG /* ESCAN00065502 */ + +#define CANIF_VAR_INIT +#define CANIF_VAR_NOINIT +#define CANIF_VAR_ZERO_INIT + +#define CANIF_VAR_INIT_FAST +#define CANIF_VAR_NOINIT_FAST +#define CANIF_VAR_ZERO_INIT_FAST + +#define CANIF_VAR_INIT_NOCACHE +#define CANIF_VAR_NOINIT_NOCACHE +#define CANIF_VAR_ZERO_INIT_NOCACHE + + +#define CANIF_APPL_CODE +#define CANIF_APPL_VAR +#define CANIF_APPL_PBCFG + + +/*-------------------------------------------------------------------------------------------------------------------*/ + +/* Has to be kept in default section -> Default access */ +#define CANIF_VAR_STACK + + +/* VAR section of higher layers (TP / NM / PduR / CanSM / EcuM) automatically mapped to APPL_VAR */ +#define CANIF_APPL_STATE_VAR CANIF_APPL_VAR +#define CANIF_APPL_MSG_VAR CANIF_APPL_VAR + +/* VAR section of lower layers (CAN Driver / Transceiver Driver) automatically mapped to APPL_VAR */ +#define CANIF_CBK_VAR CANIF_APPL_VAR + +/* #define CANIF_CBK_TRCV_VAR CANIF_CBK_VAR not used yet */ +#define CANIF_CBK_DRV_VAR CANIF_CBK_VAR + +/* Code sections - DO NOT MODIFY */ +#define CANIF_CBK_TRCV_CODE CANIF_APPL_CODE +#define CANIF_CBK_CANDRV_CODE CANIF_APPL_CODE +#define CANIF_APPL_STATE_CODE CANIF_APPL_CODE +#define CANIF_APPL_MSG_CODE CANIF_APPL_CODE + + +/* Upper layer data pointer */ +#define CANIF_UL_STANDARD_VAR CANIF_APPL_VAR +#define CANIF_UL_ADVANCED_VAR CANIF_APPL_VAR +#define CANIF_UL_OSEKNM_VAR CANIF_APPL_VAR + +/********************************************************************************************************************** + * CANIF END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CRYIF START + *********************************************************************************************************************/ + +#define CRYIF_CODE +#define CRYIF_CONST + +#define CRYIF_VAR_ZERO_INIT +#define CRYIF_APPL_VAR +#define CRYIF_APPL_DATA + +/********************************************************************************************************************** + * CRYIF END + *********************************************************************************************************************/ + + + +/*********************************************************************************************************************** + * MEMACC START + **********************************************************************************************************************/ + +#define MEMACC_CONST +#define MEMACC_VAR_NO_INIT + +/*********************************************************************************************************************** + * MEMACC END + **********************************************************************************************************************/ + + + +#ifndef STATIC +#define STATIC static +#endif + +#define _TEXAS_INSTRUMENTS_C_ARM_ + +/********************************************************************************************************************** + * ADC START + *********************************************************************************************************************/ + +#define ADC_APPL_CODE +#define ADC_APPL_CONST +#define ADC_APPL_DATA +#define ADC_CALLOUT_CODE +#define ADC_CODE +#define ADC_CONST +#define ADC_VAR +#define ADC_VAR_FAST +#define ADC_VAR_NOINIT +#define ADC_VAR_POWER_ON_INIT +#define ADC_PBCFG + + /********************************************************************************************************************** + * ADC END + *********************************************************************************************************************/ +/********************************************************************************************************************** + * CAN START + *********************************************************************************************************************/ + +#define CAN_APPL_CODE +#define CAN_APPL_CONST +#define CAN_APPL_DATA +#define CAN_CALLOUT_CODE +#define CAN_CODE +#define CAN_CONST +#define CAN_VAR +#define CAN_VAR_FAST +#define CAN_VAR_NOINIT +#define CAN_VAR_POWER_ON_INIT +#define CAN_PBCFG + + /********************************************************************************************************************** + * CAN END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD START + *********************************************************************************************************************/ + +#define CDD_APPL_CODE +#define CDD_APPL_CONST +#define CDD_APPL_DATA +#define CDD_CALLOUT_CODE +#define CDD_CODE +#define CDD_CONST +#define CDD_VAR +#define CDD_VAR_FAST +#define CDD_VAR_NOINIT +#define CDD_VAR_POWER_ON_INIT +#define CDD_PBCFG + + /********************************************************************************************************************** + * CDD END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * DIO START + *********************************************************************************************************************/ + +#define DIO_APPL_CODE +#define DIO_APPL_CONST +#define DIO_APPL_DATA +#define DIO_CALLOUT_CODE +#define DIO_CODE +#define DIO_CONST +#define DIO_VAR +#define DIO_VAR_FAST +#define DIO_VAR_NOINIT +#define DIO_VAR_POWER_ON_INIT + + /********************************************************************************************************************** + * DIO END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD_DMA START + *********************************************************************************************************************/ + +#define CDD_DMA_APPL_CODE +#define CDD_DMA_APPL_CONST +#define CDD_DMA_APPL_DATA +#define CDD_DMA_CALLOUT_CODE +#define CDD_DMA_CODE +#define CDD_DMA_CONST +#define CDD_DMA_VAR +#define CDD_DMA_VAR_FAST +#define CDD_DMA_VAR_NOINIT +#define CDD_DMA_VAR_POWER_ON_INIT + + /********************************************************************************************************************** + * CDD_DMA END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * ETH START + *********************************************************************************************************************/ + +#define ETH_APPL_CODE +#define ETH_APPL_CONST +#define ETH_APPL_DATA +#define ETH_CALLOUT_CODE +#define ETH_CODE +#define ETH_CONST +#define ETH_VAR +#define ETH_VAR_FAST +#define ETH_VAR_NOINIT +#define ETH_VAR_POWER_ON_INIT +#define ETH_PBCFG + + /********************************************************************************************************************** + * ETH END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * FLS START + *********************************************************************************************************************/ + +#define FLS_APPL_CODE +#define FLS_APPL_CONST +#define FLS_APPL_DATA +#define FLS_CALLOUT_CODE +#define FLS_CODE +#define FLS_CONST +#define FLS_VAR +#define FLS_VAR_FAST +#define FLS_VAR_NOINIT +#define FLS_VAR_POWER_ON_INIT +#define FLS_CONFIG_DATA + + /********************************************************************************************************************** + * FLS END + *********************************************************************************************************************/ +/********************************************************************************************************************** + * GPT START + *********************************************************************************************************************/ + +#define GPT_APPL_CODE +#define GPT_APPL_CONST +#define GPT_APPL_DATA +#define GPT_CALLOUT_CODE +#define GPT_CODE +#define GPT_CONST +#define GPT_VAR +#define GPT_VAR_FAST +#define GPT_VAR_NOINIT +#define GPT_VAR_POWER_ON_INIT + +/********************************************************************************************************************** + * GPT END + *********************************************************************************************************************/ /********************************************************************************************************************** + * I2C START + *********************************************************************************************************************/ + +#define I2C_APPL_CODE +#define I2C_APPL_CONST +#define I2C_APPL_DATA +#define I2C_CALLOUT_CODE +#define I2C_CODE +#define I2C_CONST +#define I2C_VAR +#define I2C_VAR_FAST +#define I2C_VAR_NOINIT +#define I2C_VAR_POWER_ON_INIT + + /********************************************************************************************************************** + * I2C END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD_I2C START + *********************************************************************************************************************/ + +#define CDD_I2C_APPL_CODE +#define CDD_I2C_APPL_CONST +#define CDD_I2C_APPL_DATA +#define CDD_I2C_CALLOUT_CODE +#define CDD_I2C_CODE +#define CDD_I2C_CONST +#define CDD_I2C_VAR +#define CDD_I2C_VAR_FAST +#define CDD_I2C_VAR_NOINIT +#define CDD_I2C_VAR_POWER_ON_INIT + + /********************************************************************************************************************** + * CDD_I2C END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * ICU START + *********************************************************************************************************************/ + +#define ICU_APPL_CODE +#define ICU_APPL_CONST +#define ICU_APPL_DATA +#define ICU_CALLOUT_CODE +#define ICU_CODE +#define ICU_CONST +#define ICU_VAR +#define ICU_VAR_FAST +#define ICU_VAR_NOINIT +#define ICU_VAR_POWER_ON_INIT +#define ICU_PBCFG + + /********************************************************************************************************************** + * ICU END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD_IPC START + *********************************************************************************************************************/ + +#define CDD_IPC_APPL_CODE +#define CDD_IPC_APPL_CONST +#define CDD_IPC_APPL_DATA +#define CDD_IPC_CALLOUT_CODE +#define CDD_IPC_CODE +#define CDD_IPC_CONST +#define CDD_IPC_VAR +#define CDD_IPC_VAR_FAST +#define CDD_IPC_VAR_NOINIT +#define CDD_IPC_VAR_POWER_ON_INIT +#define CDD_IPC_CFG + + /********************************************************************************************************************** + * CDD_IPC END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * LIN START + *********************************************************************************************************************/ + +#define LIN_APPL_CODE +#define LIN_APPL_CONST +#define LIN_APPL_DATA +#define LIN_CALLOUT_CODE +#define LIN_CODE +#define LIN_CONST +#define LIN_VAR +#define LIN_VAR_FAST +#define LIN_VAR_NOINIT +#define LIN_VAR_POWER_ON_INIT +#define LIN_PBCFG + +/********************************************************************************************************************** + * LIN END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * MCU START + *********************************************************************************************************************/ + +#define MCU_APPL_CODE +#define MCU_APPL_CONST +#define MCU_APPL_DATA +#define MCU_CALLOUT_CODE +#define MCU_CODE +#define MCU_CONST +#define MCU_VAR +#define MCU_VAR_FAST +#define MCU_VAR_NOINIT +#define MCU_VAR_POWER_ON_INIT +#define MCU_PBCFG + +/********************************************************************************************************************** + * MCU END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * PORT START + *********************************************************************************************************************/ + +#define PORT_APPL_CODE +#define PORT_APPL_CONST +#define PORT_APPL_DATA +#define PORT_CALLOUT_CODE +#define PORT_CODE +#define PORT_CONST +#define PORT_VAR +#define PORT_VAR_FAST +#define PORT_VAR_NOINIT +#define PORT_VAR_POWER_ON_INIT +#define PORT_PBCFG + +/********************************************************************************************************************** + * PORT END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * PWM START + *********************************************************************************************************************/ + +#define PWM_APPL_CODE +#define PWM_APPL_CONST +#define PWM_APPL_DATA +#define PWM_CALLOUT_CODE +#define PWM_CODE +#define PWM_CONST +#define PWM_VAR +#define PWM_VAR_FAST +#define PWM_VAR_NOINIT +#define PWM_VAR_POWER_ON_INIT +#define PWM_PBCFG + +/********************************************************************************************************************** + * PWM END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD_PWM START + *********************************************************************************************************************/ + +#define CDD_PWM_APPL_CODE +#define CDD_PWM_APPL_CONST +#define CDD_PWM_APPL_DATA +#define CDD_PWM_CALLOUT_CODE +#define CDD_PWM_CODE +#define CDD_PWM_CONST +#define CDD_PWM_VAR +#define CDD_PWM_VAR_FAST +#define CDD_PWM_VAR_NOINIT +#define CDD_PWM_VAR_POWER_ON_INIT +#define CDD_PWM_PBCFG + +/********************************************************************************************************************** + * CDD_PWM END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * SPI START + *********************************************************************************************************************/ + +#define SPI_APPL_CODE +#define SPI_APPL_CONST +#define SPI_APPL_DATA +#define SPI_CALLOUT_CODE +#define SPI_CODE +#define SPI_CONST +#define SPI_VAR +#define SPI_VAR_FAST +#define SPI_VAR_NOINIT +#define SPI_VAR_POWER_ON_INIT +#define SPI_CONFIG_DATA + +/********************************************************************************************************************** + * SPI END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * CDD_UART START + *********************************************************************************************************************/ + +#define CDD_UART_APPL_CODE +#define CDD_UART_APPL_CONST +#define CDD_UART_APPL_DATA +#define CDD_UART_CALLOUT_CODE +#define CDD_UART_CODE +#define CDD_UART_CONST +#define CDD_UART_VAR +#define CDD_UART_VAR_FAST +#define CDD_UART_VAR_NOINIT +#define CDD_UART_VAR_POWER_ON_INIT + + /********************************************************************************************************************** + * CDD_UART END + *********************************************************************************************************************/ + /********************************************************************************************************************** + * WDG START + *********************************************************************************************************************/ + +#define WDG_APPL_CODE +#define WDG_APPL_CONST +#define WDG_APPL_DATA +#define WDG_CALLOUT_CODE +#define WDG_CODE +#define WDG_CONST +#define WDG_VAR +#define WDG_VAR_FAST +#define WDG_VAR_NOINIT +#define WDG_VAR_POWER_ON_INIT + +/********************************************************************************************************************** + * WDG END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CSM START + *********************************************************************************************************************/ + +#define CSM_CODE +#define CSM_APPL_CODE +#define CSM_RTE_CODE + +#define CSM_CONST + +#define CSM_VAR_NOINIT +#define CSM_VAR_ZERO_INIT +#define CSM_APPL_VAR +#define CSM_APPL_CONST + +/********************************************************************************************************************** + * CSM END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * VSECPRIM START + *********************************************************************************************************************/ + +#define VSECPRIM_CODE +#define VSECPRIM_CONST +#define VSECPRIM_APPL_CONST +#define VSECPRIM_APPL_VAR +#define VSECPRIM_APPL_DATA + +/********************************************************************************************************************** + * VSECPRIM END + *********************************************************************************************************************/ + + +# define DET_CODE +# define DET_VAR +# define DET_APPL_DATA +# define DET_CONST + + + +/********************************************************************************************************************** + * WRAPNV START + *********************************************************************************************************************/ + +#define WRAPNV_CODE +#define WRAPNV_VAR_NOINIT +#define WRAPNV_CONST +#define WRAPNV_DATA +#define WRAPNV_NVM_APPL_DATA + +/********************************************************************************************************************** + * WRAPNV END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CANTP START + *********************************************************************************************************************/ + +#define CANTP_CODE +#define CANTP_CONST + +#define CANTP_PBCFG +#define CANTP_VAR_PBCFG + +#define CANTP_VAR_CLEARED +#define CANTP_VAR_NO_INIT + +#define CANTP_APPL_CODE +#define CANTP_APPL_DATA + +/********************************************************************************************************************** + * CANTP END + *********************************************************************************************************************/ + + + +/********************************************************************************************************************** + * VSTDLIB START + *********************************************************************************************************************/ + +#define VSTDLIB_CODE +#define VSTDLIB_VAR_FAR +#define VSTDLIB_APPL_VAR +#define VSTDLIB_CONST + +/********************************************************************************************************************** + * VSTDLIB END + *********************************************************************************************************************/ + + + + +/* Package Merger: Stop Section CompilerCfgModuleList */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + + +#endif /* COMPILER_CFG_H */ + +/********************************************************************************************************************** + * END OF FILE: Compiler_Cfg.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/EthSwt_GeneralTypes.h b/Source/bsw/Common/EthSwt_GeneralTypes.h new file mode 100644 index 0000000..b9a15d2 --- /dev/null +++ b/Source/bsw/Common/EthSwt_GeneralTypes.h @@ -0,0 +1,393 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file EthSwt_GeneralTypes.h + * \brief General Type Header of MICROSAR Ethernet Switch Driver + * + * \details The General Type Header contains the data types used. + * + *********************************************************************************************************************/ +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to Eth_GeneralTypes.h + *********************************************************************************************************************/ + +#if !defined (ETHSWT_GENERALTYPES_H) +# define ETHSWT_GENERALTYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# ifndef ETH_GENERAL_TYPES_H +# include "Eth_GeneralTypesDefs.h" +# include "EthTrcv_GeneralTypes.h" +# endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/*! Vendor and module identification */ +# define ETHSWT_30_VECTOR_VENDOR_ID (30u) +# define ETHSWT_30_VECTOR_MODULE_ID (89u) + +/*! EthSwt_StateType values */ +/*! \trace SPEC-2265331 */ +# define ETHSWT_STATE_UNINIT (0x00u) +# define ETHSWT_STATE_INIT (0x01u) +# define ETHSWT_STATE_ACTIVE (0x02u) + +/*! EthSwt_MacLearningType values */ +/*! \trace SPEC-2265334 */ +# define ETHSWT_MACLEARNING_HWDISABLED (0x00u) +# define ETHSWT_MACLEARNING_HWENABLED (0x01u) +# define ETHSWT_MACLEARNING_SWENABLED (0x02u) + +/*! EthSwt_PortModeType values */ +# define ETHSWT_MODE_DOWN_SWITCHPORT ETHTRCV_MODE_DOWN +# define ETHSWT_MODE_ACTIVE_SWITCHPORT ETHTRCV_MODE_ACTIVE + +/*! EthSwt_VlanFwType values */ +# define ETHSWT_NOT_SENT (0x00u) +# define ETHSWT_SENT_TAGGED (0x01u) +# define ETHSWT_SENT_UNTAGGED (0x02u) + +/*! Enumeration values for type EthSwt_PhysicalLayerType */ +# define ETHSWT_PORT_BROAD_R_REACH (0u) +# define ETHSWT_PORT_BASE_T (1u) +# define ETHSWT_PORT_RTPGE (2u) +# define ETHSWT_PORT_X_MII (3u) +# define ETHSWT_PORT_INTERNAL (4u) +# define ETHSWT_PORT_10BASE_T1S (5u) + +/*! Enumeration values for the different possible speed configurations of a switch port */ +# define ETHSWT_PORT_SPEED_10 ETHTRCV_BAUD_RATE_10MBIT +# define ETHSWT_PORT_SPEED_100 ETHTRCV_BAUD_RATE_100MBIT +# define ETHSWT_PORT_SPEED_1000 ETHTRCV_BAUD_RATE_1000MBIT +# define ETHSWT_PORT_SPEED_2500 ETHTRCV_BAUD_RATE_2500MBIT +# define ETHSWT_PORT_SPEED_5000 ETHTRCV_BAUD_RATE_5000MBIT +# define ETHSWT_PORT_SPEED_10000 ETHTRCV_BAUD_RATE_10000MBIT +# define ETHSWT_PORT_SPEED_DONT_CARE (0xFFu) + +/*! Enumeration values for the different possible duplex mode configurations of a switch port */ +#define ETHSWT_DUPLEX_MODE_HALF ETHTRCV_DUPLEX_MODE_HALF +#define ETHSWT_DUPLEX_MODE_FULL ETHTRCV_DUPLEX_MODE_FULL + +/*! Enumeration values for type EthSwt_XMiiPortMgmtType */ +# define ETHSWT_NO_PHY (0u) +# define ETHSWT_PHY_MANAGED_BY_MCU (1u) +# define ETHSWT_PHY_MANAGED_BY_SWITCH (2u) + +/*! Enumeration values for type EthSwt_XMiiPortConnectionType */ +#define ETHSWT_RVMII (0x00u) +#define ETHSWT_MII (0x01u) +#define ETHSWT_RGMII (0x02u) +#define ETHSWT_SGMII (0x03u) +#define ETHSWT_USXGMII (0x04u) +#define ETHSWT_HISGMII (0x05u) +#define ETHSWT_RMII (0x06u) +#define ETHSWT_XGMII (0x07u) + +/*! Enumeration values for type EthSwt_MCastPortAssignActionType */ +# define ETHSWT_MCAST_PORT_ASSIGN_ACTION_ADD (0u) +# define ETHSWT_MCAST_PORT_ASSIGN_ACTION_REMOVE (1u) + +/*! Enumeration values for type EthSwt_ArlEntryTypeType */ +# define ETHSWT_ARL_TABLE_ENTRY_TYPE_ANY (0u) +# define ETHSWT_ARL_TABLE_ENTRY_TYPE_LEARNED (1u) +# define ETHSWT_ARL_TABLE_ENTRY_TYPE_STATIC (2u) + +/*! Hardware port identification */ +# define ETHSWT_PORT_0 (0u) +# define ETHSWT_PORT_1 (1u) +# define ETHSWT_PORT_2 (2u) +# define ETHSWT_PORT_3 (3u) +# define ETHSWT_PORT_4 (4u) +# define ETHSWT_PORT_5 (5u) +# define ETHSWT_PORT_6 (6u) +# define ETHSWT_PORT_7 (7u) +# define ETHSWT_PORT_8 (8u) +# define ETHSWT_PORT_9 (9u) +# define ETHSWT_PORT_10 (10u) +# define ETHSWT_PORT_11 (11u) +# define ETHSWT_PORT_12 (12u) +# define ETHSWT_PORT_13 (13u) +# define ETHSWT_PORT_14 (14u) +# define ETHSWT_PORT_15 (15u) +# define ETHSWT_PORT_16 (16u) +# define ETHSWT_PORT_17 (17u) +# define ETHSWT_PORT_18 (18u) +# define ETHSWT_PORT_19 (19u) +# define ETHSWT_PORT_20 (20u) +# define ETHSWT_PORT_21 (21u) +# define ETHSWT_PORT_22 (22u) +# define ETHSWT_PORT_23 (23u) +# define ETHSWT_PORT_24 (24u) +# define ETHSWT_PORT_25 (25u) +# define ETHSWT_PORT_26 (26u) +# define ETHSWT_PORT_27 (27u) +# define ETHSWT_PORT_28 (28u) +# define ETHSWT_PORT_29 (29u) +# define ETHSWT_PORT_30 (30u) +# define ETHSWT_PORT_31 (31u) + +/*! Highest valid VLAN ID */ +# define ETHSWT_VLAN_MAX_VID (4094u) +/*! Invalid VLAN ID */ +# define ETHSWT_VLAN_INV_VID (ETHSWT_VLAN_MAX_VID + 1u) + +# define ETHSWT_MAX_ARL_ENTRIES (65535u) + +# define ETHSWT_DROP_COUNT_NUM (14u) +# define ETHSWT_ETHERT_STATS_NUM (17u) + +/*! Identification of invalid/unused switch ports */ +# define ETHSWT_INV_PORT_IDX (0xFFu) +# define ETHSWT_PORT_NOT_CONFIGURED ETHSWT_INV_PORT_IDX +# define ETHSWT_PORT_NO_TRCV_DRV_USED ETHSWT_INV_PORT_IDX +# define ETHSWT_PORT_NO_MII_ACCESS ETHSWT_INV_PORT_IDX +# define ETHSWT_NO_XMII_PORT ETHSWT_INV_PORT_IDX + +/*! Enumeration values for type EthSwt_PortMirrorStateType */ +# define ETHSWT_PORT_MIRROR_DISABLED (0x00u) +# define ETHSWT_PORT_MIRROR_ENABLED (0x01u) +# define ETHSWT_PORT_MIRROR_INVALID (0x02u) + +/*! Enumeration values for MirroringMode */ +# define ETHSWT_MIRROR_MODE_NO_VLAN_RETAGGING (0x00u) +# define ETHSWT_MIRROR_MODE_VLAN_RETAGGING (0x01u) +# define ETHSWT_MIRROR_MODE_DOUBLE_VLAN_RETAGGING (0x02u) + +/*! Enumeration values for EthSwt_MgmtOwner */ +# define ETHSWT_MGMT_OBJ_UNUSED (0x00u) +# define ETHSWT_MGMT_OBJ_OWNED_BY_ETHSWT (0x01u) +# define ETHSWT_MGMT_OBJ_OWNED_BY_UPPER_LAYER (0x02u) + +/*! User Defined return value returned by Hardware Filter interface */ +# define ETHSWT_HW_FILTER_E_STATE_PENDING (2u) +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ +/* PRQA S 0342,0881 ETHSWT_GENERAL_GLUE_OPERATOR */ /* MD_MSR_19.13_0342 */ + +/*! Macro for better readability of start of exclusive area */ +# define EthSwt_EnterExclusiveArea(Derivative, Area) \ + SchM_Enter_EthSwt_30_##Derivative##_EXCLUSIVE_AREA_##Area() + +/*! Macro for better readability of end of exclusive area */ +# define EthSwt_ExitExclusiveArea(Derivative, Area) \ + SchM_Exit_EthSwt_30_##Derivative##_EXCLUSIVE_AREA_##Area() + +/* PRQA L:ETHSWT_GENERAL_GLUE_OPERATOR */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +/*! Dummy type for multiple configuration. (Isn't supported by AUTOSAR at the moment) */ +/*! \trace SPEC-2265332 */ +typedef struct +{ + uint8 DummyData; /**< dummy data because multiple configuration isn't supported */ +} EthSwt_ConfigType; + +/*! AUTOSAR type (deviation) for holding MAC address, VLAN ID and port mapping information. */ +/*! \trace SPEC-2265333 */ +typedef struct +{ + uint8 MacAddr[6]; /**< MAC address */ + uint16 VlanId; /**< VLAN ID */ + uint32 SwitchPort; /**< Switch port bitmask, bit indices correspond to EthSwtPortIdx (deviation) */ +} EthSwt_MacVlanType; + +/*! AUTOSAR type for module state. */ +/*! \trace SPEC-2265331 */ +typedef uint8 EthSwt_StateType; + +/*! AUTOSAR type for switch index. */ +typedef uint8 EthSwt_SwitchIdxType; + +/*! AUTOSAR type for port index. */ +typedef uint8 EthSwt_PortIdxType; + +/*! AUTOSAR type for buffer level. */ +typedef uint32 EthSwt_BufferLevelType; + +/*! AUTOSAR type for MAC learning type. */ +/*! \trace SPEC-2265334 */ +typedef uint8 EthSwt_MacLearningType; + +/*! AUTOSAR type for port mode. */ +typedef uint8 EthSwt_PortModeType; + +/*! Type of VLAN forwarding */ +typedef uint8 EthSwt_VlanFwType; + +/*! Type of the phyiscal layer of a port */ +typedef uint8 EthSwt_PhysicalLayerType; + +/*! Type for indicating which interface is used for managing a PHY connected to a xMii port */ +typedef uint8 EthSwt_XMiiPortMgmtType; + +/*! Type for indicating which connection type is used for a PHY connected to a xMii port */ +typedef uint8 EthSwt_XMiiPortConnectionType; + +/*! AUTOSAR type for holding the management information for Ethernet frames received/transmitted on switch ports. */ +typedef struct +{ + EthSwt_SwitchIdxType SwitchIdx; /**< EthSwt switch index */ + uint8 PortIdx; /**< EthSwt port index, config view (SNV) */ +} EthSwt_MgmtInfoType; + +/*! AUTOSAR type for holding validity information of the management information contained in EthSwt_MgmtObjectType */ +typedef struct +{ + Std_ReturnType IngressTimestampValid; + Std_ReturnType EgressTimestampValid; + Std_ReturnType MgmtInfoValid; +} EthSwt_MgmtObjectValidType; + +/*! AUTOSAR type for holding ownership information of EthSwt_MgmtObjectType */ +typedef uint8 EthSwt_MgmtOwner; + +/*! Type for holding egress timestamp information for asymmetric time synchronization */ +typedef struct +{ + uint8 CfgPortIdx; /*!< EthSwt port index, config view (SNV) */ + Std_ReturnType EgressTimestampValid; + Eth_TimeStampType EgressTimestamp; +} EthSwt_VMgmtEgrTsInfoType; + +/*! Type for holding additional information for asymmetric time synchronization of EthSwt_MgmtObjectType */ +typedef struct +{ + uint8 NumEgrTsInfos; + EthSwt_VMgmtEgrTsInfoType *EgrTsInfoPtr; +} EthSwt_VMgmtObjectAddInfoType; + +/*! AUTOSAR type (deviation) for sharing management information with protocol stack (upper layers) */ +/*! \trace SPEC-20655611 */ +typedef struct +{ + EthSwt_MgmtObjectValidType Validation; + Eth_TimeStampType IngressTimestamp; + Eth_TimeStampType EgressTimestamp; + EthSwt_MgmtInfoType MgmtInfo; + EthSwt_MgmtOwner Ownership; + EthSwt_VMgmtObjectAddInfoType AddInfo; /*!< For asymmetric time synchronization */ +} EthSwt_MgmtObjectType; + +/*! Type for defining the action that is applied during EthSwt_UpdateMCastPortAssignment() */ +typedef uint8 EthSwt_MCastPortAssignActionType; + +/*! Type of address resolution table entry */ +typedef uint8 EthSwt_ArlEntryTypeType; + +/*! MAC address forwarding type */ +typedef struct +{ + uint32 PortFwVector; /*!< Bitmask defining the port forwarding vector: Bit 0 -> HwPort 0, Bit 1 -> HwPort 1, ... */ + uint8 Mac[ETH_PHYS_ADDR_LEN_BYTE]; /*!< Related MAC address */ +} EthSwt_MacFwInfoType; + +/*! VLAN modification type */ +typedef struct +{ + uint32 EgressAllowed; /*!< Bit mask defining egress allowed ports: Bit 0 -> HwPort 0, Bit 1 -> HwPort 1, ... */ + uint32 IngressAllowed; /*!< Bit mask defining ingress allowed ports: Bit 0 -> HwPort 0, Bit 1 -> HwPort 1, ... */ + uint32 EgressTagged; /*!< Bit mask defining egress tagged ports: Bit 0 -> HwPort 0, Bit 1 -> HwPort 1, ... */ + uint16 VlanId; /*!< Related VLAN ID */ +} EthSwt_VlanModType; + +/*! Port mirroring configuration type */ +typedef struct +{ + uint8 CapturePortIdx; /*!< Switch port which captures mirrored traffic + - symbolic name value from configuration must be used */ + uint8 srcMacAddrFilter[ETH_PHYS_ADDR_LEN_BYTE]; /*!< Source MAC address of packets which shall be mirrored */ + uint8 dstMacAddrFilter[ETH_PHYS_ADDR_LEN_BYTE]; /*!< Destination MAC address of packets which shall be mirrored */ + uint16 VlanIdFilter; /*!< VLAN ID of frames which shall be mirrored */ + uint8 MirroringPacketDivider; /*!< Limits mirrored frames: 1 -> all frames, 2 -> every second frame, ... */ + uint8 MirroringMode; /*!< Retagging of mirrored frames: 0x00 == no VLAN retagging, + * 0x01 == VLAN retagging, 0x02 == VLAN double retagging */ + uint16 VlanOuterTag; /*!< VLAN ID used for VLAN retagging or as outer tag for VLAN double retagging */ + uint16 VlanInnerTag; /*!< VLAN ID used as inner tag for VLAN double retagging */ + uint32 MirroredSwitchEgressPortIdxBitMask; /*!< Bit mask defining ports where egress frames shall be mirrored + - symbolic name values from configuration must be used */ + uint32 MirroredSwitchIngressPortIdxBitMask; /*!< Bit mask defining ports where ingress frames shall be mirrored + - symbolic name values from configuration must be used */ +} EthSwt_PortMirrorCfgType; + +/*! Switch port mirroring state type */ +typedef uint8 EthSwt_PortMirrorStateType; + +/*! Type for Hardware Filter match data */ +typedef uint8 FilterEntryMatchDataType; + +/*! Type for Hardware Filter mask data */ +typedef uint8 FilterEntryMaskDataType; + +/*! Type for total lenth of hardware filter match and mask data */ +typedef uint16 FilterEntryLengthType; + +/*! Type for indicating which Hardware Filter Action needs to be selected */ +typedef enum +{ + ETHSWT_FILTER_ACTION_NONE, + ETHSWT_FILTER_ACTION_ALLOW, + ETHSWT_FILTER_ACTION_FORWARD, + ETHSWT_FILTER_ACTION_BLOCK, + ETHSWT_FILTER_ACTION_VLAN_MODIFICATION, + ETHSWT_FILTER_ACTION_VLAN_MODIFICATION_FORWARD +} EthSwt_HwFilterEntryActionType; + +/*! Type for indicating which Destination Port Modification type is used when Destination Port Modification is selected */ +typedef enum +{ + ETHSWT_STREAM_EGRESS_DESTINATION_TYPE_DONT_CARE, + ETHSWT_STREAM_EGRESS_DESTINATION_EXTEND, + ETHSWT_STREAM_EGRESS_DESTINATION_LIMIT, + ETHSWT_STREAM_EGRESS_DESTINATION_OVERWRITE +} EthSwt_StreamFiltActionDPVType; + +/*! Type for configuring mask and match data for Hardware Filter entry */ +typedef struct +{ + const FilterEntryMatchDataType *FilterEntryMatchDataPtr; + const FilterEntryMaskDataType *FilterEntryMaskDataPtr; + FilterEntryLengthType FilterEntryLength; +} EthSwt_FilterEntryInfoType; + +/*! Type for configuring entries in hardware using Hardware Filter interface */ +typedef struct +{ + EthSwt_FilterEntryInfoType HwFilterEntryInfo; + uint32 UsedPortsMask; + uint32 DestPortsMask; + uint32 RxQueueId; + uint16 ModifiedVlanID; + uint16 StreamId; + uint16 FlowMeterId; + EthSwt_HwFilterEntryActionType HwFilterAction; + EthSwt_StreamFiltActionDPVType DPVType; +} EthSwt_HwFilterEntryConfigType; + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +#endif /* ETHSWT_GENERALTYPES_H */ + +/********************************************************************************************************************** + * END OF FILE: EthSwt_GeneralTypes.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/EthTrcv_GeneralTypes.h b/Source/bsw/Common/EthTrcv_GeneralTypes.h new file mode 100644 index 0000000..f542b6c --- /dev/null +++ b/Source/bsw/Common/EthTrcv_GeneralTypes.h @@ -0,0 +1,176 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file EthTrcv_GeneralTypes.h + * \brief Ethernet transceiver general types header + * + * \details General types header for Ethernet Transceiver Driver + * + *********************************************************************************************************************/ +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to Eth_GeneralTypes.h + *********************************************************************************************************************/ + +#if !defined (ETHTRCV_GENERAL_TYPES_H) +# define ETHTRCV_GENERAL_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* ETHTRCV modes */ +# define ETHTRCV_MODE_DOWN (0x00U) +# define ETHTRCV_MODE_ACTIVE (0x01U) +# define ETHTRCV_MODE_ACTIVE_WITH_WAKEUP_REQUEST (0x02U) + +/* ETHTRCV link states */ +# define ETHTRCV_LINK_STATE_DOWN (0x00U) +# define ETHTRCV_LINK_STATE_ACTIVE (0x01U) + +/* ETHTRCV baud rates */ +# define ETHTRCV_BAUD_RATE_10MBIT (0x00U) +# define ETHTRCV_BAUD_RATE_100MBIT (0x01U) +# define ETHTRCV_BAUD_RATE_1000MBIT (0x02U) +# define ETHTRCV_BAUD_RATE_2500MBIT (0x03U) +# define ETHTRCV_BAUD_RATE_5000MBIT (0x04U) +# define ETHTRCV_BAUD_RATE_10000MBIT (0x05U) + +/* ETHTRCV duplex modes */ +# define ETHTRCV_DUPLEX_MODE_HALF (0x00U) +# define ETHTRCV_DUPLEX_MODE_FULL (0x01U) + +/* ETHTRCV state */ +# define ETHTRCV_STATE_UNINIT (0x00U) +# define ETHTRCV_STATE_INIT (0x01U) +# define ETHTRCV_STATE_ACTIVE (0x02U) +# define ETHTRCV_STATE_DOWN (0x03U) + +/* ETHTRCV wakeup types */ +# define ETHTRCV_WAKEUP_NOT_SUPPORTED (0x00U) +# define ETHTRCV_WAKEUP_BY_INTERRUPT (0x01U) +# define ETHTRCV_WAKEUP_BY_POLLING (0x02U) +# define ETHTRCV_WAKEUP_BY_ASYNCHRONOUS_CHECK (0x03U) + +/* ETHTRCV wakeup modes */ +# define ETHTRCV_WUM_DISABLE (0x00U) +# define ETHTRCV_WUM_ENABLE (0x01U) +# define ETHTRCV_WUM_CLEAR (0x02U) + +/* ETHTRCV wakeup reasons */ +# define ETHTRCV_WUR_NONE (0x00U) +# define ETHTRCV_WUR_GENERAL (0x01U) +# define ETHTRCV_WUR_BUS (0x02U) +# define ETHTRCV_WUR_INTERNAL (0x03U) +# define ETHTRCV_WUR_RESET (0x04U) +# define ETHTRCV_WUR_POWER_ON (0x05U) +# define ETHTRCV_WUR_PIN (0x06U) +# define ETHTRCV_WUR_SYSERR (0x07U) +# define ETHTRCV_WUR_WODL_WUP (0x08U) +# define ETHTRCV_WUR_WODL_WUR (0x09U) +# define ETHTRCV_WUR_TRANSFER (0x0AU) +/* count of AUTOSAR wakeup reasons defined for the transceiver */ +# define ETHTRCV_WUR_NUM (0x0AU) + +/* Masks defining the bitpositions of the AUTOSAR wakeup reasons for type EthTrcv_WakeupReasonFlagsType. */ +# define ETHTRCV_WUR_GENERAL_FLAGS_MASK (0x01U) +# define ETHTRCV_WUR_BUS_FLAGS_MASK (0x02U) +# define ETHTRCV_WUR_INTERNAL_FLAGS_MASK (0x04U) +# define ETHTRCV_WUR_RESET_FLAGS_MASK (0x08U) +# define ETHTRCV_WUR_POWER_ON_FLAGS_MASK (0x10U) +# define ETHTRCV_WUR_PIN_FLAGS_MASK (0x20U) +# define ETHTRCV_WUR_SYSERR_FLAGS_MASK (0x40U) +# define ETHTRCV_WUR_WODL_WUP_FLAGS_MASK (0x80U) +# define ETHTRCV_WUR_WODL_WUR_FLAGS_MASK (0x100U) +# define ETHTRCV_WUR_TRANSFER_FLAGS_MASK (0x200U) +# define ETHTRCV_WUR_CLEAR_MASK (0x00U) + +/* EthTrcv wakeup inspection types */ +# define ETHTRCV_ICU_CHANNEL (0x01U) +# define ETHTRCV_TRCV_REGISTERS (0x02U) +# define ETHTRCV_USER_CODE (0x03U) + +/* ETHTRCV MII modes */ +# define ETHTRCV_MII_MODE (0x00U) +# define ETHTRCV_LIGHT_MII_MODE (0x01U) +# define ETHTRCV_RMII_MODE (0x02U) +# define ETHTRCV_RMII_XTAL_MODE (0x03U) +# define ETHTRCV_GMII_MODE (0x04U) +# define ETHTRCV_RGMII_MODE (0x05U) +# define ETHTRCV_RGMII_XTAL_MODE (0x06U) +# define ETHTRCV_STRAPPING_CONFIG_ONLY (0x07U) +# define ETHTRCV_DONT_CARE (0xFFU) + +/* ETHTRCV CONN NEG modes*/ +# define ETHTRCV_CONN_NEG_AUTO (0x00U) +# define ETHTRCV_CONN_NEG_MASTER (0x01U) +# define ETHTRCV_CONN_NEG_SLAVE (0x02U) +# define ETHTRCV_CONN_NEG_MANUAL (0x03U) + +# define ETHTRCV_PHYS_ADDR_LEN_BYTE (0x06U) + +/* ETHTRCV Phy Test Modes */ +# define ETHTRCV_PHYTESTMODE_NONE (0x00U) /* Normal operation*/ +# define ETHTRCV_PHYTESTMODE_1 (0x01U) /* Test transmitter drop */ +# define ETHTRCV_PHYTESTMODE_2 (0x02U) /* Test master timing jitter */ +# define ETHTRCV_PHYTESTMODE_3 (0x03U) /* Test slave timing jitter */ +# define ETHTRCV_PHYTESTMODE_4 (0x04U) /* Test transmitter distortion */ +# define ETHTRCV_PHYTESTMODE_5 (0x05U) /* Test power spectral density */ + +/* ETHTRCV Phy Loopback Modes */ +# define ETHTRCV_PHYLOOPBACK_NONE (0x00U) /* Normal operation */ +# define ETHTRCV_PHYLOOPBACK_INTERNAL (0x01U) /* Internal Loopback */ +# define ETHTRCV_PHYLOOPBACK_EXTERNAL (0x02U) /* External Loopback */ +# define ETHTRCV_PHYLOOPBACK_REMOTE (0x03U) /* Remote loopback */ + +/* ETHTRCV Phy Tx Modes */ +# define ETHTRCV_PHYTXMODE_NORMAL (0x00U) /* Normal Operation */ +# define ETHTRCV_PHYTXMODE_TX_OFF (0x01U) /* Transmitter disabled */ +# define ETHTRCV_PHYTXMODE_SCRAMBLER_OFF (0x02U) /* Scrambler disabled */ + +/* ETHTRCV Cable Diagnostic Status */ +# define ETHTRCV_CABLEDIAG_OK (0x00U) /* Cable diagnostic ok */ +# define ETHTRCV_CABLEDIAG_ERROR (0x01U) /* Cable diagnostic failed*/ +# define ETHTRCV_CABLEDIAG_SHORT (0x02U) /* Short circuit detected */ +# define ETHTRCV_CABLEDIAG_OPEN (0x03U) /* Open circuit detected */ +# define ETHTRCV_CABLEDIAG_PENDING (0x04U) /* Cable diagnostic is still running */ +# define ETHTRCV_CABLEDIAG_WRONG_POLARITY (0x05U) /* Wrong polarity detected */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +typedef uint8 EthTrcv_ModeType; +typedef uint8 EthTrcv_LinkStateType; +typedef uint8 EthTrcv_BaudRateType; +typedef uint8 EthTrcv_DuplexModeType; +typedef uint8 EthTrcv_StateType; +typedef uint8 EthTrcv_WakeupModeType; +typedef uint8 EthTrcv_WakeupReasonType; +typedef uint8 EthTrcv_WakeupReasonFlagsType; +typedef uint8 EthTrcv_WakeupInspectionType; +typedef uint8 EthTrcv_PhysAddrType[ETHTRCV_PHYS_ADDR_LEN_BYTE]; +typedef uint8 EthTrcv_PhyTestModeType; +typedef uint8 EthTrcv_PhyLoopbackModeType; +typedef uint8 EthTrcv_PhyTxModeType; +typedef uint8 EthTrcv_CableDiagResultType; + +#endif /* ETHTRCV_GENERAL_TYPES_H */ + +/********************************************************************************************************************** + * END OF FILE: EthTrcv_GeneralTypes.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/Eth_GeneralTypes.h b/Source/bsw/Common/Eth_GeneralTypes.h new file mode 100644 index 0000000..e7069bd --- /dev/null +++ b/Source/bsw/Common/Eth_GeneralTypes.h @@ -0,0 +1,91 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file Eth_GeneralTypes.h + * \brief General types header for the Ethernet stack + * + * \details Holds general data types and defines provided to and used by multiple components of the Vector + * Ethernet stack. + * + *********************************************************************************************************************/ +/********************************************************************************************************************** + * REVISION HISTORY + * ---------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ---------------------------------------------------------------------------------------------------------------------- + * 00.01.00 2017-07-14 visfer - Initial creation based on merge of Eth_GeneralTypes.h, + * EthTrcv_GeneralTypes.hand EthSwt_GeneralTypes.h, + * adaptions for AUTOSAR compliance + * 00.02.00 2017-10-04 visfer - Reorder members of Eth_TimeStampType, added Eth_CounterType and + * Eth_TxErrorCounterValuesType + * 03.00.00 2018-11-20 visnhe STORYC-5875 Release Impl_EthGeneralTypes of CommonAsr__Common + * 03.00.01 2019-02-25 vismha ESCAN00102246 Compiler error: EthSwt_GeneralTypes.h missing identifiers + * 04.00.00 2019-04-29 visdrr STORYC-7881 Interface between DrvEth__coreAsr and DrvEthSwitch__coreAsr according to ASR4.4.x (DrvEthSwitch__coreAsr) + * STORYC-7882 Interface between DrvEth__coreAsr and DrvEthSwitch__coreAsr according to ASR4.4.x (DrvEth__coreAsr) + * 04.00.01 2019-05-22 visdrr ESCAN00103216 Unused types and struct members defined in Eth_GeneralTypes and + * EthSwt_GeneralTypes + * 2019-07-02 vismha STORYC-7864 Introduce management object retrieval in reception path + * STORYC-7865 Introduce management object retrieval in transmission path + * 04.01.00 2020-04-16 visdrr ETH-1255 Provide information about dropped frames due to insufficient Tx/Rx + * software buffers + * 2020-04-23 visken ESCAN00105580 SGMII configuration incomplete - Added type and defenitions in + * EthSwt_GeneralTypes to store xMII connection type of a switch port + * 04.02.00 2021-05-11 visken ETHPLAY-28 Allow basic switching based on MAC address only - Added new definitions + * for PortSpeed, BaudRate and XMiiPortConnectionType + * 04.03.00 2021-11-17 virpab ETHPLAY-1759 Introduction of new definitions for CableDiagResult to CommonAsr__Common + * 04.04.00 2022-08-09 visapp ETHPLAY-2576 Change typedef EthSwt_MacVlanType in EthSwt_GeneralTypes.h to support + * uint32 bitmask in element SwitchPort + * 04.05.00 2022-11-25 dkeswani ETHPLAY-1788 Add asymmetric time synchronization support + * 04.06.00 2023-03-01 baubeck ETHCIF-2465 Added missing types from ASR 4.3.0, 4.6.0 and 4.7.0. + * Changed Eth_RateRatioType to struct. + * 04.07.00 2023-04-03 mloy ETHCIF-1591 Implement USXGMII support. + * 04.08.00 2023-06-12 mmares ETHCIF-4052 Communication speeds 5Gbit/s and 10 Gbit/s were added + * 04.09.00 2023-07-10 dkeswani ETHPLAY-4899 Add Destination Port Modification Types in EthSwtGeneralTypes.h + * 04.10.00 2024-10-22 visdep OSHAL-2156 Introduced conditional typedef for Eth_TimeStampType based on the + * existence of TimeStampType to avoid type redefinition conflicts. + * 04.11.00 2024-11-05 dkeswani ETHPLAY-5526 Define EthSwt_HwFilterEntryConfigType at EthSwt_GeneralTypes.h + * 2024-11-06 pkotteti DADC-145 WODL feature supportive Transceiver Macros + * 2024-11-11 dkeswani ETHPLAY-3532 Analyse how to configure half duplex mode and implement it - Added new + * types for Half and Full Duplex + * 04.12.00 2024-11-22 visdep OSHAL-2322 Conditionally introduced TimeStamp types from AR23-11 if they are not + * already defined in ComStack_Types.h + * 04.13.00 2024-11-22 pkotteti DADC-145 WODL feature supportive Transceiver Macros + * 04.14.00 2025-02-25 baubeck ETHCIF-10194 Introduce Eth_RateDeviationType and Eth_StreamStatisticCounterType + * 04.15.00 2025-02-27 viraid ETHPLAY-5370 Change the Eth_DataType from uint32 to uint8 + * 04.16.00 2025-02-27 pkotteti PS-7666 WODL feature supportive Transceiver Macros + * 04.17.00 2025-06-23 baubeck ETHCIF-11432 Add Preprocessor Conditionals Around Eth_SpiStatusType and + * Eth_RateDeviationType + * 04.18.00 2025-06-25 mbodenstein ENOVA-59 Introduce Eth_TimestampQualType and #define ETH_TIMESTAMP_QUAL_TYPE_IN_ETH_GENERAL_TYPES + * to indicate that Eth_TimestampQualType is available in Eth_GeneralTypes. + * 04.18.01 2025-07-03 mbodenstein ENOVA-1256 Fix Typo in Eth_TimeStampQualType. + * 04.19.00 2025-07-07 mschmitt ETHPLAY-7001 Add PhysicalLayerType for 10BASE-T1S + * 04.20.00 2025-08-07 jgrandhi ETHPLAY-1710 Move All SWS EthernetDriver related Definations to new file Eth_GeneralTypesDefs.h + * 04.21.00 2025-10-24 dkeswani ETHPLAY-7948 Introduction of PENDING state as return value for HW Filter APIs + **********************************************************************************************************************/ +#ifndef ETH_GENERAL_TYPES_H +# define ETH_GENERAL_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" +# include "ComStack_Types.h" +# include "Eth_GeneralTypesDefs.h" +# include "EthTrcv_GeneralTypes.h" +# include "EthSwt_GeneralTypes.h" + +#endif /* ETH_GENERAL_TYPES_H */ + +/********************************************************************************************************************** + * END OF FILE: Eth_GeneralTypes.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/Eth_GeneralTypesDefs.h b/Source/bsw/Common/Eth_GeneralTypesDefs.h new file mode 100644 index 0000000..4e0714d --- /dev/null +++ b/Source/bsw/Common/Eth_GeneralTypesDefs.h @@ -0,0 +1,315 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file Eth_GeneralTypesDefs.h + * \brief General types header for the Ethernet stack + * + * \details Holds general data types and defines provided to and used by multiple components of the Vector + * Ethernet stack. + * + *********************************************************************************************************************/ +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to Eth_GeneralTypes.h + *********************************************************************************************************************/ + +#ifndef ETH_GENERAL_TYPES_DEFS_H +# define ETH_GENERAL_TYPES_DEFS_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" +# include "ComStack_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* ETH modes */ +# define ETH_MODE_DOWN (0x00u) +# define ETH_MODE_ACTIVE (0x01u) +# define ETH_MODE_ACTIVE_WITH_WAKEUP_REQUEST (0x02u) +# define ETH_MODE_ACTIVE_TX_OFFLINE (0x03u) + +/* ETH return type */ +# define ETH_OK (0x00u) +# define ETH_E_NOT_OK (0x01u) +# define ETH_E_NO_ACCESS (0x02u) + +/* ETH RX status type */ +# define ETH_RECEIVED (0x00u) +# define ETH_NOT_RECEIVED (0x01u) +# define ETH_RECEIVED_MORE_DATA_AVAILABLE (0x02u) +# define ETH_RECEIVED_FRAMES_LOST (0x03u) + +/* ETH filter action types */ +# define ETH_ADD_TO_FILTER (0x00u) +# define ETH_REMOVE_FROM_FILTER (0x01u) + +/* ETH states */ +# define ETH_STATE_UNINIT (0x00u) +# define ETH_STATE_INIT (0x01u) +# define ETH_STATE_ACTIVE (0x02u) +# define ETH_STATE_MODE_DOWN (0x03u) +# define ETH_STATE_MODE_ACTIVE (0x04u) + +/* ETH MII modes */ +# define ETH_MII_MODE (0x00u) +# define ETH_RMII_MODE (0x01u) +# define ETH_GMII_MODE (0x02u) +# define ETH_RGMII_MODE (0x03u) +# define ETH_SGMII_MODE (0x04u) +# define ETH_USXGMII_MODE (0x05u) + +# define ETH_INVALID_FRAME_ID (0x00u) + +# define ETH_PHYS_ADDR_LEN_BYTE (6u) +# define ETH_ETHER_TYPE_LEN_BYTE (2u) +# define ETH_HEADER_LEN_BYTE (14u) + +/* ETH Timestamp Quality Types */ +# define ETH_TIMESTAMP_VALID (0u) +# define ETH_TIMESTAMP_INVALID (1u) +# define ETH_TIMESTAMP_UNCERTAIN (2u) + +/* ETH Timestamp Quality Types */ +# define ETH_VALID (0u) /* Timestamp is valid */ +# define ETH_INVALID (1u) /* Timestamp is invalid */ +# define ETH_UNCERTAIN (2u) /* Status of timestamp is uncertain */ + +/*! Value defining that the counter isn't supported */ +# define ETH_RXTX_STATS_INV_COUNTER_VAL (0xFFFFFFFFu) +/*! Value defining that the counter has overflown */ +# define ETH_RXTX_STATS_COUNTER_OVERFLOW_VAL (0xFFFFFFFEu) +/*! Value defining the maximum possible counter value */ +# define ETH_RXTX_STATS_MAX_COUNTER_VAL (0xFFFFFFFDu) + +/* Transceiver speeds in [bit/s] */ +# define ETH_TRCV_SPEED_10MBITS_IN_BITS (10000000u) +# define ETH_TRCV_SPEED_100MBITS_IN_BITS (100000000u) +# define ETH_TRCV_SPEED_1000MBITS_IN_BITS (1000000000u) +# define ETH_TRCV_SPEED_2500MBITS_IN_BITS (2500000000u) +# define ETH_TRCV_SPEED_5000MBITS_IN_BITS (5000000000u) +# define ETH_TRCV_SPEED_10000MBITS_IN_BITS (10000000000u) +# define ETH_TRCV_SPEED_DONT_CARE (0xFFFFFFFFu) + +/* ETH Measurement Index Types */ +# define ETH_MEAS_ALL (0xFFu) +# define ETH_MEAS_VENDOR_SPECIFIC_DROP_INSUFF_TX_BUFFER (0x90u) +# define ETH_MEAS_VENDOR_SPECIFIC_WARN_FULL_RX_BUFFER (0x91u) +# define ETH_MEAS_VENDOR_SPECIFIC_DROP_INSUFF_RX_BUFFER (0x92u) + +# ifndef NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES +/* Type that indicates the current status of the rate calculation */ +# define ETH_RATE_OK (0x00u) /* A valid rate deviaton value is available/calculated */ +# define ETH_RATE_NOT_AVAILABLE (0xFEu) /* No valid rate deviation value available/calculated */ +# define ETH_RATE_EXCEEDED (0xFFu) /* The calculated rate deviation value exceeds limits */ +# endif /* NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +typedef uint8 Eth_ReturnType; +typedef uint8 Eth_ModeType; +typedef uint16 Eth_FrameType; +typedef uint8 Eth_DataType; +typedef uint8 Eth_RxStatusType; +typedef uint8 Eth_FilterActionType; +typedef uint32 Eth_BufIdxType; +typedef uint8 Eth_StateType; +typedef uint8 Eth_MeasurementIdxType; +# ifndef NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES +typedef uint8 Eth_RateDeviationStatusType; +# endif /* NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES */ + +/* ETH Physical Address Type */ +typedef uint8 Eth_PhysAddrType[ETH_PHYS_ADDR_LEN_BYTE]; + +/* If the TimeStampType is defined in ComStack_Types.h then typedef the Eth_TimeStampType to TimeStampType. + Otherwise define the Eth_TimeStampType explicitly */ +# ifdef TIME_STAMP_TYPE +typedef TimeStampType Eth_TimeStampType; +# else +/*! \brief Type defining a time stamp according to AUTOSAR 4.2 */ +typedef struct +{ + uint32 nanoseconds; + uint32 seconds; + uint16 secondsHi; +} Eth_TimeStampType; + +/* Definition of AR23-11 TimeStamp types if they are not defined through ComStack_Types.h to provide backward + compatibility */ +typedef struct +{ + uint32 nanoseconds; /* Nanoseconds part of the time */ + uint32 seconds; /* 32 bit LSB of the 48 bits Seconds part of the time */ + uint16 secondsHi; /* 16 bit MSB of the 48 bits Seconds part of the time */ +} TimeStampType; /* ASR CP R23-11 */ + +typedef enum +{ + VALID = 0, /* Timestamp is valid */ + INVALID = 1, /* Timestamp is invalid */ + UNCERTAIN = 2 /* Status of timestamp is uncertain */ +} TimeStampQualType; /* ASR CP R23-11 */ + +typedef struct +{ + TimeStampType timestampClockValue; /* Value of the clock, which is used of ingress/egress timestamping */ + TimeStampType disciplinedClockValue; /* Value of the adjustable HW clock */ + TimeStampQualType timeQuality; /* Status of time tuple */ +} TimeTupleType; +# endif /* TIME_STAMP_TYPE */ + +/*! \brief Type defining the quality of a time stamp */ +typedef uint8 Eth_TimestampQualityType; + +/*! \brief Type defining the quality of a time stamp */ +typedef uint8 Eth_TimeStampQualType; + +/* Define ETH_TIMESTAMP_QUAL_TYPE_IN_ETH_GENERAL_TYPES to indicate that Eth_TimestampQualType is available in Eth_GeneralTypes. */ +#define ETH_TIMESTAMP_QUAL_TYPE_IN_ETH_GENERAL_TYPES + +/*! \brief Vector type defining the difference between time stamps */ +typedef sint32 Eth_TimediffType; + +/*! \brief AUTOSAR type defining the difference between time stamps */ +typedef struct +{ + Eth_TimeStampType diff; + boolean sign; +} Eth_TimeIntDiffType; + +/*! \brief Type defining the drift of a clock related to another clock */ +typedef struct +{ + Eth_TimeIntDiffType IngressTimeStampDelta; + Eth_TimeIntDiffType OriginTimeStampDelta; +} Eth_RateRatioType; + +/*! brief Type to read out addresses from the address resolution logic (ARL) table of the switch */ +typedef struct +{ + uint8 MacAddr[6]; + uint16 VlanId; + uint32 SwitchPort; +} Eth_MacVlanType; + +/*! brief Structure holding statistic counters for diagnostics */ +typedef struct +{ + uint32 DropPktBufOverrun; + uint32 DropPktCrc; + uint32 UndersizePkt; + uint32 OversizePkt; + uint32 AlgnmtErr; + uint32 SqeTestErr; + uint32 DiscInbdPkt; + uint32 ErrInbdPkt; + uint32 DiscOtbdPkt; + uint32 ErrOtbdPkt; + uint32 SnglCollPkt; + uint32 MultCollPkt; + uint32 DfrdPkt; + uint32 LatCollPkt; + uint32 HwDepCtr0; + uint32 HwDepCtr1; + uint32 HwDepCtr2; + uint32 HwDepCtr3; +} Eth_CounterType; + +/*! \brief Structure holding transmission statistic counters related to the Eth controller. */ +typedef struct +{ + uint32 TxNumberOfOctets; + uint32 TxNUcastPkts; + uint32 TxUniCastPkts; +} Eth_TxStatsType; + +/*! brief Structure holding reception statistic counters related to the Eth controller. */ +typedef struct +{ + uint32 RxStatsDropEvents; + uint32 RxStatsOctets; + uint32 RxStatsPkts; + uint32 RxStatsBroadcastPkts; + uint32 RxStatsMulticastPkts; + uint32 RxStatsCrcAlignErrors; + uint32 RxStatsUndersizePkts; + uint32 RxStatsOversizePkts; + uint32 RxStatsFragments; + uint32 RxStatsJabbers; + uint32 RxStatsCollisions; + uint32 RxStatsPkts64Octets; + uint32 RxStatsPkts65to127Octets; + uint32 RxStatsPkts128to255Octets; + uint32 RxStatsPkts256to511Octets; + uint32 RxStatsPkts512to1023Octets; + uint32 RxStatsPkts1024to1518Octets; + uint32 RxUnicastFrames; +} Eth_RxStatsType; + +/*! brief Type for statistic counters for tx diagnostics. */ +typedef struct +{ + uint32 TxDroppedNoErrorPkts; + uint32 TxDroppedErrorPkts; + uint32 TxDeferredTrans; + uint32 TxSingleCollision; + uint32 TxMultipleCollision; + uint32 TxLateCollision; + uint32 TxExcessiveCollison; +} Eth_TxErrorCounterValuesType; + +# ifndef NO_ETH_SPI_STATUS_TYPE_IN_ETH_GENERAL_TYPES +/*! brief Type to return the Spi status, errors and configuration state. */ +typedef struct +{ + uint32 SpiStatusRegister; + boolean Sync; + uint8 BufferStatusTxCredit; + uint8 BufferStatusRxCredit; +} Eth_SpiStatusType; +# endif /* NO_ETH_SPI_STATUS_TYPE_IN_ETH_GENERAL_TYPES */ + +# ifndef NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES +/*! brief Rate deviation value and status */ +typedef struct +{ + sint32 rateDeviationValue; /* Rate deviation value (resolution: 2^{-32}) */ + Eth_RateDeviationStatusType rateDeviationStatus; /* Current state of the rate deviation calculation */ +} Eth_RateDeviationType; +# endif /* NO_ETH_RATE_DEVIATION_TYPE_IN_ETH_GENERAL_TYPES */ + +/*! brief Type for holding the bucket counter values for a stream */ +typedef struct +{ + uint8 BucketIdx; /* Bucket Index */ + uint32 CounterValue; /* Bucket counter value */ +} Eth_StreamStatisticCounterType; + +/*! brief Type to return the pre-correction time, applied rate deviation and new PHC rate. */ +typedef struct +{ + TimeStampType PreCorrTime; /* Value of the PHC right before the correction is applied. */ + sint32 AppliedRateDeviation; /* The actual applied rate deviation (resolution: 2^{-32}). Although this parameter could be calculated using "NewPhcRate", it is explicitly returned to avoid inaccuracies in the calculation on UL side. */ + sint32 NewPhcRate; /* The resulting new rate of the PHC compared to initialization (1.0) (resolution: 2^{-32}). */ +} Eth_PhcCorrInfoType; + +#endif /* ETH_GENERAL_TYPES_DEFS_H */ + +/********************************************************************************************************************** + * END OF FILE: Eth_GeneralTypesDefs.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/Fr_GeneralTypes.h b/Source/bsw/Common/Fr_GeneralTypes.h new file mode 100644 index 0000000..39ae390 --- /dev/null +++ b/Source/bsw/Common/Fr_GeneralTypes.h @@ -0,0 +1,322 @@ +/* ***** STARTSINGLE_OF_MULTIPLE_COMMENT ***** */ + + +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------- + * File: Fr_GeneralTypes.h + * Project: FlexRay Stack + * Module: - + * Generator: - + * + * Description: Datatype definitions according to AUTOSAR 3.0 FlexRay Driver SWS + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * AUTHOR IDENTITY + * ------------------------------------------------------------------------------------------------------------------- + * Name Initials Company + * ------------------------------------------------------------------------------------------------------------------- + * Sebastian Schmar Ssr Vector Informatik GmbH + * Juergen Schaeffer Jsr Vector Informatik GmbH + * Sebastian Gaertner Seg Vector Informatik GmbH + * Klaus Bergdolt Ber Vector Informatik GmbH + * Matthias Mueller Mmu Vector Informatik GmbH + * ------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2006-05-17 Ber Generated filed according to AUTOSAR FlexRay Driver SWS. + * 01.00.01 2008-03-19 Jsr Changed enum types to u8 types + * 01.00.02 2008-06-24 Jsr ESCAN00027841 Fr_VErrorStatusType added + * 01.01.00 2008-11-04 Seg ESCAN00030471 Name of Fr_GeneralTypes.h + * 01.02.00 2009-03-11 Seg ESCAN00032698 Missing versionstring for licence database + * 01.03.00 2009-07-30 Ssr ESCAN00036317 FlexRay Driver shall support FIFOs (Asr 4.0) + * Jsr ESCAN00031969 update function headers + * 01.03.01 2009-10-22 Jsr ESCAN00035424 Compiler errors in Enabled "Extended Version checks and Link Time" Variant + * 01.04.00 2009-11-13 Jsr ESCAN00037151 Read and verification of the FlexRay configuration + * 01.04.01 2009-11-26 Jsr Update Fr_CCLLParamIndexType + * 01.05.00 2010-02-19 Jsr Update comments according coding rules (CDK) + * ESCAN00040841 Add Trcv Types + * Ssr Resolve compiler errors at header include protection + * 01.06.00 2010-07-23 Jsr Update ReadCCConfig Values according Autosar + * ESCAN00043900 Enhancement parameters for ReadCCConfig + * ESCAN00044864 Truncation of parameter values at ReadCCConfig + * Review finding in in DocTechRef: replace Fr_CCLLParamIndexType with uint8 + * 01.07.00 2011-06-17 Seg ESCAN00048747 Missing declaration of Fr_ConfigType + * ESCAN00050556 Update ReadCCConfig Values according Autosar 3.2 + * ESCAN00051495 Extend FrTrcv_TrcvWUReasonType in Fr_GeneralTypes.h + * 01.08.00 2014-01-13 Mmu ESCAN00070897 AR3-2508: Support Fr_TxConflictStatusType + * 02.00.00 2025-10-23 Mte CANCORE-2233 Support Fr_SlotAssignmentType + **************************************************************************************************/ +#if (!defined FR_GENERALTYPES_H) +# define FR_GENERALTYPES_H + +/************************************************************************************************** +* INCLUDES +**************************************************************************************************/ +# include "Std_Types.h" + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : DrvFr__baseAsr CQComponent : Implementation */ +# define DRVFR__BASEASR_VERSION 0x0200u/* BCD coded version number */ +# define DRVFR__BASEASR_RELEASE_VERSION 0x00u /* BCD coded release version number */ + +typedef void Fr_ConfigType; + +/** The values of this enumeration are used to provide information + whether or not the local FlexRay CC is synchronous to the FR global time */ + +typedef uint8 Fr_SyncStateType; +# define FR_ASYNC ((Fr_SyncStateType)0) /** The local FlexRay CC is asynchronous to the FR global time */ +# define FR_SYNC ((Fr_SyncStateType)1) /** The local FlexRay CC is synchronous to the FR global time */ + +typedef uint8 Fr_OffsetCorrectionType; +# define FR_OFFSET_INC ((Fr_OffsetCorrectionType)0) /** add predefined correction value vOffsetCorrection */ +# define FR_OFFSET_DEC ((Fr_OffsetCorrectionType)1) /** subtract predefined correction value vOffsetCorrection */ +# define FR_OFFSET_NOCHANGE ((Fr_OffsetCorrectionType)2) /** apply no offset correction value */ + +typedef uint8 Fr_RateCorrectionType; +# define FR_RATE_INC ((Fr_RateCorrectionType)0) /** add predefined correction value vRateCorrection. */ +# define FR_RATE_DEC ((Fr_RateCorrectionType)1) /** subtract predefined correction value vRateCorrection. */ +# define FR_RATE_NOCHANGE ((Fr_RateCorrectionType)2) /** apply no rate correction value */ + +typedef uint8 Fr_POCStateType; +# define FR_POCSTATE_CONFIG ((Fr_POCStateType)0) /** Configuration state */ +# define FR_POCSTATE_DEFAULT_CONFIG ((Fr_POCStateType)1) /** State prior to config, only left with an explicit configuration request */ +# define FR_POCSTATE_HALT ((Fr_POCStateType)2) /** Error state, can only be left by a re-initialization */ +# define FR_POCSTATE_NORMAL_ACTIVE ((Fr_POCStateType)3) /** Normal operation */ +# define FR_POCSTATE_NORMAL_PASSIVE ((Fr_POCStateType)4) /** Errors detected, no transmission of data, but attempting to return to normal operation */ +# define FR_POCSTATE_READY ((Fr_POCStateType)5) /** State reached from FR_POCSTATE_CONFIG after concluding the configuration */ +# define FR_POCSTATE_STARTUP ((Fr_POCStateType)6) /** CC transmits only startup frames */ +# define FR_POCSTATE_WAKEUP ((Fr_POCStateType)7) /** CC sends a wakeup pattern if it couldn't find anything on the bus */ + +typedef uint8 Fr_TxLPduStatusType; +# define FR_TRANSMITTED ((Fr_TxLPduStatusType)0) /** LSdu has been transmitted */ +# define FR_NOT_TRANSMITTED ((Fr_TxLPduStatusType)1) /** LSdu has not been transmitted */ + +/** These values are used to determine if a LSdu has been received */ +typedef uint8 Fr_RxLPduStatusType; +# define FR_RECEIVED ((Fr_RxLPduStatusType)0) /** LSdu has been received */ +# define FR_NOT_RECEIVED ((Fr_RxLPduStatusType)1) /** LSdu has not been received */ +# define FR_RECEIVED_MORE_DATA_AVAILABLE ((Fr_RxLPduStatusType)2) + +/** This formal definition refers to chapter "2.2.1.3 POC status" of FlexRay Protocol Specification */ +typedef uint8 Fr_WakeupStateType; +# define FR_WAKEUPSTATE_UNDEFINED ((Fr_WakeupStateType)0) +# define FR_WAKEUPSTATE_RECEIVED_HEADER ((Fr_WakeupStateType)1) +# define FR_WAKEUPSTATE_RECEIVED_WUP ((Fr_WakeupStateType)2) +# define FR_WAKEUPSTATE_COLLISION_HEADER ((Fr_WakeupStateType)3) +# define FR_WAKEUPSTATE_COLLISION_WUP ((Fr_WakeupStateType)4) +# define FR_WAKEUPSTATE_COLLISION_UNKNOWN ((Fr_WakeupStateType)5) +# define FR_WAKEUPSTATE_TRANSMITTED ((Fr_WakeupStateType)6) + +/** These values are derived from Table 9-1 of Version 2.1 of the FlexRay Protocol Specification */ +typedef uint8 Fr_MTSStatusType; +# define FR_MTS_RCV ((Fr_MTSStatusType)0)/** A valid MTS has been received */ +# define FR_MTS_RCV_SYNERR ((Fr_MTSStatusType)1)/** A valid MTS has been received and a Syntax Error was detected */ +# define FR_MTS_RCV_BVIO ((Fr_MTSStatusType)2)/** A valid MTS has been received and a Boundary Violation has been detected */ +# define FR_MTS_RCV_SYNERR_BVIO ((Fr_MTSStatusType)3)/** A valid MTS has been received and a Syntax Error and a Boundary Violation has been detected */ +# define FR_MTS_NOT_RCV ((Fr_MTSStatusType)4)/** No valid MTS has been received */ +# define FR_MTS_NOT_RCV_SYNERR ((Fr_MTSStatusType)5)/** No valid MTS has been received and a Syntax Error was detected */ +# define FR_MTS_NOT_RCV_BVIO ((Fr_MTSStatusType)6)/** No valid MTS has been received and a Boundary Violation has been detected */ +# define FR_MTS_NOT_RCV_SYNERR_BVIO ((Fr_MTSStatusType)7)/** No valid MTS has been received and a Syntax Error and a Boundary Violation has been detected */ + +/** The values are used to reference a channel on a CC */ +typedef uint8 Fr_ChannelType; +# define FR_CHANNEL_A ((Fr_ChannelType)0)/** Refers to channel A of a CC */ +# define FR_CHANNEL_B ((Fr_ChannelType)1)/** Refers to channel B of a CC */ +# define FR_CHANNEL_AB ((Fr_ChannelType)2)/** Refers to both channels of a CC */ + +typedef uint8 Fr_SlotModeType; +# define FR_SLOTMODE_SINGLE ((Fr_SlotModeType)0) +# define FR_SLOTMODE_ALL_PENDING ((Fr_SlotModeType)1) +# define FR_SLOTMODE_ALL ((Fr_SlotModeType)2) + +typedef uint8 Fr_ErrorModeType; +# define FR_ERRORMODE_ACTIVE ((Fr_ErrorModeType)0) +# define FR_ERRORMODE_PASSIVE ((Fr_ErrorModeType)1) +# define FR_ERRORMODE_COMM_HALT ((Fr_ErrorModeType)2) + +typedef uint8 Fr_WakeupStatusType; +# define FR_WAKEUP_UNDEFINED ((Fr_WakeupStatusType)0) +# define FR_WAKEUP_RECEIVED_HEADER ((Fr_WakeupStatusType)1) +# define FR_WAKEUP_RECEIVED_WUP ((Fr_WakeupStatusType)2) +# define FR_WAKEUP_COLLISION_HEADER ((Fr_WakeupStatusType)3) +# define FR_WAKEUP_COLLISION_WUP ((Fr_WakeupStatusType)4) +# define FR_WAKEUP_COLLISION_UNKNOWN ((Fr_WakeupStatusType)5) +# define FR_WAKEUP_TRANSMITTED ((Fr_WakeupStatusType)6) + +typedef uint8 Fr_StartupStateType; +# define FR_STARTUP_UNDEFINED ((Fr_StartupStateType)0) +# define FR_STARTUP_COLDSTART_LISTEN ((Fr_StartupStateType)1) +# define FR_STARTUP_INTEGRATION_COLDSTART_CHECK ((Fr_StartupStateType)2) +# define FR_STARTUP_COLDSTART_JOIN ((Fr_StartupStateType)3) +# define FR_STARTUP_COLDSTART_COLLISION_RESOLUTION ((Fr_StartupStateType)4) +# define FR_STARTUP_COLDSTART_CONSISTENCY_CHECK ((Fr_StartupStateType)5) +# define FR_STARTUP_INTEGRATION_LISTEN ((Fr_StartupStateType)6) +# define FR_STARTUP_INITIALIZE_SCHEDULE ((Fr_StartupStateType)7) +# define FR_STARTUP_INTEGRATION_CONSISTENCY_CHECK ((Fr_StartupStateType)8) +# define FR_STARTUP_COLDSTART_GAP ((Fr_StartupStateType)9) + +typedef struct +{ + boolean ColdstartNoise; + boolean CHIHaltRequest; + boolean Freeze; + Fr_SlotModeType SlotMode; + Fr_WakeupStatusType WakeupStatus; + Fr_ErrorModeType ErrorMode; + Fr_StartupStateType StartupState; + Fr_POCStateType State; +} Fr_POCStatusType; + +/* This structure contains information about the assignment of a FlexRay frame to a cycle, a slot ID and a channel. */ +typedef struct +{ + uint8 Cycle; + uint16 SlotId; + Fr_ChannelType ChannelId; +} Fr_SlotAssignmentType; + +typedef uint32 Fr_VErrorStatusType; + +/** Data type to provide information about Tx conflicts. */ +typedef enum +{ + FR_NO_CONFLICT = 0u, + FR_CONFLICT +} Fr_TxConflictStatusType; + +/* uint32 values */ +#define FR_CIDX_GDCYCLE 0 +#define FR_CIDX_PMICROPERCYCLE 1 +#define FR_CIDX_PDLISTENTIMEOUT 2 + +/* uint16 values */ +#define FR_CIDX_GMACROPERCYCLE 3 +#define FR_CIDX_GDMACROTICK 4 +#define FR_CIDX_GNUMBEROFMINISLOTS 5 +#define FR_CIDX_GNUMBEROFSTATICSLOTS 6 +#define FR_CIDX_GDNIT 7 +#define FR_CIDX_GDSTATICSLOT 8 +#define FR_CIDX_GDWAKEUPRXWINDOW 9 +#define FR_CIDX_PKEYSLOTID 10 +#define FR_CIDX_PLATESTTX 11 +#define FR_CIDX_POFFSETCORRECTIONOUT 12 +#define FR_CIDX_POFFSETCORRECTIONSTART 13 +#define FR_CIDX_PRATECORRECTIONOUT 14 +#define FR_CIDX_PSECONDKEYSLOTID 15 +#define FR_CIDX_PDACCEPTEDSTARTUPRANGE 16 + +/* uint8 values */ +#define FR_CIDX_GCOLDSTARTATTEMPTS 17 +#define FR_CIDX_GCYCLECOUNTMAX 18 +#define FR_CIDX_GLISTENNOISE 19 +#define FR_CIDX_GMAXWITHOUTCLOCKCORRECTFATAL 20 +#define FR_CIDX_GMAXWITHOUTCLOCKCORRECTPASSIVE 21 +#define FR_CIDX_GNETWORKMANAGEMENTVECTORLENGTH 22 +#define FR_CIDX_GPAYLOADLENGTHSTATIC 23 +#define FR_CIDX_GSYNCFRAMEIDCOUNTMAX 24 +#define FR_CIDX_GDACTIONPOINTOFFSET 25 +#define FR_CIDX_GDBIT 26 +#define FR_CIDX_GDCASRXLOWMAX 27 +#define FR_CIDX_GDDYNAMICSLOTIDLEPHASE 28 +#define FR_CIDX_GDMINISLOTACTIONPOINTOFFSET 29 +#define FR_CIDX_GDMINISLOT 30 +#define FR_CIDX_GDSAMPLECLOCKPERIOD 31 +#define FR_CIDX_GDSYMBOLWINDOW 32 +#define FR_CIDX_GDSYMBOLWINDOWACTIONPOINTOFFSET 33 +#define FR_CIDX_GDTSSTRANSMITTER 34 +#define FR_CIDX_GDWAKEUPRXIDLE 35 +#define FR_CIDX_GDWAKEUPRXLOW 36 +#define FR_CIDX_GDWAKEUPTXACTIVE 37 +#define FR_CIDX_GDWAKEUPTXIDLE 38 +#define FR_CIDX_PALLOWPASSIVETOACTIVE 39 +#define FR_CIDX_PCHANNELS 40 +#define FR_CIDX_PCLUSTERDRIFTDAMPING 41 +#define FR_CIDX_PDECODINGCORRECTION 42 +#define FR_CIDX_PDELAYCOMPENSATIONA 43 +#define FR_CIDX_PDELAYCOMPENSATIONB 44 +#define FR_CIDX_PMACROINITIALOFFSETA 45 +#define FR_CIDX_PMACROINITIALOFFSETB 46 +#define FR_CIDX_PMICROINITIALOFFSETA 47 +#define FR_CIDX_PMICROINITIALOFFSETB 48 +#define FR_CIDX_PPAYLOADLENGTHDYNMAX 49 +#define FR_CIDX_PSAMPLESPERMICROTICK 50 +#define FR_CIDX_PWAKEUPCHANNEL 51 +#define FR_CIDX_PWAKEUPPATTERN 52 +#define FR_CIDX_PDMICROTICK 53 +#define FR_CIDX_PDEXTERNRATECORRECTION 54 +#define FR_CIDX_PDEXTERNOFFSETCORRECTION 55 +#define FR_CIDX_GDIGNOREAFTERTX 56 + +/* boolean values */ +#define FR_CIDX_PALLOWHALTDUETOCLOCK 57 +#define FR_CIDX_PEXTERNALSYNC 58 +#define FR_CIDX_PFALLBACKINTERNAL 59 +#define FR_CIDX_PKEYSLOTONLYENABLED 60 +#define FR_CIDX_PKEYSLOTUSEDFORSTARTUP 61 +#define FR_CIDX_PKEYSLOTUSEDFORSYNC 62 +#define FR_CIDX_PNMVECTOREARLYUPDATE 63 +#define FR_CIDX_PTWOKEYSLOTMODE 64 + + + + + +/* FrTrcv252: FrTrcv048: */ +/*! Transceiver is in an unknown state */ +#define FRTRCV_TRCVMODE_UNKNOWN (FrTrcv_TrcvModeType)0u +/*! Transceiver is in state NORMAL */ +#define FRTRCV_TRCVMODE_NORMAL (FrTrcv_TrcvModeType)1u +/*! Transceiver is in state STANDBY */ +#define FRTRCV_TRCVMODE_STANDBY (FrTrcv_TrcvModeType)2u +/*! Transceiver is in state SLEEP */ +#define FRTRCV_TRCVMODE_SLEEP (FrTrcv_TrcvModeType)3u +/*! Transceiver is in state RECEIVEONLY */ +#define FRTRCV_TRCVMODE_RECEIVEONLY (FrTrcv_TrcvModeType)4u +/*! The FrTrcv_TrcvModeType defines all modes the Transceiver driver can be set in */ +typedef uint8 FrTrcv_TrcvModeType; + +/* FrTrcv074: */ +/*! The transceiver does not support any information for the wake up reason. */ +#define FRTRCV_WU_NOT_SUPPORTED (FrTrcv_TrcvWUReasonType)0u +/*! The transceiver has detected that the bus has caused the wake up of the ECU. */ +#define FRTRCV_WU_BY_BUS (FrTrcv_TrcvWUReasonType)1u +/*! The transceiver has detected that the bus has woken up by the ECU via FrTrcv_GotoNormalMode API call */ +#define FRTRCV_WU_INTERNALLY (FrTrcv_TrcvWUReasonType)2u +/*! The transceiver has detected that the "wake up" is due to an ECU reset. */ +#define FRTRCV_WU_RESET (FrTrcv_TrcvWUReasonType)3u +/*! The transceiver has detected that the "wake up" is due to an ECU reset after power on. */ +#define FRTRCV_WU_POWER_ON (FrTrcv_TrcvWUReasonType)4u +/*! The transceiver has detected a wake-up event at one of the transceiver's pins (not at the FlexRay bus). */ +#define FRTRCV_WU_BY_PIN (FrTrcv_TrcvWUReasonType)5u +/*! The type determines last wake up reason of the transceiver driver */ +typedef uint8 FrTrcv_TrcvWUReasonType; + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/***** end of header file ************************************************************************/ +#endif /* FR_GENERALTYPES_H */ diff --git a/Source/bsw/Common/Lin_GeneralTypes.h b/Source/bsw/Common/Lin_GeneralTypes.h new file mode 100644 index 0000000..5062883 --- /dev/null +++ b/Source/bsw/Common/Lin_GeneralTypes.h @@ -0,0 +1,254 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Lin_GeneralTypes.h + * \brief AUTOSAR LIN General types header + * + * \details AUTOSAR LIN General types header for the LIN stack + * + *********************************************************************************************************************/ +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 1.00.00 2020-01-08 visjgl create new Lin General Types + * 1.00.01 2020-03-27 visjgl rework Review findings + * 2.00.00 2024-12-11 visjgl added compatibility support for the Frame Response Type + * 2.01.00 2025-07-21 visjgl LIN-1393 include Std_Types and add numerical representation of enum + *********************************************************************************************************************/ + +#if !defined (LIN_GENERALTYPES_H) +# define LIN_GENERALTYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" + +/*! + \name LIN General Types + \{ +*/ + +/********************************************************************************************************************** + * LIN General Types + *********************************************************************************************************************/ + +/*! [Defined by AUTOSAR]: LIN operation states for a LIN channel or frame, as returned by the API service + Lin_GetStatus(). */ +typedef enum Lin_StatusTypeTag +{ + /*! LIN frame operation return value. + Development or production error occurred. */ + LIN_NOT_OK = 0x00u, + + /*! LIN frame operation return value. + Successful transmission. */ + LIN_TX_OK = 0x01u, + + /*! LIN frame operation return value. + Ongoing transmission (Header or Response). */ + LIN_TX_BUSY = 0x02u, + + /*! LIN frame operation return value. + Erroneous header transmission such as: + - Mismatch between sent and read back data + - Identifier parity error or + - Physical bus error */ + LIN_TX_HEADER_ERROR = 0x03u, + + /*! LIN frame operation return value. + Erroneous response transmission such as: + - Mismatch between sent and read back data + - Physical bus error */ + LIN_TX_ERROR = 0x04u, + + /*! LIN frame operation return value. + Successful frame response reception. */ + LIN_RX_OK = 0x05u, + + /*! LIN frame operation return value. + Ongoing reception: at least one response byte has been received, but the checksum byte has not been received. */ + LIN_RX_BUSY = 0x06u, + + /*! LIN frame operation return value. + Erroneous response reception such as: + - Framing error + - Overrun error + - Checksum error or + - Short response */ + LIN_RX_ERROR = 0x07u, + + /*! LIN frame operation return value. + No response byte has been received. */ + LIN_RX_NO_RESPONSE = 0x08u, + + /*! LIN channel state return value. + Normal operation; the related LIN channel is ready to transmit next header. No data from previous frame available + (e.g. after initialization). */ + LIN_OPERATIONAL = 0x09u, + + /*! LIN channel state return value. + Sleep state operation; in this state wake-up detection from responder nodes is enabled. */ + LIN_CH_SLEEP = 0x0Au +} Lin_StatusType; + +/*! [Defined by AUTOSAR]: This type represents the slave error types that are detected during header reception and + response transmission / reception. */ +typedef enum Lin_SlaveErrorTypeTag +{ + /*! Error in header. */ + LIN_ERR_HEADER = 0x00u, + + /*! Framing error in response. */ + LIN_ERR_RESP_STOPBIT = 0x01u, + + /*! Checksum error. */ + LIN_ERR_RESP_CHKSUM = 0x02u, + + /*! Monitoring error of transmitted data bit in response. */ + LIN_ERR_RESP_DATABIT = 0x03u, + + /*! No response. */ + LIN_ERR_NO_RESP = 0x04u, + + /*! Incomplete response. */ + LIN_ERR_INC_RESP = 0x05u +} Lin_SlaveErrorType; + + +/*! [Defined by Vector]: Pointer to a shadow buffer or memory mapped LIN hardware receive buffer where the current SDU + is stored. */ +typedef P2VAR(uint8, TYPEDEF, AUTOMATIC) Lin_u8PtrType; + +/*! [Defined by Vector]: Pointer to pointer to a shadow buffer or memory mapped LIN hardware receive buffer where the + current SDU is stored. */ +typedef P2VAR(Lin_u8PtrType, TYPEDEF, AUTOMATIC) Lin_u8PtrPtrType; + + +/*! [Defined by AUTOSAR]: Represents all valid protected identifier used by Lin_SendFrame(). */ +typedef uint8 Lin_FramePidType; + + +/*! [Defined by AUTOSAR]: This type is used to specify the checksum model to be used for the LIN frame. */ +typedef enum Lin_FrameCsModelTypeTag +{ + /*! Enhanced checksum model. */ + LIN_ENHANCED_CS = 0x00u, + /*! Classic checksum model. */ + LIN_CLASSIC_CS = 0x01u +} Lin_FrameCsModelType; + + +/*! [Defined by AUTOSAR, extended by Vector]: This type is used to specify whether the frame processor is required to + transmit the response part of the LIN frame. */ +typedef enum Lin_FrameResponseTypeTag +{ + /*! Lin_FrameResponseType according to AUTOSAR <= 4.3.1 */ + LIN_MASTER_RESPONSE = 0x00u, /*!< Response is generated from this (master) node */ + LIN_SLAVE_RESPONSE = 0x01u, /*!< Response is generated from a remote slave node */ + LIN_SLAVE_TO_SLAVE = 0x02u, /*!< Response is generated from one slave to another slave */ + + /*! Lin_FrameResponseType according to AUTOSAR >= 4.4.0 */ + LIN_FRAMERESPONSE_TX = 0x00u, /*!< Response is generated by this node. */ + LIN_FRAMERESPONSE_RX = 0x01u, /*!< Response is generated by another node. */ + LIN_FRAMERESPONSE_IGNORE = 0x02u /*!< Response is ignored by this node. */ +} Lin_FrameResponseType; + + + +/*! [Defined by AUTOSAR]: This type is used to specify the number of SDU data bytes to copy. + Range: 1 - 8, data length of a LIN frame. */ +typedef uint8 Lin_FrameDlType; + + +/*! [Defined by AUTOSAR]: This type is used to provide PID, checksum model, data length and SDU pointer of a LIN frame + from the LIN Interface to the LIN driver. */ +typedef struct Lin_PduTypeTag +{ + /*! Valid protected identifier. */ + VAR(Lin_FramePidType, TYPEDEF) Pid; + /*! Specified Checksum model. */ + VAR(Lin_FrameCsModelType, TYPEDEF) Cs; + /*! Type of response part. */ + VAR(Lin_FrameResponseType, TYPEDEF) Drc; + /*! Number of SDU data bytes to copy. */ + VAR(Lin_FrameDlType, TYPEDEF) Dl; + /*! Pointer to SDU data bytes. */ + P2VAR(uint8, TYPEDEF, AUTOMATIC) SduPtr; +} Lin_PduType; + +/*! [Defined by Vector]: Pointer Type for the Lin_PduType */ +typedef P2VAR(Lin_PduType, TYPEDEF, AUTOMATIC) Lin_PduPtrType; + +/*! \} */ + +/*! + \name LIN Transceiver General Types + \{ +*/ + +/********************************************************************************************************************** + * LIN Transceiver General Types + *********************************************************************************************************************/ + +/*! [Defined by AUTOSAR]: This type is used to indicate and set the operation mode of the transceiver. */ +typedef enum LinTrcv_TrcvModeTypeTag +{ + /*! Normal mode. */ + LINTRCV_TRCV_MODE_NORMAL = 0x00u, + /*! Standby mode. */ + LINTRCV_TRCV_MODE_STANDBY = 0x01u, + /*! Sleep mode. */ + LINTRCV_TRCV_MODE_SLEEP = 0x02u +} LinTrcv_TrcvModeType; + +/*! [Defined by AUTOSAR]: This type is used to configure the wakeup setting of the transceiver. */ +typedef enum LinTrcv_TrcvWakeupModeTypeTag +{ + /*! Enable wakeup reporting. */ + LINTRCV_WUMODE_ENABLE = 0x00u, + /*! Disable wakeup reporting. */ + LINTRCV_WUMODE_DISABLE = 0x01u, + /*! Clear the stored wakeup reason. */ + LINTRCV_WUMODE_CLEAR = 0x02u +} LinTrcv_TrcvWakeupModeType; + +/*! [Defined by AUTOSAR]: This type is used to indicate the wakeup reason. */ +typedef enum LinTrcv_TrcvWakeupReasonTypeTag +{ + /*! Error, wakeup reason was not detected. */ + LINTRCV_WU_ERROR = 0x00u, + /*! Wakeup reporting is not supported. */ + LINTRCV_WU_NOT_SUPPORTED = 0x01u, + /*! Wakeup caused by the network was detected. */ + LINTRCV_WU_BY_BUS = 0x02u, + /*! Wakeup caused by a transceiver pin was detected. */ + LINTRCV_WU_BY_PIN = 0x03u, + /*! Wakeup caused by a ECU request was detected. */ + LINTRCV_WU_INTERNALLY = 0x04u, + /*! Wakeup caused by a ECU reset was detected. */ + LINTRCV_WU_RESET = 0x05u, + /*! Wakeup caused by a ECU reset after power on was detected. */ + LINTRCV_WU_POWER_ON = 0x06u +} LinTrcv_TrcvWakeupReasonType; + +/*! \} */ + +#endif /* LIN_GENERALTYPES_H */ + +/********************************************************************************************************************** + * END OF FILE: Lin_GeneralTypes.h + *********************************************************************************************************************/ + diff --git a/Source/bsw/Common/MemMap.h b/Source/bsw/Common/MemMap.h new file mode 100644 index 0000000..2f8c0fa --- /dev/null +++ b/Source/bsw/Common/MemMap.h @@ -0,0 +1,2993 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------- + * File: _MemMap.h + * Component: - + * Module: - + * Generator: - + * + * Description: This File is a template for the MemMap.h + * This file has to be extended with the memory section defined for all BSW modules + * which are used. + * + * ------------------------------------------------------------------------------------------------------------------- + * MISRA VIOLATIONS + * ------------------------------------------------------------------------------------------------------------------- + * + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * ------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2007-08-01 Jk Initial creation + * 01.01.00 2007-12-14 Jk Component specific defines filtering added + * 01.01.02 2008-11-04 Jk Component specific defines filtering added + * 01.01.03 2008-12-17 Ht Improve list of components (Tp_AsrTpCan,Tp_AsrTpFr,DrvMcu,DrvIcu added) + * 01.01.04 2009-04-27 Ht improve list of components (Cp_XcpOnCanAsr, Il_AsrIpduM, If_VxFblDcm, + * If_VxFblVpm_Volvo_ab, DrvFls added) + * 01.01.05 2009-04-24 Msr Renamed J1939_AsrBase as TpJ1939_AsrBase + * 01.01.06 2009-06-03 Ht Improve list of components (Adc, Dio, Gpt, Pwm, Spi, Wdg, Fls, Port, Fim) + * 01.02.00 2009-08-01 Ht Improve list of components (Fee_30_Inst2, Can, ...Sub) + * Support filtering for RTE + * 01.02.01 2009-08-18 HH replaced C++ comment by C comment + * 01.02.02 2009-09-02 Lo add external Flash driver support + * 01.02.03 2009-09-12 Lo add DrvFls_Mcs12xFslftm01ExtVx + * Ht Improve list of components (CanTrcv_30_Tja1040dio, + * Eth, EthTrcv, EthIf, SoAd, TcpIp, EthSM) + * 01.03.00 2009-10-30 Ht support R8: change EthTrcv to EthTrcv_30_Canoeemu + * support EthTrcv_30_Dp83848 + * change CanTrcv_30_Xdio to CanTrcv_30___Your_Trcv__ + * change CanTrcv_30_Tja1040dio to CanTrcv_30_Tja1041 + * change name FrTrcv to FrTrcv_30_Tja1080dio + * Lo add Cp_AsrXcp + * Ht add Cp_XcpOnFrAsr + * 01.03.01 2010-01-13 Ht support SysService_AsrCal + * 01.03.02 2010-02-15 Ht support SysService_SswRcs_Daimler, SysService_Tls, Tp_Http, + * SysService_Dns, SysService_Json, DrvTrans_GenericLindioAsr + * Lo add Diag_AsrDem for all OEMs + * rename internal variables and filter methods + * 01.04.00 2010-03-04 Ht change name FrTrcv_30_Tja1080dio to FrTrcv_30_Tja1080 + * 01.04.01 2010-03-10 Ht support DrvTrans_GenericFrAsr, DrvTrans_As8223FrspiAsr, DrvEep and If_AsrIfEa + * 01.04.02 2010-04-07 Lo change IfFee to real components and add If_AsrIfWdV85xNec01Sub + * 01.04.03 2010-06-11 Ht add CanTrcv_30_Tja1043 + * Lo add Il_AsrIpduMEbBmwSub + * 01.04.04 2010-08-24 Ht add CanTrcv_30_Tle62512G, DrvEep_XAt25128EAsr, Tp_AsrTpFrEbBmwSub + * 01.05.00 2010-08-24 Ht support R10: + * change LinTrcv_30_Tle7259dio to LinTrcv_30_Tle7259 + * 01.05.01 2010-10-14 Ht add VStdLib, SysService_SswScc, SysService_IpBase, SysService_Crypto + * 01.05.02 2010-10-20 Ht support comments for Package Merge Tool + * 01.05.03 2010-11-03 Ht add SysService_E2eLibTttechSub, SysService_E2ePwTttechSub + * 01.05.04 2010-11-16 Ht add SysService_Exi, DrvTrans_Int6400EthAsr, Cdd_AsrCdd_Fiat, Diag_AsrDem_Fiat + * 01.05.05 2010-12-17 Ht add SysService_AsrSchM, DrvEep_XXStubAsr, DrvIcu_Tms570Tinhet01ExtVx + * DrvWd_XTle4278gEAsr, DrvWd_XXStubAsr + * 01.05.06 2011-02-17 Ht add DrvEed, SysService_AsrBswM + * 01.05.07 2011-03-04 Ht add DrvTrans_Tja1055CandioAsr + * rename CanTrcv_30_Tja1040dio to CanTrcv_30_Tja1040 + * add SysService_XmlEngine + * 01.06.00 2011-03-15 Ht support ASR4.0 + * add Ccl_Asr4ComM, Ccl_Asr4SmCan, Nm_Asr4NmIf, Nm_AsrNmDirOsek + * 01.06.01 2011-04-15 Ht add Diag_AsrDcm_ + * 01.06.02 2011-06-17 Ht correct Diag_AsrDcm_ + * add Monitoring_AsrDlt and Monitoring_GenericMeasurement + * 01.06.03 2011-09-20 Ht add DrvTrans_Tja1145CanSpiAsr, DrvTrans_E52013CanspiAsr, DrvFls_XXStubAsr, + * If_AsrIfFeeV85xNec05Sub, If_AsrIfFeeV85xNec06Sub, If_AsrIfFeeV85xNec07Sub + * SysService_AsrWdMTttechSub and If_AsrIfWdTttechSub + * 01.06.04 2011-11-22 Ht add If_AsrIfFeeTiSub, + * ESCAN00054718: add Cdd_AsrCdd + * 01.06.05 2011-12-09 Ht add Tp_IpV4, Tp_IpV6 + * 01.06.06 2011-12-14 Ht add Monitoring_RuntimeMeasurement + * 01.06.07 2012-01-03 Ht add DrvI2c, SysService_Asr4BswM + * 01.06.08 2012-01-31 Ht add DrvTrans_Ar7000EthAsr, DrvTrans_GenericEthmiiAsr + * 01.06.09 2012-03-06 Ht add If_AsrIfFeeMb9df126Fuji01Sub, + * Infineon_Tc1767Inf01Sub, Infineon_Tc178xInf01Sub, Infineon_Tc1797Inf01Sub, Infineon_Tc1797Inf02Sub + * 01.06.10 2012-03-13 Ht add Gw_AsrPduRCfg5, Il_AsrComCfg5, Il_AsrIpduMCfg5, Cdd_AsrCddCfg5, + * Tp_Asr4TpCan, Diag_Asr4Dcm, Diag_Asr4Dem + * 01.06.11 2012-03-20 Ht add Cp_AsrCcp, Cp_XcpOnTcpIpAsr + * 01.07.00 2012-07-26 Ht ESCAN00059365: [AUTOSAR4, compiler warning]: Wrong define name in #undef statement causes re-definition warning + * add Nm_Asr4NmCan, Nm_Asr4NmFr, Infineon_Xc2000Inf01Sub, Ccl_Asr4ComMCfg5, SysService_Asr4BswMCfg5, SysService_Asr4EcuM, SysService_AsrRamTst, + * Ccl_Asr4SmLin + * 2012-09-04 Ht add support for ASR specification 4.0 R3 + * 01.07.01 2012-10-23 Seu add SysService_XmlSecurity + * 01.07.02 2013-01-10 Seu MISRA deviation comments added + * 01.08.00 2013-03-01 Seu ESCAN00065501 AR4-325: Add support for Post-build RAM memory section + * 2013-04-12 Seu ESCAN00066614 Add the deviation for violation of MISRA rule 19.6 + * 01.09.00 2013-12-10 Seu ESCAN00072537 Add *_NOCACHE_* memory sections for variables + * 2013-12-16 Seu MISRA compliance: usage of character "'" removed, typos corrected + * 01.10.00 2016-09-27 Seu FEATC-317: FEAT-2002: CommonAsr__Common: Support 64 Bit Signal Types for COM according to ASR 4.2.2 + * 01.11.00 2017-07-05 Seu ESCAN00095756 FEAT-2455: Support ASR4.2 compatible MemMap for MCALs + * 2017-08-01 Seu ESCAN00096129 MEMMAP_SW_MINOR_VERSION / MEM_SW_MINOR_VERSION is not correct + * 01.12.00 2018-10-17 visdfe ESCAN00095695 Add support for Os_CoreGen7 within _MemMap.h (Include of Os_MemMap.h) + * TASK-78775 Change MemMap_Common.h to Template + * 01.13.00 2021-05-06 virmfr HALBE-3985 CommonAsr_MemMap shall include Common_MemMap generated compatibility header + * 02.00.00 2021-06-09 visto HALBE-4594 Create a branch for >=R27 Features + * 02.01.00 2021-08-25 virmfr HALBE-4526 MemMap_Common.h removed + * 02.01.01 2021-09-07 virmfr HALBE-5304 MemMapIncludesList removed + * 02.02.00 2022-08-18 virmfr HALBE-7504 Interchange include order of MemMap_Common.h and MemMap_Compatibility.h + * 2022-08-18 virmfr ASR3 defines removed + * 02.02.01 2022-08-26 virmfr Correction of small non-functional findings + * 03.00.00 2024-11-05 virjas OSHAL-1936 Adaption for new ASR Mem module + * 03.01.00 2025-10-13 virjas OSHAL-3696 Adaption for changed infrastructure (veHub) + *********************************************************************************************************************/ + +/* PRQA S 0841 MEMMAP_0841_TAG */ /* MD_MSR_19.6 */ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + + /* PRQA S 0883 1 */ /* MD_MemMap_19.15 */ +#undef MEMMAP_VENDOR_ID /* PRQA S 0841 */ /* MD_MSR_19.6 */ + +#define MEMMAP_VENDOR_ID (30u) + +/* AUTOSAR Software Specification Version Information */ +#undef MEMMAP_AR_RELEASE_MAJOR_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ +#undef MEMMAP_AR_RELEASE_MINOR_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ +#undef MEMMAP_AR_RELEASE_REVISION_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ + +/* AUTOSAR release 4.0 R3 */ +#define MEMMAP_AR_RELEASE_MAJOR_VERSION (4u) +#define MEMMAP_AR_RELEASE_MINOR_VERSION (0u) +#define MEMMAP_AR_RELEASE_REVISION_VERSION (3u) + +#undef MEMMAP_SW_MAJOR_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ +#undef MEMMAP_SW_MINOR_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ +#undef MEMMAP_SW_PATCH_VERSION /* PRQA S 0841 */ /* MD_MSR_19.6 */ + +#define MEMMAP_SW_MAJOR_VERSION (3u) +#define MEMMAP_SW_MINOR_VERSION (1u) +#define MEMMAP_SW_PATCH_VERSION (0u) + +#define MEMMAP_ERROR + +/* Package Merger: Start Section MemMapModuleList */ + + +/********************************************************************************************************************** + * MEM_30_FBLHIS START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ +#if defined( MEM_30_FBLHIS_START_SEC_CODE ) +# undef MEM_30_FBLHIS_START_SEC_CODE +# define START_SEC_CODE +#endif + +#if defined( MEM_30_FBLHIS_STOP_SEC_CODE ) +# undef MEM_30_FBLHIS_STOP_SEC_CODE +# define STOP_SEC_CODE +#endif + +/******* VAR sections ***********************************************************************************************/ +#if defined( MEM_30_FBLHIS_START_SEC_VAR ) +# undef MEM_30_FBLHIS_START_SEC_VAR +# define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#if defined( MEM_30_FBLHIS_STOP_SEC_VAR ) +# undef MEM_30_FBLHIS_STOP_SEC_VAR +# define STOP_SEC_VAR +#endif + +/******* CONST sections *********************************************************************************************/ +#if defined( MEM_30_FBLHIS_START_SEC_CONST ) +# undef MEM_30_FBLHIS_START_SEC_CONST +# define START_SEC_CONST_UNSPECIFIED +#endif + +#if defined( MEM_30_FBLHIS_STOP_SEC_CONST ) +# undef MEM_30_FBLHIS_STOP_SEC_CONST +# define STOP_SEC_CONST +#endif + +/********************************************************************************************************************** + * MEM_30_FBLHIS END + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CANTRCV_30_GENERICCAN START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CODE) +# undef CANTRCV_30_GENERICCAN_START_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE /* mapped to default code section */ +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CODE) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE /* default code stop section */ +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CODE_FAST) +# undef CANTRCV_30_GENERICCAN_START_SEC_CODE_FAST /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE_FAST /* mapped to default fast code section */ +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CODE_FAST) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CODE_FAST /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE /* default code stop section */ +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CODE_ISR) +# undef CANTRCV_30_GENERICCAN_START_SEC_CODE_ISR /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE_ISR /* mapped to default ISR code section */ +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CODE_ISR) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CODE_ISR /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE /* default code stop section */ +#endif + + +/******* CONST sections ********************************************************************************************/ + +/* CONST sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_8BIT /* mapped to default const 8bit section */ +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST /* default const stop section */ +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + + +/* FAST CONST sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_FAST_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_FAST_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_FAST_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_CONST_FAST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_FAST_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_CONST_FAST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + + +/* Postbuild CFG CONST sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_PBCFG) +# undef CANTRCV_30_GENERICCAN_START_SEC_PBCFG /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_PBCFG +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_PBCFG) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_PBCFG /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + + +/******* VAR sections **********************************************************************************************/ + +/* VAR INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_INIT_8BIT /* mapped to default var init 8bit section */ +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR /* default var stop section */ +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + + +/* VAR NOINIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* ESCAN00065501 */ +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_PBCFG) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_PBCFG /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_PBCFG +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_PBCFG) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_PBCFG /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + + +/* VAR ZERO INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + + +/* VAR FAST INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_INIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + + +/* VAR FAST NOINIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_NOINIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_NOINIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_NOINIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_NOINIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* VAR FAST ZERO INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_ZERO_INIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_ZERO_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_ZERO_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_FAST_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_FAST_ZERO_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_FAST_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* VAR NOCACHE INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_INIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* VAR NOCACHE NOINIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_NOINIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_NOINIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_NOINIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_NOINIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* VAR NOCACHE ZERO INIT sections */ + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_ZERO_INIT_8BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_8BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_ZERO_INIT_16BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_16BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_ZERO_INIT_32BIT +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_32BIT) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined(CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_START_SEC_VAR_NOCACHE_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOCACHE_ZERO_INIT_UNSPECIFIED +#endif +#if defined(CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_UNSPECIFIED) +# undef CANTRCV_30_GENERICCAN_STOP_SEC_VAR_NOCACHE_ZERO_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * CANTRCV_30_GENERICCAN END + *********************************************************************************************************************/ /* PRQA S 0883 */ /* Appears only while testing */ + + +/********************************************************************************************************************** + * BSWSTUB-COMM START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLASRSTUBS_COMM_START_SEC_CODE + #undef FBLASRSTUBS_COMM_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLASRSTUBS_COMM_STOP_SEC_CODE + #undef FBLASRSTUBS_COMM_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/********************************************************************************************************************** + * BSWSTUB-COMM END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * BSWSTUB-DEM START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLASRSTUBS_DEM_START_SEC_CODE + #undef FBLASRSTUBS_DEM_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLASRSTUBS_DEM_STOP_SEC_CODE + #undef FBLASRSTUBS_DEM_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/********************************************************************************************************************** + * BSWSTUB-DEM END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * FBLBM_HDR START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLBMHDR_START_SEC_CODE + #undef FBLBMHDR_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLBMHDR_STOP_SEC_CODE + #undef FBLBMHDR_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef FBLBMHDR_BMHEADER_START_SEC_CONST + #undef FBLBMHDR_BMHEADER_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLBMHDR_BMHEADER_STOP_SEC_CONST + #undef FBLBMHDR_BMHEADER_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +#ifdef FBLBMHDR_START_SEC_CONST + #undef FBLBMHDR_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLBMHDR_STOP_SEC_CONST + #undef FBLBMHDR_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +#ifdef FBLBMHDR_BMHEADER_IMAGE_START_SEC_CONST + #undef FBLBMHDR_BMHEADER_IMAGE_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLBMHDR_BMHEADER_IMAGE_STOP_SEC_CONST + #undef FBLBMHDR_BMHEADER_IMAGE_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +/********************************************************************************************************************** + * FBLBM_HDR END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * FBLBM_MAIN START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLBM_START_SEC_CODE + #undef FBLBM_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLBM_STOP_SEC_CODE + #undef FBLBM_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +#ifdef FBLBM_MAIN_FBLSTART_START_SEC_CODE + #undef FBLBM_MAIN_FBLSTART_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLBM_MAIN_FBLSTART_STOP_SEC_CODE + #undef FBLBM_MAIN_FBLSTART_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +#ifdef FBLBM_MAIN_APPLSTART_START_SEC_CODE + #undef FBLBM_MAIN_APPLSTART_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLBM_MAIN_APPLSTART_STOP_SEC_CODE + #undef FBLBM_MAIN_APPLSTART_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef FBLBM_HEADER_START_SEC_CONST + #undef FBLBM_HEADER_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLBM_HEADER_STOP_SEC_CONST + #undef FBLBM_HEADER_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +#ifdef FBLBM_START_SEC_CONST + #undef FBLBM_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLBM_STOP_SEC_CONST + #undef FBLBM_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +/******* VAR sections **********************************************************************************************/ + +#ifdef FBLBM_START_SEC_VAR + #undef FBLBM_START_SEC_VAR + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef FBLBM_STOP_SEC_VAR + #undef FBLBM_STOP_SEC_VAR + #define STOP_SEC_VAR +#endif + +#ifdef FBLBM_MAIN_MAGICFLAG_START_SEC_VAR_NOINIT + #undef FBLBM_MAIN_MAGICFLAG_START_SEC_VAR_NOINIT + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef FBLBM_MAIN_MAGICFLAG_STOP_SEC_VAR_NOINIT + #undef FBLBM_MAIN_MAGICFLAG_STOP_SEC_VAR_NOINIT + #define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * FBLBM_MAIN END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * FBLLIB_SECBOOT START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLSB_START_SEC_CODE + #undef FBLSB_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLSB_STOP_SEC_CODE + #undef FBLSB_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef FBLSB_START_SEC_CONST + #undef FBLSB_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLSB_STOP_SEC_CONST + #undef FBLSB_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +/******* VAR sections **********************************************************************************************/ + +#ifdef FBLSB_START_SEC_VAR + #undef FBLSB_START_SEC_VAR + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef FBLSB_STOP_SEC_VAR + #undef FBLSB_STOP_SEC_VAR + #define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * FBLLIB_SECBOOT END + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FblCw START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLCW_START_SEC_CODE +# undef FBLCW_START_SEC_CODE +# define START_SEC_CODE +#endif +#ifdef FBLCW_STOP_SEC_CODE +# undef FBLCW_STOP_SEC_CODE +# define STOP_SEC_CODE +#endif +/* FBCW application callback code section */ +#ifdef FBLCW_START_SEC_APPL_CODE +# undef FBLCW_START_SEC_APPL_CODE +# define START_SEC_CODE +#endif +#ifdef FBLCW_STOP_SEC_APPL_CODE +# undef FBLCW_STOP_SEC_APPL_CODE +# define STOP_SEC_CODE +#endif +#ifdef FBLCW_CAN_START_SEC_CODE +# undef FBLCW_CAN_START_SEC_CODE +# define START_SEC_CODE +#endif +#ifdef FBLCW_CAN_STOP_SEC_CODE +# undef FBLCW_CAN_STOP_SEC_CODE +# define STOP_SEC_CODE +#endif +#ifdef FBLCW_FR_START_SEC_CODE +# undef FBLCW_FR_START_SEC_CODE +# define START_SEC_CODE +#endif +#ifdef FBLCW_FR_STOP_SEC_CODE +# undef FBLCW_FR_STOP_SEC_CODE +# define STOP_SEC_CODE +#endif +#ifdef FBLCW_LIN_START_SEC_CODE +# undef FBLCW_LIN_START_SEC_CODE +# define START_SEC_CODE +#endif +#ifdef FBLCW_LIN_STOP_SEC_CODE +# undef FBLCW_LIN_STOP_SEC_CODE +# define STOP_SEC_CODE +#endif + +/******* CONST sections ********************************************************************************************/ + +/* CONST sections */ + +#ifdef FBLCW_START_SEC_CONST_8 +# undef FBLCW_START_SEC_CONST_8 +# define START_SEC_CONST_8 +#endif +#ifdef FBLCW_STOP_SEC_CONST_8 +# undef FBLCW_STOP_SEC_CONST_8 +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_CONST_16 +# undef FBLCW_START_SEC_CONST_16 +# define START_SEC_CONST_16 +#endif +#ifdef FBLCW_STOP_SEC_CONST_16 +# undef FBLCW_STOP_SEC_CONST_16 +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_CONST_32 +# undef FBLCW_START_SEC_CONST_32 +# define START_SEC_CONST_32 +#endif +#ifdef FBLCW_STOP_SEC_CONST_32 +# undef FBLCW_STOP_SEC_CONST_32 +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_CONST_64 +# undef FBLCW_START_SEC_CONST_64 +# define START_SEC_CONST_64 +#endif +#ifdef FBLCW_STOP_SEC_CONST_64 +# undef FBLCW_STOP_SEC_CONST_64 +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_CONST_UNSPECIFIED +# undef FBLCW_START_SEC_CONST_UNSPECIFIED +# define START_SEC_CONST_UNSPECIFIED +#endif +#ifdef FBLCW_STOP_SEC_CONST_UNSPECIFIED +# undef FBLCW_STOP_SEC_CONST_UNSPECIFIED +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_PBCFG +# undef FBLCW_START_SEC_PBCFG +# define START_SEC_CONST_PBCFG +#endif +#ifdef FBLCW_STOP_SEC_PBCFG +# undef FBLCW_STOP_SEC_PBCFG +# define STOP_SEC_CONST +#endif + +#ifdef FBLCW_START_SEC_VAR_PBCFG +# undef FBLCW_START_SEC_VAR_PBCFG +# define START_SEC_VAR_PBCFG +#endif +#ifdef FBLCW_STOP_SEC_VAR_PBCFG +# undef FBLCW_STOP_SEC_VAR_PBCFG +# define STOP_SEC_VAR +#endif + + +/******* VAR sections **********************************************************************************************/ + +#ifdef FBLCW_START_SEC_VAR +# undef FBLCW_START_SEC_VAR +# define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif +#ifdef FBLCW_STOP_SEC_VAR +# undef FBLCW_STOP_SEC_VAR +# define STOP_SEC_VAR +#endif + +/* VAR INIT sections */ + +#ifdef FBLCW_START_SEC_VAR_INIT_UNSPECIFIED +# undef FBLCW_START_SEC_VAR_INIT_UNSPECIFIED +# define START_SEC_VAR_INIT_UNSPECIFIED +#endif +#ifdef FBLCW_STOP_SEC_VAR_INIT_UNSPECIFIED +# undef FBLCW_STOP_SEC_VAR_INIT_UNSPECIFIED +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_CLEARED_UNSPECIFIED +# undef FBLCW_START_SEC_VAR_CLEARED_UNSPECIFIED +# define START_SEC_VAR_CLEARED_UNSPECIFIED +#endif +#ifdef FBLCW_STOP_SEC_VAR_CLEARED_UNSPECIFIED +# undef FBLCW_STOP_SEC_VAR_CLEARED_UNSPECIFIED +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_CLEARED_8 +# undef FBLCW_START_SEC_VAR_CLEARED_8 +# define START_SEC_VAR_CLEARED_8 +#endif +#ifdef FBLCW_STOP_SEC_VAR_CLEARED_8 +# undef FBLCW_STOP_SEC_VAR_CLEARED_8 +# define STOP_SEC_VAR +#endif + +/* VAR NO_INIT sections */ + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_BOOLEAN +# undef FBLCW_START_SEC_VAR_NO_INIT_BOOLEAN +# define START_SEC_VAR_NO_INIT_8 +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_BOOLEAN +# undef FBLCW_STOP_SEC_VAR_NO_INIT_BOOLEAN +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_8 +# undef FBLCW_START_SEC_VAR_NO_INIT_8 +# define START_SEC_VAR_NO_INIT_8 +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_8 +# undef FBLCW_STOP_SEC_VAR_NO_INIT_8 +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_16 +# undef FBLCW_START_SEC_VAR_NO_INIT_16 +# define START_SEC_VAR_NO_INIT_16 +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_16 +# undef FBLCW_STOP_SEC_VAR_NO_INIT_16 +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_32 +# undef FBLCW_START_SEC_VAR_NO_INIT_32 +# define START_SEC_VAR_NO_INIT_32 +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_32 +# undef FBLCW_STOP_SEC_VAR_NO_INIT_32 +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_64 +# undef FBLCW_START_SEC_VAR_NO_INIT_64 +# define START_SEC_VAR_NO_INIT_64 +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_64 +# undef FBLCW_STOP_SEC_VAR_NO_INIT_64 +# define STOP_SEC_VAR +#endif + +#ifdef FBLCW_START_SEC_VAR_NO_INIT_UNSPECIFIED +# undef FBLCW_START_SEC_VAR_NO_INIT_UNSPECIFIED +# define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif +#ifdef FBLCW_STOP_SEC_VAR_NO_INIT_UNSPECIFIED +# undef FBLCW_STOP_SEC_VAR_NO_INIT_UNSPECIFIED +# define STOP_SEC_VAR +#endif + + +/* VAR ZERO INIT sections */ + + + +/* VAR FAST INIT sections */ + + + +/* VAR FAST NO_INIT sections */ + + +/* VAR FAST ZERO INIT sections */ + + + +/********************************************************************************************************************** + * FblCw END + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * FBLVIRTUALIO START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef FBLVIRTUALIO_START_SEC_CODE + #undef FBLVIRTUALIO_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef FBLVIRTUALIO_STOP_SEC_CODE + #undef FBLVIRTUALIO_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef FBLVIRTUALIO_START_SEC_CONST + #undef FBLVIRTUALIO_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FBLVIRTUALIO_STOP_SEC_CONST + #undef FBLVIRTUALIO_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + + +/********************************************************************************************************************** + * FBLVIRTUALIO END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** +* 3rdParty_Mcal START +*********************************************************************************************************************/ + +#ifdef ADC_START_SEC_CODE + #undef ADC_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef ADC_STOP_SEC_CODE + #undef ADC_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ADC_START_SEC_CONFIG_DATA + #undef ADC_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef ADC_STOP_SEC_CONFIG_DATA + #undef ADC_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef ADC_START_SEC_ISR_CODE + #undef ADC_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef ADC_STOP_SEC_ISR_CODE + #undef ADC_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ADC_START_SEC_VAR_INIT_32 + #undef ADC_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef ADC_STOP_SEC_VAR_INIT_32 + #undef ADC_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef ADC_START_SEC_VAR_INIT_UNSPECIFIED + #undef ADC_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef ADC_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef ADC_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef ADC_START_SEC_VAR_NO_INIT_8 + #undef ADC_START_SEC_VAR_NO_INIT_8 + #define START_SEC_VAR_NO_INIT_8 +#endif + +#ifdef ADC_STOP_SEC_VAR_NO_INIT_8 + #undef ADC_STOP_SEC_VAR_NO_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef ADC_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ADC_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef ADC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ADC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CAN_START_SEC_CODE + #undef CAN_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CAN_STOP_SEC_CODE + #undef CAN_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CAN_START_SEC_CONFIG_DATA + #undef CAN_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CAN_STOP_SEC_CONFIG_DATA + #undef CAN_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CAN_START_SEC_CONST_32 + #undef CAN_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef CAN_STOP_SEC_CONST_32 + #undef CAN_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef CAN_START_SEC_CONST_8 + #undef CAN_START_SEC_CONST_8 + #define START_SEC_CONST_8 +#endif + +#ifdef CAN_STOP_SEC_CONST_8 + #undef CAN_STOP_SEC_CONST_8 + #define STOP_SEC_CONST +#endif + +#ifdef CAN_START_SEC_CONST_UNSPECIFIED + #undef CAN_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CAN_STOP_SEC_CONST_UNSPECIFIED + #undef CAN_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef CAN_START_SEC_ISR_CODE + #undef CAN_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CAN_STOP_SEC_ISR_CODE + #undef CAN_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CAN_START_SEC_VAR_INIT_32 + #undef CAN_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CAN_STOP_SEC_VAR_INIT_32 + #undef CAN_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CAN_START_SEC_VAR_INIT_8 + #undef CAN_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CAN_STOP_SEC_VAR_INIT_8 + #undef CAN_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CAN_START_SEC_VAR_INIT_UNSPECIFIED + #undef CAN_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CAN_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CAN_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CAN_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CAN_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CAN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CAN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_DMA_START_SEC_CODE + #undef CDD_DMA_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_DMA_STOP_SEC_CODE + #undef CDD_DMA_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_DMA_START_SEC_CONFIG_DATA + #undef CDD_DMA_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CDD_DMA_STOP_SEC_CONFIG_DATA + #undef CDD_DMA_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CDD_DMA_START_SEC_ISR_CODE + #undef CDD_DMA_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CDD_DMA_STOP_SEC_ISR_CODE + #undef CDD_DMA_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_DMA_START_SEC_VAR_INIT_32 + #undef CDD_DMA_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CDD_DMA_STOP_SEC_VAR_INIT_32 + #undef CDD_DMA_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_DMA_START_SEC_VAR_INIT_8 + #undef CDD_DMA_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CDD_DMA_STOP_SEC_VAR_INIT_8 + #undef CDD_DMA_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_DMA_START_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_DMA_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CDD_DMA_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_DMA_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_DMA_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_DMA_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CDD_DMA_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_DMA_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_I2C_START_SEC_CODE + #undef CDD_I2C_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_I2C_STOP_SEC_CODE + #undef CDD_I2C_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_I2C_START_SEC_CONFIG_DATA + #undef CDD_I2C_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CDD_I2C_STOP_SEC_CONFIG_DATA + #undef CDD_I2C_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CDD_I2C_START_SEC_CONST_32 + #undef CDD_I2C_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef CDD_I2C_STOP_SEC_CONST_32 + #undef CDD_I2C_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef CDD_I2C_START_SEC_ISR_CODE + #undef CDD_I2C_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CDD_I2C_STOP_SEC_ISR_CODE + #undef CDD_I2C_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_I2C_START_SEC_VAR_INIT_16 + #undef CDD_I2C_START_SEC_VAR_INIT_16 + #define START_SEC_VAR_INIT_16 +#endif + +#ifdef CDD_I2C_STOP_SEC_VAR_INIT_16 + #undef CDD_I2C_STOP_SEC_VAR_INIT_16 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_I2C_START_SEC_VAR_INIT_32 + #undef CDD_I2C_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CDD_I2C_STOP_SEC_VAR_INIT_32 + #undef CDD_I2C_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_I2C_START_SEC_VAR_INIT_8 + #undef CDD_I2C_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CDD_I2C_STOP_SEC_VAR_INIT_8 + #undef CDD_I2C_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_I2C_START_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_I2C_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CDD_I2C_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_I2C_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_I2C_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_I2C_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CDD_I2C_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_I2C_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_IPC_START_SEC_CODE + #undef CDD_IPC_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_IPC_STOP_SEC_CODE + #undef CDD_IPC_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_IPC_START_SEC_CONFIG_DATA + #undef CDD_IPC_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CDD_IPC_STOP_SEC_CONFIG_DATA + #undef CDD_IPC_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CDD_IPC_START_SEC_ISR_CODE + #undef CDD_IPC_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CDD_IPC_STOP_SEC_ISR_CODE + #undef CDD_IPC_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_IPC_START_SEC_VAR_INIT_32 + #undef CDD_IPC_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CDD_IPC_STOP_SEC_VAR_INIT_32 + #undef CDD_IPC_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_IPC_START_SEC_VAR_INIT_8 + #undef CDD_IPC_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CDD_IPC_STOP_SEC_VAR_INIT_8 + #undef CDD_IPC_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_IPC_START_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_IPC_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CDD_IPC_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_IPC_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_IPC_START_SEC_VAR_NO_INIT_8 + #undef CDD_IPC_START_SEC_VAR_NO_INIT_8 + #define START_SEC_VAR_NO_INIT_8 +#endif + +#ifdef CDD_IPC_STOP_SEC_VAR_NO_INIT_8 + #undef CDD_IPC_STOP_SEC_VAR_NO_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_IPC_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_IPC_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CDD_IPC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_IPC_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_PWM_START_SEC_CODE + #undef CDD_PWM_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_PWM_STOP_SEC_CODE + #undef CDD_PWM_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_PWM_START_SEC_CONFIG_DATA + #undef CDD_PWM_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CDD_PWM_STOP_SEC_CONFIG_DATA + #undef CDD_PWM_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CDD_PWM_START_SEC_ISR_CODE + #undef CDD_PWM_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CDD_PWM_STOP_SEC_ISR_CODE + #undef CDD_PWM_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_PWM_START_SEC_VAR_INIT_32 + #undef CDD_PWM_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CDD_PWM_STOP_SEC_VAR_INIT_32 + #undef CDD_PWM_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_PWM_START_SEC_VAR_INIT_8 + #undef CDD_PWM_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CDD_PWM_STOP_SEC_VAR_INIT_8 + #undef CDD_PWM_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_PWM_START_SEC_VAR_NO_INIT_16 + #undef CDD_PWM_START_SEC_VAR_NO_INIT_16 + #define START_SEC_VAR_NO_INIT_16 +#endif + +#ifdef CDD_PWM_STOP_SEC_VAR_NO_INIT_16 + #undef CDD_PWM_STOP_SEC_VAR_NO_INIT_16 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_PWM_START_SEC_VAR_NO_INIT_32 + #undef CDD_PWM_START_SEC_VAR_NO_INIT_32 + #define START_SEC_VAR_NO_INIT_32 +#endif + +#ifdef CDD_PWM_STOP_SEC_VAR_NO_INIT_32 + #undef CDD_PWM_STOP_SEC_VAR_NO_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_PWM_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_PWM_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CDD_PWM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_PWM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_START_SEC_CODE + #undef CDD_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_STOP_SEC_CODE + #undef CDD_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_START_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CDD_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_UART_START_SEC_CODE + #undef CDD_UART_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef CDD_UART_STOP_SEC_CODE + #undef CDD_UART_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_UART_START_SEC_CONFIG_DATA + #undef CDD_UART_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef CDD_UART_STOP_SEC_CONFIG_DATA + #undef CDD_UART_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef CDD_UART_START_SEC_ISR_CODE + #undef CDD_UART_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef CDD_UART_STOP_SEC_ISR_CODE + #undef CDD_UART_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef CDD_UART_START_SEC_VAR_INIT_32 + #undef CDD_UART_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef CDD_UART_STOP_SEC_VAR_INIT_32 + #undef CDD_UART_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_UART_START_SEC_VAR_INIT_8 + #undef CDD_UART_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef CDD_UART_STOP_SEC_VAR_INIT_8 + #undef CDD_UART_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_UART_START_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_UART_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef CDD_UART_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef CDD_UART_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef CDD_UART_START_SEC_VAR_NO_INIT_32 + #undef CDD_UART_START_SEC_VAR_NO_INIT_32 + #define START_SEC_VAR_NO_INIT_32 +#endif + +#ifdef CDD_UART_STOP_SEC_VAR_NO_INIT_32 + #undef CDD_UART_STOP_SEC_VAR_NO_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef CDD_UART_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_UART_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef CDD_UART_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef CDD_UART_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef DIO_START_SEC_CODE + #undef DIO_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef DIO_STOP_SEC_CODE + #undef DIO_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef DIO_START_SEC_CONFIG_DATA + #undef DIO_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef DIO_STOP_SEC_CONFIG_DATA + #undef DIO_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef DIO_START_SEC_CONST_32 + #undef DIO_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef DIO_STOP_SEC_CONST_32 + #undef DIO_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef DIO_START_SEC_CONST_UNSPECIFIED + #undef DIO_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef DIO_STOP_SEC_CONST_UNSPECIFIED + #undef DIO_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef ETH_START_SEC_CODE + #undef ETH_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef ETH_STOP_SEC_CODE + #undef ETH_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ETH_START_SEC_CONFIG_DATA + #undef ETH_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef ETH_STOP_SEC_CONFIG_DATA + #undef ETH_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef ETH_START_SEC_CONST_8 + #undef ETH_START_SEC_CONST_8 + #define START_SEC_CONST_8 +#endif + +#ifdef ETH_STOP_SEC_CONST_8 + #undef ETH_STOP_SEC_CONST_8 + #define STOP_SEC_CONST +#endif + +#ifdef ETH_START_SEC_CONST_UNSPECIFIED + #undef ETH_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef ETH_STOP_SEC_CONST_UNSPECIFIED + #undef ETH_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef ETH_START_SEC_ISR_CODE + #undef ETH_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef ETH_STOP_SEC_ISR_CODE + #undef ETH_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ETH_START_SEC_VAR_INIT_32 + #undef ETH_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef ETH_STOP_SEC_VAR_INIT_32 + #undef ETH_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef ETH_START_SEC_VAR_INIT_8 + #undef ETH_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef ETH_STOP_SEC_VAR_INIT_8 + #undef ETH_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef ETH_START_SEC_VAR_INIT_UNSPECIFIED + #undef ETH_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef ETH_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef ETH_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef ETH_START_SEC_VAR_NO_INIT_8 + #undef ETH_START_SEC_VAR_NO_INIT_8 + #define START_SEC_VAR_NO_INIT_8 +#endif + +#ifdef ETH_STOP_SEC_VAR_NO_INIT_8 + #undef ETH_STOP_SEC_VAR_NO_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef ETH_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ETH_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef ETH_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ETH_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_CODE + #undef FLS_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef FLS_STOP_SEC_CODE + #undef FLS_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef FLS_START_SEC_CONFIG_DATA + #undef FLS_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef FLS_STOP_SEC_CONFIG_DATA + #undef FLS_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef FLS_START_SEC_ISR_CODE + #undef FLS_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef FLS_STOP_SEC_ISR_CODE + #undef FLS_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef FLS_START_SEC_VAR_INIT_32 + #undef FLS_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef FLS_STOP_SEC_VAR_INIT_32 + #undef FLS_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_VAR_INIT_8 + #undef FLS_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef FLS_STOP_SEC_VAR_INIT_8 + #undef FLS_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_VAR_INIT_UNSPECIFIED + #undef FLS_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef FLS_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef FLS_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_VAR_NO_INIT_32 + #undef FLS_START_SEC_VAR_NO_INIT_32 + #define START_SEC_VAR_NO_INIT_32 +#endif + +#ifdef FLS_STOP_SEC_VAR_NO_INIT_32 + #undef FLS_STOP_SEC_VAR_NO_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_VAR_NO_INIT_8 + #undef FLS_START_SEC_VAR_NO_INIT_8 + #define START_SEC_VAR_NO_INIT_8 +#endif + +#ifdef FLS_STOP_SEC_VAR_NO_INIT_8 + #undef FLS_STOP_SEC_VAR_NO_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef FLS_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef FLS_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef FLS_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef FLS_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_CODE + #undef GPT_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef GPT_STOP_SEC_CODE + #undef GPT_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef GPT_START_SEC_CONFIG_DATA + #undef GPT_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_CONFIG_DATA + #undef GPT_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef GPT_START_SEC_CONST_32 + #undef GPT_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef GPT_STOP_SEC_CONST_32 + #undef GPT_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef GPT_START_SEC_CONST_PTR + #undef GPT_START_SEC_CONST_PTR + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_CONST_PTR + #undef GPT_STOP_SEC_CONST_PTR + #define STOP_SEC_CONST +#endif + +#ifdef GPT_START_SEC_CONST_UNSPECIFIED + #undef GPT_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_CONST_UNSPECIFIED + #undef GPT_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef GPT_START_SEC_ISR_CODE + #undef GPT_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef GPT_STOP_SEC_ISR_CODE + #undef GPT_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef GPT_START_SEC_VAR_INIT_16 + #undef GPT_START_SEC_VAR_INIT_16 + #define START_SEC_VAR_INIT_16 +#endif + +#ifdef GPT_STOP_SEC_VAR_INIT_16 + #undef GPT_STOP_SEC_VAR_INIT_16 + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_VAR_INIT_PTR + #undef GPT_START_SEC_VAR_INIT_PTR + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_VAR_INIT_PTR + #undef GPT_STOP_SEC_VAR_INIT_PTR + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_VAR_INIT_UNSPECIFIED + #undef GPT_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef GPT_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_VAR_NO_INIT_16 + #undef GPT_START_SEC_VAR_NO_INIT_16 + #define START_SEC_VAR_NO_INIT_16 +#endif + +#ifdef GPT_STOP_SEC_VAR_NO_INIT_16 + #undef GPT_STOP_SEC_VAR_NO_INIT_16 + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_VAR_NO_INIT_32 + #undef GPT_START_SEC_VAR_NO_INIT_32 + #define START_SEC_VAR_NO_INIT_32 +#endif + +#ifdef GPT_STOP_SEC_VAR_NO_INIT_32 + #undef GPT_STOP_SEC_VAR_NO_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef GPT_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef GPT_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef GPT_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef GPT_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef I2C_START_SEC_CODE + #undef I2C_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef I2C_STOP_SEC_CODE + #undef I2C_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef I2C_START_SEC_CONFIG_DATA_UNSPECIFIED + #undef I2C_START_SEC_CONFIG_DATA_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef I2C_STOP_SEC_CONFIG_DATA_UNSPECIFIED + #undef I2C_STOP_SEC_CONFIG_DATA_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef I2C_START_SEC_VAR_CLEARED_16 + #undef I2C_START_SEC_VAR_CLEARED_16 + #define START_SEC_VAR_CLEARED_16 +#endif + +#ifdef I2C_STOP_SEC_VAR_CLEARED_16 + #undef I2C_STOP_SEC_VAR_CLEARED_16 + #define STOP_SEC_VAR +#endif + +#ifdef I2C_START_SEC_VAR_CLEARED_UNSPECIFIED + #undef I2C_START_SEC_VAR_CLEARED_UNSPECIFIED + #define START_SEC_VAR_CLEARED_UNSPECIFIED +#endif + +#ifdef I2C_STOP_SEC_VAR_CLEARED_UNSPECIFIED + #undef I2C_STOP_SEC_VAR_CLEARED_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef I2C_START_SEC_VAR_INIT_UNSPECIFIED + #undef I2C_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef I2C_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef I2C_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef ICU_START_SEC_CODE + #undef ICU_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef ICU_STOP_SEC_CODE + #undef ICU_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ICU_START_SEC_CONFIG_DATA + #undef ICU_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef ICU_STOP_SEC_CONFIG_DATA + #undef ICU_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef ICU_START_SEC_ISR_CODE + #undef ICU_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef ICU_STOP_SEC_ISR_CODE + #undef ICU_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef ICU_START_SEC_VAR_INIT_32 + #undef ICU_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef ICU_STOP_SEC_VAR_INIT_32 + #undef ICU_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef ICU_START_SEC_VAR_INIT_8 + #undef ICU_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef ICU_STOP_SEC_VAR_INIT_8 + #undef ICU_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef ICU_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ICU_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef ICU_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef ICU_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef LIN_START_SEC_CODE + #undef LIN_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef LIN_STOP_SEC_CODE + #undef LIN_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef LIN_START_SEC_CONFIG_DATA + #undef LIN_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef LIN_STOP_SEC_CONFIG_DATA + #undef LIN_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef LIN_START_SEC_ISR_CODE + #undef LIN_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef LIN_STOP_SEC_ISR_CODE + #undef LIN_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef LIN_START_SEC_VAR_INIT_UNSPECIFIED + #undef LIN_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef LIN_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef LIN_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef LIN_START_SEC_VAR_NO_INIT_8 + #undef LIN_START_SEC_VAR_NO_INIT_8 + #define START_SEC_VAR_NO_INIT_8 +#endif + +#ifdef LIN_STOP_SEC_VAR_NO_INIT_8 + #undef LIN_STOP_SEC_VAR_NO_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef LIN_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef LIN_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef LIN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef LIN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef LIN_START_SEC_VAR_NOINIT_UNSPECIFIED + #undef LIN_START_SEC_VAR_NOINIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef LIN_STOP_SEC_VAR_NOINIT_UNSPECIFIED + #undef LIN_STOP_SEC_VAR_NOINIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef MCAL_LIB_START_SEC_CODE + #undef MCAL_LIB_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef MCAL_LIB_STOP_SEC_CODE + #undef MCAL_LIB_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef MCU_START_SEC_CODE + #undef MCU_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef MCU_STOP_SEC_CODE + #undef MCU_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef MCU_START_SEC_CONFIG_DATA + #undef MCU_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef MCU_STOP_SEC_CONFIG_DATA + #undef MCU_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef MCU_START_SEC_VAR_INIT_8 + #undef MCU_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef MCU_STOP_SEC_VAR_INIT_8 + #undef MCU_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef MCU_START_SEC_VAR_INIT_PTR + #undef MCU_START_SEC_VAR_INIT_PTR + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef MCU_STOP_SEC_VAR_INIT_PTR + #undef MCU_STOP_SEC_VAR_INIT_PTR + #define STOP_SEC_VAR +#endif + +#ifdef MCU_START_SEC_VAR_INIT_UNSPECIFIED + #undef MCU_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef MCU_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef MCU_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef PORT_START_SEC_CODE + #undef PORT_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef PORT_STOP_SEC_CODE + #undef PORT_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef PORT_START_SEC_CONFIG_DATA + #undef PORT_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef PORT_STOP_SEC_CONFIG_DATA + #undef PORT_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef PORT_START_SEC_CONST_32 + #undef PORT_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef PORT_STOP_SEC_CONST_32 + #undef PORT_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef PORT_START_SEC_CONST_UNSPECIFIED + #undef PORT_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef PORT_STOP_SEC_CONST_UNSPECIFIED + #undef PORT_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef PORT_START_SEC_ISR_CODE + #undef PORT_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef PORT_STOP_SEC_ISR_CODE + #undef PORT_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef PORT_START_SEC_VAR_INIT_UNSPECIFIED + #undef PORT_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef PORT_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef PORT_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef PORT_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef PORT_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef PORT_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef PORT_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef PWM_START_SEC_CODE + #undef PWM_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef PWM_STOP_SEC_CODE + #undef PWM_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef PWM_START_SEC_CONFIG_DATA + #undef PWM_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef PWM_STOP_SEC_CONFIG_DATA + #undef PWM_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef PWM_START_SEC_ISR_CODE + #undef PWM_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef PWM_STOP_SEC_ISR_CODE + #undef PWM_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef PWM_START_SEC_VAR_INIT_32 + #undef PWM_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef PWM_STOP_SEC_VAR_INIT_32 + #undef PWM_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef PWM_START_SEC_VAR_INIT_8 + #undef PWM_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef PWM_STOP_SEC_VAR_INIT_8 + #undef PWM_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef PWM_START_SEC_VAR_INIT_PTR + #undef PWM_START_SEC_VAR_INIT_PTR + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef PWM_STOP_SEC_VAR_INIT_PTR + #undef PWM_STOP_SEC_VAR_INIT_PTR + #define STOP_SEC_VAR +#endif + +#ifdef PWM_START_SEC_VAR_NO_INIT_32 + #undef PWM_START_SEC_VAR_NO_INIT_32 + #define START_SEC_VAR_NO_INIT_32 +#endif + +#ifdef PWM_STOP_SEC_VAR_NO_INIT_32 + #undef PWM_STOP_SEC_VAR_NO_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef PWM_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef PWM_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef PWM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef PWM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef SPI_START_SEC_CODE + #undef SPI_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef SPI_STOP_SEC_CODE + #undef SPI_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef SPI_START_SEC_CONFIG_DATA + #undef SPI_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef SPI_STOP_SEC_CONFIG_DATA + #undef SPI_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef SPI_START_SEC_CONST_32 + #undef SPI_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef SPI_STOP_SEC_CONST_32 + #undef SPI_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef SPI_START_SEC_CONST_UNSPECIFIED + #undef SPI_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef SPI_STOP_SEC_CONST_UNSPECIFIED + #undef SPI_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef SPI_START_SEC_ISR_CODE + #undef SPI_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef SPI_STOP_SEC_ISR_CODE + #undef SPI_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef SPI_START_SEC_UDMA_RING + #undef SPI_START_SEC_UDMA_RING + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef SPI_STOP_SEC_UDMA_RING + #undef SPI_STOP_SEC_UDMA_RING + #define STOP_SEC_VAR +#endif + +#ifdef SPI_START_SEC_VAR_INIT_32 + #undef SPI_START_SEC_VAR_INIT_32 + #define START_SEC_VAR_INIT_32 +#endif + +#ifdef SPI_STOP_SEC_VAR_INIT_32 + #undef SPI_STOP_SEC_VAR_INIT_32 + #define STOP_SEC_VAR +#endif + +#ifdef SPI_START_SEC_VAR_INIT_8 + #undef SPI_START_SEC_VAR_INIT_8 + #define START_SEC_VAR_INIT_8 +#endif + +#ifdef SPI_STOP_SEC_VAR_INIT_8 + #undef SPI_STOP_SEC_VAR_INIT_8 + #define STOP_SEC_VAR +#endif + +#ifdef SPI_START_SEC_VAR_INIT_UNSPECIFIED + #undef SPI_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef SPI_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef SPI_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef SPI_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef SPI_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef SPI_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef SPI_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef WDG_START_SEC_CODE + #undef WDG_START_SEC_CODE + #define START_SEC_CODE +#endif + +#ifdef WDG_STOP_SEC_CODE + #undef WDG_STOP_SEC_CODE + #define STOP_SEC_CODE +#endif + +#ifdef WDG_START_SEC_CONFIG_DATA + #undef WDG_START_SEC_CONFIG_DATA + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef WDG_STOP_SEC_CONFIG_DATA + #undef WDG_STOP_SEC_CONFIG_DATA + #define STOP_SEC_CONST +#endif + +#ifdef WDG_START_SEC_CONST_32 + #undef WDG_START_SEC_CONST_32 + #define START_SEC_CONST_32 +#endif + +#ifdef WDG_STOP_SEC_CONST_32 + #undef WDG_STOP_SEC_CONST_32 + #define STOP_SEC_CONST +#endif + +#ifdef WDG_START_SEC_CONST_UNSPECIFIED + #undef WDG_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef WDG_STOP_SEC_CONST_UNSPECIFIED + #undef WDG_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +#ifdef WDG_START_SEC_ISR_CODE + #undef WDG_START_SEC_ISR_CODE + #define START_SEC_CODE_ISR +#endif + +#ifdef WDG_STOP_SEC_ISR_CODE + #undef WDG_STOP_SEC_ISR_CODE + #define STOP_SEC_CODE +#endif + +#ifdef WDG_START_SEC_VAR_INIT_UNSPECIFIED + #undef WDG_START_SEC_VAR_INIT_UNSPECIFIED + #define START_SEC_VAR_INIT_UNSPECIFIED +#endif + +#ifdef WDG_STOP_SEC_VAR_INIT_UNSPECIFIED + #undef WDG_STOP_SEC_VAR_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +#ifdef WDG_START_SEC_VAR_NO_INIT_UNSPECIFIED + #undef WDG_START_SEC_VAR_NO_INIT_UNSPECIFIED + #define START_SEC_VAR_NO_INIT_UNSPECIFIED +#endif + +#ifdef WDG_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #undef WDG_STOP_SEC_VAR_NO_INIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** +* 3rdParty_Mcal END +*********************************************************************************************************************/ + + +/********************************************************************************************************************** + * CSM START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#if defined (CSM_START_SEC_CODE) +# undef CSM_START_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE /* mapped to default code section */ +#endif +#if defined (CSM_STOP_SEC_CODE) +# undef CSM_STOP_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE /* default code stop section */ +#endif + +#if defined (CSM_START_SEC_APPL_CODE) +# undef CSM_START_SEC_APPL_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE /* mapped to default code section */ +#endif +#if defined (CSM_STOP_SEC_APPL_CODE) +# undef CSM_STOP_SEC_APPL_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE /* default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +/* CONST sections */ + +#if defined (CSM_START_SEC_CONST_8BIT) +# undef CSM_START_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_8BIT +#endif + +#if defined (CSM_STOP_SEC_CONST_8BIT) +# undef CSM_STOP_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +#if defined (CSM_START_SEC_CONST_UNSPECIFIED) +# undef CSM_START_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_UNSPECIFIED +#endif +#if defined (CSM_STOP_SEC_CONST_UNSPECIFIED) +# undef CSM_STOP_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + +/******* VAR sections **********************************************************************************************/ + +/* VAR NOINIT sections */ + +#if defined (CSM_START_SEC_VAR_NOINIT_8BIT) +# undef CSM_START_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_8BIT +#endif +#if defined (CSM_STOP_SEC_VAR_NOINIT_8BIT) +# undef CSM_STOP_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined (CSM_START_SEC_VAR_NOINIT_16BIT) +# undef CSM_START_SEC_VAR_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_16BIT +#endif +#if defined (CSM_STOP_SEC_VAR_NOINIT_16BIT) +# undef CSM_STOP_SEC_VAR_NOINIT_16BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/* VAR ZERO INIT sections */ +#if defined (CSM_START_SEC_VAR_ZERO_INIT_8BIT) +# undef CSM_START_SEC_VAR_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_8BIT +#endif +#if defined (CSM_STOP_SEC_VAR_ZERO_INIT_8BIT) +# undef CSM_STOP_SEC_VAR_ZERO_INIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined (CSM_START_SEC_VAR_ZERO_INIT_32BIT) +# undef CSM_START_SEC_VAR_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_ZERO_INIT_32BIT +#endif +#if defined (CSM_STOP_SEC_VAR_ZERO_INIT_32BIT) +# undef CSM_STOP_SEC_VAR_ZERO_INIT_32BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#if defined (CSM_START_SEC_VAR_NOINIT_UNSPECIFIED) +# undef CSM_START_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif +#if defined (CSM_STOP_SEC_VAR_NOINIT_UNSPECIFIED) +# undef CSM_STOP_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * CSM END + *********************************************************************************************************************/ + + +#ifdef DET_START_SEC_CODE +# undef DET_START_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE +#endif +#ifdef DET_STOP_SEC_CODE +# undef DET_STOP_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE +#endif + +#ifdef DET_START_SEC_VAR_NOINIT_UNSPECIFIED +# undef DET_START_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif +#ifdef DET_STOP_SEC_VAR_NOINIT_UNSPECIFIED +# undef DET_STOP_SEC_VAR_NOINIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#ifdef DET_START_SEC_VAR_NOINIT_8BIT +# undef DET_START_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_NOINIT_8BIT +#endif +#ifdef DET_STOP_SEC_VAR_NOINIT_8BIT +# undef DET_STOP_SEC_VAR_NOINIT_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#ifdef DET_START_SEC_VAR_INIT_UNSPECIFIED +# undef DET_START_SEC_VAR_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_VAR_INIT_UNSPECIFIED +#endif +#ifdef DET_STOP_SEC_VAR_INIT_UNSPECIFIED +# undef DET_STOP_SEC_VAR_INIT_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_VAR +#endif + +#ifdef DET_START_SEC_CONST_UNSPECIFIED +# undef DET_START_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_UNSPECIFIED +#endif +#ifdef DET_STOP_SEC_CONST_UNSPECIFIED +# undef DET_STOP_SEC_CONST_UNSPECIFIED /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST +#endif + + +/********************************************************************************************************************** + * WRAPNV START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef SECM_RAMCODE_START_SEC_CODE + #undef SECM_RAMCODE_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef SECM_RAMCODE_STOP_SEC_CODE + #undef SECM_RAMCODE_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +#ifdef SECM_START_SEC_CODE + #undef SECM_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef SECM_STOP_SEC_CODE + #undef SECM_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef SECM_START_SEC_CONST + #undef SECM_START_SEC_CONST + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef SECM_STOP_SEC_CONST + #undef SECM_STOP_SEC_CONST + #define STOP_SEC_CONST +#endif + +/******* VAR sections **********************************************************************************************/ + +#ifdef SECM_START_SEC_VAR + #undef SECM_START_SEC_VAR + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef SECM_STOP_SEC_VAR + #undef SECM_STOP_SEC_VAR + #define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * WRAPNV END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * WRAPNV START + *********************************************************************************************************************/ + +/******* CODE sections **********************************************************************************************/ + +#ifdef WRAPNV_START_SEC_CODE + #undef WRAPNV_START_SEC_CODE + #define START_SEC_CODE /* Mapped to default code section */ +#endif + +#ifdef WRAPNV_STOP_SEC_CODE + #undef WRAPNV_STOP_SEC_CODE + #define STOP_SEC_CODE /* Default code stop section */ +#endif + +/******* CONST sections ********************************************************************************************/ + +#ifdef WRAPNV_START_SEC_CONST_UNSPECIFIED + #undef WRAPNV_START_SEC_CONST_UNSPECIFIED + #define START_SEC_CONST_UNSPECIFIED +#endif + +#ifdef WRAPNV_STOP_SEC_CONST_UNSPECIFIED + #undef WRAPNV_STOP_SEC_CONST_UNSPECIFIED + #define STOP_SEC_CONST +#endif + +/******* VAR sections **********************************************************************************************/ + +#ifdef WRAPNV_START_SEC_VAR_NOINIT_UNSPECIFIED + #undef WRAPNV_START_SEC_VAR_NOINIT_UNSPECIFIED + #define START_SEC_VAR_NOINIT_UNSPECIFIED +#endif + +#ifdef WRAPNV_STOP_SEC_VAR_NOINIT_UNSPECIFIED + #undef WRAPNV_STOP_SEC_VAR_NOINIT_UNSPECIFIED + #define STOP_SEC_VAR +#endif + +/********************************************************************************************************************** + * WRAPNV END + *********************************************************************************************************************/ + + +/********************************************************************************************************************** + * VSTDLIB START + *********************************************************************************************************************/ + +#if defined(VSTDLIB_START_SEC_CODE) +# undef VSTDLIB_START_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CODE /* mapped to default code section */ +#endif +#if defined(VSTDLIB_STOP_SEC_CODE) +# undef VSTDLIB_STOP_SEC_CODE /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CODE +#endif + +#if defined(VSTDLIB_START_SEC_CONST_8BIT) +# undef VSTDLIB_START_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define START_SEC_CONST_8BIT /* mapped to const 8 bit section */ +#endif +#if defined(VSTDLIB_STOP_SEC_CONST_8BIT) +# undef VSTDLIB_STOP_SEC_CONST_8BIT /* PRQA S 0841 */ /* MD_MSR_Undef */ +# define STOP_SEC_CONST /* default const stop section */ +#endif + +/********************************************************************************************************************** + * VSTDLIB END + *********************************************************************************************************************/ + + + +/* PRQA L:MEMMAP_0841_TAG */ + +/* MEMMAP_REMAPPING_ONLY is set if the MemMap is only used to remap Memory Allocation Keywords. + If not set the Memory Allocation Keywords will be resolved to pragmas */ +#ifndef MEMMAP_REMAPPING_ONLY +# include "MemMap_Common.h" + +/* MEMMAP_ERROR is + - still defined if MemMap_Common.h did not contain a matching section + - undefined, if MemMap_Common.h handled the section define. */ +# ifdef MEMMAP_ERROR +/* contains all configured MemMap Sections */ +# include "MemMap_Compatibility.h" /* generated by module MemMap */ +# endif + +# ifdef MEMMAP_ERROR +# error No MemMap section found in MemMap_Common.h and MemMap_Compatibility.h. Check your section define for validity. +# endif +#endif + + +/********************************************************************************************************************** + * END OF FILE: MemMap.h + *********************************************************************************************************************/ + diff --git a/Source/bsw/Common/Platform_Types.h b/Source/bsw/Common/Platform_Types.h new file mode 100644 index 0000000..1e7b896 --- /dev/null +++ b/Source/bsw/Common/Platform_Types.h @@ -0,0 +1,216 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------- + * File: Platform_Types.h + * Component: - + * Module: - + * Generator: - + * + * Description: Provision of Platform Types for Arm32 + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2007-11-06 Jk Template creation + * 01.00.01 2008-12-03 Ces Update version of AUTOSAR software specification document in template + * 01.00.02 2010-01-07 Ht comment about handling of float 64 in case floating point type with size 8 + * byte is not supported by a platform/Compiler + * 01.01.00 2011-03-04 visht support ASR 4.0R1 + * 01.02.00 2012-06-29 visht support ASR 4.0R3 ( no change ) + * 01.03.00 2012-08-23 visht version define corrected - replace PATCH by REVISION - (PLATFORM_AR_RELEASE_REVISION_VERSION) + * 01.03.01 2012-11-05 visseu PLATFORM_MODULE_ID added as specified in "AUTOSAR_TR_BSWModuleList.pdf" (R4.0 Rev 3), component version corrected + * 02.00.00 2015-03-13 vispl Setup for CommonAsr_Arm32 + * 02.00.01 2015-09-04 vispl Add suffix "u" in compliance with MISRA-C:2004 rule 10.6. + * AR4-667: Support sint64 and uint64 + * 02.01.00 2020-11-16 visbwa Removed AUTHOR IDENTITY, changed filter mechanism (Product instead of + * AutosarVersion) + * 02.01.01 2020-11-17 visbwa Fix of PLATFORM_SW_MINOR_VERSION + * 02.02.00 2023-07-18 virrlu HALBE-10062 Update to AUTOSAR Release 21-11 + * 02.02.01 2023-08-28 virrlu ESCAN00115495 Compiler warning: __STDC_VERSION__ not defined + * 02.02.02 2023-09-20 virjas ESCAN00115709 PostBuild generator fails when the AUTOSAR boolean type (_Bool) is used + * 02.02.03 2024-02-01 virmid OSHAL-990 Updated copyright year. + * 02.02.04 2024-03-15 virjas OSHAL-1016 Encapsulate UINTx_MAX definitions. + * 02.02.05 2024-10-09 virjas ESCAN00118247 Incorrect definition of SINT8_MIN. + *********************************************************************************************************************/ + +#ifndef PLATFORM_TYPES_H +#define PLATFORM_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* ##V_CFG_MANAGEMENT ##CQProject : CommonAsr_Arm32 CQComponent : Impl_PlatformTypes */ +#define COMMONASR_ARM32_IMPL_PLATFORMTYPES_VERSION 0x0202 +#define COMMONASR_ARM32_IMPL_PLATFORMTYPES_RELEASE_VERSION 0x05 + +#define PLATFORM_VENDOR_ID 30u /* Vendor ID of Vector */ +#define PLATFORM_MODULE_ID 199u /* 199 is the ID of Platform types */ + +/* AUTOSAR Software Specification Document Version Information */ + +#define PLATFORM_AR_RELEASE_MAJOR_VERSION (4u) +#define PLATFORM_AR_RELEASE_MINOR_VERSION (8u) +#define PLATFORM_AR_RELEASE_REVISION_VERSION (0u) + +/* Component Version Information */ +#define PLATFORM_SW_MAJOR_VERSION (2u) +#define PLATFORM_SW_MINOR_VERSION (2u) +#define PLATFORM_SW_PATCH_VERSION (5u) + +#define CPU_TYPE_8 8u +#define CPU_TYPE_16 16u +#define CPU_TYPE_32 32u +#define CPU_TYPE_64 64u + +#define MSB_FIRST 0u /* big endian bit ordering */ +#define LSB_FIRST 1u /* little endian bit ordering */ + +#define HIGH_BYTE_FIRST 0u /* big endian byte ordering */ +#define LOW_BYTE_FIRST 1u /* little endian byte ordering */ + +#ifndef TRUE +# define TRUE 1u +#endif + +#ifndef FALSE +# define FALSE 0u +#endif + +#define CPU_TYPE CPU_TYPE_32 +#define CPU_BIT_ORDER LSB_FIRST +#define CPU_BYTE_ORDER LOW_BYTE_FIRST + +/* data type limitation defines */ +#ifndef UINT8_MIN +# define UINT8_MIN 0u +#endif +#ifndef UINT8_MAX +# define UINT8_MAX 255u +#endif +#ifndef UINT16_MIN +# define UINT16_MIN 0u +#endif +#ifndef UINT16_MAX +# define UINT16_MAX 65535u +#endif +#ifndef UINT32_MIN +# define UINT32_MIN 0ul +#endif +#ifndef UINT32_MAX +# define UINT32_MAX 4294967295ul +#endif +#ifndef UINT64_MIN +# define UINT64_MIN 0ull +#endif +#ifndef UINT64_MAX +# define UINT64_MAX 18446744073709551615ull +#endif + +#ifndef SINT8_MIN +# define SINT8_MIN -128 +#endif +#ifndef SINT8_MAX +# define SINT8_MAX 127 +#endif +#ifndef SINT16_MIN +# define SINT16_MIN -32768 +#endif +#ifndef SINT16_MAX +# define SINT16_MAX 32767 +#endif +#ifndef SINT32_MIN +# define SINT32_MIN -2147483648 +#endif +#ifndef SINT32_MAX +# define SINT32_MAX 2147483647 +#endif +#ifndef SINT64_MIN +# define SINT64_MIN -9223372036854775808 +#endif +#ifndef SINT64_MAX +# define SINT64_MAX 9223372036854775807 +#endif + +#ifndef FLOAT32_MIN +# define FLOAT32_MIN 1.17549435e-38f +#endif +#ifndef FLOAT32_MAX +# define FLOAT32_MAX 3.40282347e+38f +#endif +#ifndef FLOAT32_EPSILON +# define FLOAT32_EPSILON 1.19209290e-07f +#endif + +#ifndef FLOAT64_MIN +# define FLOAT64_MIN 2.2250738585072014e-308l +#endif +#ifndef FLOAT64_MAX +# define FLOAT64_MAX 1.7976931348623157e+308l +#endif +#ifndef FLOAT64_EPSILON +# define FLOAT64_EPSILON 2.2204460492503131e-16l +#endif + + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +typedef unsigned char boolean; /* for use with TRUE/FALSE */ + +typedef signed char sint8; /* -128 .. +127 */ +typedef unsigned char uint8; /* 0 .. 255 */ +typedef signed short sint16; /* -32768 .. +32767 */ +typedef unsigned short uint16; /* 0 .. 65535 */ +typedef signed long sint32; /* -2147483648 .. +2147483647 */ +typedef unsigned long uint32; /* 0 .. 4294967295 */ +#define PLATFORM_SUPPORT_SINT64_UINT64 +typedef signed long long sint64; /* \brief 64-bit unsigned integer */ +typedef unsigned long long uint64; +typedef unsigned long uint8_least; /* At least 8 bit */ +typedef unsigned long uint16_least; /* At least 16 bit */ +typedef unsigned long uint32_least; /* At least 32 bit */ +typedef signed long sint8_least; /* At least 7 bit + 1 bit sign */ +typedef signed long sint16_least; /* At least 15 bit + 1 bit sign */ +typedef signed long sint32_least; /* At least 31 bit + 1 bit sign */ + +typedef float float32; +typedef double float64; + +typedef void* VoidPtr; +typedef const void* ConstVoidPtr; + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#endif /* PLATFORM_TYPES_H */ + +/********************************************************************************************************************** + * END OF FILE: Platform_Types.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Common/Std_Types.h b/Source/bsw/Common/Std_Types.h new file mode 100644 index 0000000..342b9de --- /dev/null +++ b/Source/bsw/Common/Std_Types.h @@ -0,0 +1,198 @@ +/*********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------ + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** + * File: Std_Types.h + * Component: - + * Module: - + * Generator: - + * + * Description: Provision of Standard Types + * + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2007-08-01 Jk Initial creation + * 03.00.00 2007-10-10 Jk Changes for AUTOSAR 3.0 + * 03.00.01 2007-11-20 Jk Version defines for CFG management added + * 03.01.00 2008-03-05 Jk Include order changed + * 03.02.00 2008-03-18 Jk Version defines changed to specification version + * 03.03.00 2008-06-03 Jk changed ModuleId Type in Std_VersionInfoType from uint8 to uint16 + * 03.03.01 2009-11-11 visht ESCAN00038201 Support the Standard Type E_PENDING + * 03.04.00 2011-02-15 visht support ASR 4.0R1 + * 03.04.01 2011-02-28 visht ESCAN00049579 incorrect BSW version scan information + * 03.04.02 2012-08-23 visht version define corrected - replace PATCH by REVISION - + * (STD_TYPES_AR_RELEASE_REVISION_VERSION) + * 2012-10-23 visseu Add _VENDOR_ID and _MODULE_ID as specified in + * "AUTOSAR_TR_BSWModuleList.pdf" (R4.0 Rev 3) + * 03.04.03 2013-02-13 visseu No changes, only SW version corrected + * 03.04.04 2013-05-29 visseu ESCAN00067740 Add general defines with prefix: STD + * 03.04.05 2019-03-18 visdfe OI-10000 Remove E_PENDING from Std_Types.h + * 03.05.00 2022-05-05 visto HALBE-6470 Add support for Std_TransformerError according to AUTOSAR 20-11 + * 03.06.00 2023-04-12 visbwa HALBE-7488 Removed outdated fragments of ASR3.x and file filtering, + * fixed copyright header, codestyle review + **********************************************************************************************************************/ + +#ifndef STD_TYPES_H +# define STD_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ +# include "Platform_Types.h" + +# include "Compiler.h" + +/*********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + **********************************************************************************************************************/ +# define STD_TYPES_VENDOR_ID (30u) /* SREQ00015345, SREQ00015361 */ +# define STD_TYPES_MODULE_ID (197u) /* SREQ00015345, SREQ00015361 */ + +/* ESCAN00067740 */ +# define STD_VENDOR_ID STD_TYPES_VENDOR_ID +# define STD_MODULE_ID STD_TYPES_MODULE_ID + +/* ##V_CFG_MANAGEMENT ##CQProject : CommonAsr__Common CQComponent : Impl_StdTypes */ +# define COMMONASR__COMMON_IMPL_STDTYPES_VERSION 0x0306 +# define COMMONASR__COMMON_IMPL_STDTYPES_RELEASE_VERSION 0x00 + +/* AUTOSAR Software Specification Version Information */ +/* AUTOSAR release R21-11 -> 4.7.0 */ +# define STD_TYPES_AR_RELEASE_MAJOR_VERSION (4u) +# define STD_TYPES_AR_RELEASE_MINOR_VERSION (7u) +# define STD_TYPES_AR_RELEASE_REVISION_VERSION (0u) + +/* ESCAN00067740 */ +# define STD_AR_RELEASE_MAJOR_VERSION STD_TYPES_AR_RELEASE_MAJOR_VERSION +# define STD_AR_RELEASE_MINOR_VERSION STD_TYPES_AR_RELEASE_MINOR_VERSION +# define STD_AR_RELEASE_REVISION_VERSION STD_TYPES_AR_RELEASE_REVISION_VERSION + +/* Component Version Information */ +# define STD_TYPES_SW_MAJOR_VERSION (3u) +# define STD_TYPES_SW_MINOR_VERSION (6u) +# define STD_TYPES_SW_PATCH_VERSION (0u) + +/* ESCAN00067740 */ +# define STD_SW_MAJOR_VERSION STD_TYPES_SW_MAJOR_VERSION +# define STD_SW_MINOR_VERSION STD_TYPES_SW_MINOR_VERSION +# define STD_SW_PATCH_VERSION STD_TYPES_SW_PATCH_VERSION + +# define STD_HIGH 1u /* Physical state 5V or 3.3V */ +# define STD_LOW 0u /* Physical state 0V */ + +# define STD_ACTIVE 1u /* Logical state active */ +# define STD_IDLE 0u /* Logical state idle */ + +# define STD_ON 1u +# define STD_OFF 0u + +/*********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ +/* This typedef has been added for OSEK compliance */ +# ifndef STATUSTYPEDEFINED +# define STATUSTYPEDEFINED +# define E_OK 0u +typedef unsigned char StatusType; /* OSEK compliance */ +# endif + +# define E_NOT_OK 1u + +typedef uint8 Std_ReturnType; + +typedef struct +{ + uint16 vendorID; + uint16 moduleID; + uint8 sw_major_version; + uint8 sw_minor_version; + uint8 sw_patch_version; +} Std_VersionInfoType; + +typedef uint8 Std_TransformerErrorCode; + +typedef uint8 Std_TransformerClass; +# define STD_TRANSFORMER_UNSPECIFIED 0u +# define STD_TRANSFORMER_SERIALIZER 1u +# define STD_TRANSFORMER_SAFETY 2u +# define STD_TRANSFORMER_SECURITY 3u +# define STD_TRANSFORMER_CUSTOM 0xFFu + +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ + +typedef uint8 Std_MessageTypeType; +# define STD_MESSAGETYPE_REQUEST 0u +# define STD_MESSAGETYPE_RESPONSE 1u + +typedef uint8 Std_MessageResultType; +# define STD_MESSAGERESULT_OK 0u +# define STD_MESSAGERESULT_ERROR 1u + +typedef struct +{ + Std_TransformerErrorCode errorCode; + Std_TransformerClass transformerClass; +} Std_TransformerError; + +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ + +typedef Std_ReturnType (*Std_ExtractProtocolHeaderFieldsType) ( + const uint8* buffer, + uint32 bufferLength, + Std_MessageTypeType* messageType, + Std_MessageResultType* messageResult +); + +/*********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#endif /* STD_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: Std_Types.h + **********************************************************************************************************************/ diff --git a/Source/bsw/Common/v_def.h b/Source/bsw/Common/v_def.h new file mode 100644 index 0000000..92aef1e --- /dev/null +++ b/Source/bsw/Common/v_def.h @@ -0,0 +1,1175 @@ +/* STARTSINGLE_OF_MULTIPLE */ +/***************************************************************************** +| Project Name: V E C T O R - Common module type definition header +| File Name: v_def.h +| +| Description: Declares types and definitions common to all +| VECTOR CANbedded modules. +| +| Note: +| ===== +| that some hardware dependent settings are included in this file. +| Never mix up files with same namings but intended for +| other hardware platforms. +| +| +|----------------------------------------------------------------------------- +| C O P Y R I G H T +|----------------------------------------------------------------------------- +| Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +| +| This software is copyright protected and proprietary +| to Vector Informatik GmbH. Vector Informatik GmbH +| grants to you only those rights as set out in the +| license conditions. All other rights remain with +| Vector Informatik GmbH. +| +|----------------------------------------------------------------------------- +| R E V I S I O N H I S T O R Y +|----------------------------------------------------------------------------- +| Date Ver Author Description +| --------- ---- ------ -------------------------------------------------- +| 13-Mar-01 1.00 Hp Creation +| 04-Apr-01 1.01 Ht general rework +| 05-Apr-01 1.02 dH added Fujitsu FFMC16LX +| 05-Apr-01 1.03 HH added COMP_GHS_V85X +| 11-Apr-01 1.04 Et added LIN components +| 23-Apr-01 1.05 Si corrections for C_COMP_IAR_78K0 +| lint comments added +| 29-Mai-01 1.06 Pl added ARM7 STMICRO +| 22-Jun-01 1.07 Ht added ANSI CANoe +| 03-Jul-01 Wr added C_COMP_OKI_CC665S +| 12-Jul-01 Et support combination of "old" CAN driver and "new" LIN driver +| 13-Jul-01 1.08 Ht error check for supported systems and switches added +| 16-Jul-01 dH added C_COMP_HEW_SH7055 / C_COMP_HEW_H8S +| 17-Aug-01 1.09 Et deleted keywords __near and __far for C_COMP_FUJITSU_8L +| 21-Aug-01 1.10 Ht/Vg added C_COMP_DIABDATA_PPC +| 25-Aug-01 1.11 Ml added #pragma MESSAGE DISABLE C1106 for Hiware HC08 compiler +| 06-Sep-01 1.12 Ht/Vg added C_COMP_GNU_ST9 +| 11-Sep-01 1.13 Fr added C_COMP_ANSI_TMS_470 +| 21-Sep-01 1.14 Pl added C_COMP_MCP18_PIC_INT +| 25-Sep-01 1.15 Vg added C_COMP_MICROTEC_MC376 and C_COMP_TASKING_MC376 +| 28-Sep-01 1.16 Hp added C_COMP_GHS_TX39 and C_COMP_TOSHIBA_TLC900 +| 23-Oct-01 1.17 Js added C_COMP_DIABDATA_MCORE +| 23-Oct-01 1.18 dH changed ..._SH705X to ..._SH705X +| 05-Nov-01 1.19 dH added M32R +| 19-Nov-01 1.20 Ht added C_COMP_xxx_XC16X +| 22-Nov-01 1.21 dH added C_COMP_IAR_H8S +| 11-Nov-01 1.22 Fz added C_COMP_MITSUBISHI_M32C/C_COMP_NEC_V85X +| 19-Dec-01 1.23 dH changed Fujitsu FFMC16LX +| 28-Jan-02 1.24 Ml 00002160: added paging keywords for HC12 +| 31-Jan-02 1.25 Pl added C_COMP_KEIL_T89C51C +| 07-Mar-02 1.26 Vg/Rn added C_COMP_METROWERKS_PPC +| 27-Mar-02 1.27 Fz added C_COMP_IAR_V85X +| 09-Apr-02 1.28 Ht addaption to LI 1.3 +| 02-Apr-02 1.29 Ml added C_COMP_METROWERKS_MGT5100 +| added C_COMP_METROWERKS_DSP56F80X +| 13-May-02 1.30 LS MEMORY_HUGE added for C_COMP_TASKING_C16X +| 21-May-02 1.31 Ml canbittype for HC12 is now unsigned short +| 10-Jul-02 1.32 Ml canbittype for HC12 changed to unsigned char +| 16-Jul-02 1.33a Fz canbittype for V850 changed to unsigend int +| _c_bits32 added +| 31-Jul-02 Ts added C_COMP_HEW_SH70XX_HCAN2 +| 31-Jul-02 1.33 Ht _c_bits16 added for C_CPUTYPE_BITORDER_MSB2LSB +| 31-Jul-02 1.34 Si pc-lint comments for 78K0 changed +| 02-Aug-02 1.33 Sf 00003192: Memory qualifier for M16C changed +| 08-Aug-02 1.34 Zw ESCAN00003456 added STmicro ST7 (beCAN) / Hiware +| 18-Aug-02 Pet ESCAN00003530 delete keyword near for HC08 +| 06-Sep-02 1.35 Zw 00003688: MEMORY_NEAR defined to nothing for ST7_beCAN +| 09-Sep-02 1.36 Bs controller OKI MSM9225B (C_COMP_GHS_ARM7TM) added (needed for FBL) +| 10-Sep-02 1.37 Ds added C_COMP_COSMIC_ST7_BECAN +| and C_COMP_HIWARE_ST7_BECAN +| 13-Sep-02 1.38 Ht rework the module +| 17-Sep-02 1.39 Stu add the C_COMP_NEC_78K0 +| 17-Sep-02 1.40 Vg ESCAN00003614 added __declspec() to place const +| variables into ROM for Metrowerks +| 18-Sep-02 1.41 Stu added C_COMP_NEC_78K0 +| 07-Oct-02 1.42 dH added C_COMP_GAIO_SH705X +| 11-Oct-02 1.43 dH added C_COMP_FUJITSU_16LX_HL +| 14-Oct-02 1.44 Ml changed vbittype for MGT5100 into unsigned short +| 14-Oct-02 1.45 Stu changed vbittype for 78k0 into unsigned char +| 18-Oct-02 1.46 Pl added C_COMP_TASKING_ST10_CCAN +| added C_COMP_ARM_ST30_CCAN +| 30-Oct-02 1.47 Ml added C_COMP_ARM_470 and C_COMP_TI_470 +| 06-Nov-02 1.48 Wr added C_COMP_NATIONAL_CR16 +| 07-Nov-02 1.49 RAP added C_COMP_DIABDATA_MPC823 +| RAP added C_COMP_GHS_STARFISH +| 14-Nov-02 1.50 An corrected the banking defines for Cosmic and Hiware +| 27-Nov-02 1.50 Pl added C_COMP_FUJITSU_FR50 +| 02-Dec-02 1.51 Si MEMORY_NEAR changed for C_COMP_NEC_78K0 +| 11-Dec-02 Pet added C_COMP_IAR_CEVF +| 18-Dec-02 1.52 Si added C_COMP_NEC_78K0 +| 04-Jan-03 Et added memory qualifier for C_COMP_IAR_CEVF +| 22-Jan-03 Ap added C_COMP_ARM_EASYCAN +| 28-Jan-03 1.53 Pl added C_COMP_KEIL_ST10_CCAN +| delete C_COMP_ARM_ARM7STM +| 03-Apr-04 1.54 To added C_COMP_METROWERKS_DSP5683X +| ZW canbittype for CEVG is now unsigned char +| Hp Add MEMORY_HUGE for XC16x +| Fz added C_COMP_IAR_CR16 and C_COMP_NATIONAL_CR16 changed +| Ml added C_COMP_TI_TMS320 +| 2003-05-13 1.60 Ht support V_MEMROM0 +| 2003-05-14 1.61 Tri added V_MEMROM0 definition for MGT5100 +| 2003-05-15 1.62 Pl added C_COMP_FUJITSU_FR60_CCAN +| 2003-05-20 1.63 WM added near/far memory defines for C_COMP_HIWARE_12 +| 2003-06-11 1.64 CB MEMORY_HUGE added for C_COMP_TASKING_ST10_CCAN +| 2003-06-18 1.65 Bir added C_COMP_MICROCHIP_DSPIC30 +| 2003-07-08 1.66 Bir no local lint command +| 2003-08-15 1.67 Rr changed MEMORY_FAR for M32C +| 2003-08-18 1.68 BWR added support for MAC710X +| 2003-09-02 1.69 BWR added support for MC332 with external Intel 82527 +| 2003-09-09 1.70 Bir added C_COMP_TASKING_TRICORE_MULTICAN & C_COMP_GNU_TRICORE_MULTICAN +| 2003-10-30 1.71 RAP added C_COMP_MICROCHIP_PIC18 +| 2003-11-13 2.00 Ht memory qualifier changed to new definition +| 2004-01-08 2.01 BWR added support for MPC55XX +| 2004-01-16 2.02 Ml added cast macros +| 2004-01-22 2.03 dH added C_COMP_HEW_SH2_HCAN1 and C_COMP_HEW_H8S_HCAN1 +| 2004-02-13 2.04 WM Added banking support for C_COMP_IAR_12 +| 2004-02-18 2.05 RAP Update for C_COMP_MICROCHIP_PIC18 +| 2004-03-12 2.06 Ml changed canbittype for TMS470 +| 2004-03-13 2.07 dH added C_COMP_HEW_H8TINY +| 2004-04-20 2.08 dH added C_COMP_HEW_H8SX_HCAN1 +| 2004-04-08 2.09 Rna Memoryclassifier V_MEMROM0 and MEMORY_ROM for Metrowerks PPC changed +| 2004-05-14 2.10 Ms added Release Version define +| added include for vstdlib.h +| 2004-05-18 2.11 Ml changed plattform check to work in any case (NO_ELSE) +| Ml added V_NULL +| 2004-06-17 2.12 Ms changed C_COMP_SUPPORTED_PLATTFORM -> V_COMP_SUPPORTED_PLATTFORM +| 2004-06-26 2.13 RAP added C_COMP_GHS_SJA2020 +| 2004-06-30 2.14 Ml added C_COMP_COSMIC_MCS12X_MSCAN12 +| 2004-08-17 2.15 Pl Memoryclassifier V_MEMROM0/1/2 for the C_COMP_TOSHIBA_TLC900 changed +| 2004-08-31 2.16 Ml changed bitfieldtype for MCS12X +| 2004-09-08 2.17 RAP changed vbittype for C_COMP_GHS_SJA2020 +| 2004-09-12 2.18 BWR added C_COMP_GHS_PPC +| 2004-09-20 2.19 Ces added C_COMP_GHS_ST30_CCAN +| 2004-09-27 2.20 Ms -ESCAN00009636: Naming Conventions +| 2004-09-28 2.21 Bir changed bitfieldtype for TriCore MultiCAN +| 2004-09-30 2.22 Ht Review +| 2004-10-06 2.23 Ml Added C_COMP_MTRWRKS_MCS12X_MSCAN12 +| 2004-10-27 2.24 Ml changed V_ENABLE_VSTDLIB -> VGEN_ENABLE_VSTDLIB +| 2004-10-29 2.25 Pl Added C_COMP_GHS_TX19 +| 2004-11-05 2.26 Ml Added C_COMP_COSMIC_MCS12X_MSCAN12 and C_COMP_COSMIC_MCS12_MSCAN12 +| 2004-11-08 2.27 Et support compiler option -fNP (C_COMP_MITSUBISHI_M32C) +| 2004-11-10 2.28 Ml Added compatibility for VStdLib +| 2004-11-15 2.29 dH new memoryclassifier for C_COMP_FUJITSU_16LX/C_COMP_FUJITSU_16LX_HL +| 2004-11-15 2.30 Ms ESCAN00010228: Support C_COMP specific V_NULL definition +| 2004-11-19 2.31 Ml bitfields for TMS470 are now int +| Ths ESCAN00010435: Due to compatibility V_DEF_VERSION added +| 2005-01-31 2.32 Ml Added C_COMP_IAR_TMS430_SCCHECC +| 2005-02-09 2.33 Ht support V_NULL for C_COMP_KEIL_C5X5C +| 2005-03-10 2.34 Ces Memory qualifier MEMORY_SADDR and MEMORY_NEAR for IAR 78K0 compiler +| 2005-03-22 2.35 Pl support V_NULL for C_COMP_TASKING_ST10_CCAN +| 2005-03-22 2.36 Ces support C_COMP_IAR_78K0_AFCAN +| support V_NULL for Tasking C16x/ST10, Mitsubishi M16C, IAR 78K0, +| Metrowerks DSP5683x and GreenHills ST30 +| 2005-03-24 2.37 Krt Set cast macros for M32C controller, to avoid compiler warnings +| Bir support V_NULL for C_COMP_TASKING_C16X, C_COMP_TASKING_XC16X, C_COMP_GNU_TRICORE_MULTICAN +| Ces MEMORY_NEAR corrections for IAR 78K0 AFCAN +| 2005-06-17 2.38 Ht remove duplicated compiler switch +| dH added C_COMP_HEW_SH2_RCAN +| Pl added C_COMP_GNU_ST10_CCAN +| Ds Added support for ADI Blackfin (BF5xx) +| Ml Added QNX platforms +| Fz MEMORY_HUGE changed for V85X IAR compiler in case tiny memory model +| Ht default definition of NULL +| 2005-06-20 2.39 BWR Added support for MAC7100 IAR compiler +| dH changed bittype for C_COMP_HEW_SH2_RCAN to unsigned char +| 2005-08-24 2.40 Rna position for NULL definitions moved to prevent redefinitions for HC12 cosmic (string.h) +| 2005-10-05 2.41 Ces adaptions for IAR compiler M16C +| 2005-10-14 2.42 Fn added C_COMP_IAR_AVR_CANARY +| Ces corrections for C_COMP_IAR_M16C +| Ces added C_COMP_IAR_M32C +| Ces added V_MEMROM3 for C_COMP_MITSUBISHI_M16C +| 2005-10-25 2.43 Ces IAR M32C: MEMORY_ROM is always far const +| 2005-12-02 2.44 dH added C_COMP_HEW_H8S_RCAN +| Fn added C_COMP_MICROCHIP_PIC18 for V_NULL +| Ht V_COMP_SUPPORTED_PLATTFORM changed to V_DEF_SUPPORTED_PLATFORM +| Pl added C_COMP_MATSUSHITA_MN103S_CCAN +| Svh added C_COMP_TOSHIBA_TLCS870 +| Ces changed compiler version check of IAR M16C and IAR M32C +| 2005-12-20 2.45 Ml Added C_COMP_METROWERKS_MGT5X00 +| Ces changed MEMORY_NORMAL for IAR M16C and IAR M32C +| 2006-01-27 2.46 Ml ESCAN00014816: Added cast defines for MCS12x with comsic +| Ml 00015045: Added support for constants in global pages +| Ml Added C_COMP_MTRWRKS_MPC5X00 +| Svh Added C_COMP_ARM_ADUC703X +| 2006-02-08 2.47 Pl Added C_COMP_IAR_ML67Q25XX_CCAN +| 2006-02-09 Ml Changed check for XGate compiler +| 2006-02-10 2.48 Ces Added #define V_NULL for MITSUBISHI M32C and MITSUBISHI M32R +| 2006-02-20 2.49 Ml Changes for dependency builder to accept XGate compiler specific preprocessor +| 2006-03-28 2.50 Ard Added C_COMP_ARM_OMAP +| Pl Added C_COMP_TOSHIBA_TLCS900 +| Svh Added C_COMP_HPINFOTECH_AVR_CANARY +| 2006-04-27 2.51 dH added C_COMP_MATSUSHITA_MN101E_CCAN +| Ap added C_COMP_HITECH_PIC18 +| Fn modifications for C_COMP_MICROCHIP_PIC18 +| Ces Added C_COMP_GHS_TX49 and C_COMP_NEC_78K0_AFCAN +| 2006-05-02 2.52 Ces Change MEMORY_NEAR and MEMORY_SADDR for C_COMP_NEC_78K0_AFCAN +| Svh Added C_COMP_IAR_ADUC703X +| 2006-05-19 2.53 Ces Change MEMORY_NEAR for C_COMP_NEC_78K0_AFCAN +| Ces Change define V_NULL for C_COMP_MITSUBISHI_M32R +| 2006-08-03 2.54 Her Added type cast for C_COMP_: COSMIC_08/NEC_78K0_AFCAN/COSMIC_MCS12X_MSCAN12 +| Fn Added C_COMP_MICROCHIP_DSPIC33 +| Ap Added C_COMP_MTRWRKS_MCS08_MSCAN and C_COMP_COSMIC_MCS08_MSCAN +| BWR Added C_COMP_GAIO_MPC55XX +| Pl Added C_COMP_FUJITSU_16FX_CCAN +| 2006-08-04 2.55 Ces Added C_COMP_GHS_LPC2XXX +| 2006-08-09 2.56 Svh Added V_MEMRAM1_NEAR for C_COMP_NEC_78K0 +| 2006-08-13 2.57 Ml Changed bitfield type for C_COMP_COSMIC_MCS08_MSCAN +| Pl Added C_COMP_ARM_AVCCORE1_CCAN +| 2006-08-30 2.58 Wr Added C_COMP_GNU_VR55XX_AFCAN +| 2.58 Ml Added C_COMP_DIABDATA_MPC5X00_MSCAN +| 2006-09-22 2.59 swk Added C_COMP_KEIL_ST10_CCAN +| Ml Changed bitfield type for C_COMP_COSMIC_MCS08_MSCAN back to vuint8 +| 2006-10-23 2.60 BWR Added C_COMP_GNU_MICROBLAZE_LOGICORECAN +| Ard Added C_COMP_GHS_MAC710X +| 2006-10-23 2.61 Bir Added C_COMP_TASKING_XC2000_MULTICAN +| 2006-11-14 Ml Added function near/far qualifier for platform MCS12X +| 2006-11-20 BWR Added C_COMP_METROWERKS_MPC55XX_FLEXCAN +| Added C_COMP_DIABDATA_MCORE_FLEXCAN +| 2006-11-20 Bir changes for C_COMP_TASKING_XC2000_MULTICAN +| 2006-12-14 Pl Added C_COMP_TI_TMS470_DCAN +| 2007-01-10 Bir changes for C_COMP_TASKING_XC2000_MULTICAN +| 2007-01-11 Ces Added C_COMP_IAR_MCS12_MSCAN12 +| 2007-02-01 2.62 Svh Added C_COMP_FUJITSU_8FX +| 2007-02-19 2.63 Ces Added C_COMP_GHS_SAF7780_PELICAN +| Ces Changed MEMORY_NORMAL for C_COMP_MITSUBISHI_M32C +| 2007-06-21 2.64 Ces Changed MEMORY_NORMAL for C_COMP_MITSUBISHI_M16C +| Fn Added C_COMP_IAR_R32C +| BWR Added C_COMP_DIABDATA_MCF_FLEXCAN +| Awh Added C_COMP_KEIL_XC16X +| Ou Changed vbittype for C_COMP_MTRWRKS_MCS12X_MSCAN12 to unsigned char, additionally disabled warning C1106 for this compiler (see #pragma MESSAGE DISABLE C1106) +| 2007-09-07 2.65 Ou Changed back vbittype for C_COMP_MTRWRKS_MCS12X_MSCAN12 to unsigned int +| Ard Added C_COMP_GHS_TMS470 +| 2007-09-28 2.66 Fn Added C_COMP_COSMIC_ST79_BECAN3 +| Ces Added V_MEMROMx_NEAR and V_MEMROMx_FAR for C_COMP_IAR_M16C +| Added V_MEMROMx_NEAR and V_MEMROMx_FAR for C_COMP_IAR_M32C +| Use predefined compiler macros __VX__ and _C166 for C_COMP_TASKING_XC2000_MULTICAN +| 2007-10-24 2.67 Fn Changed C_COMP_COSMIC_ST79_BECAN3 to C_COMP_COSMIC_STM8A_BECAN3 +| Fn Added C_COMP_RENESAS_R32C +| 2007-11-09 2.68 Wr Added C_COMP_KEIL_SLC8051 +| 2007-11-14 2.69 Svh Added C_COMP_KEIL_ADUC703X +| 2007-11-27 2.70 Fn Adapted rom qualifier for: C_COMP_RENESAS_R32C, C_COMP_IAR_R32C and C_COMP_MICROCHIP_DSPIC33 +| Ml Added memory mapping defines for C_COMP_MTRWRKS_MCS12X_MSCAN12 +| 2007-12-03 2.71 Ard Added C_COMP_MICROSOFT_TMS320ARM +| 2008-01-14 2.72 Ou Added memory mapping defines for C_COMP_MTRWRKS_MCS08_MSCAN and C_COMP_COSMIC_MCS08_MSCAN +| Ces Added C_COMP_GHS_MPC55XX and C_COMP_GHS_MPC55XX_FLEXCAN2 +| Added C_COMP_GAIO_MPC55XX_FLEXCAN2 +| Added C_COMP_DIABDATA_MPC55XX_FLEXCAN2 +| Changed memory qualifier for IAR M16C and IAR M32C +| 2008-02-19 2.73 Ces Corrected V_NULL for DIABDATA_MPC55XX +| 2008-03-05 2.74 Pl Added C_COMP_GNU_NIOS_DCAN +| 2008-03-12 Fn Added V_MEMROM2_FAR and V_MEMROM2_NEAR for C_COMP_IAR_AVR_CANARY +| 2008-04-18 Ap Added C_COMP_GNU_AVR_CANARY +| 2008-05-05 2.75 Bir Possibility to change V_MEMROM2 for XC2000 (user config) +| 2008-05-05 2.76 Ou Change the behavior for V_MEMROM3 on MCS12X (relevant just for Cosmic compiler, global constants feature) +| 2008-05-06 2.77 Ces Changed V_MEMRAM2_FAR for IAR compiler M16C/R8C +| Added P_MEM_ROM for IAR compiler M16C +| Ap Added C_COMP_IAR_78K0R +| 2008-07-24 2.78 Ht Memory qualifier for C_COMP_COSMIC_STM8A_BECAN3 added +| 2008-08-27 2.79 Ces Adapt memory qualifier for C_COMP_MITSUBISHI_M16C and C_COMP_MITSUBISHI_M32C +| 2008-09-18 2.80 Ard Added C_COMP_QCC_TMS320ARM +| 2008-10-15 2.81 Bir Added C_COMP_GHS_TRICORE_MULTICAN +| BWR Adapt memory qualifier for C_COMP_GNU_MPC5X00_MSCAN +| 2008-11-14 2.82 Pl Added C_COMP_GNU_MB86R0X_CCAN +| Ou V_MEMROMx have the default behavior for C_COMP_MICROCHIP_DSPIC33 +| 2008-11-21 2.83 Ces Added C_COMP_GNU_IMX_FLEXCAN2 +| Added V_MEMROM2 for C_COMP_MITSUBISHI_M32C +| 2009-01-19 2.84 Ou Change the behavior of data pointer buffers in order to meet the global data expectations in case of C_COMP_COSMIC_MCS12X_MSCAN12 +| Change the default behavior for V_MEMRAM1_FAR and V_MEMRAM3_FAR in case of C_COMP_COSMIC_MCS12X_MSCAN12 +| Tvi Added C_COMP_IAR_M16C_RCAN2 and C_COMP_RENESAS_M16C_RCAN2 +| 2009-01-23 2.85 Ou Adjust the behavior of V_MEMRAM1_FAR and V_MEMRAM3_FAR in case of C_COMP_COSMIC_MCS12X_MSCAN12 in order to have an unified behavior +| 2009-01-29 2.86 Pl For the TI_TMS470_DCAN changed vuint32 from unsigned long to unsigned int and vsint32 int from signed long to signed int +| Added C_COMP_GNU_ST30_CCAN +| 2009-02-18 Ou Added C_COMP_MTRWRKS_MPC5X00_MSCAN +| 2009-03-19 2.87 Kk Added C_COMP_GAIO_SH2_RCAN +| Pl Some V_MEMROM and V_MEMRAM defines for the C_COMP_FUJITSU_16FX_CCAN added ( only in the case VGEN_ENABLE_CANFBL is defined ) +| 2009-03-25 2.88 Aj Added C_COMP_ARM_TCC800X_CCAN +| 2009-07-08 2.89 Bir Added Compiler abstraction like ASR +| Ou Added C_COMP_KEIL_PSOC3_CANMODULE3 +| Ces Added C_COMP_METROWERKS_MPC55XX and C_COMP_METROWERKS_MPC55XX_FLEXCAN2 +| Pl For the TI_TMS470_DCAN changed back vuint32 from unsigned int to unsigned long and vsint32 from signed int to signed long +| Reason is to be compatible with TI_TMS470 and with Platform_Types.h +| 2009-07-08 2.90 Bir change Compiler abstraction "V_DEF_P2SFR_CAN" +| Ou Rework the V_MEMROMx and V_MEMRAMx for C_COMP_KEIL_PSOC3_CANMODULE3 +| Seg Added C_COMP_ARM_TMS470_DCAN +| Ou Added C_COMP_QCC_MPC5X00_MSCAN +| 2009-09-03 2.91 Bir Added C_COMP_IAR_AVR32_CANIF +| Kk Added C_COMP_RENESAS_SH4_RCAN +| 2009-09-04 2.92 Tvi Added C_COMP_GHS_V85X_FCN +| 2009-10-06 2.93 Tvi Added C_COMP_GHS_SH4_RCAN2 +| 2009-10-16 2.94 Ou,Ht Fixed V_NULL for C_COMP_KEIL_PSOC3_CANMODULE3, C_COMP_KEIL_C5X5C and +| C_COMP_KEIL_SLC8051 +| 2009-10-27 2.95 Ou Map the reentrant keyword to C_API_3 in case of C_COMP_KEIL_PSOC3_CANMODULE3 +| 2009-10-30 2.96 Rna Support C_COMP_ARM_STM32_BXCAN +| 2009-11-10 2.97 Ht ESCAN00039030: Support V_MEMRAM2_FAR for XC2000 Tasking +| Seg Support C_COMP_GNU_TX49 +| 2009-11-20 2.98 Tvi ESCAN00039020: Renesas: support "-fansi" option +| Ou Fixed the standard memory qualifier definitions (vuintx/ vsintx) in combination with CAN-Driver for ASR +| 2009-11-23 2.98.01 Ht correct COMMON_VDEF_RELEASE_VERSION +| 2010-02-03 2.99 Tvi ESCAN00039371: [M16C/R8C with RENESAS]: Warnings about incompatible pointer types for Compiler versions >= V5.45 +| Ht Support C_COMP_KEIL_SJA2020 +| 2010-02-03 3.00.00 Ht change version number +| 2010-03-02 3.01.00 Ou Rework the V_MEMROMx and V_MEMRAMx for C_COMP_IAR_78K0R +| vadaba Added V_MEMROM0 to place const variables into ROM for C_COMP_METROWERKS_MPC55XX_FLEXCAN2 +| 2010-03-10 3.02.00 Tvi ESCAN00041468: [SH4Rcan2 w. GHS] "-Ospace" leads to a runtime exception due to incorrect bitfield access +| Kk Added C_COMP_QCC_SH4_RCAN +| Kk Added C_COMP_IAR_SH2_RCAN +| 2010-05-12 3.03.00 Pl Added C_COMP_QCC_MB86R0X_CCAN +| Ces Support C_COMP_GNU_MPC55XX and C_COMP_GNU_MPC55XX_FLEXCAN2 +| 2010-06-09 3.04.00 Tvi Added C_COMP_NEC_78K0R +| 2010-07-01 3.05.00 Ht Added support of MEMORY_HUGE for C_COMP_KEIL_C16X +| 2010-07-12 3.06.00 Ces Support C_COMP_GHS_IMX_FLEXCAN2 +| Tvi ESCAN00044064: [R32C with RENESAS]: Warnings about incompatible pointer types for Compiler versions >= V1.02 r00 +| 2010-09-06 3.07.00 Ces ESCAN00044378: added check for V_NULL definiton if default is not used +| Tvi Misra warning due to wrong characters in history removed +| Kk Added C_COMP_ARM_TRITON_AFCAN +| Ap Added C_PROCESSOR_R8C_XX to distinguish different derivatives +| 2010-10-01 3.08.00 Tvi Added C_COMP_RENESAS_V85X_FCN +| 2010-10-17 3.09.00 Bir Added C_COMP_KEIL_XC800 +| 2010-12-13 3.10.00 Tvi Added C_COMP_RENESAS_78K0R +| 2011-01-28 3.11.00 Ht M16C Compiler switch for Organi added +| Added C_COMP_GHS_SH2_RCAN +| Tvi Changed V_MEMROM1 for C_COMP_RENESAS_78K0R when memory model MEDIUM is used +| Rna Support TMS320(canbedded) with Geny +| 2011-02-25 3.12.00 Ces Added C_COMP_ARM_TX03_TXCAN +| Pl Added C_COMP_FUJITSU_FR81_CCAN +| Tkr Added C_COMP_GHS_SH2_RCAN2A +| 2011-04-08 3.13.00 Ou Added C_COMP_IAR_MCS12X_MSCAN12 +| Tvi Support C_PROCESSOR_R8C again (removed in 3.07.00) +| Aj Added C_COMP_RENESAS_V85X_AFCAN +| 2011-05-20 3.14.00 Tvi Added C_COMP_IAR_V85X_FCN +| Was Added C_COMP_TI_TMS320C64X_HECCSCC +| 2011-05-31 3.15.00 Aj Added C_COMP_GNU_SH2_RCAN +| 2011-07-11 3.16.00 Ht replace V_NONE with V_STORAGE_NONE in case of V_CPU_TMS320ARM +| 2011-08-08 3.17.00 Pl Added C_COMP_GHS_FCR4_CCAN +| Eta Added C_COMP_IAR_ADUCM33X +| 2011-09-26 3.18.00 Aj Added C_COMP_HEW_SH2_RCAN2 +| 2011-11-24 3.19.00 Aj Added C_COMP_ARM_AVNA_CCAN +| 2012-01-12 3.20.00 Rse Added C_COMP_QCC_IMX_FLEXCAN2, C_COMP_GNU_IMX_FLEXCAN3, C_COMP_QCC_IMX_FLEXCAN3, C_COMP_GHS_IMX_FLEXCAN3 +| 2012-02-15 3.21.00 Aj Added C_COMP_KEIL_FM3_CCAN +| Ht Header changed +| remove C_COMP_MCP18_PIC_INT (old driver version) +| Tvi Added C_COMP_RENESAS_SH4_RCAN2 +| 2012-02-24 3.22.00 Tvi Change VEMROM2_NEAR to __near for C_COMP_IAR_78K0R +| 2012-03-23 3.23.00 Ht Add C_COMP_IAR_RL78_AFCAN +| 2012-03-30 3.24.00 bir Add CAN_STATIC define for AutoSar4 compatible LL +| 2012-04-18 3.25.00 Seu Added C_COMP_TASKING_XC800_MULTICAN +| 2012-06-18 3.26.00 Aj Set vbittype=char for Sh4/Rcan2 in order to support littleendian +| 2012-08-01 3.27.00 Was Added C_COMP_KEIL_XC2000_MULTICAN +| 2012-08-22 3.28.00 Pl Added C_COMP_KEIL_SLC8051_CCAN, integration of C_COMP_KEIL_ switches +| QPs Added C_COMP_RENESAS_RL78_AFCAN +| 2012-09-20 3.29.00 Rse Added C_COMP_GNU_MPC5700_MCAN +| 2012-09-24 3.30.00 Tkr Added C_COMP_GHS_RH850_RSCAN, C_COMP_HEW_SH2_RSCAN and C_COMP_GHS_SH2_RSCAN +| 2012-10-08 3.30.01 Was ESCAN00061961: Compiler error: Using of V_MEMROM2_FAR and V_MEMROM2_NEAR leads to an compile error (Keil compiler/ XC2000) +| 2012-11-06 3.31.00 Ht ESCAN00062762: Remove function memory qualifier for 78K0R and RL78 +| 2012-11-08 3.32.00 Pl Added C_COMP_TI_TMS320ARM_DCAN +| 2012-12-12 3.33.00 Pl Added C_COMP_QCC_TMS320ARM_DCAN +| 2012-12-18 3.34.00 Rna Added C_COMP_IAR_STM32_BXCAN +| Bmo Added C_COMP_KEIL_TLE986X +| 2013-03-06 3.35.00 Rse Added C_COMP_GHS_MPC5700_FLEXCAN3, C_COMP_DIABDATA_MPC5700_FLEXCAN3 +| Rna VUINTx_CAST for STM8A with Cosmic added +| 2013-03-26 3.36.00 Tkr Added C_COMP_RENESAS_RL78_RSCAN +| Ht improve RL78 and 78K0R +| 2013-04-02 3.37.00 Was Added V_COMP_COSMIC_MCS12Z +| 2013-06-11 3.38.00 Ht Replace C_COMP_xxx_MPC5700_yyy with V_COMP_xxx_MPC5700 +| Replace C_COMP_xxx_IMX_yyyy with V_COMP_xxx_IMX +| Replace C_COMP_GHS_RH850_RSCAN with V_COMP_GHS_RH850 +| Replace canbittype by vbittype in this file -> no change of API +| Was Support IAR HCS12 Compiler Version 3.x +| 2013-06-21 3.38.01 Ht Remove comment +| 2013-07-02 3.39.00 Tkr Replace C_COMP_IAR_RL78_AFCAN with V_COMP_IAR_RL78 +| Tkr merge and adapt RL78 and 78K0R memory qualifier definitions for IAR compiler +| Replace C_COMP_RENESAS_RL78_xxx with V_COMP_RENESAS_RL78 +| 2013-08-20 3.40.00 Pl Added V_COMP_ARM_STA8088 +| Tkr Added V_COMP_DIABDATA_RH850 +| Rse Added V_COMP_GNU_VYBRID +| 2014-04-11 3.41.00 Rse Added V_COMP_GHS_VYBRID +| Was Added V_COMP_ARM_ZYNQ7000 +| Rse Added V_COMP_MICROSOFT_IMX +| Rse Added V_COMP_GHS_IMX +| Rse Added V_COMP_ARM_VYBRID +| QPs Added C_COMP_GNU_STM32_BXCAN +| Rna Added V_COMP_DIAB_TRICORE +| 2014-04-29 3.42.00 Rse Added V_COMP_IAR_VYBRID +| Tkr Added V_COMP_IAR_RH850 +| 2014-06-06 3.43.00 Zam Added V_COMP_GNU_TMS320ARM +| Was Added V_COMP_FREESCALE_MCS12Z +| 2014-07-25 3.44.00 Tkr Added V_COMP_RENESAS_RH850 +| Uce Added V_COMP_RENESAS_RCARSH4 +| 2014-09-03 3.45.00 Ap Added V_COMP_KEIL_ZSSC +| Ht adapt V_NULL definition for KEIL_FM3, KEIL_SJA2020, KEIL_ZSSC +| 2014-12-01 3.46.00 Pl Added V_COMP_GNU_ACCORDO2 +| 2014-12-17 3.47.00 CEl Added V_COMP_ARM_RZ +| 2015-02-25 3.48.00 Her Added V_COMP_GHS_TRAVEO +| 2015-05-12 3.49.00 Eta Added V_COMP_KEIL_ADUCM33X +| 2015-06-11 3.50.00 Zam Added V_COMP_TI_TMS320 +| 2015-09-30 3.51.00 Pl Added V_COMP_GHS_S32 +| Tkr Added Renesas CC-RL compiler for RL78 +| 2015-10-12 3.52.00 Eta Added V_COMP_GNU_SAM +| 2015-10-19 3.53.00 Bmo Added V_COMP_IAR_STM8A +| 2016-01-21 3.54.00 Aj Added V_COMP_KEIL_SAM +| Eta Added V_COMP_IAR_SAM +| 2016-03-21 3.55.00 Ht default definition of LOCAL_INLINE added +| Her Added V_COMP_GNU_SPC5800, V_COMP_GHS_SPC5800 +| 2016-04-27 3.56.00 Was LOCAL_INLINE definition for MSCAN based platforms added +| 2016-04-27 3.57.00 Rse LOCAL_INLINE definition for MPC5700 with DIABDATA +| 2016-06-07 3.58.00 Hzo Added V_COMP_IAR_TMPR4XX +| 2016-07-01 3.59.00 Her Added V_COMP_DIABDATA_SPC5800 +| Neb Added V_COMP_IAR_S32 +| 2016-08-22 3.60.00 Neb Added V_COMP_GHS_SAM +| 2016-11-16 3.61.00 Tkr Added LOCAL_INLINE definition for RH850 and RL78 +| 2016-12-21 3.62.00 Jan Added V_COMP_GNU_CSRATLAS7 +| 2017-02-21 3.63.00 Rse Added V_COMP_GHS_TCC802X +| Ap Added V_COMP_KEIL_HVC4223 +| 2017-05-08 3.64.00 Jgl Added V_COMP_QCC_INTEL64CPU and 64 Bit vuintx +| 2017-07-17 3.65.00 Ap Added V_COMP_GHS_SPC5800 +| Bmo Added V_COMP_GNU_PSOC4, V_COMP_IAR_CC26X0 +| 2017-08-08 3.65.01 Bmo Corrected version +| 2017-09-29 3.66.00 Aj Added V_COMP_ARM_TCC802X +| 2017-12-08 3.67.00 Ap Added C_COMP_IAR_TLE986X +| 2018-01-15 3.68.00 Rli Added V_COMP_GNU_S32 +| Bmo Added V_COMP_IAR_RX +| 2018-02-28 3.69.00 Ap Added Microchip XC8 compiler support +| 2018-03-02 3.70.00 Rli LOCAL_INLINE definition for FlexCAN3 and FlexCAN2 based derivatives with GHS, GNU, IAR added +| 2018-08-17 3.71.00 Ht Added V_COMP_GNU_BCM8910X +| 2018-09-24 3.72.00 Hum Added V_COMP_IAR_TRAVEO2 +| 2018-09-28 3.72.01 Hum Added ALM filter attribute for V_COMP_IAR_TRAVEO2 +| 2019-03-04 3.73.00 Ap Added V_COMP_IAR_MKW35 +| Hum Added LOCAL_INLINE definition for V_COMP_IAR_SAM +| 2019-03-04 3.74.00 Bns Added LOCAL_INLINE definition for TRICORE +| Jan Added V_COMP_GHS_RCARARM +| Jan Change LOCAL_INLINE definition for V_COMP_GHS_TRAVEO +| 2019-07-16 3.75.00 Ht Added V_COMP_GHS_TRAVEO2 +| Hum Added V_COMP_TI_AWR1 +| 2019-09-02 3.76.00 Bmo Added V_COMP_GHS_KEA +| 2019-11-27 3.77.00 Bmo Added V_COMP_ARM_TLE986X +| 2019-12-04 3.78.00 Pl Added V_COMP_GNU_TCC800X +| Ht replace C_COMP_ARM_TCC800X_CCAN with V_COMP_ARM_TCC800X +| 2019-12-20 3.79.00 Ht replace C_COMP_ARM_STM32_BXCAN with V_COMP_ARM_STM32 +| replace C_COMP_IAR_STM32_BXCAN with V_COMP_IAR_STM32 +| replace C_COMP_GNU_STM32_BXCAN with V_COMP_GNU_STM32 +| 2020-01-22 3.80.00 Pl Added V_COMP_IAR_TRAVEO +| Ht Replace C_COMP_GNU_TRICORE_MULTICAN by V_COMP_GNU_TRICORE +| Replace C_COMP_TASKING_TRICORE_MULTICAN by V_COMP_TASKING_TRICORE +| Replace C_COMP_GHS_TRICORE_MULTICAN by V_COMP_GHS_TRICORE +| 2020-02-21 3.81.00 Ap Added V_COMP_GNU_AVR +| 2020-03-05 3.82.00 TMo Added V_COMP_CADENCE_GW5 +| Ht Removed support for C_COMP_HIWARE_08, C_COMP_HIWARE_12, C_COMP_HIWARE_ST7, C_COMP_HIWARE_ST7_BECAN +| Ht Removed support for C_COMP_NEC_78K0_AFCAN, C_COMP_NEC_78K0, C_COMP_NEC_78K0R +| Ht Removed support for C_COMP_TOSHIBA_TLC900, C_COMP_TOSHIBA_TLCS900, C_COMP_TOSHIBA_TLCS870 +| Ht Removed support for C_COMP_HITECH_PIC18 +| 2020-03-11 3.83.00 Bmo Added V_COMP_IAR_PSOC4 +| 2020-05-05 3.84.00 Ap Added V_COMP_NXP_DSP56800EX +| 2020-06-15 3.85.00 Pl Added V_COMP_GNU_TCC802X +| 2020-07-23 3.86.00 Ap Added V_COMP_MICROCHIP_SAM +| 2020-09-30 3.87.00 Naj Added V_COMP_TI_JACINTO7 +| 2020-11-04 3.88.00 TMo Added V_COMP_ARM6_RCARARM +| TMo Added V_COMP_GNU_XMC4 +| TMo Added V_COMP_GNU_TRAVEO2 +| 2021-04-19 3.89.00 Ht Added V_COMP_TI_AWRGEN2 +| Ap Added V_COMP_GNU_TLE986X +| Ap Added V_COMP_MICROCHIP_AVR +| Ap Added V_COMP_ARM6_TLE986X +| 2021-05-26 3.90.00 Ht Added V_COMP_IAR_IMX +| JDn Added V_COMP_LLVMDIAB_ZYNQ7000 +| JDn Added V_COMP_GHS_ZYNQ7000 +| JDn Added V_COMP_GNU_ZYNQ7000 +| 2021-07-07 3.91.00 Ht Added V_COMP_IAR_TAYRONA +| Ht Added V_COMP_IAR_KW4 +| Ht Added V_COMP_LLVMDIAB_AWRGEN2 +| Ht Added V_COMP_GHS_JACINTO7 +| Ht Replace C_COMP_TI_TMS320ARM_DCAN with V_COMP_TI_TMS320ARM +| 2021-10-06 3.92.00 Ht Added V_COMP_ARM6_BCM8910X +| Ht Added V_COMP_LLVMTI_JACINTO7 +| 2022-03-11 3.93.00 Ht CANCORE-1117: Added V_COMP_LLVMTI_AWRGEN2 +| Ht Added V_COMP_GNU_LINUXFORARM32 +| Ht CANCORE-1125: Added V_COMP_ARM_ACCORDO2, V_COMP_ARM_ACCORDO2 +| 2022-07-06 3.94.00 Ht CANCORE-1377: Added V_COMP_GNU_LPC54 +| Ht CANCORE-1375: Added V_COMP_GHS_SAF85 +| 2022-10-13 3.95.00 Ap CANCORE-1555: Added V_COMP_ARM6_S32 +| 2022-11-17 3.96.00 Bmo Added V_COMP_IAR_MSPM0 +| 2023-02-14 3.97.00 Ht CANCORE-1818: Added V_COMP_GHS_TCC70XX +| 2023-03-03 3.98.00 Ap Added V_COMP_LLVMTI_MSPM0 +| 2023-03-31 4.00.00 Ht CANCORE-1848: Added V_COMP_IAR_ASX +| Ht Added V_COMP_TI_MSPM0 +| Ht Improvements related to compiler for ARM platforms +| Ht Removed: C_COMP_IAR_78K0_AFCAN, C_COMP_IAR_78K0 +| 2023-08-10 4.01.00 Ht Removed: C_COMP_COSMIC_08, C_COMP_COSMIC_ST7, C_COMP_COSMIC_ST7_BECAN +| Removed: C_COMP_GNU_ST9, C_COMP_FUJITSU_8FX, C_COMP_FUJITSU_8L +| Removed: C_COMP_MICROCHIP_DSPIC30, C_COMP_ARM_MAC710X, C_COMP_IAR_MAC710X, C_COMP_GHS_MAC710X +| Removed: C_COMP_IAR_CEVF, C_COMP_IAR_M32C, C_COMP_MITSUBISHI_M32C +| Removed: C_COMP_KEIL_C5X5C, C_COMP_KEIL_C16X, C_COMP_TASKING_C16X, +| Removed: C_COMP_MICROTEC_MC376, C_COMP_TASKING_MC376, C_COMP_GHS_ARM7TM +| Removed: C_COMP_MITSUBISHI_M32R, C_COMP_GAIO_M32R, C_COMP_OKI_CC665S +| Removed: C_COMP_GHS_CEVG, C_COMP_GHS_STARFISH, C_COMP_IAR_CR16, C_COMP_NATIONAL_CR16 +| Removed: C_COMP_ARM_EASYCAN, C_COMP_MICROTEC_332_82527, C_COMP_DIABDATA_MPC823 +| Removed: C_COMP_TI_OMAP, C_COMP_ARM_OMAP, C_COMP_HEW_H8TINY, C_COMP_FUJITSU_FR50 +| Removed: C_COMP_ARM_ST30_CCAN, C_COMP_GHS_ST30_CCAN, C_COMP_GNU_ST30_CCAN +| Removed: C_COMP_FUJITSU_FR60_CCAN, C_COMP_HEW_SH70XX_HCAN2, C_COMP_QCC_SH70XX_HCAN2 +| Removed: C_COMP_HEW_SH2_HCAN1, C_COMP_DIABDATA_MCF_FLEXCAN +| Removed: C_COMP_METROWERKS_MGT5100, C_COMP_METROWERKS_MGT5X00, C_COMP_HPINFOTECH_AVR_CANARY +| Removed: C_COMP_MTRWRKS_MPC5X00_MSCAN, C_COMP_MTRWRKS_MPC5X00, C_COMP_QCC_MGT5X00_MSCAN12 +| Removed: C_COMP_GNU_VR55XX_AFCAN, C_COMP_KEIL_SJA2020, C_COMP_GHS_SJA2020 +| Removed: C_COMP_METROWERKS_DSP56F80X, C_COMP_IAR_TMS430_SCCHECC, C_COMP_ARM_TRITON_AFCAN +| CANCORE-2110: Added V_COMP_ARM6_NCJ29D6 +| Pwf Added V_COMP_ARM6_MSPM0 +| 2023-09-15 4.02.00 Ht CANCORE-2179: Added V_COMP_LLVMTI_SITARA, V_COMP_LLVMDIAB_SITARA, V_COMP_TI_SITARA +| 2023-10-26 4.03.00 Ht CANCORE-2223: Added V_COMP_ARM6_RCARGEN4ARM +| 2023-11-30 4.04.00 Bmo LIN-988: Added V_COMP_ARM6_E53306 +| 2024-01-10 4.05.00 Ht Added V_COMP_GNU_KW4 +| CANCORE-2401: Added V_COMP_TI_TM4C +| 2024-03-12 4.06.00 Ht CANCORE-2520: Added V_COMP_QCC_QNXFORARM64 +| 2024-05-22 4.07.00 Ht CANCORE-2616: Added V_COMP_GHS_QPF51 +| CANCORE-2663: Added V_COMP_LLVMDIAB_S32 +| 2024-06-25 4.07.01 Kja CANCORE-2765: Added V_MEMRAM2_NEAR as user definable for RL78+IAR compiler +| 2024-07-08 4.08.00 Ht CANCORE-2770: Added V_COMP_ARM6_VAYYAR720X +| Kja CANCORE-2800: Added V_MEMRAM1_NEAR as user definable for RL78+Renesas compiler +| 2024-12-04 4.09.00 Ht CANCORE-2959: Added V_COMP_IAR_PIC32C, V_COMP_MICROCHIP_PIC32C, V_COMP_GNU_PIC32C, V_COMP_GHS_PIC32C +| Ht CANCORE-2961: Added V_COMP_GHS_VISCONTI5 +| Ht CANCORE-3019: Added V_COMP_LLVMHIGHTEC_STELLARSR6 +| Ht CANCORE-3012: Added V_COMP_GHS_SAF90 +| 2025-01-08 4.10.00 Ht CANCORE-3053: Added V_COMP_IAR_HC32A4 +| CANCORE-3074: Added V_COMP_LLVMHIGHTEC_TRICORE +| 2025-03-04 4.11.00 Ht CANCORE-3217: Added V_COMP_IAR_XHSCXC2 +| 2025-03-10 4.12.00 Ht CANCORE-3250: Added V_COMP_LLVMDIAB_SAF85 +| 2025-08-08 4.13.00 Ht CANCORE-3320: Added V_COMP_LLVMTI_TMS320ARM +| CANCORE-3544: Added Generic ARM implementation (MSR4 FBL usecase) +| Pwf LIN-1436: Added V_COMP_GNU_MSPM0 +| LIN-1438: Added V_COMP_ARM6_A89XXX, V_COMP_GNU_A89XXX, V_COMP_IAR_A89XXX +| 2025-10-22 4.14.00 Ht CANCORE-3649: Added V_COMP_GHS_RCARGEN5ARM, V_COMP_IAR_RCARGEN5ARM +| CANCORE-3260: Added V_COMP_LLVMTI_AWRGEN2LOW, V_COMP_LLVMDIAB_AWRGEN2LOW, V_COMP_TI_AWRGEN2LOW +|****************************************************************************/ + + + +#ifndef V_DEF_H +# define V_DEF_H + +/***************************************************************************/ +/* Version (abcd: Main version=ab, Sub Version=cd ) */ +/***************************************************************************/ +# define COMMON_VDEF_VERSION 0x0414 +# define COMMON_VDEF_RELEASE_VERSION 0x00 + +/* compatibility for IL versions < 3.52 */ +# define V_DEF_VERSION COMMON_VDEF_VERSION + + +/***************************************************************************/ +/* Supported Systems */ +/***************************************************************************/ + + + +/* compatibility define due to older implementations */ + + + +/* ARM32 with ARM6 compiler */ + +/* ARM32 with GHS compiler */ + +/* ARM32 with GNU compiler */ + +/* ARM32 with IAR compiler */ + +/* ARM32 with Microchip compiler */ + +/* ARM32 with LLVMDIAB compiler */ + +/* ARM32 with LLVMHighTec compiler */ + +/* ARM32 with LLVMTI compiler */ +# if defined( V_COMP_LLVMTI_SITARA ) +# define V_DEF_COMP_LLVMTI_ARM +# define V_DEF_SUPPORTED_PLATFORM +# endif + +/* ARM32 with TI compiler */ + + +/* all other supported plattform compiler combination */ + + +# if !defined V_DEF_SUPPORTED_PLATFORM +# error "Plattform unknown or V_COMP_xxx_yyy not defined" +# endif + + + + + +/***************************************************************************/ +/***************************************************************************/ +/**** General and platform dependent type definitions ********************/ +/***************************************************************************/ +/***************************************************************************/ +/*--- standard memory qualifier definition --------------------------------*/ + +/* 8-Bit qualifier */ +# if !defined( vuint8 ) /* ASR compatibility */ +typedef unsigned char vuint8; +# endif +# define canuint8 vuint8 + +# if !defined( vsint8 ) /* ASR compatibility */ +typedef signed char vsint8; +# endif +# define cansint8 vsint8 + +/* 16-Bit qualifier */ +# if !defined( vuint16 ) /* ASR compatibility */ +typedef unsigned short vuint16; +# endif +# define canuint16 vuint16 + +# if !defined( vsint16 ) /* ASR compatibility */ +typedef signed short vsint16; +# endif +# define cansint16 vsint16 + + +/* 32-Bit qualifier */ +# if !defined( vuint32 ) /* ASR compatibility */ +typedef unsigned long vuint32; +# endif +# define canuint32 vuint32 + +# if !defined( vsint32 ) /* ASR compatibility */ +typedef signed long vsint32; +# endif +# define cansint32 vsint32 + + + +typedef unsigned char *TxDataPtr; /* ptr to transmission data buffer */ +typedef unsigned char *RxDataPtr; /* ptr to receiving data buffer */ + +/***************************************************************************/ +/* Defines */ +/***************************************************************************/ + + +/***************************************************************************/ +/***************************************************************************/ +/**** Hardware/Compiler dependent settings ******************************/ +/***************************************************************************/ +/***************************************************************************/ + +/* data type according to the CPU type */ +# if defined( C_CPUTYPE_8BIT ) +/* 8-Bit qualifier */ +# ifndef vuintx +# define vuintx vuint8 +# endif +# ifndef vsintx +# define vsintx vsint8 +# endif +# else +# if defined( C_CPUTYPE_16BIT ) +/* 16-Bit qualifier */ +# ifndef vuintx +# define vuintx vuint16 +# endif +# ifndef vsintx +# define vsintx vsint16 +# endif +# else +# if defined( C_CPUTYPE_32BIT ) +/* 32-Bit qualifier */ +# ifndef vuintx +# define vuintx vuint32 +# endif +# ifndef vsintx +# define vsintx vsint32 +# endif +# else +# if defined( C_CPUTYPE_64BIT ) +/* 64-Bit qualifier */ +# ifndef vuintx +# define vuintx vuint32 +# endif +# ifndef vsintx +# define vsintx vsint32 +# endif +# endif +# endif +# endif +# endif + +/* qualifier for bitfield definition */ +typedef unsigned int vbittype; +# define canbittype vbittype + + + +# if defined( C_SUPPORT_MIXED_CAN_LIN ) +/* support combination of "old" CAN driver and "new" LIN driver */ +# else +/* Structure for bit accessed memory. */ +/* The bit-order is hardware/compiler dependent */ +# if defined( C_CPUTYPE_BITORDER_LSB2MSB ) +struct _c_bits8 +{ + vbittype b0:1; /* LSB-Bits (lower adr!) */ + vbittype b1:1; + vbittype b2:1; + vbittype b3:1; + vbittype b4:1; + vbittype b5:1; + vbittype b6:1; + vbittype b7:1; /* MSB-Bits (higher address) unused */ + }; + +struct _c_bits16 +{ + vbittype b0:1; /* lower adr */ + vbittype b1:1; + vbittype b2:1; + vbittype b3:1; + vbittype b4:1; + vbittype b5:1; + vbittype b6:1; + vbittype b7:1; + + vbittype b10:1; /* higher adr */ + vbittype b11:1; + vbittype b12:1; + vbittype b13:1; + vbittype b14:1; + vbittype b15:1; + vbittype b16:1; + vbittype b17:1; +}; + +struct _c_bits32 +{ + vbittype b0:1; /* lower adr */ + vbittype b1:1; + vbittype b2:1; + vbittype b3:1; + vbittype b4:1; + vbittype b5:1; + vbittype b6:1; + vbittype b7:1; + + vbittype b10:1; /* mid low adr */ + vbittype b11:1; + vbittype b12:1; + vbittype b13:1; + vbittype b14:1; + vbittype b15:1; + vbittype b16:1; + vbittype b17:1; + + vbittype b20:1; /* mid high adr */ + vbittype b21:1; + vbittype b22:1; + vbittype b23:1; + vbittype b24:1; + vbittype b25:1; + vbittype b26:1; + vbittype b27:1; + + vbittype b30:1; /* higher adr */ + vbittype b31:1; + vbittype b32:1; + vbittype b33:1; + vbittype b34:1; + vbittype b35:1; + vbittype b36:1; + vbittype b37:1; +}; + +# else /* MSB2LSB */ +# if defined( C_CPUTYPE_BITORDER_MSB2LSB ) +struct _c_bits8 +{ + vbittype b7:1; /* MSB-Bits (Higher addr!) */ + vbittype b6:1; + vbittype b5:1; + vbittype b4:1; + vbittype b3:1; + vbittype b2:1; + vbittype b1:1; + vbittype b0:1; /* LSB-Bits (higher address) unused */ +}; + +struct _c_bits16 +{ + vbittype b7:1; /* lower adr */ + vbittype b6:1; + vbittype b5:1; + vbittype b4:1; + vbittype b3:1; + vbittype b2:1; + vbittype b1:1; + vbittype b0:1; + + vbittype b17:1; /* higher adr */ + vbittype b16:1; + vbittype b15:1; + vbittype b14:1; + vbittype b13:1; + vbittype b12:1; + vbittype b11:1; + vbittype b10:1; +}; + + +struct _c_bits32 +{ + vbittype b7:1; /* lower adr */ + vbittype b6:1; + vbittype b5:1; + vbittype b4:1; + vbittype b3:1; + vbittype b2:1; + vbittype b1:1; + vbittype b0:1; + + vbittype b17:1; /* mid low adr */ + vbittype b16:1; + vbittype b15:1; + vbittype b14:1; + vbittype b13:1; + vbittype b12:1; + vbittype b11:1; + vbittype b10:1; + + vbittype b27:1; /* mid high adr */ + vbittype b26:1; + vbittype b25:1; + vbittype b24:1; + vbittype b23:1; + vbittype b22:1; + vbittype b21:1; + vbittype b20:1; + + vbittype b37:1; /* higher adr */ + vbittype b36:1; + vbittype b35:1; + vbittype b34:1; + vbittype b33:1; + vbittype b32:1; + vbittype b31:1; + vbittype b30:1; +}; +# else +# error "Bitorder unknown: C_CPUTYPE_BITORDER_MSB2LSB or C_CPUTYPE_BITORDER_LSB2MSB has to be defined" +# endif /* C_CPUTYPE_BITORDER_MSB2LSB */ +# endif /* C_CPUTYPE_BITORDER_LSB2MSB */ +# endif + + + + +/***************************************************************************/ +/* Memory qualifier */ +/***************************************************************************/ + + + + + + +# if defined ( VGEN_ENABLE_CANFBL ) +# endif + + + + + + + + + + + + + + + + + +# ifndef MEMORY_HUGE +# define MEMORY_HUGE /* no entry */ +# endif + + + + + +/* *********************** default defines - used to store permanent data **************************************** */ +# ifndef V_MEMROM0 +# define V_MEMROM0 /* addition qualifier data access in ROM */ +# endif + +# ifndef V_MEMROM1_NEAR +# define V_MEMROM1_NEAR /* fast data access in ROM */ +# endif + +# ifndef V_MEMROM1 +# define V_MEMROM1 /* fast data access in ROM */ +# endif + +# ifndef V_MEMROM1_FAR +# define V_MEMROM1_FAR /* slow addressing mode in ROM */ +# endif + + +# ifndef MEMORY_ROM_NEAR +# ifndef V_MEMROM2_NEAR +# define V_MEMROM2_NEAR const /* fast data access in ROM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_ROM_NEAR V_MEMROM2_NEAR +# else +# define V_MEMROM2_NEAR MEMORY_ROM_NEAR +# endif + +# ifndef MEMORY_ROM +# ifndef V_MEMROM2 +# define V_MEMROM2 const /* fast data access in ROM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_ROM V_MEMROM2 +# else +# define V_MEMROM2 MEMORY_ROM +# endif + +# ifndef MEMORY_ROM_FAR +# ifndef V_MEMROM2_FAR +# define V_MEMROM2_FAR const /* slow addressing mode in ROM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_ROM_FAR V_MEMROM2_FAR +# else +# define V_MEMROM2_FAR MEMORY_ROM_FAR +# endif + +# ifndef V_MEMROM3 +# define V_MEMROM3 +# endif + + +/* *********************** default defines - used to store volatile data **************************************** */ +# ifndef V_MEMRAM0 +# define V_MEMRAM0 /* addition qualifier data access in RAM */ +# endif + +# ifndef V_MEMRAM1_NEAR +# define V_MEMRAM1_NEAR /* fast data access in RAM */ +# endif + +# ifndef V_MEMRAM1 +# define V_MEMRAM1 /* fast data access in RAM */ +# endif + +# ifndef V_MEMRAM1_FAR +# define V_MEMRAM1_FAR /* slow addressing mode in RAM */ +# endif + + +# ifndef MEMORY_NEAR +# ifndef V_MEMRAM2_NEAR +# define V_MEMRAM2_NEAR /* fast data access in RAM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_NEAR V_MEMRAM2_NEAR +# else +# define V_MEMRAM2_NEAR MEMORY_NEAR +# endif + +# ifndef MEMORY_NORMAL +# ifndef V_MEMRAM2 +# define V_MEMRAM2 /* fast data access in RAM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_NORMAL V_MEMRAM2 +# else +# define V_MEMRAM2 MEMORY_NORMAL +# endif + +# ifndef MEMORY_FAR +# ifndef V_MEMRAM2_FAR +# define V_MEMRAM2_FAR /* slow addressing mode in RAM */ +# endif +/* compatibility for modules which use old definition of memory qualifer */ +# define MEMORY_FAR V_MEMRAM2_FAR +# else +# define V_MEMRAM2_FAR MEMORY_FAR +# endif + +# ifndef V_MEMRAM3_NEAR +# define V_MEMRAM3_NEAR /* fast data access in RAM */ +# endif + +# ifndef V_MEMRAM3 +# define V_MEMRAM3 /* fast data access in RAM */ +# endif + +# ifndef V_MEMRAM3_FAR +# define V_MEMRAM3_FAR /* slow addressing mode in RAM */ +# endif + + +/* *********************** default defines - to cast results **************************************************** */ +# if !defined(VUINT8_CAST) +# define VUINT8_CAST +# endif +# if !defined(VSINT8_CAST) +# define VSINT8_CAST +# endif +# if !defined(VUINT16_CAST) +# define VUINT16_CAST +# endif +# if !defined(VSINT16_CAST) +# define VSINT16_CAST +# endif +# if !defined(CANBITTYPE_CAST) +# define CANBITTYPE_CAST +# endif +# if !defined(CANSINTCPUTYPE_CAST) +# define CANSINTCPUTYPE_CAST +# endif +# if !defined(CANUINTCPUTYPE_CAST) +# define CANUINTCPUTYPE_CAST +# endif + + +/***************************************************************************/ +/* Local Inline */ +/***************************************************************************/ + + +# if defined( V_DEF_COMP_GHS_ARM ) || \ + defined( V_DEF_COMP_IAR_ARM ) +# if !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) +# if !defined(LOCAL_INLINE) +# define LOCAL_INLINE static inline +# endif +# endif +# endif +# if defined( V_DEF_COMP_GNU_ARM ) || \ + defined( V_DEF_COMP_MICROCHIP_ARM ) || \ + defined( V_DEF_COMP_LLVMDIAB_ARM ) || \ + defined( V_DEF_COMP_LLVMHIGHTEC_ARM ) || \ + defined( V_DEF_COMP_LLVMTI_ARM ) +# if !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) +# if !defined(LOCAL_INLINE) +# define LOCAL_INLINE static __inline__ +# endif +# endif +# endif + + + +/* ARM32 with TI compiler */ +# if defined( V_DEF_COMP_TI_ARM ) +# if !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) +# if !defined(LOCAL_INLINE) +# define LOCAL_INLINE static __inline +# endif +# endif +# endif + +/* ARM32 with ARM6 compiler */ +# if defined( V_DEF_COMP_ARM6_ARM ) +# if !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) +# if !defined(LOCAL_INLINE) +# define LOCAL_INLINE static __inline +# endif +# endif +# endif + + + + +/* ************************************************************************* */ +/* Common_VStdLib */ +/* ************************************************************************* */ +# if defined (VGEN_ENABLE_VSTDLIB) || defined (V_ENABLE_VSTDLIB) +# include "vstdlib.h" +# endif + +/* ************************************************************************* */ +/* V_NULL Definition */ +/* ************************************************************************* */ + + + +/* *********************** default definition of V_NULL **************************************** */ +# if !defined(V_NULL) +# define V_NULL ((void*)0) +# endif + + +# ifndef NULL +# define NULL V_NULL +# endif + +/* ************************************************************************* */ +/* defines regarding CAN and VStdLib MSR abstraction */ +/* ************************************************************************* */ +# if !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) +# define V_ENABLE_CBD_ABSTRACTION +# define STATIC static /* MSR3 */ +# define CAN_STATIC static /* MSR4 */ +# define AUTOMATIC +# if !defined(NULL_PTR) +# define NULL_PTR V_NULL +# endif +# if !defined(LOCAL_INLINE) +# define LOCAL_INLINE +# endif +# define CAN_LOCAL_INLINE LOCAL_INLINE + +# define V_NONE /* empty storage used instead of extern, static, volatile... */ +# define V_STORAGE_NONE /* empty storage used instead of extern, static, volatile... */ + +# if !defined( C_CALLBACK_1 ) +# define C_CALLBACK_1 +# endif +# if !defined( C_CALLBACK_2 ) +# define C_CALLBACK_2 +# endif +# if !defined( C_API_1 ) +# define C_API_1 +# endif +# if !defined( C_API_2 ) +# define C_API_2 +# endif +# if !defined( C_API_3 ) +# define C_API_3 +# endif +# define V_DEF_VAR(storage, vartype, memclass) V_MEMRAM0 storage V_MEMRAM1 vartype V_MEMRAM2 +# define V_DEF_VAR_NEAR(storage, vartype) V_MEMRAM0 storage V_MEMRAM1_NEAR vartype V_MEMRAM2_NEAR +# define V_DEF_VAR_FAR(storage, vartype) V_MEMRAM0 storage V_MEMRAM1_FAR vartype V_MEMRAM2_FAR +# define V_DEF_VAR_TYPE(storage, vartype) typedef storage V_MEMRAM1 vartype V_MEMRAM2 +# define V_DEF_P2VAR(storage, ptrtype, memclass, ptrclass) V_MEMRAM0 storage V_MEMRAM1 ptrtype V_MEMRAM2 * +# define V_DEF_P2VAR_PARA(storage, ptrtype, memclass, ptrclass) storage V_MEMRAM1 ptrtype V_MEMRAM2 * +# define V_DEF_P2VAR_TYPE(storage, ptrtype, ptrclass) typedef storage V_MEMRAM1 ptrtype V_MEMRAM2 * +/* platform specific order may be needed for MEMORY_CAN (position RAM1 or RAM2) */ +# define V_DEF_P2SFR_CAN(storage, ptrtype, memclass) V_MEMRAM0 storage V_MEMRAM1 ptrtype MEMORY_CAN * +# define V_DEF_P2SFR_CAN_TYPE(storage, ptrtype) typedef storage V_MEMRAM1 ptrtype MEMORY_CAN * +/* --- */ +# define V_DEF_CONSTP2VAR(storage, ptrtype, memclass, ptrclass) V_MEMROM0 storage V_MEMRAM1 ptrtype V_MEMRAM2 V_MEMRAM3 * V_MEMROM1 V_MEMROM2 +# define V_DEF_CONST(storage, type, memclass) V_MEMROM0 storage V_MEMROM1 type V_MEMROM2 +# define V_DEF_CONST_NEAR(storage, type) V_MEMROM0 storage V_MEMROM1_NEAR type V_MEMROM2_NEAR +# define V_DEF_CONST_FAR(storage, type) V_MEMROM0 storage V_MEMROM1_FAR type V_MEMROM2_FAR +# define V_DEF_CONST_TYPE(storage, type, memclass) typedef storage V_MEMROM1 type V_MEMROM2 +# define V_DEF_P2CONST(storage, ptrtype, memclass, ptrclass) V_MEMRAM0 storage V_MEMROM1 ptrtype V_MEMROM2 V_MEMROM3 * V_MEMRAM1 V_MEMRAM2 +# define V_DEF_P2CONST_PARA(storage, ptrtype, memclass, ptrclass) storage V_MEMROM1 ptrtype V_MEMROM2 V_MEMROM3 * V_MEMRAM1 V_MEMRAM2 +# define V_DEF_P2CONST_TYPE(storage, ptrtype, ptrclass) typedef storage V_MEMROM1 ptrtype V_MEMROM2 V_MEMROM3 * +# define V_DEF_CONSTP2CONST(storage, ptrtype, memclass, ptrclass) V_MEMROM0 storage V_MEMROM1 ptrtype V_MEMROM2 V_MEMROM3 * V_MEMROM1 V_MEMROM2 +# define V_DEF_FUNC(storage, rettype, memclass) storage rettype +# define V_DEF_FUNC_API(storage, rettype, memclass) storage C_API_1 rettype C_API_2 +# define V_DEF_FUNC_CBK(storage, rettype, memclass) storage C_CALLBACK_1 rettype C_CALLBACK_2 +# define V_DEF_P2FUNC(storage, rettype, ptrclass, fctname) storage C_CALLBACK_1 rettype (C_CALLBACK_2 *fctname) +# endif /* !defined(V_ENABLE_CAN_ASR_ABSTRACTION) && !defined(V_ENABLE_VSTDLIB_ASR_ABSTRACTION) */ +/*-----------------------------------------------------------------------------------------------*/ + +#endif /* V_DEF_H */ +/* STOPSINGLE_OF_MULTIPLE */ diff --git a/Source/bsw/CryIf/CryIf.c b/Source/bsw/CryIf/CryIf.c new file mode 100644 index 0000000..487c736 --- /dev/null +++ b/Source/bsw/CryIf/CryIf.c @@ -0,0 +1,2014 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file CryIf.c + * \brief MICROSAR Crypto Interface (CRYIF) + * \details The Crypto Interface module provides a unique interface to manage different Crypto HW and SW + * solutions. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ +#define CRYIF_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "CryIf.h" +#include "CryIf_Private.h" +#include "CryIf_Cfg.h" +#include "CryIf_Cbk.h" +#include "Csm_Cbk.h" + +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + +/* Check the version of CryIf header file */ +#if ( (CRYIF_SW_MAJOR_VERSION != (9u)) \ + || (CRYIF_SW_MINOR_VERSION != (1u)) \ + || (CRYIF_SW_PATCH_VERSION != (0u))) +# error "Vendor specific version numbers of CryIf.c and CryIf.h are inconsistent" +#endif + +#if ( (CRYIF_SW_MAJOR_VERSION != CRYIF_CFG_MAJOR_VERSION) \ + || (CRYIF_SW_MINOR_VERSION != CRYIF_CFG_MINOR_VERSION) \ + || (CRYIF_SW_PATCH_VERSION != CRYIF_CFG_PATCH_VERSION)) +# error "Version numbers of CryIf.c and CryIf_Cfg.h are inconsistent" +#endif + +#if ( (CRYIF_GENERATOR_MAJOR_VERSION != (9u)) \ + || (CRYIF_GENERATOR_MINOR_VERSION != (1u))) +# error "Module version numbers of CryIf.c and generator are inconsistent" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +#define CRYIF_FIRST_KEY_PRIMITIVE CRYPTO_RANDOMSEED + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ +#define CryIf_Util_MemClr(dst, count) CryIf_Util_MemSet(dst, 0u, count) + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#if !defined (CRYIF_LOCAL) /* COV_CRYIF_ALWAYS_ON */ +# define CRYIF_LOCAL static +#endif + +#if !defined (CRYIF_LOCAL_INLINE) /* COV_CRYIF_ALWAYS_ON */ +# define CRYIF_LOCAL_INLINE LOCAL_INLINE +#endif +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYIF_START_SEC_CODE +#include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * CryIf_KeyCopyForDifferentDrivers() + *********************************************************************************************************************/ +/*! \brief Copies two key between two drivers. + * \details Gets each key element of set source key and writes it to a matching key element of the target key. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetCryIfKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyCopyForDifferentDrivers(uint32 cryIfKeyId, uint32 targetCryIfKeyId); + +/********************************************************************************************************************** + * CryIf_MapKeyIds() + *********************************************************************************************************************/ + /*! \brief Map the job's cryIfKeyIds to cryptoKeyIds. + * \details Check if each cryIfKeyId is in range before mapping it. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \return E_OK Request successful. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \spec requires job->jobPrimitiveInfo != NULL_PTR; + * requires job->jobPrimitiveInfo->primitiveInfo != NULL_PTR; + * \endspec + *********************************************************************************************************************/ +CRYIF_LOCAL_INLINE FUNC(Std_ReturnType, CRYIF_CODE) CryIf_MapKeyIds(P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job); + +#if (CRYIF_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * CryIf_TranslateRedirectionKeys() + *********************************************************************************************************************/ +/*! \brief Translates CryIf redirection keys to Crypto keys. + * \details If the keyId is valid, it is translated to a crypto Key Id + * \param[in,out] keyId Pointer to the cryIfKeyId. + * \return CRYIF_E_NO_ERROR Translation was successful. + * \return CRYIF_E_PARAM_HANDLE Translation was not successful. + * \pre Parameter keyId must point to an accessible memory location and must be valid. + * \context TASK + * \reentrant TRUE, for different keyIds + * \synchronous TRUE + * \spec requires keyId != NULL_PTR; + * \endspec + *********************************************************************************************************************/ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_TranslateRedirectionKeys(P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) keyId); + +/********************************************************************************************************************** + * CryIf_UpdateRedirectionInfo() + *********************************************************************************************************************/ +/*! \brief Updates redirection info ob job objects. + * \details If a redirection for the corresponding job is available, this function translates the CryIf KeyIds to Crypto KeyIds. + * \param[in] job Pointer to the corresponding job object + * \return E_OK Redirection was successful. + * \return E_NOT_OK Redirection failed. + * \pre Parameter job must point to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_UpdateRedirectionInfo(P2CONST(Crypto_JobType, AUTOMATIC, CRYIF_APPL_DATA) job); +#endif /* (CRYIF_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * CryIf_Util_Max() + *********************************************************************************************************************/ +/*! \brief Calculates the maximum value of the inputs. + * \details The function calculates for the two given values the maximum and returns its value. + * \param[in] a First Value + * \param[in] b Second value + * \return The maximum value + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYIF_LOCAL_INLINE FUNC(uint32, CRYIF_CODE) CryIf_Util_Max(uint32 a, uint32 b); + +/********************************************************************************************************************** + * CryIf_Util_MemSet() + *********************************************************************************************************************/ +/*! \brief Sets destination buffer to pattern. + * \details The function sets the destination bytewise to a specified pattern. + * \param[out] dst Pointer to the destination buffer + * \param[in] pattern Pattern which shall be written to the destination buffer. + * \param[in] count Number of bytes which shall be set + * \pre dst must point to a valid memory location. The buffer pointed to by dst has to have a capacity of at least count bytes. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \spec requires dst != NULL_PTR; + * requires $lengthOf(dst) >= count; + * \endspec + *********************************************************************************************************************/ +CRYIF_LOCAL_INLINE FUNC(void, CRYIF_CODE) CryIf_Util_MemSet(P2VAR(uint8, AUTOMATIC, AUTOMATIC) dst, uint8 pattern, uint32 count); + +/********************************************************************************************************************** + * CryIf_Util_MemCpy() + *********************************************************************************************************************/ +/*! \brief Copies values from one buffer to another. + * \details The function copies a specified amount of bytes from a source buffer to a destination buffer. + * \param[out] dst Pointer to the destination buffer + * \param[in] src Pointer to the source buffer + * \param[in] count Number of bytes which shall be copied + * \pre dst and src must point to valid memory locations. The buffer pointed to by dst has to have a capacity of at least count bytes. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \spec requires dst != NULL_PTR; + * requires $lengthOf(dst) >= count; + * requires src != NULL_PTR; + * \endspec + *********************************************************************************************************************/ +CRYIF_LOCAL_INLINE FUNC(void, CRYIF_CODE) CryIf_Util_MemCpy(P2VAR(uint8, AUTOMATIC, AUTOMATIC) dst, P2CONST(uint8, AUTOMATIC, AUTOMATIC) src, uint32 count); + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial_Internal() + *********************************************************************************************************************/ +/*! \brief Copies key element partially without using the Crypto Service. + * \details This function copies key element partially without using the Crypto Service. This is necessary if either + * the keys are lying in different Crypto Drivers or if the underlying Crypto Driver do not support KeyElementCopyPartial Service. + * \param[in] cryptoFctIdxSrc Internal array index of the crypto function table for the source key + * \param[in] cryptoFctIdxDst Internal array index of the crypto function table for the target key + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset This is the offset of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset This is the offset of the destination key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Specifies the number of bytes that shall be copied. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data. + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element. + * \context TASK + * \reentrant TRUE, but not for the same cryIfKeyId + * \synchronous TRUE + * \pre cryptoFctIdxSrc and cryptoFctIdxDst must be valid indices of the crypto function table. + *********************************************************************************************************************/ +CRYIF_LOCAL_INLINE FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial_Internal(CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxSrc, + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxDst, + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId); +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CryIf_KeyCopyForDifferentDrivers() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyCopyForDifferentDrivers(uint32 cryIfKeyId, uint32 targetCryIfKeyId) +{ + uint32_least i, j; + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType retValSrc; + Std_ReturnType retValDst; + uint8 buffer[CryIf_GetMaxSizeOfKeyElementOfGeneral()]; + uint32 bufferSize = CryIf_GetMaxSizeOfKeyElementOfGeneral(); + uint32 elementIdsSrc[CryIf_GetMaxNumberOfKeyElementsOfGeneral()]; + uint32 elementIdsSrcSize = CryIf_GetMaxNumberOfKeyElementsOfGeneral(); + uint32 elementIdsDst[CryIf_GetMaxNumberOfKeyElementsOfGeneral()]; + uint32 elementIdsDstSize = CryIf_GetMaxNumberOfKeyElementsOfGeneral(); + + /* Get key element ids of both keys */ + retValSrc = CryIf_GetKeyElementIdsGetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), elementIdsSrc, &elementIdsSrcSize); + retValDst = CryIf_GetKeyElementIdsGetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(targetCryIfKeyId))(CryIf_GetRefOfKey(targetCryIfKeyId), elementIdsDst, &elementIdsDstSize); + + if ((retValSrc == E_OK) && (retValDst == E_OK)) + { + /* Iterate through both key element lists and copy compatible elements from source to destination */ + for (i = 0; i < elementIdsSrcSize; i++) /* FETA_CRYIF_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND */ + { + for (j = 0; j < elementIdsDstSize; j++) /* FETA_CRYIF_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND */ + { + if (elementIdsSrc[i] == elementIdsDst[j]) + { + bufferSize = CryIf_GetMaxSizeOfKeyElementOfGeneral(); + + /* Copy compatible elements */ + if (E_OK == CryIf_GetKeyElementGetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), elementIdsSrc[i], buffer, &bufferSize)) + { + if (E_OK == CryIf_GetKeyElementSetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(targetCryIfKeyId))(CryIf_GetRefOfKey(targetCryIfKeyId), elementIdsDst[j], buffer, bufferSize)) + { + retVal = E_OK; + } + } + break; + } + } + } + } + + return retVal; +} /* CryIf_KeyCopyForDifferentDrivers() */ + +/********************************************************************************************************************** + * CryIf_MapKeyIds() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +CRYIF_LOCAL_INLINE FUNC(Std_ReturnType, CRYIF_CODE) CryIf_MapKeyIds(P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* Use jobPrimitiveInputOutput keyIds if job is a key primitive job */ + if (job->jobPrimitiveInfo->primitiveInfo->service >= CRYIF_FIRST_KEY_PRIMITIVE) + { + /* Check cryIfKeyId before mapping it */ + if (job->jobPrimitiveInputOutput.cryIfKeyId >= CryIf_GetSizeOfKey()) + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + Crypto_ServiceInfoType service = job->jobPrimitiveInfo->primitiveInfo->service; + + /* Map cryIfKeyId */ + job->cryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInputOutput.cryIfKeyId); + retVal = E_OK; + + /* Check if service contains targetCryIfKeyId */ + if ((service == CRYPTO_KEYDERIVE) + || (service == CRYPTO_CUSTOM_SERVICE) + || (service == CRYPTO_KEYWRAP) + || (service == CRYPTO_KEYUNWRAP)) + { + /* Check targetCryIfKeyId before mapping it */ + if (job->jobPrimitiveInputOutput.targetCryIfKeyId >= CryIf_GetSizeOfKey()) + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + /* Map targetCryIfKeyId */ + job->targetCryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInputOutput.targetCryIfKeyId); + /* retVal already set to E_OK */ + } + } + } + } + /* For all other primitives, use jobPrimitiveInfo cryIfKeyId */ + else + { + /* Check cryIfKeyId before mapping it */ + if (job->jobPrimitiveInfo->cryIfKeyId >= CryIf_GetSizeOfKey()) + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + job->cryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInfo->cryIfKeyId); + retVal = E_OK; + } + } + + return retVal; +} + +#if (CRYIF_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * CryIf_TranslateRedirectionKeys() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_TranslateRedirectionKeys(P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) keyId) +{ + uint8 errorId = CRYIF_E_NO_ERROR; + +# if (CRYIF_DEV_ERROR_DETECT == STD_ON) + if (*keyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +# endif + { + /* Translate cryIfKeyId to CryptoKeyId */ + *keyId = CryIf_GetRefOfKey(*keyId); + } + + return errorId; +} /* CryIf_TranslateRedirectionKeys() */ + +/********************************************************************************************************************** + * CryIf_UpdateRedirectionInfo() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYIF_LOCAL FUNC(Std_ReturnType, CRYIF_CODE) CryIf_UpdateRedirectionInfo(P2CONST(Crypto_JobType, AUTOMATIC, CRYIF_APPL_DATA) job) +{ + Std_ReturnType retVal = E_OK; + uint8 errorId = CRYIF_E_NO_ERROR; + + /* Check if redirection shall be applied */ + if(job->jobRedirectionInfoRef != NULL_PTR) + { + uint8 redirectionConfigValue = job->jobRedirectionInfoRef->redirectionConfig; + + /* Update key ids depending on redirection mask */ + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT) + { + errorId = CryIf_TranslateRedirectionKeys(&job->jobRedirectionInfoRef->inputKeyId); + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT) + { + errorId &= CryIf_TranslateRedirectionKeys(&job->jobRedirectionInfoRef->secondaryInputKeyId); /* VCA_CRYIF_FORWARDING_OF_REDIRECTION_POINTER_OF_JOB */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT) + { + errorId &= CryIf_TranslateRedirectionKeys(&job->jobRedirectionInfoRef->tertiaryInputKeyId); /* VCA_CRYIF_FORWARDING_OF_REDIRECTION_POINTER_OF_JOB */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT) + { + errorId &= CryIf_TranslateRedirectionKeys(&job->jobRedirectionInfoRef->outputKeyId); /* VCA_CRYIF_FORWARDING_OF_REDIRECTION_POINTER_OF_JOB */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT) + { + errorId &= CryIf_TranslateRedirectionKeys(&job->jobRedirectionInfoRef->secondaryOutputKeyId); /* VCA_CRYIF_FORWARDING_OF_REDIRECTION_POINTER_OF_JOB */ + } + } + +# if (CRYIF_DEV_ERROR_DETECT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + retVal = E_NOT_OK; + + /* ----- Development Error Report --------------------------------------- */ +# if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError((uint16)CRYIF_MODULE_ID, + CRYIF_INSTANCE_ID_DET, + CRYIF_SID_PROCESS_JOB, + errorId); +# else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + } +# else /* !(CRYIF_DEV_ERROR_DETECT == STD_ON) */ + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* CryIf_UpdateRedirectionInfo() */ +#endif /* (CRYIF_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * CryIf_Util_Max() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYIF_LOCAL_INLINE FUNC(uint32, CRYIF_CODE) CryIf_Util_Max(uint32 a, uint32 b) +{ + return (a > b)?(a):(b); +} /* CryIf_Util_Max() */ + +/********************************************************************************************************************** + * CryIf_Util_MemSet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYIF_LOCAL_INLINE FUNC(void, CRYIF_CODE) CryIf_Util_MemSet(P2VAR(uint8, AUTOMATIC, AUTOMATIC) dst, uint8 pattern, uint32 count) +{ + uint32_least i; + + for(i = 0; i < count; ++i) /* FETA_CRYIF_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND */ + { + dst[i] = pattern; /* VCA_CRYIF_API_CHECKED_SIZE_ACCESS */ + } +} /* CryIf_Util_MemSet() */ + +/********************************************************************************************************************** + * CryIf_Util_MemCpy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYIF_LOCAL_INLINE FUNC(void, CRYIF_CODE) CryIf_Util_MemCpy(P2VAR(uint8, AUTOMATIC, AUTOMATIC) dst, P2CONST(uint8, AUTOMATIC, AUTOMATIC) src, uint32 count) +{ + uint32_least i; + + for(i = 0; i < count; ++i) /* FETA_CRYIF_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND */ + { + dst[i] = src[i]; /* VCA_CRYIF_API_CHECKED_SIZE_ACCESS */ + } +} /* CryIf_Util_MemCpy() */ + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial_Internal() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060, 6080 10 */ /* MD_CRYIF_STPAR, MD_MSR_STMIF */ +CRYIF_LOCAL_INLINE FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial_Internal( + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxSrc, + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxDst, + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId) +{ + Std_ReturnType retVal; + + uint8 bufferSrc[CryIf_GetMaxSizeOfKeyElementOfGeneral()]; + uint8 bufferDst[CryIf_GetMaxSizeOfKeyElementOfGeneral()]; + uint32 bufferSizeSrc = CryIf_GetMaxSizeOfKeyElementOfGeneral(); + uint32 bufferSizeDst = CryIf_GetMaxSizeOfKeyElementOfGeneral(); + + /* Check local buffer size vs copy length */ + if (((keyElementTargetOffset + keyElementCopyLength) <= CryIf_GetMaxSizeOfKeyElementOfGeneral()) && + /* Prevent integer overflow */ + (CryIf_NoUInt32Overflow(keyElementTargetOffset, keyElementCopyLength))) + { + /* Get Source key element */ + retVal = CryIf_GetKeyElementGetOfCryptoFunctions(cryptoFctIdxSrc)(cryptoKeyId, keyElementId, bufferSrc, &bufferSizeSrc); + + /* Check if required data is inside the queried key element */ + if (retVal == E_OK) + { + if (((keyElementSourceOffset + keyElementCopyLength) <= bufferSizeSrc) && + /* Prevent integer overflow */ + (CryIf_NoUInt32Overflow(keyElementSourceOffset, keyElementCopyLength))) + { + /* Get Destination key element */ + retVal = CryIf_GetKeyElementGetOfCryptoFunctions(cryptoFctIdxDst)(targetCryptoKeyId, targetKeyElementId, bufferDst, &bufferSizeDst); + switch (retVal) + { + case CRYPTO_E_KEY_EMPTY: + { + bufferSizeDst = 0u; + } + /* intentionally no break, since the processing of both cases is similar except of length assignment */ + /* fall through */ + case E_OK: /* PRQA S 2003 */ /* MD_CRYIF_NO_BREAK_IN_SWITCH */ + { + /* Fill destination keyElement with zeroes if there are holes in the destination element */ + if (bufferSizeDst < keyElementTargetOffset) + { + CryIf_Util_MemClr(&bufferDst[bufferSizeDst], keyElementTargetOffset - bufferSizeDst); /* VCA_CRYIF_STACK_ARRAY_VARIABLE_AS_PTR */ + } + + /* Copy source window to destination window */ + CryIf_Util_MemCpy(&bufferDst[keyElementTargetOffset], &bufferSrc[keyElementSourceOffset], keyElementCopyLength); /* VCA_CRYIF_STACK_ARRAY_VARIABLE_AS_PTR */ + + bufferSizeDst = CryIf_Util_Max(bufferSizeDst, keyElementTargetOffset + keyElementCopyLength); /* Potential overflow checked at the beginning. */ + + /* Set destination key element */ + retVal = CryIf_GetKeyElementSetOfCryptoFunctions(cryptoFctIdxDst)(targetCryptoKeyId, targetKeyElementId, bufferDst, bufferSizeDst); + } + break; + + default: + /* return retVal to caller */ + break; + } + + } + else + { + retVal = E_NOT_OK; + } + } + } + else + { + retVal = E_NOT_OK; + } + + return retVal; +} /* CryIf_KeyElementCopyPartial_Internal() */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CryIf_InitMemory() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYIF_CODE) CryIf_InitMemory(void) +{ + /* Nothing to do. */ +} /* CryIf_InitMemory() */ + +/********************************************************************************************************************** + * CryIf_Init() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYIF_CODE) CryIf_Init(void) +{ + /* Nothing to do. */ +} /* CryIf_Init() */ + +#if (CRYIF_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * CryIf_GetVersionInfo() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, CRYIF_CODE) CryIf_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, CRYIF_APPL_VAR) versioninfo) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYIF_DEV_ERROR_DETECT == STD_ON) + if (versioninfo == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + versioninfo->vendorID = (CRYIF_VENDOR_ID); + versioninfo->moduleID = (CRYIF_MODULE_ID); + versioninfo->sw_major_version = (CRYIF_SW_MAJOR_VERSION); + versioninfo->sw_minor_version = (CRYIF_SW_MINOR_VERSION); + versioninfo->sw_patch_version = (CRYIF_SW_PATCH_VERSION); + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_GET_VERSION_INFO, errorId); + } +# else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ +} /* CryIf_GetVersionInfo() */ +#endif /* (CRYIF_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * CryIf_CallbackNotification() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(void, CRYIF_CODE) CryIf_CallbackNotification(P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job, + Std_ReturnType result) +{ + /* AUTOSAR 4.3.x standard deviation + * According to ASR 4.3.x, this function receives job as P2CONST. + * Also according to ASR 4.3.x, Csm_CallbackNotification expects job as a P2VAR. + * This inconsistency in the standard was fixed in ASR 4.4.0 and later versions. + * The MICROSAR CryIf does not offer support for the ASR 4.3.x CryIf_CallbackNotification interface, + * as the standard is broken and a workaround (e.g., by creating a local clone of the job struct) + * would involve heavy performance penalties. + */ + + Csm_CallbackNotification(job, result); +} /* CryIf_CallbackNotification() */ + +/********************************************************************************************************************** + * CryIf_ProcessJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 2 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_ProcessJob(uint32 channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (job == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check parameter 'channelId' */ + else if (channelId >= CryIf_GetSizeOfChannel()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* Map CryIfKeyIds to CryptoKeyIds */ + retVal = CryIf_MapKeyIds(job); + + if (retVal == E_OK) + { +#if (CRYIF_REDIRECTION == STD_ON) +# if (CRYIF_DEV_ERROR_DETECT == STD_ON) + retVal = CryIf_UpdateRedirectionInfo(job); + if (retVal == E_OK) +# else + (void)CryIf_UpdateRedirectionInfo(job); +# endif +#endif /* (CRYIF_REDIRECTION == STD_ON) */ + { + retVal = CryIf_GetProcessJobOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfChannel(channelId))(CryIf_GetDriverObjectRefOfChannel(channelId), job); + } + } + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_PROCESS_JOB, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_ProcessJob() */ + +/********************************************************************************************************************** + * CryIf_CancelJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 2 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CancelJob(uint32 channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (job == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check parameter 'channelId' */ + else if (channelId >= CryIf_GetSizeOfChannel()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + + /* Check if keyId is in range */ + if (job->jobPrimitiveInfo->cryIfKeyId < CryIf_GetSizeOfKey()) + { + /* Check if service is an key primitive job */ + if (job->jobPrimitiveInfo->primitiveInfo->service < CRYIF_FIRST_KEY_PRIMITIVE) + { + job->cryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInfo->cryIfKeyId); + } + else + { + job->cryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInputOutput.cryIfKeyId); + + /* Check if service contains targetCryIfKeyId */ + if (job->jobPrimitiveInfo->primitiveInfo->service == (Crypto_ServiceInfoType)CRYPTO_KEYDERIVE) + { + job->targetCryptoKeyId = CryIf_GetRefOfKey(job->jobPrimitiveInputOutput.targetCryIfKeyId); + } + } +#if (CRYIF_CANCELJOBWITHINFOTYPEOFCRYPTOFUNCTIONS == STD_ON) + /* Check if canceljob service with jobinfotype parameter is enabled */ + if (CryIf_GetCancelJobOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfChannel(channelId)) == NULL_PTR) + { + /* CancelJob expects a non-const Crypto_JobInfoType, therefore a local non-const Crypto_JobInfoType must be created. + * Since the call in synchronous, a pointer to a local struct is okay. */ + Crypto_JobInfoType jobInfo; + jobInfo.jobId = job->jobInfo->jobId; + jobInfo.jobPriority = job->jobInfo->jobPriority; + + retVal = CryIf_GetCancelJobWithInfoTypeOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfChannel(channelId))(CryIf_GetDriverObjectRefOfChannel(channelId), &jobInfo); + } + else +#endif /* (CRYIF_CANCELJOBWITHINFOTYPEOFCRYPTOFUNCTIONS == STD_ON) */ + { + retVal = CryIf_GetCancelJobOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfChannel(channelId))(CryIf_GetDriverObjectRefOfChannel(channelId), job); + } + } + else + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CANCEL_JOB, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_CancelJob() */ + +/********************************************************************************************************************** + * CryIf_KeyElementSet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementSet(uint32 cryIfKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) keyPtr, + uint32 keyLength) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + /* Removed to allow null ptr as value (e.g. start address for secure boot). + * CryIf is not accessing the pointer, check is up to crypto driver. SWS_CryIf_00052 deviation. */ + + /* Check parameter 'keyLength' */ + /* Removed to allow key deletion (keyLength must be 0 in this case). SWS_CryIf_00053 deviation. */ + + /* Check parameter 'cryIfKeyId' */ + if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyElementSetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), + keyElementId, + keyPtr, + keyLength); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_ELEMENT_SET, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyElementSet() */ + +/********************************************************************************************************************** + * CryIf_KeySetValid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetValid(uint32 cryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' */ + if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyValidSetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId)); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_SET_VALID, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeySetValid() */ + +/********************************************************************************************************************** + * CryIf_KeyElementGet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementGet(uint32 cryIfKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) resultLengthPtr) +{ + + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if ((resultPtr == NULL_PTR) || (resultLengthPtr == NULL_PTR)) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check parameter 'resultLengthPtr' */ + else if (*resultLengthPtr == 0u) + { + errorId = CRYIF_E_PARAM_VALUE; + } + /* Check parameter 'cryIfKeyId' */ + else if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyElementGetOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), /* VCA_CRYIF_API_CALL_FORWARDING_PTR_AND_LENGTH */ + keyElementId, + resultPtr, + resultLengthPtr); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_ELEMENT_GET, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyElementGet() */ + +/********************************************************************************************************************** + * CryIf_KeyElementCopy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopy(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' and 'targetCryIfKeyId' */ + if ((cryIfKeyId >= CryIf_GetSizeOfKey()) + || (targetCryIfKeyId >= CryIf_GetSizeOfKey())) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxSrc = CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId); + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxDst = CryIf_GetCryptoFunctionsIdxOfKey(targetCryIfKeyId); + CryIf_RefOfKeyType cryptoKeyIdSrc = CryIf_GetRefOfKey(cryIfKeyId); + CryIf_RefOfKeyType cryptoKeyIdDst = CryIf_GetRefOfKey(targetCryIfKeyId); + + /* ----- Implementation ----------------------------------------------- */ + if (cryptoFctIdxSrc == cryptoFctIdxDst) + { + /* Keys are in same crypto driver */ + retVal = CryIf_GetKeyElementCopyOfCryptoFunctions(cryptoFctIdxSrc)(cryptoKeyIdSrc, keyElementId, cryptoKeyIdDst, targetKeyElementId); + } + else + { + uint8 buffer[CryIf_GetMaxSizeOfKeyElementOfGeneral()]; + uint32 bufferSize = CryIf_GetMaxSizeOfKeyElementOfGeneral(); + /* Copy key element by getting element from source driver and set it to given key element in destination driver. */ + if (CryIf_GetKeyElementGetOfCryptoFunctions(cryptoFctIdxSrc)(cryptoKeyIdSrc, keyElementId, buffer, &bufferSize) == E_OK) + { + retVal = CryIf_GetKeyElementSetOfCryptoFunctions(cryptoFctIdxDst)(cryptoKeyIdDst, targetKeyElementId, buffer, bufferSize); + } + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_ELEMENT_COPY, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyElementCopy() */ + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYIF_STPAR */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial_Stub(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId) +{ + CRYIF_DUMMY_STATEMENT(cryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyElementSourceOffset); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyElementTargetOffset); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyElementCopyLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(targetCryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(targetKeyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return E_NOT_OK; +} /* CryIf_KeyElementCopyPartial_Stub() */ + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYIF_STPAR */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' and 'targetCryIfKeyId' */ + if ((cryIfKeyId >= CryIf_GetSizeOfKey()) + || (targetCryIfKeyId >= CryIf_GetSizeOfKey())) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxSrc = CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId); + CryIf_CryptoFunctionsIdxOfKeyType cryptoFctIdxDst = CryIf_GetCryptoFunctionsIdxOfKey(targetCryIfKeyId); + CryIf_RefOfKeyType cryptoKeyIdSrc = CryIf_GetRefOfKey(cryIfKeyId); + CryIf_RefOfKeyType cryptoKeyIdDst = CryIf_GetRefOfKey(targetCryIfKeyId); + + /* ----- Implementation ----------------------------------------------- */ + /* If KeyElementCopyPartial is supported by underlying driver and source- and target keys are in the same + driver, call the KeyElementCopyPartial Service of the underlying key, otherwise use internal function */ + if((cryptoFctIdxSrc == cryptoFctIdxDst) && (CryIf_IsSupportsKeyElementCopyPartialOfCryptoFunctions(cryptoFctIdxDst))) + { + retVal = CryIf_GetKeyElementCopyPartialOfCryptoFunctions(cryptoFctIdxSrc)(cryptoKeyIdSrc, keyElementId, keyElementSourceOffset, keyElementTargetOffset, keyElementCopyLength, cryptoKeyIdDst, targetKeyElementId); + } + else + { + retVal = CryIf_KeyElementCopyPartial_Internal(cryptoFctIdxSrc, cryptoFctIdxDst, cryptoKeyIdSrc, keyElementId, keyElementSourceOffset, keyElementTargetOffset, keyElementCopyLength, cryptoKeyIdDst, targetKeyElementId); + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_ELEMENT_COPY_PARTIAL, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyElementCopyPartial() */ + +/********************************************************************************************************************** + * CryIf_KeyCopy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyCopy(uint32 cryIfKeyId, + uint32 targetCryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' and 'targetCryIfKeyId' */ + if ((cryIfKeyId >= CryIf_GetSizeOfKey()) + || (targetCryIfKeyId >= CryIf_GetSizeOfKey())) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + if (CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId) == CryIf_GetCryptoFunctionsIdxOfKey(targetCryIfKeyId)) + { + /* Keys are in same crypto driver */ + retVal = CryIf_GetKeyCopyOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), CryIf_GetRefOfKey(targetCryIfKeyId)); + } + else + { + /* Keys are in different crypto drivers */ + retVal = CryIf_KeyCopyForDifferentDrivers(cryIfKeyId, targetCryIfKeyId); + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_COPY, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyCopy() */ + +/********************************************************************************************************************** + * CryIf_RandomSeed() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_RandomSeed(uint32 cryIfKeyId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) seedPtr, + uint32 seedLength) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (seedPtr == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check for value 'seedLength' */ + else if (seedLength == 0u) + { + errorId = CRYIF_E_PARAM_VALUE; + } + /* Check parameter 'cryIfKeyId' */ + else if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetRandomSeedOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), + seedPtr, + seedLength); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_RANDOM_SEED, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_RandomSeed() */ + +/********************************************************************************************************************** + * CryIf_KeyGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGenerate(uint32 cryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' */ + if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyGenerateOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId)); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_GENERATE, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyGenerate() */ + +/********************************************************************************************************************** + * CryIf_KeyDerive() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyDerive(uint32 cryIfKeyId, + uint32 targetCryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' and 'targetCryIfKeyId' */ + if ((cryIfKeyId >= CryIf_GetSizeOfKey()) + || (targetCryIfKeyId >= CryIf_GetSizeOfKey())) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyDeriveOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), CryIf_GetRefOfKey(targetCryIfKeyId)); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_DERIVE, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyDerive() */ + +/********************************************************************************************************************** + * CryIf_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyExchangeCalcPubVal(uint32 cryIfKeyId, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) publicValueLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if ((publicValuePtr == NULL_PTR) || (publicValueLengthPtr == NULL_PTR)) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check for value 'publicValueLengthPtr' */ + else if (*publicValueLengthPtr == 0u) + { + errorId = CRYIF_E_PARAM_VALUE; + } + /* Check parameter 'cryIfKeyId' */ + else if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyExchangeCalcPubValOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), /* VCA_CRYIF_API_CALL_FORWARDING_PTR_AND_LENGTH */ + publicValuePtr, + publicValueLengthPtr); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_EXCHANGE_CALC_PUB_VAL, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyExchangeCalcPubVal() */ + +/********************************************************************************************************************** + * CryIf_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyExchangeCalcSecret(uint32 cryIfKeyId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (partnerPublicValuePtr == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check for value 'partnerPublicValueLength' */ + else if (partnerPublicValueLength == 0u) + { + errorId = CRYIF_E_PARAM_VALUE; + } + /* Check parameter 'cryIfKeyId' */ + else if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyExchangeCalcSecretOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), + partnerPublicValuePtr, + partnerPublicValueLength); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_EXCHANGE_CALC_SECRET, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyExchangeCalcSecret() */ + +/********************************************************************************************************************** + * CryIf_CertificateParse() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateParse(uint32 cryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' */ + if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetCertificateParseOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId)); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CERTIFICATE_PARSE, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_CertificateParse() */ + +/********************************************************************************************************************** + * CryIf_CertificateParse_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateParse_Stub(uint32 cryIfKeyId) +{ + CRYIF_DUMMY_STATEMENT(cryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CERTIFICATE_PARSE, CRYIF_E_REQUEST_NOT_SUPPORTED); +#endif + + return E_NOT_OK; +} /* CryIf_CertificateParse_Stub() */ + +/********************************************************************************************************************** + * CryIf_CertificateVerify() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateVerify(uint32 cryIfKeyId, + uint32 verifyCryIfKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYIF_APPL_VAR) verifyPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (verifyPtr == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check parameter 'cryIfKeyId' */ + else if ((cryIfKeyId >= CryIf_GetSizeOfKey()) + || (verifyCryIfKeyId >= CryIf_GetSizeOfKey())) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetCertificateVerifyOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), + CryIf_GetRefOfKey(verifyCryIfKeyId), + verifyPtr); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CERTIFICATE_VERIFY, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_CertificateVerify() */ + +/********************************************************************************************************************** + * CryIf_CertificateVerify_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +/* PRQA S 3673 3 */ /* MD_CRYIF_POINTER_TO_CONST */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateVerify_Stub(uint32 cryIfKeyId, + uint32 verifyCryIfKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYIF_APPL_VAR) verifyPtr) +{ + CRYIF_DUMMY_STATEMENT(cryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(verifyCryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CERTIFICATE_VERIFY, CRYIF_E_REQUEST_NOT_SUPPORTED); +#endif + + return E_NOT_OK; +} /* CryIf_CertificateVerify_Stub() */ + +/********************************************************************************************************************** + * CryIf_KeyGetStatus() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGetStatus(uint32 cryIfKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYIF_APPL_VAR) keyStatusPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer */ + if (keyStatusPtr == NULL_PTR) + { + errorId = CRYIF_E_PARAM_POINTER; + } + /* Check parameter 'cryIfKeyId' */ + else if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeyGetStatusOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId), keyStatusPtr); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_GET_STATUS, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeyGetStatus() */ + +/********************************************************************************************************************** + * CryIf_KeyGetStatus_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +/* PRQA S 3673 2 */ /* MD_CRYIF_POINTER_TO_CONST */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGetStatus_Stub(uint32 cryIfKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYIF_APPL_VAR) keyStatusPtr) +{ + CRYIF_DUMMY_STATEMENT(cryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyStatusPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_GET_STATUS, CRYIF_E_REQUEST_NOT_SUPPORTED); +#endif + + return E_NOT_OK; +} /* CryIf_KeyGetStatus_Stub() */ + +/********************************************************************************************************************** + * CryIf_KeySetInvalid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetInvalid(uint32 cryIfKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check parameter 'cryIfKeyId' */ + if (cryIfKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetKeySetInvalidOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(cryIfKeyId))(CryIf_GetRefOfKey(cryIfKeyId)); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_SET_INVALID, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_KeySetInvalid() */ + +/********************************************************************************************************************** + * CryIf_KeySetInvalid_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetInvalid_Stub(uint32 cryIfKeyId) +{ + CRYIF_DUMMY_STATEMENT(cryIfKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_KEY_SET_INVALID, CRYIF_E_REQUEST_NOT_SUPPORTED); +#endif + + return E_NOT_OK; +} /* CryIf_KeySetInvalid_Stub() */ + +/********************************************************************************************************************** + * CryIf_CustomSync() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CustomSync(uint32 dispatchId, + uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) outputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYIF_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYIF_DEV_ERROR_DETECT == STD_ON) + /* Check for null pointer: + * No checks for null pointers, as SWS_CryIf_91002 does not list any. */ + + /* Check parameter 'keyId' and 'targetKeyId'. */ + if (keyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else if (targetKeyId >= CryIf_GetSizeOfKey()) + { + errorId = CRYIF_E_PARAM_HANDLE; + } + else +#endif /* (CRYIF_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + retVal = CryIf_GetCustomSyncOfCryptoFunctions(CryIf_GetCryptoFunctionsIdxOfKey(keyId))(dispatchId, /* SBSW_CRYIF_API_CALL_FORWARDING_ID_ONLY */ + CryIf_GetRefOfKey(keyId), + keyElementId, + CryIf_GetRefOfKey(targetKeyId), + targetKeyElementId, + inputPtr, + inputLength, + outputPtr, + outputLengthPtr, + secondaryOutputPtr, + secondaryOutputLengthPtr); + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYIF_E_NO_ERROR) + { + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CUSTOM_SYNC, errorId); + } +#else + CRYIF_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYIF_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* CryIf_CustomSync() */ + +/********************************************************************************************************************** + * CryIf_CustomSync_Stub() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYIF_STPAR */ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CustomSync_Stub(uint32 dispatchId, + uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) outputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputLengthPtr) +{ + CRYIF_DUMMY_STATEMENT(dispatchId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(targetKeyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + CRYIF_DUMMY_STATEMENT_CONST(inputPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(inputLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(outputPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(outputLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(secondaryOutputPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYIF_DUMMY_STATEMENT(secondaryOutputLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYIF_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYIF_MODULE_ID, CRYIF_INSTANCE_ID_DET, CRYIF_SID_CUSTOM_SYNC, CRYIF_E_REQUEST_NOT_SUPPORTED); +#endif + + return E_NOT_OK; +} /* CryIf_CustomSync_Stub() */ + +#define CRYIF_STOP_SEC_CODE +#include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Justification for module-specific MISRA deviations: + MD_CRYIF_STPAR: + Reason: Number of parameters is too high. + Risk: None + Prevention: None + + MD_CRYIF_NO_BREAK_IN_SWITCH: + Reason: No break in a single case of a switch statement. Both cases only differ in one statement. Otherwise, the code must be duplicated or a function call must occur here. + Risk: If the code is refactored or adapted, this may lead to a problem if it is not considered. + Prevention: Code Review. + + MD_CRYIF_POINTER_TO_CONST: + Reason: A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object (MISRA2012-Rule8.13). + In this case the function is just an interface which hands the pointer forward to a function that will change the addressed object. + Risk: None + Prevention: None + + */ + +/* VCA_JUSTIFICATION_BEGIN + + \ID VCA_CRYIF_API_CALL_FORWARDING_PTR_AND_LENGTH + \DESCRIPTION The API call is forwarded using a function pointer which is read using ComStackLib macros. + The API is called with an id, a pointer and a corresponding pointer, referencing the former pointer's length. + \COUNTERMEASURE \R Validity of the function pointer and the ID: + The function pointer is read using the passed Id and ComStackLib macros (CSL03). + The Id is a SNV provided by the CryIf and is converted to the corresponding ID of lower layer using ComStackLib (CSL01). + It is checked when it was first passed to the CryIf module. + Validity of the passed pointer and its length: + The caller uses runtime checks to ensure that neither the (output) pointer itself nor the pointer referencing the output pointer's + length are null pointers. + The caller is required to provide an output buffer of at least as many bytes as referenced by the latter pointer per API contract. + + \ID VCA_CRYIF_API_CHECKED_SIZE_ACCESS + \DESCRIPTION Write access to array given by pointer through a parameter.The API requires the array to have a certain size and it is assumed that the size is available in the given pointer. + \COUNTERMEASURE \R The caller has to assure that the API requirements are matched and the size of the buffer is according to these requirements. + + \ID VCA_CRYIF_FORWARDING_OF_REDIRECTION_POINTER_OF_JOB + \DESCRIPTION A member of the redirection info of a job pointer is provided to the callee as a pointer. + \COUNTERMEASURE \R The job pointer is assumed to be valid by API requirements, the redirection info pointer is checked locally. + + \ID VCA_CRYIF_STACK_ARRAY_VARIABLE_AS_PTR + \DESCRIPTION A pointer to an array located on the stack is given as parameter to a function including its size. + \COUNTERMEASURE \R The function call is synchronous and the size of the array is given, therefore the stack array is valid throughout the function call. + Runtime checks ensure that the passed sizes are valid and not corrupted by overflown values. + +VCA_JUSTIFICATION_END */ + +/* COV_JUSTIFICATION_BEGIN + + \ID COV_CRYIF_ALWAYS_ON + \ACCEPT TX + \REASON CRYIF_LOCAL is always defined externally. + + COV_JUSTIFICATION_END */ + +/* FETA_JUSTIFICATION_BEGIN + +\ID FETA_CRYIF_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND + \DESCRIPTION According to FETA loop may not terminate + in function + - CryIf_KeyCopyForDifferentDrivers + - CryIf_Util_MemCpy + - CryIf_Util_MemSet + + \COUNTERMEASURE \N The here applied loop uses as upper bound a constant value or a variable that remains unchanged during loop + execution. The loop's type of the counter variable is appropriate for the loop's type of upper + bound value / variable and is increased once within each single loop (strictly monotonically increasing) + until it reaches a value that makes the loop stop without any occurrences of overflows. This + is done by a comparison used as loop termination condition that considers the amount of the + increment that is applied within each single loop. + +FETA_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * END OF FILE: CryIf.c + *********************************************************************************************************************/ diff --git a/Source/bsw/CryIf/CryIf.h b/Source/bsw/CryIf/CryIf.h new file mode 100644 index 0000000..4d6c51a --- /dev/null +++ b/Source/bsw/CryIf/CryIf.h @@ -0,0 +1,649 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file CryIf.h + * \brief MICROSAR Crypto Interface (CRYIF) + * \details The Crypto Interface module provides a unique interface to manage different Crypto HW and SW + * solutions. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-12-01 vismss - Initial creation of Crypto Interface + * 01.00.01 2016-12-06 visrpp ESCAN00093184 Renamed CryIf_KeyValidSet to CryIf_KeySetValid + * 01.00.02 2016-12-16 vismss ESCAN00093334 Adapted CryIf_CallbackNotification + * 01.00.03 2017-01-24 vismss ESCAN00093699 Correction of error and service id codes + * 01.01.00 2017-02-14 visgut FEATC-815 Support CRYIF + * Support CryIf_CancelJob + * Fix Reference of Driver Object + * 01.02.00 2017-05-05 visrpp FEATC-1228 FEAT-2902 Release of AR4.3 CryIf + * 02.00.00 2017-05-12 vismaw ESCAN00095159 Validity of cryIfKeyId is not checked + * Silent BSW + * 04.00.00 2018-11-07 vismaw STORYC-6541 Support redirection of input/output buffers from/to key elements + * STORYC-6546 Support partial key element copy + * 04.01.00 2019-03-15 vismaw STORYC-7654 Release of CryIf 4.x + * STORYC-5723 MISRA-C:2012 Compliance + * 05.00.00 2019-12-04 visenc SEC-19 Asynchronous Key Handling + * ESCAN00105151 Compiler error due to incompatible function pointer declaration and + * function definition + * 05.01.00 2020-08-18 vismxe SEC-1838 Migration to QAC Helix + * vismxe ESCAN00105785 Fix comment before case label not recognized by compiler + * 06.00.00 2023-02-28 rstemmler SEC-5474 Introduce APIs KeyGetStatus and KeySetInvalid + * SEC-3020 Add stub functions for non-autosar services CertificateVerify and + * CertificateParse + * SEC-5682 Improve parameter checks in CryIf_KeyElementSet + * SEC-3644 _MemMap migration + * ESCAN00114084 Avoid possible endless loop when copying keys between crypto drivers + * 07.00.00 2023-04-26 kwiedom HSM-3726 Multi Core support: remove CryIf_ModuleInitialized variable and checks + * 07.01.00 2023-11-07 coechsler ESCAN00116074 CryIf_KeyCopy may not copy key elements as expected when copying from one driver to another + * main-1 2024-04-23 viseag CRY-717 Change history is maintained in the global ChangeHistory.txt file starting with this release. + *********************************************************************************************************************/ + +#if !defined (CRYIF_H) +# define CRYIF_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" +# include "Crypto_GeneralTypes.h" +# include "CryIf_Cfg.h" +# include "CryIf_Cbk.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Vendor and module identification */ +# define CRYIF_VENDOR_ID (30u) +# define CRYIF_MODULE_ID (112u) + +/* AUTOSAR Software specification version information */ +# define CRYIF_AR_RELEASE_MAJOR_VERSION (4u) +# define CRYIF_AR_RELEASE_MINOR_VERSION (4u) +# define CRYIF_AR_RELEASE_REVISION_VERSION (0u) + +/* ----- Component version information (decimal version of ALM implementation package) ----- */ +# define CRYIF_SW_MAJOR_VERSION (9u) +# define CRYIF_SW_MINOR_VERSION (1u) +# define CRYIF_SW_PATCH_VERSION (0u) + +# define CRYIF_INSTANCE_ID_DET (0x00u) + +/* ----- API service IDs ----- */ +# define CRYIF_SID_INIT (0x00u) /*!< Service ID: CryIf_Init() */ +# define CRYIF_SID_GET_VERSION_INFO (0x01u) /*!< Service ID: CryIf_GetVersionInfo() */ +# define CRYIF_SID_PROCESS_JOB (0x02u) /*!< Service ID: CryIf_ProcessJob() */ +# define CRYIF_SID_CANCEL_JOB (0x03u) /*!< Service ID: CryIf_CancelJob() */ +# define CRYIF_SID_KEY_ELEMENT_SET (0x04u) /*!< Service ID: CryIf_KeyElementSet() */ +# define CRYIF_SID_KEY_SET_VALID (0x05u) /*!< Service ID: CryIf_KeySetValid() */ +# define CRYIF_SID_KEY_ELEMENT_GET (0x06u) /*!< Service ID: CryIf_KeyElementGet() */ +# define CRYIF_SID_KEY_ELEMENT_COPY (0x0fu) /*!< Service ID: CryIf_KeyElementCopy() */ +# define CRYIF_SID_KEY_ELEMENT_COPY_PARTIAL (0x12u) /*!< Service ID: CryIf_KeyElementCopyPartial() */ +# define CRYIF_SID_KEY_COPY (0x10u) /*!< Service ID: CryIf_KeyCopy() */ +# define CRYIF_SID_RANDOM_SEED (0x07u) /*!< Service ID: CryIf_RandomSeed() */ +# define CRYIF_SID_KEY_GENERATE (0x08u) /*!< Service ID: CryIf_KeyGenerate() */ +# define CRYIF_SID_KEY_DERIVE (0x09u) /*!< Service ID: CryIf_KeyDerive() */ +# define CRYIF_SID_KEY_EXCHANGE_CALC_PUB_VAL (0x0au) /*!< Service ID: CryIf_KeyExchangeCalcPubVal() */ +# define CRYIF_SID_KEY_EXCHANGE_CALC_SECRET (0x0bu) /*!< Service ID: CryIf_KeyExchangeCalcSecret() */ +# define CRYIF_SID_CERTIFICATE_PARSE (0x0cu) /*!< Service ID: CryIf_CertificateParse() */ +# define CRYIF_SID_CERTIFICATE_VERIFY (0x11u) /*!< Service ID: CryIf_CertificateVerify() */ +# define CRYIF_SID_KEY_GET_STATUS (0x13u) /*!< Service ID: CryIf_KeyGetStatus() */ +# define CRYIF_SID_KEY_SET_INVALID (0x14u) /*!< Service ID: CryIf_KeySetInvalid() */ +# define CRYIF_SID_CUSTOM_SYNC (0x15u) /*!< Service ID: CryIf_CustomSync()*/ + +/* ----- Error codes ----- */ +# define CRYIF_E_NO_ERROR (0xFFu) /*!< used to check if no error occurred - use a value unequal to any error code */ +# define CRYIF_E_UNINIT (0x00u) /*!< Error code: API service used without module initialization */ +# define CRYIF_E_INIT_FAILED (0x01u) /*!< Error code: Initialisation of CRYIF module failed */ +# define CRYIF_E_PARAM_POINTER (0x02u) /*!< Error code: API request called with invalid parameter (null pointer) */ +# define CRYIF_E_PARAM_HANDLE (0x03u) /*!< Error code: API request called with invalid parameter (out of range) */ +# define CRYIF_E_PARAM_VALUE (0x04u) /*!< Error code: API request called with invalid parameter (invalid value) */ +# define CRYIF_E_ALREADY_INITIALIZED (0x11u) /*!< Error code: The service CryIf_Init() is called while the module is already initialized */ +# define CRYIF_E_REQUEST_NOT_SUPPORTED (0x12u) /*!< Error code: API request called but request is not supported by Crypto */ + +/* ----- Modes ----- */ +# define CRYIF_UNINIT (0x00u) /*!< State: Module was not initialized */ +# define CRYIF_INIT (0x01u) /*!< State: Module is initialized */ + +/* ----- Other constants ----- */ +# define CRYIF_UINT32_MAX (0xFFFFFFFFuL) + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +# define CryIf_NoUInt32Overflow(Value1, Value2) (((Value2) <= (uint32)(CRYIF_UINT32_MAX - Value1)) ? TRUE:FALSE ) + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYIF_START_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * CryIf_InitMemory() + *********************************************************************************************************************/ +/*! \brief Power-up memory initialization. + * \details Initialize component variables at power up. No action is performed, CryIf is stateless. + * \pre Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYIF_CODE) CryIf_InitMemory(void); + +/********************************************************************************************************************** + * CryIf_Init() + *********************************************************************************************************************/ +/*! \brief Initialization function. + * \details This function initializes the module CryIf. No action is performed, CryIf is stateless. + * \pre Interrupts are disabled. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYIF_CODE) CryIf_Init(void); + +# if (CRYIF_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * CryIf_GetVersionInfo() + *********************************************************************************************************************/ +/*! \brief Returns the version information. + * \details CryIf_GetVersionInfo() returns version information, vendor ID and AUTOSAR module ID of the component. + * \param[out] versioninfo Pointer to where to store the version information. Parameter must not be NULL. + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYIF_CODE) CryIf_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, CRYIF_APPL_VAR) versioninfo); +# endif /* (CRYIF_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * CryIf_ProcessJob() + *********************************************************************************************************************/ +/*! \brief Process the received job. + * \details This interface dispatches the received jobs to the configured crypto driver object. + * \param[in] channelId Holds the identifier of the crypto channel. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \return CRYPTO_E_QUEUE_FULL Request failed, the queue is full. + * \return CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \return CRYPTO_E_CUSTOM_ERROR Remote processing failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \spec requires job->jobPrimitiveInfo != NULL_PTR; + * requires job->jobPrimitiveInfo->primitiveInfo != NULL_PTR; + * \endspec + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_ProcessJob(uint32 channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job); + +/********************************************************************************************************************** + * CryIf_CancelJob() + *********************************************************************************************************************/ +/*! \brief Cancels the received job. + * \details This interface removes the provided job from the underlying Crypto Driver Object queue. + * \param[in] channelId Holds the identifier of the crypto channel. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \return E_OK Request successful, job has been removed. + * \return E_NOT_OK Request failed, job could not be removed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127561 + * \spec requires job->jobPrimitiveInfo != NULL_PTR; + * requires job->jobPrimitiveInfo->primitiveInfo != NULL_PTR; + * requires job->jobInfo != NULL_PTR; + * \endspec + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CancelJob(uint32 channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job); + +/********************************************************************************************************************** + * CryIf_KeyElementSet() + *********************************************************************************************************************/ +/*! \brief Sets a key element. + * \details This function shall dispatch the set key element function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \return CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre - + * \note NULL_PTR check for P2CONST keyPtr is not executed to save runtime. + * Zero value check for keyLength is not executed to be able to support key deletion. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127562 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementSet(uint32 cryIfKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * CryIf_KeySetValid() + *********************************************************************************************************************/ +/*! \brief Sets the key to valid. + * \details This function shall dispatch the set key valid function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key whose key elements shall be set to valid. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127563 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetValid(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_KeyElementGet() + *********************************************************************************************************************/ +/*! \brief Exports the key element. + * \details This function shall dispatch the get key element function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in,out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \return CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127564 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementGet(uint32 cryIfKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * CryIf_KeyElementCopy() + *********************************************************************************************************************/ +/*! \brief Copy key element. + * \details This function shall copy a key element from one key to a target key. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] targetCryIfKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * \return CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * \return CRYPTO_E_KEY_EXTRACT_DENIED Request failed, not allowed to extract key material. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \return CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127565 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopy(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! \brief Copies a key element partially. + * \details This function copies a key element partially from one key to a target key. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset This is the offset of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset This is the offset of the destination key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Specifies the number of bytes that shall be copied. + * \param[in] targetCryIfKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data. + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element. + * \context TASK + * \reentrant TRUE, but not for the same cryIfKeyId + * \synchronous TRUE + * \pre - + * \trace CREQ-188329 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * CryIf_KeyCopy() + *********************************************************************************************************************/ +/*! \brief Copy the key + * \details This function shall copy all key elements from the source key to a target key. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetCryIfKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * \return CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * \return CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \return CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127566 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyCopy(uint32 cryIfKeyId, + uint32 targetCryIfKeyId); + +/********************************************************************************************************************** + * CryIf_RandomSeed() + *********************************************************************************************************************/ +/*! \brief Initialize the seed + * \details This function shall dispatch the random seed function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key for which a new material shall be generated. + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the + * seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127567 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_RandomSeed(uint32 cryIfKeyId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) seedPtr, + uint32 seedLength); + +/********************************************************************************************************************** + * CryIf_KeyGenerate() + *********************************************************************************************************************/ +/*! \brief Generates a key. + * \details This function shall dispatch the key generate function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key which is to be updated with the generated + * value. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127568 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGenerate(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_KeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a key. + * \details This function shall dispatch the key derive function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryIfKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127569 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyDerive(uint32 cryIfKeyId, + uint32 targetCryIfKeyId); + +/********************************************************************************************************************** + * CryIf_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value. + * \details This function shall dispatch the key exchange public value calculation function to the configured + * crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127570 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyExchangeCalcPubVal(uint32 cryIfKeyId, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * CryIf_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret. + * \details This function shall dispatch the key exchange common shared secret calculation function to the + * configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partners public value in bytes. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-127571 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyExchangeCalcSecret(uint32 cryIfKeyId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * CryIf_CertificateParse() + *********************************************************************************************************************/ +/*! \brief Parse stored certificate. + * \details This function shall dispatch the certificate parse function to the configured crypto driver object. + * \param[in] cryIfKeyId Holds the identifier of the key slot in which the certificate has been + * stored. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note If API support is disabled (/MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsCertificateAPI) + * for a specific driver, the service will always return E_NOT_OK for this driver. + * \trace CREQ-127572 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateParse(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_CertificateVerify() + *********************************************************************************************************************/ +/*! \brief Certificate verification. + * \details Verifies the certificate stored in the key referenced by verifyCryptoKeyId with the certificate + * stored in the key referenced by cryIfKeyId. + * \param[in] cryIfKeyId Holds the identifier of the key which shall be used to validate the + * certificate. + * \param[in] verifyCryIfKeyId Holds the identifier of the key containing the certificate, which shall be + * verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the + * certificate verification. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note If API support is disabled (/MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsCertificateAPI) + * for a specific driver, the service will always return E_NOT_OK for this driver. + * \trace CREQ-127573 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateVerify(uint32 cryIfKeyId, + uint32 verifyCryIfKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYIF_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * CryIf_KeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Set crypto key to invalid. + * \details If no errors are detected by CryIf, the service calls Crypto_KeySetInvalid() of the configured + * crypto driver for the crypto key which is mapped to cryIfKeyId and returns the service result. + * \param[in] cryIfKeyId Holds the identifier of the key which shall be set to invalid. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note If API support is disabled (/MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsKeyStatusAPI) + * for a specific driver, the service will always return E_NOT_OK for this driver. + * \trace CREQ-324923 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetInvalid(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_KeyGetStatus() + *********************************************************************************************************************/ +/*! \brief Get status of a key. + * \details If no errors are detected by CryIf, the service calls Crypto_KeyGetStatus() of the configured + * crypto driver for the crypto key which is mapped to cryIfKeyId. The driver writes the key status to + * keyStatusPtr and returns the service result. + * \param[in] cryIfKeyId Holds the identifier of the key of which the status shall be read. + * \param[out] keyStatusPtr Holds a pointer to the memory where the key status shall be written to. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \return CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note If API support is disabled (/MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsKeyStatusAPI) + * for a specific driver, the service will always return E_NOT_OK for this driver. + * \trace CREQ-324922 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGetStatus(uint32 cryIfKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYIF_APPL_VAR) keyStatusPtr); + +/********************************************************************************************************************** + * CryIf_CustomSync() + *********************************************************************************************************************/ +/*! \brief Requests the execution of a function that is specified by the given dispatch id. + * \details If no errors are detected by CryIf, the service calls Crypto_CustomSync() of the configured + * crypto driver and passes on the return value. + * The driver executes the custom cryptographic operation and returns the service result. + * \param[in] dispatchId Unique id to identify the request. + * \param[in] keyId Key Id (e.g. of the key in which the certificate is stored). + * \param[in] keyElementId Key element id. + * \param[in] targetKeyId Holds the target key id. + * If the service does not require a target key, the targetKeyId still + * must reference a valid key + * \param[in] targetKeyElementId Key element id of target key. + * \param[in] inputPtr Pointer to the input data. + * \param[in] inputLength Contains the input length in bytes. + * \param[out] outputPtr Pointer to the output data. + * \param[out] outputLengthPtr Contains the output length in bytes. + * \param[out] secondaryOutputPtr Pointer to the secondary output data. + * \param[out] secondaryOutputLengthPtr Contains the secondary output length in bytes. + * \return E_OK: Request successful. + * \return E_NOT_OK: Request failed. + * \return CRYPTO_E_BUSY: Request failed, Crypto Driver Object is busy. + * \return CRYPTO_E_CUSTOM_ERROR: Custom processing failed. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note If API support is disabled (/MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsCustomSyncService) + * for a specific driver, the service will always return E_NOT_OK for this driver. + * If the service does not require a target key, the key referenced by targetKeyId will not be used. + * However, its id must be valid. + * \trace CREQ-CryIf-CustomSyncService + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CustomSync(uint32 dispatchId, + uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) outputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputLengthPtr); + +# define CRYIF_STOP_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYIF_H) */ + +/********************************************************************************************************************** + * END OF FILE: CryIf.h + *********************************************************************************************************************/ diff --git a/Source/bsw/CryIf/CryIf_Cbk.h b/Source/bsw/CryIf/CryIf_Cbk.h new file mode 100644 index 0000000..7c21155 --- /dev/null +++ b/Source/bsw/CryIf/CryIf_Cbk.h @@ -0,0 +1,63 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file CryIf_Cbk.h + * \brief MICROSAR Crypto Interface (CRYIF) + * \details The Crypto Interface module provides a unique interface to manage different Crypto HW and SW + * solutions. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYIF_CBK_H) +# define CRYIF_CBK_H + +# include "Std_Types.h" +# include "Crypto_GeneralTypes.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYIF_START_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * CryIf_CallbackNotification() + *********************************************************************************************************************/ +/*! \brief CryIf Callback Notification + * \details Notifies the CRYIF about the completion of the request with the result of the cryptographic operation. + * \param[in,out] job Points to the completed job's information structure. It contains a + * callbackID to identify which job is finished. + * \param[in] result Contains the result of the cryptographic operation. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \trace CREQ-127574 + *********************************************************************************************************************/ +FUNC(void, CRYIF_CODE) CryIf_CallbackNotification(P2VAR(Crypto_JobType, AUTOMATIC, CRYIF_APPL_VAR) job, + Std_ReturnType result); + +# define CRYIF_STOP_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYIF_CBK_H) */ + +/********************************************************************************************************************** + * END OF FILE: CryIf_Cbk.h + *********************************************************************************************************************/ diff --git a/Source/bsw/CryIf/CryIf_Private.h b/Source/bsw/CryIf/CryIf_Private.h new file mode 100644 index 0000000..d7087ad --- /dev/null +++ b/Source/bsw/CryIf/CryIf_Private.h @@ -0,0 +1,202 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file CryIf_Private.h + * \brief MICROSAR Crypto Interface (CRYIF) + * \details The Crypto Interface module provides a unique interface to manage different Crypto HW and SW + * solutions. This header file contains stub function declarations for services that are not supported + * by the underlying Crypto. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYIF_PRIVATE_H) +# define CRYIF_PRIVATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" +# include "Crypto_GeneralTypes.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYIF_START_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * CryIf_KeyElementCopyPartial_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underyling Crypto Driver does not + * support KeyElementCopyPartial Service. This function should never be called and is only existent to + * overcome Compiler / Linker errors. + * \param[in] cryIfKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset This is the offset of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset This is the offset of the destination key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Specifies the number of bytes that shall be copied. + * \param[in] targetCryIfKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyElementCopyPartial_Stub(uint32 cryIfKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryIfKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * CryIf_CertificateParse_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underlying Crypto Driver does not + * support CertificateParse Service. This function should never be called and is only existent to + * overcome Compiler / Linker errors. + * \param[in] cryIfKeyId Holds the identifier of the key slot in which the certificate has been + * stored. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateParse_Stub(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_CertificateVerify_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underlying Crypto Driver does not + * support CertificateVerify Service. This function should never be called and is only existent to + * overcome Compiler / Linker errors. + * \param[in] cryIfKeyId Holds the identifier of the key which shall be used to validate the + * certificate. + * \param[in] verifyCryIfKeyId Holds the identifier of the key containing the certificate, which shall be + * verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the + * certificate verification. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \endspec + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CertificateVerify_Stub(uint32 cryIfKeyId, + uint32 verifyCryIfKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYIF_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * CryIf_KeySetInvalid_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underlying Crypto Driver does not + * support KeySetInvalid Service. This function should never be called and is only existent to overcome + * Compiler / Linker errors. + * \param[in] cryIfKeyId Holds the identifier of the key that shall be invalidated. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \pre - + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeySetInvalid_Stub(uint32 cryIfKeyId); + +/********************************************************************************************************************** + * CryIf_KeyGetStatus_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underlying Crypto Driver does not + * support KeyGetStatus Service. This function should never be called and is only existent to overcome + * Compiler / Linker errors. + * \param[in] cryIfKeyId Holds the identifier of the key whose status shall be returned. + * \param[out] keyStatusPtr Holds a pointer to the memory where the key status shall be written to. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \endspec + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_KeyGetStatus_Stub(uint32 cryIfKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYIF_APPL_VAR) keyStatusPtr); + +/********************************************************************************************************************** + * CryIf_CustomSync_Stub() + *********************************************************************************************************************/ +/*! \brief Returns E_NOT_OK. + * \details This function is referenced in the crypto functions array if the underlying Crypto Driver does not + * support CustomSync Service. This function should never be called and is only existent to overcome + * Compiler / Linker errors. + * \param[in] dispatchId Unique id to identify the request. + * \param[in] keyId Key Id (e.g. of the key in which the certificate is stored). + * \param[in] keyElementId Key element id. + * \param[in] targetKeyId Holds the target key id. + * If the service does not require a target key Id, pass on + * CRYIF_EMPTY_KEY_ID. + * \param[in] targetKeyElementId Key element id of target key. + * \param[in] inputPtr Pointer to the input data. + * \param[in] inputLength Contains the input length in bytes. + * \param[out] outputPtr Pointer to the output data. + * \param[out] outputLengthPtr Contains the output length in bytes. + * \param[out] secondaryOutputPtr Pointer to the secondary output data. + * \param[out] secondaryOutputLengthPtr Contains the secondary output length in bytes. + * \return E_NOT_OK As this should never be called directly, E_NOT_OK is always returned. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYIF_CODE) CryIf_CustomSync_Stub(uint32 dispatchId, + uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId, + P2CONST(uint8, AUTOMATIC, CRYIF_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) outputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputPtr, + P2VAR(uint32, AUTOMATIC, CRYIF_APPL_VAR) secondaryOutputLengthPtr); + +# define CRYIF_STOP_SEC_CODE +# include "CryIf_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYIF_PRIVATE_H) */ + +/********************************************************************************************************************** + * END OF FILE: CryIf_Private.h + *********************************************************************************************************************/ diff --git a/Source/bsw/CryIf/Make/CryIf_cfg.mak b/Source/bsw/CryIf/Make/CryIf_cfg.mak new file mode 100644 index 0000000..6e53173 --- /dev/null +++ b/Source/bsw/CryIf/Make/CryIf_cfg.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : CryIf_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the CryIf_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefore the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +#CRYIF_CONFIG_PATH = + + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + +#CRYIF_DRIVER_MODE = singlechannel + + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/CryIf/Make/CryIf_check.mak b/Source/bsw/CryIf/Make/CryIf_check.mak new file mode 100644 index 0000000..907183c --- /dev/null +++ b/Source/bsw/CryIf/Make/CryIf_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : CryIf_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the CryIf_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/CryIf/Make/CryIf_defs.mak b/Source/bsw/CryIf/Make/CryIf_defs.mak new file mode 100644 index 0000000..9615cfa --- /dev/null +++ b/Source/bsw/CryIf/Make/CryIf_defs.mak @@ -0,0 +1,82 @@ +############################################################################### +# File Name : CryIf_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the CryIf_rules.mak file. +############################################################################### + + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... +CRYIF_CORE_PATH = +# e.g.: CAN_OUTPUT_PATH = $(GENDATA_DIR) +CRYIF_OUTPUT_PATH = $(GENDATA_DIR) + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: can_DEPENDENT_PLUGINS = +CRYIF_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += CryIf$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/CryIf/Make/CryIf_rules.mak b/Source/bsw/CryIf/Make/CryIf_rules.mak new file mode 100644 index 0000000..feb925e --- /dev/null +++ b/Source/bsw/CryIf/Make/CryIf_rules.mak @@ -0,0 +1,101 @@ +############################################################################### +# File Name : CryIf_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2016-11-22 visrpp Initial creation +# 1.01.00 2019-02-06 vircbl Added support of component-based SIP structure +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += $(LIB_OUPUT_PATH)\vendorx_canlib1.$(LIB_FILE_SUFFIX) +LIBRARIES_TO_BUILD += CryIf +CryIf_FILES = CryIf$(BSW_SRC_DIR)\CryIf.c + +# e.g.: CC_FILES_TO_BUILD += drv\can_drv.c +CC_FILES_TO_BUILD += CryIf$(BSW_SRC_DIR)\CryIf.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\CryIf_Cfg.c + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: + #$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_MemMap.arxml b/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_MemMap.arxml new file mode 100644 index 0000000..6ea7617 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_MemMap.arxml @@ -0,0 +1,117 @@ + + + + + + MICROSAR + + + Crypto_30_LibCv + + + Crypto_Impl + + ResourceConsumption + + + + CRYPTO_30_LIBCV_CODE + /MICROSAR_MemMap/SwAddrMethods/CODE + CODE + + + + CRYPTO_30_LIBCV_CONST_8 + 8 + /MICROSAR_MemMap/SwAddrMethods/CONST + CONST_8BIT + + + CRYPTO_30_LIBCV_CONST_32 + 32 + /MICROSAR_MemMap/SwAddrMethods/CONST + CONST_32BIT + + + CRYPTO_30_LIBCV_CONST_UNSPECIFIED + UNSPECIFIED + /MICROSAR_MemMap/SwAddrMethods/CONST + CONST_UNSPECIFIED + + + + CRYPTO_30_LIBCV_VAR_NO_INIT_8 + 8 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + VAR_NOINIT_8BIT + + + CRYPTO_30_LIBCV_VAR_NO_INIT_16 + 16 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + VAR_NOINIT_16BIT + + + CRYPTO_30_LIBCV_VAR_NO_INIT_32 + 32 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + VAR_NOINIT_32BIT + + + CRYPTO_30_LIBCV_VAR_NO_INIT_UNSPECIFIED + UNSPECIFIED + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + VAR_NOINIT_UNSPECIFIED + + + CRYPTO_30_LIBCV_CRYPTO_SINGLE_PARTITION_VAR_NOINIT_8 + 8 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + CRYPTO_SINGLE_PARTITION_VAR_NOINIT_8BIT + + + CRYPTO_30_LIBCV_CRYPTO_SINGLE_PARTITION_VAR_NOINIT_16 + 16 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + CRYPTO_SINGLE_PARTITION_VAR_NOINIT_16BIT + + + CRYPTO_30_LIBCV_CRYPTO_SINGLE_PARTITION_VAR_NOINIT_32 + 32 + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + CRYPTO_SINGLE_PARTITION_VAR_NOINIT_32BIT + + + + CRYPTO_30_LIBCV_VAR_CLEARED_8 + 8 + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + VAR_ZERO_INIT_8BIT + + + + + + + + + + \ No newline at end of file diff --git a/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_bswmd.arxml b/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_bswmd.arxml new file mode 100644 index 0000000..d478cb8 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/BSWMD/Crypto_30_LibCv_bswmd.arxml @@ -0,0 +1,15429 @@ + + + + + + MICROSAR + + + Crypto_30_LibCv + + + Crypto_Impl + C + 14.09.04 + DaVinci Configurator + 30 + 4.03.00 + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_LibCv + + /MICROSAR/Crypto_30_LibCv/Crypto_Pre + + + /MICROSAR/Crypto_30_LibCv/Crypto_Rec + + LibCv + + /MICROSAR/Crypto_30_LibCv/Crypto + + + + Crypto + + The Crypto Driver (CRYPTO) is called by the Crypto Interface (CRYIF) and performs the specific cryptographic functionality. The Crypto Driver specification by AUTOSAR offers a key storage and a superset of algorithms which can be extended by custom algorithms. This software-based Crypto Driver offers a subset of algorithms and features. + +#Security #Crypto #Cryptography #Key #SHE +#AUTOSAR + + + VENDOR_SPECIFIC_MODULE_DEFINITION + + + + 1.00.00 + beta + visrpp + 2016-07-13T09:39:25+02:00 + + + + Initial creation + + + + + + 1.00.01 + beta + visrpp + 2016-12-06T05:24:34+01:00 + + + + Added CryptoNvMBlockDescriptor + + + + + + 1.00.02 + beta + vismss + 2016-12-07T02:24:39+01:00 + + + + SW Version update + + + + + + 1.00.03 + beta + vismss + 2016-12-14T05:13:35+01:00 + + + + SW Version update + + + + + + 1.00.04 + beta + vismss + 2017-01-24T09:44:19+01:00 + + + + Adaptions to Specification + + + + + + 1.01.00 + beta + visgut + 2017-02-23T09:24:55+01:00 + + + + Change multiplicity of Mainfunction Cycle Time and add default value + + + + + + 1.01.00 + beta + visgut + 2017-03-03T01:15:32+01:00 + + + + Set min. and max. Queue Size to 1. + + + + + + 1.01.00 + beta + visrpp + 2017-03-07T09:23:34+01:00 + + + + Removed non ASR 4.3 parameter, added CryptoKeyDeriveIterations + + + + + + 1.01.01 + beta + vismaw + 2017-04-19T03:18:30+02:00 + + + + SW Version Update + + + + + + 1.02.00 + released + vismaw + 2017-05-05T05:26:41+02:00 + + + + Release of component + + + FEATC-1229 + + + + + + 2.01.00 + released + vismaw + 2017-09-01T05:07:30+02:00 + + + + Added CryptoSupportSheKeyUpdate, CryptoSupportKeyDerive and CryptoSupportPublicKeyExchange + + + STORYC-281 + + + + + + 3.00.00 + released + vismwe + 2017-09-12T15:28:40+02:00 + + + + Adaption of Preconfiguration for RSA Support, Added CryptoSheMasterKeyRef reference, Added missing default values + + + STORYC-1851, STORYC-2438 + + + + + + 3.01.00 + released + vismwe + 2017-10-06T16:37:50+02:00 + + + + Adaption of Preconfiguration for ECC and References; Adapt Rsa Key Type Names + + + STORYC-2159, STORYC-2600, ESCAN00096938 + + + + + + 3.02.00 + released + vismwe + 2017-11-10T10:54:51+01:00 + + + + Key Primitive Configuration, Add ECDHE with ANSIp256r1, Add HMAC with SHA1 and SHA256 pre-defines + + + STORYC-2604, STORYC-2606 + + + + + + 3.03.00 + released + vismwe + 2017-12-01T14:25:27+01:00 + + + + Use VStdLib switch, Adapt enum for CryptoKeyDeriveAlgorithm + + + STORYC-2601, STORYC-2603 + + + + + + 3.04.00 + released + vismwe + 2018-01-10T13:17:55+01:00 + + + + Add ANSI/NIST/SECp256r1 with SHA-1, expand pre-configured key types + + + STORYC-2605 + + + + + + 3.05.00 + released + vismwe + 2018-01-31T13:12:26+01:00 + + + + Add NIST DRBG, add RSA PKCS1 CRT, add ECDHE SECp256r1, add dele key elements, rework AES CMAC key reuse + + + STORYC-3392, STORYC-2607, STORYC-2602, STORYC-4075 + + + + + + 3.06.00 + released + vismwe + 2018-02-20T12:45:23+01:00 + + + + Support AES 128 encryption and decryption without padding + + + STORYC-4373 + + + + + + 4.00.00 + released + vismwe + 2018-05-18T14:20:06+02:00 + + + + Support for ECDSA 384, Support AES256, fix she pre config + + + STORYC-5043, STORYC-5044, ESCAN00099048 + + + + + + 4.01.00 + released + vismwe + 2018-06-12T09:49:35+02:00 + + + + She Key Update Protocol - Support UID, Fid and counter + + + STORYC-5529 + + + + + + 4.02.00 + released + vismwe + 2018-08-20T11:10:41+02:00 + + + + Fix KeyExchange SECP256P KeyType + + + ESCAN00100349 + + + + + + 5.00.00 + released + vismwe + 2018-09-12T11:00:30+02:00 + + + + Support RSAES-OAEP with SHA-1 and SHA-256 + + + STORYC-6301 + + + + + + 5.01.00 + released + vismwe + 2018-11-07T13:15:54+01:00 + + + + Support redirection of input/output buffers from/to key elements + + + STORYC-6543 + + + + + + 5.02.00 + released + visivg + 2018-11-26T13:10:28+01:00 + + + + Support of SHA512 pre-hashing for ECDSA , SHA384 Hash and ECDHE for SECp384r1 + + + STORYC-7065, STORYC-5518, STORYC-5520 + + + + + + 5.03.00 + released + visivg + 2019-01-07T15:03:34+01:00 + + + + Support GMAC AES-256 + + + STORYC-5807 + + + + + + 5.04.00 + released + visivg + 2019-01-25T10:21:01+01:00 + + + + Support of HMAC SHA-384 + + + STORYC-7447 + + + + + + 5.05.00 + released + visivg + 2019-02-26T15:18:30+01:00 + + + + Prepare Release of Crypto 5.x + + + STORYC-7655 + + + + + + 5.06.00 + released + vismwe + 2019-03-26T11:34:26+01:00 + + + + Support RSAES PKCS#1 v1.5 public key decryption, Support KDF X9.63 with Sha256 in Crypto Driver + + + STORYC-7979, STORYC-7161 + + + + + + 6.00.00 + released + vismwe + 2019-07-10T12:56:35+02:00 + + + + Support Multiple Nv Blocks and Export of She RAM Keys, General Improvements, Support of She DEBUG_CMD + + + SEC-61, SEC-62, SEC-652, SEC-27 + + + + + + 6.01.00 + released + vismwe + 2019-08-05T14:03:37+02:00 + + + + Introduce Immediate write of NvM Blocks + + + SEC-667 + + + + + + 6.01.01 + released + vismaw + 2019-08-20T11:42:56+02:00 + + + + LibCv causes endless loop in NvM_Readall + + + ESCAN00104069 + + + + + + 7.00.00 + released + vismwe + 2019-12-15T19:44:34+01:00 + + + + Support Asynchronous Key Services + + + SEC-54 + + + + + + 7.00.01 + released + vismwe + 2020-01-20T12:13:08+01:00 + + + + Update Version + + + ESCAN00105402 + + + + + + 7.01.00 + released + vismwe + 2020-01-20T12:16:31+01:00 + + + + Add callout implementation for esl_getrandom bytes + + + SEC-10 + + + + + + 7.02.00 + released + vismwe + 2020-02-28T14:56:26+01:00 + + + + Support AES Padding One with Zeros + + + SEC-885 + + + + + + 7.03.00 + released + visenc + 2020-03-23T16:29:15+01:00 + + + + Support CryptoStack KeyGenerate Interfaces + + + SEC-902 + + + + + + 8.00.00 + released + visenc + 2020-04-14T12:15:45+02:00 + + + + Support HMAC with RIPEMD160 + + + SEC-1280 + + + + + + 8.00.01 + released + vismwe + 2020-04-23T11:51:57+02:00 + + + + Update Version + + + ESCAN00106180 + + + + + + 8.01.00 + released + visenc + 2020-04-26T15:30:25+02:00 + + + + Support of ECDSA with SECP160R1, Support User Config File + + + SEC-1276, SEC-1408 + + + + + + 8.02.00 + released + visenc + 2020-05-25T11:17:29+02:00 + + + + Support of HASH with RIPEMD-160, AES CTR mode and KDF2 + + + SEC-1278, SEC-796, SEC-954 + + + + + + 8.03.00 + released + visenc + 2020-06-10T16:13:56+02:00 + + + + Support KDF963 in combination with SHA512 + + + SEC-1534 + + + + + + 8.04.00 + released + visenc + 2020-06-19T17:22:51+02:00 + + + + Support ChaCha20 with Poly1305 as authenticator for AEAD + + + SEC-1250 + + + + + + 8.05.00 + released + visenc + 2020-07-06T12:13:03+02:00 + + + + Support CTR_DRBG based on AES-128 from vSecPrim, Support Write OnceKeys,Support PRNG based on SHA512 according to SP800-90A, Support of HASH SHA3-256 + + + SEC-1164, SEC-1687, SEC-1215, SEC-1472 + + + + + + 9.00.00 + released + visenc + 2020-08-27T10:28:08+02:00 + + + + Support DRBG CTR AES256, Support SHE command: CMD_GET_ID + + + SEC-1691, SEC-1665 + + + + + + 9.01.00 + released + vismwe + 2020-08-27T17:15:40+02:00 + + + + Support AES-CMAC 256, HKDF HMAC SHA256, AES-CCM 128 and SPAKE2+ + + + SEC-1801, SEC-1805, SEC-1809, SEC-1812 + + + + + + 9.02.00 + released + visenc + 2020-11-18T16:14:22+01:00 + + + + Support MD5 and Key Generation for Ed25519 Keys + + + SEC-2080, SEC-1677 + + + + + + 9.03.00 + released + vismxe + 2020-12-17T14:21:22+01:00 + + + + Support AUTOSAR 20-11 custom mode configuration + + + SEC-1887 + + + + + + 10.00.00 + released + visenc + 2021-05-05T17:25:50+02:00 + + + + Save and restore context for running crypto operations + + + SEC-2476 + + + + + + 10.01.00 + released + vismwe + 2021-08-25T13:29:39+02:00 + + + + Support Elliptic Curve Burmester Desmedt + + + SEC-2122 + + + + + + 11.00.00 + released + visenc + 2021-11-29T18:34:14+01:00 + + + + Support Key Derivation NIST SP 800-56C Option 1 + + + SEC-3388 + + + + + + 11.01.00 + released + visenc + 2021-12-20T17:18:40+01:00 + + + + Support key value changed callouts + + + SEC-3570 + + + + + + 12.00.00 + released + visenc + 2022-05-16T15:37:45+02:00 + + + + Support of ECDSA secp521r1 with SHA2-512, Support AES-192, Fix ESCAN00111597 + + + SEC-4482, SEC-4863 + + + + + + 12.01.00 + released + viskju + 2022-11-11T10:01:11+01:00 + + + + Support of ECDHE secp521r1, Support SHA-3 and SHAKE + + + HSM-3249, HSM-3096 + + + + + + 12.02.00 + released + viskju + 2023-01-23T15:13:12+01:00 + + + + Support of HKDF HMAC SHA384 + + + HSM-3086 + + + + + + 12.03.00 + released + viskju + 2023-03-15T10:31:55+01:00 + + + + Support of HKDF HASH Sha-512 + + + HSM-3819 + + + + + + 12.04.00 + released + viskju + 2023-03-23T15:50:06+01:00 + + + + Support of ISO-15118-20 KDF for P521 + + + HSM-3826 + + + + + + 13.00.00 + released + viskju + 2023-04-13T15:10:26+02:00 + + + + Support multicore with shared memory + + + HSM-3728 + + + + + + 13.01.00 + released + viskju, vikrio + 2023-06-06T09:05:40+02:00 + + + + Support X448/ECDH based on curve Edwards448, Make LibCv more compatible with Hwa with regard to primitives and custom refs, Support ISO-15118-20 Key Derivation for ED448, Support EdDSA ED448 + + + HSM-4098, HSM-3811, HSM-4090, SEC-6446 + + + + + + 13.02.00 + released + coechsler + 2023-08-02T15:52:43+02:00 + + + + Support HMAC SHA2-512, support HKDF Expand SHA256, SHA384, Support IsKeyOnCurve + + + SEC-6306, SEC-6310, SEC-6685 + + + + + + 13.03.00 + released + coechsler + 2023-08-21T13:51:35+02:00 + + + + Support IsKeyOnCurve Ed, Support ECBD P256R1 + + + SEC-6734, SEC-6768 + + + + + + 13.04.00 + released + viskju + 2023-10-04T10:01:53+02:00 + + + + Support for secp521r1 Key Generation + + + HSM-4583 + + + + + + 13.04.01 + released + viskju + 2023-10-16T16:05:32+02:00 + + + + Update Version + + + ESCAN00115928 + + + + + + 13.05.00 + released + coechsler + 2023-11-10T11:48:25+01:00 + + + + Update Version + + + CRY-418 + + + + + + 13.05.01 + released + coechsler + 2024-01-05T10:58:36+01:00 + + + + Update Version + + + ESCAN00116209 + + + + + + 13.06.00 + released + coechsler + 2024-01-16T15:36:41+01:00 + + + + Support SLH-DSA SHA2-128s Verify, SM4 Cipher, SM3 Hash, SM2 Signature, SM2 Key Generation + + + CRY-58, CRY-391, CRY-389, CRY-395, CRY-393 + + + + + + 14.00.00 + released + coechsler + 2024-03-15T09:24:46+01:00 + + + + Support AES GCM variable tag length + + + CRY-759 + + + + + + 14.01.00 + released + coechsler + 2024-03-20T07:45:18+01:00 + + + + Change history is maintained in the global ChangeHistory.txt file starting with this release. + + + CRY-462 + + + + + + + 0 + 1 + /AUTOSAR/EcucDefs/Crypto + + VARIANT-PRE-COMPILE + + + + CryptoDriverObjects + + Container for Crypto Driver Objects + + + + + false + false + + + + 1 + 1 + false + + + CryptoDriverObject + + Container for configuration of Crypto Driver Object. The container name serves as a symbolic name for the identifier of a Crypto Driver Object. + + + + + false + false + + + + 1 + true + false + + + CryptoDriverObjectId + + Identifier of the Crypto Driver Object. The Crypto Driver Object offers different crypto primitives. + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + true + 0 + 4294967295 + 0 + + + CryptoDriverObjectQueueSize + + Size of the queue in the Crypto Driver. Defines the maximum number of jobs in the Crypto Driver Object queue. If it is set to 0, queueing is disabled in the Crypto Driver Object. This Crypto Driver does not support queuing but uses the buffer for asynchronous processing therefore the value need to be set to 1. + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + 1 + 1 + 1 + + + + + CryptoPrimitiveRef + + Refers to primitive in the CRYPTO. +The CryptoPrimitive is a pre-configured container of the crypto service that shall be used. + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + CryptoDefaultRandomKeyRef + + This is a reference to the CryptoKey that is used by the +CryptoDefaultRandomPrimitiveRef. The key contains key elements that +are necessary to seed the random number generator. +This element shall only be set if the primitive referenced by +CryptoDefaultRandomPrimitiveRef requires a seed value. +The reference has to be different for each partition. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoDefaultRandomPrimitiveRef + + This is a reference to a primitive that configures a default random number +generator. If a crypto driver object needs to perform a crypto primitive that +requires a random number generator, but the configuration of this primitive +does not provide parameter for a random number generator, then this +default random number generator shall be used (i.e. the elements of +algorithm family, secondary algorithm family and algorithm mode do not +provide this information). +Example: The crypto driver shall generate a signature based on elliptic +curve but the primitive for signature generation lacks information about a +random number generator. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + CryptoDriverObjectEcucPartitionRef + + Maps a crypto driver object to zero or one ECUC partition. The ECUC +partition referenced is a subset of the ECUC partitions where the Crypto +driver is mapped to. + + + + + false + + + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /AUTOSAR/EcucDefs/EcuC/EcucPartitionCollection/EcucPartition + + + + + + + CryptoGeneral + + Container for common configuration options. + + + + + false + false + + + + 1 + 1 + false + false + + + + + + + + + CryptoVersionInfoApi + + Pre-processor switch to enable and disable availability of the API Crypto_GetVersionInfo(). +- True: API Crypto_GetVersionInfo() is available +- False: API Crypto_GetVersionInfo() is not available. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + false + + + CryptoMainFunctionPeriod + + Specifies the period of main function Crypto_MainFunction in seconds. + + + + + SEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + 0.01 + 3600 + 0 + + + CryptoDevErrorDetect + + Switches the development error detection and notification on or off. +- True: detection and notification is enabled. +- False: detection and notification is disabled. + + + +

+ True: Development error detection enabled. + False: Development error detection disabled +

+
+ 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + true +
+ + CryptoSafeBswChecks + + Selects if safety checks are used. These checks improve robustness as e.g. invalid parameters are checked before function is executed. This attribute has to be enabled for safety projects where this component is mapped to an ASIL partition. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoUseVStdLib + + Use VStdLib + + + If enabled the VStdLib is used for copy and clear data operations. If there is no VStdLib, disable the switch to use the implementation of the Crypto. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoKeyElementDelete + + If Crypto_KeyElementSet is called with the length 0 the key will be overwritten with 0 and the length is set to 0. If KeyElementDelete is enabled the standard AUTOSAR DET check for the given key element length in Crypto_KeyElementSet will be disabled. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + CryptoAlignKeyStorage + + Enable, to align each key inside the KeyStorage. The KeyStorage size will increase but the access will be faster. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + CryptoNvMEnableSetRamBlockStatus + + NvM Enable SetRamBlockStatus + + + Select if SetRamBlockStatus shall be called in KeyValidSet. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoRedirection + + Enable job input/output redirection to key elements. This is a Autosar 4.4 feature. Therefore a Csm and CryIf is required which also supports this feature + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + CryptoWatchdogTriggerFunction + + This function is called by the vSecPrim to trigger the watchdog. The vSecPrim watchdog level need to be set additional. +void "WatchdogTriggerFunction"(void) + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + Appl_WatchdogTriggerFunction + 1 + + + + + CryptoDefaultRandomMaxRetries + + Number of max retries for default random number generation. The calculation is reexecuted if the default random source is used from two driver objects at the same time. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 10 + 65535 + 1 + + + CryptoUserConfigFile + + Reference to an external user configuration file that will be included during generation. +The content of the user configuration file will be added at the end of the generated module configuration file and allows altering or extending the generated code. + +Caution: User configuration files can cause the software module to malfunction and must only be used with great care! + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + 1 + + + + + CryptoNumberOfLongTermPrimitiveWorkspace + + Determines the number of workspaces used for long term primitive execution. +See Technical Reference for more information including which primitives use this workspace, (for example Spake2+ and ECBD Key Exchange). + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 255 + 0 + + + CryptoStrictLengthCheckForKeyElementGet + + This option only affects key elements which have partial access enabled. + +Enabled: KeyElementGet does not allow partially reading key elements, only complete reads of key elements are allowed. +Disabled: KeyElementGet allows partially reading key elements depending on the available buffer size. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoEnableKeyLocking + + true: Enables the protection of keys while they are used. It is recommended for single-partition usecases. +If this should be used for multi-partition usecases, please check the technical references for the necessary adaptions. + +false: Disables the protection of keys while they are used. This is recommended to be set for multi-partition usecases. The user must ensure that key elements are only changed when they are not accessed (read or write) by any other user (different contexts or cores). +Please see the individual API definitions to check when a key element is changed. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoMultiPartitionRuntimeChecks + + If enabled, additional checks are performed to +- prevent the usage of driver objects by wrong partitions +- prevent the usage of SHE functionality by other partitions than the main partition +- prevent the initialization of the module by unknown partitions +- prevent the usage of default random source by unknown partitions. + +All partitions referenced in CryptoEcucPartitionRef are known to the module. + + + + + false + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + +
+ + + CryptoEcucPartitionRef + + Maps the Crypto driver to zero or multiple ECUC partitions to make the +modules API available in this partition. It must contain all partitions which will use the Crypto driver. + + + + + false + + + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /AUTOSAR/EcucDefs/EcuC/EcucPartitionCollection/EcucPartition + + + CryptoMainEcucPartitionRef + + Defines the main partition is responsible for the initialization of the shared data of the Crypto driver. +The main partition also is the only partition which can use SHE functionality and persist key elements. NvM has to be located on this partition if key element persisting should be used. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /AUTOSAR/EcucDefs/EcuC/EcucPartitionCollection/EcucPartition + + + + + CryptoKeyExchangePrimitives + + Configuration of a Crypto Key Exchange Primitive. If there is an algorithm configured, key exchange is usable via Crypto_KeyExchangeCalcPubVal and Crypto_KeyExchangeCalcSecret API. + + + + + false + false + + + + 1 + 1 + false + + + CryptoKeyExchangeAlgorithm + + Determines the algorithm used for the crypto key exchange. +The exact algorithm specification can be found in the technical reference of this component. +Disable to save ROM. + +Equivalent algorithms: +- SECp384r1 = NIST P-384 +- SECp521r1 = NIST P-521 + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + CRYPTO_KEY_EXCHANGE_ALGORITHM_X25519 + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_X25519 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_ANSIP256R1 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_SECP256R1 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_SECP384R1 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_NISTP224R1_BD + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_SECP521R1 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_X448 + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_P256R1_BD + Vector Informatik + + + CRYPTO_KEY_EXCHANGE_ALGORITHM_P224R1 + Vector Informatik + + + + + + + CryptoKeyDerivePrimitives + + If enabled, key derivation is usable via Crypto_KeyDerive API. + + + + + false + false + + + + 1 + 1 + false + + + CryptoKeyDeriveAlgorithm + + Determines the algorithm used for the crypto key derive. +The exact algorithm specification can be found in the technical reference of this component. +Disable to save ROM. + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + CRYPTO_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256 + + + CRYPTO_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB + Vector Informatik + + + CRYPTO_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING + Vector Informatik + + + CRYPTO_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_X963_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_PBKDF2_HMAC_SHA1 + Vector Informatik + + + CRYPTO_KDF_ALGO_PBKDF2_HMAC_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_X963_SHA512 + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_HMAC_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_SPAKE2_PLUS_P256R1 + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_OPTION1_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_HMAC_SHA384 + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_OPTION1_SHA512 + Vector Informatik + + + CRYPTO_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256 + Vector Informatik + + + CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384 + Vector Informatik + + + CRYPTO_KDF_ALGO_NIST_800_108_CTR_CMAC_AES + Vector Informatik + + + + + + + CryptoMacPrimitives + + Determines the algorithm used for the crypto mac jobs. + + + + + false + false + + + + 1 + 1 + false + + + CryptoCmacAesRoundkeyReuse + + The AES CMAC supports the reuse of calculated AES round keys. If this feature is enabled +the round keys are hold in the driver object. The round keys are hold until a different job type +is processed (not CMAC AES128 and CMAC AES256) or the corresponding key has changed. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + + + CryptoCipherPrimitives + + Determines the algorithm used for the crypto cipher jobs. + + + + + false + false + + + + 1 + 1 + false + + + CryptoEnableAES192 + + Enable AES 192 for driver objects with AES. Otherwise only AES 128 is available. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + CryptoEnableAES256 + + Enable AES 256 for driver objects with AES. Otherwise only AES 128 is available. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + + + CryptoKeyGeneratePrimitives + + If enabled, key generate is usable via Crypto_KeyGenerate API. + + + + + false + false + + + + 1 + 1 + false + + + CryptoKeyGenerateAlgorithm + + Determines the algorithm used for the crypto key generation. +Disable to save ROM. + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + CRYPTO_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC + + + CRYPTO_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC + Vector Informatik + + + CRYPTO_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1 + Vector Informatik + + + CRYPTO_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1 + Vector Informatik + + + CRYPTO_KEY_GENERATE_ALGORITHM_ED25519 + Vector Informatik + + + CRYPTO_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1 + Vector Informatik + + + CRYPTO_KEY_GENERATE_ALGORITHM_SM2P256V1 + Vector Informatik + + + + + CryptoKeyGenerateMaxLength + + Select the max key length in bytes.This parameter is only used for CRYPTO_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 32 + 65535 + 1 + + + + + CryptoConfigurableCallouts + + This container is used for the callouts to notify the application. +Activating the callouts costs runtime, so it is recommended to activate them only when needed. + + + + + false + false + + + + 1 + 1 + false + + + CryptoKeyValueChangedCalloutFctName + + This function is called by the LibCv to notify the application when a key value was changed. +This function is only available if the callout name is set, otherwise it is disabled. +It notifies which key element of the key was changed. +If the keys are set to their initial value, the callout will not occur. +The limitations are documented in the technical reference. + + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + Appl_KeyValueChangedCallout + 1 + + + + + CryptoKeyValiditySetCalloutFctName + + This function is called by the LibCv to notify the application when the validity of the key has changed. +This function is only available if the callout name is set, otherwise it is disabled. +The limitations are documented in the technical reference. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + Appl_KeyValiditySetCallout + 1 + + + + + + +
+ + CryptoKeyElements + + Container for CRYPTO key elements. + + + + + false + false + + + + 0 + 1 + false + + + CryptoKeyElement + + Configuration of a CryptoKeyElement + + + + + false + false + + + + 1 + true + false + + + CryptoKeyElementId + + Identifier of the CRYPTO key element + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + true + 1 + 4294967295 + 0 + + + CryptoKeyElementSize + + Maximum size of a CRYPTO key element in bytes + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + 16 + 4294967295 + 1 + + + CryptoKeyElementInitValue + + Value which will be used to fill the element during initialization, when the element is not already initialized. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + + + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + + + + + CryptoKeyElementReadAccess + + Define the reading access rights of the key element. +CRYPTO_RA_DENIED = key element cannot be read from outside the Crypto Driver +CRYPTO_RA INTERNAL_COPY = key element can be copied to another key element in the same crypto driver. +CRYPTO_RA_ALLOWED = key element can be read as plaintext +CRYPTO_RA_ENCRYPTED = key element can be read encrypted. E.g. SHE Ram-Key export. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + RA_ALLOWED + + + RA_ALLOWED + + + RA_DENIED + + + RA_ENCRYPTED + + + RA_INTERNAL_COPY + + + + + CryptoKeyElementAllowPartialAccess + + Enable or disable writing and reading the key element with data smaller than the size of the element. + +- True: enable partial access of the key element + +- False: disable partial access of the key element + + + +The partial access setting for writing applies to all APIs, while the partial access setting for reading is specifically used for the KeyElementGet() API. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + false + + + CryptoKeyElementPersist + + Enable or disable persisting of the key element in non-volatile storage. +- True: enable persisting of the key element. +- False: disable persisting of the key element. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + false + + + CryptoKeyElementWriteAccess + + Define the writing access rights of the key element +CRYPTO_WA_DENIED = key element cannot be written from outside the Crypto Driver +CRYPTO_WA INTERNAL_COPY = key element can be filled with another key element in the same crypto driver. +CRYPTO_WA_ALLOWED = key element can be rewritten as plaintext +CRYPTO_WA_ENCRYPTED = key element can be written encrypted. E.g. SHE load key. + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + WA_ALLOWED + + + WA_ALLOWED + + + WA_DENIED + + + WA_ENCRYPTED + + + WA_INTERNAL_COPY + + + + + CryptoKeyElementFormat + + Defines the format for the key element. This is the format used to provide or extract the key data from the driver. + +Parameter not used. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + CRYPTO_KE_FORMAT_BIN_OCTET + + + CRYPTO_KE_FORMAT_BIN_OCTET + AUTOSAR_ECUC + + + CRYPTO_KE_FORMAT_BIN_SHEKEYS + AUTOSAR_ECUC + + + CRYPTO_KE_FORMAT_BIN_IDENT_PRIVATEKEY_PKCS8 + AUTOSAR_ECUC + + + CRYPTO_KE_FORMAT_BIN_IDENT_PUBLICKEY + AUTOSAR_ECUC + + + CRYPTO_KE_FORMAT_BIN_RSA_PRIVATEKEY + AUTOSAR_ECUC + + + CRYPTO_KE_FORMAT_BIN_RSA_PUBLICKEY + AUTOSAR_ECUC + + + + + CryptoKeyElementWriteOnce + + Determine if a key shall only be writeable once. +- non-persist keys: Only once after start-up. +- persist keys: Only once for all time. +A init value does not affects this behavior. +If a init value shall not be overwritable use CRYPTO_WA_DENIED. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + + + + + CryptoKeyTypes + + Container for CRYPTO key types + + + + + false + false + + + + 0 + 1 + false + + + CryptoKeyType + + Configuration of a CryptoKeyType + + + + + false + false + + + + 1 + true + false + + + CryptoKeyElementRef + + Refers to a pointer in the CRYPTO Key Element, which holds the data of the crypto key element. + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + + + + + CryptoKeys + + Container for CRYPTO keys + + + + + false + false + + + + 0 + 1 + false + + + CryptoKey + + Configuration of a CryptoKey + + + + + false + false + + + + 1 + true + false + + + CryptoKeyId + + Identifier of the CRYPTO key + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + true + 0 + 4294967295 + 0 + + + CryptoKeyDeriveIterations + + Holds the number of iterations to be performed by the key derivation primitive. + +Parameter not used. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + 1 + 4294967295 + 1 + + + CryptoKeyNvId + + The CRYPTO_KEY_NV_ID is used to give a key a unique id for the complete lifecycle even if the CRYPTO_KEY_ID changed. The CRYPTO_KEY_NV_ID is used to identify a key within the Nv Block over several different configurations. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 65535 + 0 + + + + + CryptoKeyTypeRef + + Refers to a pointer in the CRYPTO to a CryptoKeyType. The CryptoKeyType provides the information which key elements are contained in a CryptoKey. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + + + + + CryptoPrimitives + + Container for CRYPTO primitives + + + + + false + false + + + + 0 + 1 + false + + + CryptoPrimitive + + Configuration of a CryptoPrimitive + + + + + false + false + + + + 0 + true + false + + + CryptoPrimitiveAlgorithmFamily + + Determines the algorithm family used for the crypto service. + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + CRYPTO_ALGOFAM_NOT_SET + + + CRYPTO_ALGOFAM_3DES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_AES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_1_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_1_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_2s_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_2s_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BRAINPOOL + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CHACHA + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CUSTOM + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CUSTOM_DRBG + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_FIPS186 + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_HKDF + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_ISO15118 + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_MD5 + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_X25519 + Vector Informatik + + + CRYPTO_ALGOFAM_DH + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_DRBG + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCANSI + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCNIST + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCSEC + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECDH + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECDSA + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECIES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ED25519 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_EEA3 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_EIA3 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_FIPS186 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_HKDF + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_KDFX963 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_NOT_SET + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_PADDING_PKCS7 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_PBKDF2 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_POLY1305 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RIPEMD160 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RNG + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RSA + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SECURECOUNTER + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA1 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_384 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_384 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHAKE128 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHAKE256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SIPHASH + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SM2 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SM3 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_X25519 + AUTOSAR_ECUC + + + + + CryptoPrimitiveAlgorithmMode + + Determines the algorithm mode used for the crypto service + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + CRYPTO_ALGOMODE_NOT_SET + + + CRYPTO_ALGOMODE_12ROUNDS + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_20ROUNDS + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_8ROUNDS + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CBC + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CFB + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CMAC + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CTR + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CTRDRBG + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CUSTOM + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CUSTOM_CCM + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_MODE_1 + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_P160R1 + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_P256R1 + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_P384R1 + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT + Vector Informatik + + + CRYPTO_ALGOMODE_CUSTOM_USE_DF + Vector Informatik + + + CRYPTO_ALGOMODE_ECB + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_GCM + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_GMAC + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_HMAC + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_NOT_SET + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_OFB + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_PXXXR + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_RSAES_OAEP + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_RSASSA_PSS + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_SIPHASH_2_4 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_SIPHASH_4_8 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_XTS + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CUSTOM_P224R1 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_CUSTOM_P521R1 + AUTOSAR_ECUC + + + CRYPTO_ALGOMODE_AESKEYWRAP + AUTOSAR_ECUC + + + + + CryptoPrimitiveService + + Determines the crypto service used for defining the capabilities + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + CRYPTO_MAC_VERIFY + + + CRYPTO_AEADDECRYPT + AUTOSAR_ECUC + + + CRYPTO_AEADENCRYPT + AUTOSAR_ECUC + + + CRYPTO_CERTIFICATE_PARSE + AUTOSAR_ECUC + + + CRYPTO_CERTIFICATE_VERIFY + AUTOSAR_ECUC + + + CRYPTO_DECRYPT + AUTOSAR_ECUC + + + CRYPTO_ENCRYPT + AUTOSAR_ECUC + + + CRYPTO_HASH + AUTOSAR_ECUC + + + CRYPTO_KEY_DERIVE + AUTOSAR_ECUC + + + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + AUTOSAR_ECUC + + + CRYPTO_KEY_EXCHANGE_CALC_SECRET + AUTOSAR_ECUC + + + CRYPTO_KEY_GENERATE + AUTOSAR_ECUC + + + CRYPTO_KEY_SET_VALID + AUTOSAR_ECUC + + + CRYPTO_MAC_GENERATE + AUTOSAR_ECUC + + + CRYPTO_MAC_VERIFY + AUTOSAR_ECUC + + + CRYPTO_RANDOM + AUTOSAR_ECUC + + + CRYPTO_RANDOM_SEED + AUTOSAR_ECUC + + + CRYPTO_SIGNATURE_GENERATE + AUTOSAR_ECUC + + + CRYPTO_SIGNATURE_VERIFY + AUTOSAR_ECUC + + + CRYPTO_KEYSETINVALID + AUTOSAR_ECUC + + + CRYPTO_KEYWRAP + AUTOSAR_ECUC + + + CRYPTO_KEYUNWRAP + AUTOSAR_ECUC + + + + + CryptoPrimitiveAlgorithmSecondaryFamily + + Determines the algorithm secondary family used for the crypto service. +See Technical Reference for cipher suites. + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + CRYPTO_ALGOFAM_NOT_SET + + + CRYPTO_ALGOFAM_3DES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_AES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_1_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_1_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_2s_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BLAKE_2s_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_BRAINPOOL + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CHACHA + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CUSTOM + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_CMD_GET_ID + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 + Vector Informatik + + + CRYPTO_ALGOFAM_CUSTOM_POLY_1305 + Vector Informatik + + + CRYPTO_ALGOFAM_DRBG + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCANSI + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCNIST + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECCSEC + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ECIES + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_ED25519 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_FIPS186 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_NOT_SET + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_PADDING_PKCS7 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_POLY1305 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RIPEMD160 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RNG + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_RSA + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SECURECOUNTER + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA1 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_384 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA2_512_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_224 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_384 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHA3_512 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHAKE128 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SHAKE256 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_SIPHASH + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_X25519 + AUTOSAR_ECUC + + + CRYPTO_ALGOFAM_CUSTOM_BD + AUTOSAR_ECUC + + + + + CryptoPrimitiveSupportContext + + Configures if the crypto primitive supports to store or restore context data of the workspace. Since this option is vulnerable to security, it shall only set to TRUE if absolutely needed. + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + false + false + + + + + CryptoPrimitiveAlgorithmFamilyCustomRef + + Reference to a customer specific algorithm family custom container + + + + + false + + + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + CryptoPrimitiveAlgorithmModeCustomRef + + Reference to a customer specific algorithm mode custom container + + + + + false + + + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + + Reference to a customer specific algorithm family custom container + + + + + false + + + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + + + CryptoPrimitiveAlgorithmFamilyCustom + + Container of custom algorithm family values. +The container name serves as a symbolic name for the identifier of the custom algorithm family type. + + + + + false + false + + + + 0 + true + false + + + CryptoPrimitiveAlgorithmFamilyCustomId + + The custom value of this algorithm family + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + true + 254 + 128 + + + + + CryptoPrimitiveAlgorithmModeCustom + + Container of custom algorithm mode values. +The container name serves as a symbolic name for the identifier of the custom algorithm mode type. + + + + + false + false + + + + 0 + true + false + + + CryptoPrimitiveAlgorithmModeCustomId + + The custom value of this algorithm mode + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + AUTOSAR_ECUC + false + true + 254 + 128 + + + + + + + CryptoSheKeyUpdate + + Container for She key update, +Present Container, the She key update with M1,M2 and M3 can be used for setting/updating a She key. +Remove Container to save ROM and Runtime. + + + + + false + false + + + + 0 + 1 + false + + + CryptoSheEnableFid + + Enable check of FID. +If the check is disabled all flags will be interpreted as 0 and the keys can be used for each service. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoSheEnableCounter + + Enable check of Counter. +If the feature is enabled ech she key requires a key element with the Id CRYPTO_KE_CUSTOM_SHE_COUNTER. Otherwise the key element can be exclude to reduce KeyStorage size. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + true + + + CryptoSheDebugCmd + + Enable She DEBUG_CMD. +If the check is enabled the DEBUG_CMD requires the CryptoSheInfoKeyRef. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + false + + + + + CryptoSheInfoKeyRef + + Reference to a key which holds information's for the she key update. +Information's are: +UID key element +Boot Protection control key element (Only required if CryptoSheEnableFid is enabled.) +Debugger Protection control key element (Only required if CryptoSheEnableFid is enabled.) + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoSheKeyRefSecretKey + + SECRET_KEY + + + Reference to a key which shall be used as SECRET_KEY She key. +The SECRET_KEY is mapped to She page 1 and She Id 0, + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoSheKeyRefMasterKey + + MASTER_ECU_KEY + + + Reference to a key which shall be used as MASTER_ECU_KEY She key. +The MASTER_ECU_KEY is mapped to She page 1 and She Id 1, + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoSheKeyRefBootMacKey + + BOOT_MAC_KEY + + + Reference to a key which shall be used as BOOT_MAC_KEY She key. +The BOOT_MAC_KEY is mapped to She page 1 and She Id 2, + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoSheKeyRefBootMac + + BOOT_MAC + + + Reference to a key which shall be used as BOOT_MAC She key. +The BOOT_MAC is mapped to She page 1 and She Id 3, + + 0 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + CryptoSheDebugCmdAdditionalKeys + + Reference a non-She key which shall be additionally be cleared by the She DEBUG_CMD. This key will be cleared additional to the She keys. + + 0 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + + + CryptoShePage + + Container for a She page. +A she page includes up to 11 She keys. +Key_1 - Key_10 and one RAM_Key. +The Encryption and Mac constants are defined for each page. +The SECRET_KEY, MASTER_ECU_KEY, BOOT_MAC_KEY and BOOT_MAC are mapped to page 1, + + + + + false + false + + + + 1 + 255 + false + + + CryptoShePageEncryptionConstant + + KEY_UPDATE_ENC_C + + + KEY_UPDATE_ENC_C +Page_1: 010153484500800000000000000000B0 h +Page_2: 018153484500800000000000000000B0 h +Page_N: Not Specified + +String may only consist concatenated hex values without leading 0x and any spaces. 32 Bytes are needed. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + 010153484500800000000000000000B0 + 32 + 32 + + + + + CryptoShePageMacConstant + + KEY_UPDATE_MAC_C + + + KEY_UPDATE_MAC_C +Page_1: 010253484500800000000000000000B0 h +Page_2: 018253484500800000000000000000B0 h +Page_N: Not Specified + +String may only consist concatenated hex values without leading 0x and any spaces. 32 Bytes are needed. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + 010253484500800000000000000000B0 + 32 + 32 + + + + + CryptoShePageId + + Id of the She Page. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + true + 1 + 255 + 1 + + + + + CryptoSheKey + + Container for a She key. +It is possible to configure Key_1 - Key_10 and Ram_Key for each page. +Key_1 = She Id 4 +... +Key_10 = She Id 13 +RAM_Key = She Id 14 + + + + + false + false + + + + 1 + 11 + false + + + CryptoSheKeyId + + Set the She key Id. +Key_1 = She Id 4 +... +Key_10 = She Id 13 +RAM_Key = She Id 14 + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 4 + 14 + 4 + + + + + CryptoSheKeyRef + + Reference a key which shall be used as She key. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + + + + + + + CryptoNvStorage + + Nv Storage + + + This container is used for the non-volatile storage of the key information + + + + + false + false + + + + 1 + 1 + false + + + CryptoNvManagementDataPerKey + + This parameter is for information purposes only and can not be changed. + +This Parameter shows how many additional bytes are needed per key element when it is stored in the NVRAM. + +e.g. 16 bytes AES key needs 20 bytes of data flash inside the NvRam if the management data is 4 bytes long. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 4 + 4 + 4 + + + CryptoNvWriteBlockFctName + + This function is called by the LibCv to write a Nv Block. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + + + NvM_WriteBlock + 1 + + + + + + + CryptoNvBlock + + A NvBlock describes the mapping of to be persisted keys and a NvM Decsriptor. + + + + + false + false + + + + 0 + true + false + + + CryptoNvBlockId + + Id of the NvBlock. This value has to be unique. + + + + + DEC + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + true + 0 + 4294967294 + 0 + + + CryptoNvBlockLength + + Size of the NvBlock that is actually used by CRYPTO. The referenced NvBlock shall have at least this size. + + + + + BYTE + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 4294967295 + 0 + + + CryptoNvBlockFillLevel + + Number of used bytes inside the Nv Block. +This value is for information only. + + + + + BYTE + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 4294967295 + 0 + + + CryptoNvBlockProcessing + + Set the block processing type. +DEFERRED: write block will not be triggered by the crypto.The block can be written manually and is written on shutdown. +IMMEDIATE: write block will be triggered by the crypto with validation of the key.This cannot be used if key locking is disabled. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + NV_PROCESSING_DEFERRED + + + NV_PROCESSING_IMMEDIATE + Vector Informatik + + + NV_PROCESSING_DEFERRED + Vector Informatik + + + + + CryptoNvBlockConsistencyLevel + + Select the storage kind. +NONE: none (deprecated) +DETECT: CRC layout checksum, checks if the key storage layout has changed. If the layout has change the initial data is restored. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + NV_CONSISTENCY_LEVEL_DETECT + + + NV_CONSISTENCY_LEVEL_NONE + Vector Informatik + + + NV_CONSISTENCY_LEVEL_DETECT + Vector Informatik + + + + + CryptoNvBlockRevision + + Revision of the NvBlock. + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 4294967295 + 0 + + + CryptoNvBlockCrcLayoutChecksum + + CRC checksum over the NvBlock layout. + +CRC Calculation is influenced by: +- CRYPTO_ALIGN_KEY_STORAGE +- CRYPTO_NV_MANAGEMENT_DATA_PER_KEY + - For each Block + - CRYPTO_NV_BLOCK_REVISION + - For each Key within the Block + - CRYPTO_KEY_NV_ID + - For each KeyElement within the Key + - CRYPTO_KEY_ELEMENT_ID + - CRYPTO_KEY_ELEMENT_SIZE + + + + + HEX + + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + false + 0 + 4294967294 + 0 + + + + + CryptoNvBlockDescriptor + + NvM Block which will be used for this CryptoNvBlock. + + + 1 + 1 + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /AUTOSAR/EcucDefs/NvM/NvMBlockDescriptor + + + CryptoNvBlockKeyRef + + Reference to the key which will be stored inside this NvBlock + + 1 + true + + + PRE-COMPILE + VARIANT-PRE-COMPILE + + + Vector Informatik + false + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + + + +
+
+ + Crypto_Pre + + Software Crypto Driver pre-configuration + + /MICROSAR/Crypto_30_LibCv/Crypto + + + CryptoPrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives + + + AesGCMEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesGCMDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_PKCS7 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_PaddingPKCS7 + + + + + AesDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_PKCS7 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_PaddingPKCS7 + + + + + SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + + + SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + AesCmacGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesCmacVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + RngFips186Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_FIPS186 + + + + + EcDsaEd25519Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + EcDsaEd25519Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + SipHashGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SIPHASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_SIPHASH_2_4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SipHashVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SIPHASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_SIPHASH_2_4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RsaPkcs1Sha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPkcs1Sha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPkcs1Sha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPkcs1Sha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPssSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPssSha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPssSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPssSha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPkcs1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RsaPkcs1Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccNistP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HmacSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + HmacSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + EccNistP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + RngFips186 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RNG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RngDrbgAes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_DRBG + + + + + RngDrbgAes128Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + RsaPkcs1CrtSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + + + + + RsaPkcs1CrtSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + + + + + EccNistP384R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + + + EccSecP384R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + + + EccNistP384R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + RsaOaepSha1Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + + + RsaOaepSha1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + + + RsaOaepSha256Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + + + RsaOaepSha256Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + + + RsaOaepCrtSha1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_RSAES_OAEP_CRT + + + + + RsaOaepCrtSha256Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_RSAES_OAEP_CRT + + + + + EccNistP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP384R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + EccNistP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP384R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + GmacAesGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + GmacAesVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + HmacSha384Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha384Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + KeySetValid + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_SET_VALID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDeriveX963SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_KDFX963 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyExchangeCalcPubValX25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_X25519 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_X25519 + + + + + KeyExchangeCalcSecretX25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_X25519 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_X25519 + + + + + KeyExchangeCalcPubValSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcSecretSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcPubValAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcSecretNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + RandomSeedRngFips186Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RandomSeedRngDrbgAes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RandomSeedRngDrbgAes128Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + KeyDeriveIso15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ISO15118 + + + + + KeyDeriveSymNist800108CntModeSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveAsymNistFips1864Erb + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveNist80056AOnePassSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateSymmetricGeneric + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyGenerateSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyGenerateNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyGenerateAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HmacRipemd160Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + HmacRipemd160Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccSecP160R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P160R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + + + EccSecP160R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P160R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + + + HashRipemd160 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDerivePbkdf2HmacSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + KeyDerivePbkdf2HmacSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveX963SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_KDFX963 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + AeadChaCha20Poly1305Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_20ROUNDS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CHACHA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_POLY_1305 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_POLY1305 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_POLY1305 + + + + + AeadChaCha20Poly1305Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_20ROUNDS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CHACHA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_POLY_1305 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_POLY1305 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_POLY1305 + + + + + RngHashDrbgSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + RandomSeedRngHashDrbgSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + SHA3_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RngDrbgAes256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RngDrbgAes256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + RandomSeedRngDrbgAes256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RandomSeedRngDrbgAes256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + SheCmdGetId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CMD_GET_ID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_CmdGetId + + + + + AesCCMEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_CCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_CCM + + + + + AesCCMDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_CCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_CCM + + + + + KeyDeriveHkdfHmacSHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + KeyExchangeCalcPubValSpake2PlusCipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_MODE_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_CipherSuite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_Mode1 + + + + + KeyExchangeCalcSecretSpake2PlusCipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_MODE_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_CipherSuite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_Mode1 + + + + + KeyDeriveSpake2PlusP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HashMD5 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_MD5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_MD5 + + + + + KeyGenerateEd25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + Crypto_30_LibCv_PaddingPKCS7 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_FIPS186 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_ECCANSI + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_ECCSEC + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_DRBG + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_ISO15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_POLY1305 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_CmdGetId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_HKDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_SPAKE2PLUS + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_CipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_MD5 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_CCM + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_Mode1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_P160r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_P256r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_P384r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_RSAES_OAEP_CRT + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_UseDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + KeyExchangeCalcPubValNistP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyExchangeCalcSecretNistP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + Crypto_30_LibCv_P224r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + KeyDeriveHkdfOption1SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + EccSecP521R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + Crypto_30_LibCv_P521r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + EccSecP521R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcSecretSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcPubValSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + SHA3_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_224 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHA3_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHA3_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHAKE128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHAKE128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHAKE256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHAKE256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccNistP521R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + EccNistP521R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcSecretNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcPubValNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyDeriveHkdfHmacSHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + KeyDeriveHkdfOption1SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + KeyDeriveIso15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ISO15118_20 + + + + + Crypto_30_LibCv_ISO15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + KeyExchangeCalcPubValX448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_X448 + + + + + KeyExchangeCalcSecretX448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_X448 + + + + + Crypto_30_LibCv_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_ED448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_EdDsaEd448Pure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_EdDsaEd448Ph + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_EdDsaEd25519Pure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_EdDsaEd25519Ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_EdDsaEd25519Ph + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + EdDsaEd448PhGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Ph + + + + + EdDsaEd448PhVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Ph + + + + + EdDsaEd25519PureVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Pure + + + + + EdDsaEd25519PhVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ph + + + + + EdDsaEd25519CtxVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ctx + + + + + EdDsaEd25519PhGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ph + + + + + EdDsaEd25519CtxGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ctx + + + + + EdDsaEd25519PureGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Pure + + + + + EdDsaEd448PureGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Pure + + + + + EdDsaEd448PureVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Pure + + + + + HmacSha512Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha512Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + Crypto_30_LibCv_HKDF_Expand + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + KeyDeriveHkdfExpandHmacSHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_HKDF_Expand + + + + + KeyDeriveHkdfExpandHmacSHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_HKDF_Expand + + + + + Crypto_30_LibCv_IsPrivateKeyOnCurve + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_IsPublicKeyOnCurve + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + IsKeyOnCurveP160R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveEd25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveEd448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + KeyExchangeCalcPubValP256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyExchangeCalcSecretP256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyGenerateSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyGenerateNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + SlhDsaSha2_128sVerifyPure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + Crypto_30_LibCv_SLH_DSA + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Crypto_30_LibCv_SHA2_128S + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + Crypto_30_LibCv_SM4 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + Sm4Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SM4 + + + + + Sm4Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SM4 + + + + + Sm3 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM3 + + + + + Sm2Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + Sm2Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + Crypto_30_LibCv_Sm2P256v1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + KeyGenerate_SM2_Sm2P256V1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + RsaPssSha384Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + RsaPssSha384Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + KeySetInvalid + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYSETINVALID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDeriveNist800108CtrModeCmacAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_NIST800108 + + + + + Crypto_30_LibCv_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + SHA512_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512_224 + + + + + SHA512_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512_256 + + + + + SHA224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_224 + + + + + SlhDsaSha2_128sVerifyPhSha2_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_512 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhShake128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE128 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhShake256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + KeyWrapAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_AESKEYWRAP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYWRAP + + + + + KeyUnwrapAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_AESKEYWRAP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYUNWRAP + + + + + KeyExchangeCalcPubValP224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + + + KeyExchangeCalcSecretValP224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + + + + + CryptoKeyTypes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes + + + Cipher + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + + + KeyExchange_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Seed + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + + + Signature + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + + + Mac + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Key + + + + + KeyDerive + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerive_Algorithm + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + + + Random_Fips186_Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Fips186_Sha1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed + + + + + Hash + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Hash_Result + + + + + Signature_Rsa_Pkcs1_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Signature_Rsa_Pkcs1_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Signature_Rsa_Pss_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_SaltLength + + + + + Signature_Rsa_Pss_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Salt + + + + + Signature_Rsa_Pss_Verify_AutoSalt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + KeyExchange_ANSIP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_ANSIP256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyDerive_NIST80056A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_NIST80056A + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_ISO15118_ProvCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + + + KeyDerive_SYM_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_SYM_NIST800108 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + + + KeyDerive_ASM_NISTFIPS1864 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ASM_NISTFIPS1864 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + + + KeyDerive_ISO15118_ContrCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_PubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + + + + + CipherWithoutIv + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key + + + + + CipherShe + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key_She + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Proof + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_She_Counter + + + + + MacShe + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Key_She + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Proof + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_She_Counter + + + + + Random_Nist_800_90A_DRBG_AES_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + Random_Nist_800_90A_DRBG_AES_NoDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + + + Signature_RsaCrt_Pkcs1_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + + + KeyExchange_SECP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + SheInfoKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_She_UId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_She_BootProtection + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_She_DebuggerProtection + + + + + Cipher_Rsa_Oaep_Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Cipher_Rsa_Oaep_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Cipher_RsaCrt_Oaep_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + + + Cipher_Rsa_Pkcs1_Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Cipher_Rsa_Pkcs1_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Cipher_Rsa_Oaep_Encrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + Cipher_Rsa_Oaep_Decrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + Cipher_RsaCrt_Oaep_Decrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + KeyExchange_SECP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + Cipher_Rsa_Pkcs1_Decrypt_Pub + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + KeyDerive_KDF_X963_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA256 + + + + + CipherSheRam + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key_She_Ram + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_Proof + + + + + MacSheRam + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Key_She_Ram + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Proof + + + + + MacGmac + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Mac_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + + + KeyGenerate_Symmetric_Generic + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Symmetric_Generic + + + + + KeyGenerate_Ansi_Nist_Sec_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Ansi_Nist_Sec_P256R1 + + + + + KeyGenerate_Nist_Sec_P384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P384R1 + + + + + KeyDerive_PBKDF2_HMAC_SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA1 + + + + + KeyDerive_PBKDF2_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA256 + + + + + KeyDerive_KDF_X963_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA512 + + + + + AEAD_ChaCha20_Poly1305 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Aead_ChaCha_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Aead_ChaCha_Nonce + + + + + Random_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_HASH_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_HASH_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + Random_Nist_800_90A_DRBG_AES256_NoDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + + + Random_Nist_800_90A_DRBG_AES256_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256Df + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + KeyDerive_HKDF_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_Spake2Plus_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_Spake2Plus_P256R1 + + + + + KeyExchange_Spake2Plus_A_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_B_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_L + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_A_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_B_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_L + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyGenerate_ED25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Ed25519 + + + + + KeyExchange_NISTP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_NISTP224R1_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_NumEcu + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_EcuId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Intermediate + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + + + + + KeyDerive_Hkdf_Option1_Sha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA256 + + + + + KeyExchange_SECP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyDerive_HKDF_HMAC_SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_Hkdf_Option1_Sha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA512 + + + + + KeyDerive_ISO15118_20_ProvCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + + + KeyDerive_ISO15118_20_ContrCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_PubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_AAD + + + + + KeyExchange_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_X448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + Signature_EcDsa_SECp160r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp160r1_public + + + + + Signature_EcDsa_SECp256r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp256r1_public + + + + + Signature_EcDsa_SECp384r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp384r1_public + + + + + Signature_EcDsa_SECp521r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp521r1_public + + + + + Signature_EdDsa_Ed25519_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + + + + + Signature_EcDsa_SECp160r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp160r1_private + + + + + Signature_EcDsa_SECp256r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp256r1_private + + + + + Signature_EcDsa_SECp384r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp384r1_private + + + + + Signature_EcDsa_SECp521r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp521r1_private + + + + + Signature_EdDsa_Ed25519_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + + + + + Signature_EdDsa_Ed448_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_public + + + + + Signature_EdDsa_Ed448_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_private + + + + + Signature_EdDsa_Ed448_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed448_private_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed25519_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed25519_private_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + KeyExchange_P256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_P256R1_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_NumEcu + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_EcuId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Intermediate + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + + + + + KeyGenerate_Nist_Sec_P521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P521R1 + + + + + Signature_SlhDsaSha2_128s_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + + + + + Signature_Sm2_P256Sm2_Generate_withoutID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + + + + + Signature_Sm2_P256Sm2_Verify_withoutID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + + + + + Signature_Sm2_P256Sm2_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_ID + + + + + Signature_Sm2_P256Sm2_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_ID + + + + + KeyGenerate_Sm2P256V1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Sm2P256v1 + + + + + KeyDerive_NIST800108_CTR_CMAC_AES + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_NIST800108_CTR_CMAC_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Context + + + + + KeyDerive_NIST800108_CTR + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Context + + + + + Signature_SlhDsaSha2_128s_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_SlhDsa_Context + + + + + KeyWrap_Aes_PlaintextKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyWrap_Aes_PlaintextKey + + + + + KeyWrap_Aes_Kek + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyWrap_Aes_Kek + + + + + KeyExchange_P224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /MICROSAR/Crypto_30_LibCv/Crypto_Pre/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + + + CryptoGeneral + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral + + + CryptoKeyElements + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements + + + Crypto_30_LibCv_Signature_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_Random_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + + + Crypto_30_LibCv_KeyGenerate_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 16 + + + + + Crypto_30_LibCv_KeyGenerate_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_KeyExchange_SharedValue + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_KeyExchange_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 9 + + + + + Crypto_30_LibCv_Mac_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_KeyDerivation_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 13 + + + + + Crypto_30_LibCv_KeyExchange_OwnPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 10 + + + + + Crypto_30_LibCv_KeyExchange_Base + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 8 + + + + + Crypto_30_LibCv_KeyDerivation_Password + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_Cipher_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_Cipher_IV + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 5 + + + + + Crypto_30_LibCv_Cipher_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 6 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_Mac_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_Hash_Result + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_KeyDerive_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Random_Algorithm_Fips186_Sha1 + + 4 + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 130 + + + + + Crypto_30_LibCv_Rsa_Modulus + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 160 + + + + + Crypto_30_LibCv_Rsa_Pub_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 161 + + + + + Crypto_30_LibCv_Rsa_Priv_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 162 + + + + + Crypto_30_LibCv_Rsa_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 163 + + + + + Crypto_30_LibCv_Rsa_SaltLength + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 164 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 2 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_ANSIP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_PartnerPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3003 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_NIST80056A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x03 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x04 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_SYM_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ASM_NISTFIPS1864 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x02 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_AdditionalInfo + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 131 + + + + + Crypto_30_LibCv_SCC_Contract_PubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3013 + + + + + Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3014 + + + + + Crypto_30_LibCv_Random_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + + + Crypto_30_LibCv_Random_AdditionalInput + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3016 + + + + + Crypto_30_LibCv_Random_PrivateString + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3015 + + + + + Crypto_30_LibCv_Random_Nonce + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3017 + + + + + Crypto_30_LibCv_Random_Reseed_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3018 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 0 0 1 + + + + + Crypto_30_LibCv_Rsa_PrimeP + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3051 + + + + + Crypto_30_LibCv_Rsa_PrimeQ + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3052 + + + + + Crypto_30_LibCv_Rsa_ExponentDp + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3053 + + + + + Crypto_30_LibCv_Rsa_ExponentDq + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3054 + + + + + Crypto_30_LibCv_Rsa_InverseQi + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3055 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x02 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Mac_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_Cipher_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_She_UId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3021 + + + + + Crypto_30_LibCv_She_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3019 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_DENIED + + + + + Crypto_30_LibCv_She_BootProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3056 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_She_DebuggerProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3057 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3058 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x04 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x06 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Mac_Key_She_Ram + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + + + Crypto_30_LibCv_Cipher_Key_She_Ram + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + + + Crypto_30_LibCv_Cipher_2NDKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 7 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Symmetric_Generic + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Ansi_Nist_Sec_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 14 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x09 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0A + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x07 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Aead_ChaCha_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Aead_ChaCha_Nonce + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 12 + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 2 + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 222 + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 4 + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0B + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 14 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_Spake2Plus_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0C + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 6 + + + + + Crypto_30_LibCv_W0 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3084 + + + + + Crypto_30_LibCv_W1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3085 + + + + + Crypto_30_LibCv_L + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3086 + + + + + Crypto_30_LibCv_Verification_Result + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3088 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_AdditionalInfo + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 131 + + + + + Crypto_30_LibCv_Verification + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3087 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Ed25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + + + Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3004 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_NISTP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_EcuId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3007 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_NumEcu + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3006 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_Intermediate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3005 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0D + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x07 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0E + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0F + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_SCC_Contract_AAD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3060 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x08 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp160r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 40 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp256r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp384r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 96 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp521r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp160r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp256r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp384r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp521r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 66 + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed448_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 57 + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed448_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 57 + + + + + Crypto_30_LibCv_EdDsa_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3061 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_P256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 9 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + + + Crypto_30_LibCv_Signature_Sm2_ID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3092 + + + + + Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3093 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Sm2P256v1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_NIST800108_CTR_CMAC_AES + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 8 + + + + + Crypto_30_LibCv_KeyDerivation_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3061 + + + + + Crypto_30_LibCv_SlhDsa_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3062 + + + + + Crypto_30_LibCv_KeyWrap_Aes_PlaintextKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_KeyWrap_Aes_Kek + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_P224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + + + + + CryptoNvStorage + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage/CryptoNvManagementDataPerKey + 4 + + + + + + + Crypto_Rec + + Software Crypto Driver rec-configuration + + /MICROSAR/Crypto_30_LibCv/Crypto + + + CryptoKeyElements + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements + + + Crypto_30_LibCv_Signature_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Random_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + + + Crypto_30_LibCv_KeyGenerate_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_KeyGenerate_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_KeyExchange_SharedValue + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_KeyExchange_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Mac_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_KeyDerivation_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_KeyExchange_OwnPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + + + Crypto_30_LibCv_KeyExchange_Base + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_KeyDerivation_Password + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 1 + + + + + Crypto_30_LibCv_Cipher_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_Cipher_IV + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_Cipher_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + + + Crypto_30_LibCv_Mac_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + + + Crypto_30_LibCv_Hash_Result + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + + + Crypto_30_LibCv_KeyDerive_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyGenerate_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyExchange_Algorithm_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_Algorithm_Fips186_Sha1 + + 4 + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_Modulus + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 256 + + + + + Crypto_30_LibCv_Rsa_Pub_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 3 + + + + + Crypto_30_LibCv_Rsa_Priv_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 256 + + + + + Crypto_30_LibCv_Rsa_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Rsa_SaltLength + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyExchange_Algorithm_ANSIP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyExchange_PartnerPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_NIST80056A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyDerivation_Algorithm_SYM_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ASM_NISTFIPS1864 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyDerivation_AdditionalInfo + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 5 + + + + + Crypto_30_LibCv_SCC_Contract_PubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 1 + + + + + Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 1 + + + + + Crypto_30_LibCv_Random_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_AdditionalInput + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + + + Crypto_30_LibCv_Random_Nonce + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_PrivateString + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_Reseed_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_PrimeP + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_PrimeQ + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_ExponentDp + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_ExponentDq + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Rsa_InverseQi + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_Mac_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + + + Crypto_30_LibCv_Cipher_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + + + Crypto_30_LibCv_She_UId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + Crypto_30_LibCv_She_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 0 0 0 + + + + + Crypto_30_LibCv_She_BootProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + + + Crypto_30_LibCv_She_DebuggerProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + + + Crypto_30_LibCv_SCC_Contract_AAD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 34 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + 1 + + + + + Crypto_30_LibCv_KeyDerivation_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + + + + + CryptoKeyTypes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes + + + CryptoDriverObjects + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects + + + Crypto_30_LibCv + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectQueueSize + 1 + + + + + + + CryptoGeneral + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoUseVStdLib + 1 + + + + + +
+
+
+
+
+
\ No newline at end of file diff --git a/Source/bsw/Crypto_30_LibCv/ChangeHistory.txt b/Source/bsw/Crypto_30_LibCv/ChangeHistory.txt new file mode 100644 index 0000000..eeeed02 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/ChangeHistory.txt @@ -0,0 +1,77 @@ +/********************************************************************************************************************** + * REVISION HISTORY + * + * This file contains the revision history of the component implementation and all related artifacts. + * The revision history covers all released version of the component. If you have received a development version of + * this component, the changes made in the development version are not referenced herein. + * + * Legend of Columns: + * + * I - Implementation + * G - Generator + * D - Documentation & Technical Reference + * T - Test Implementation + * S - Specification + * B - Build-Artifacts + * + * Legend of Cells: + * + * X - Artifact is affected by the change. + * - - Artifact is not affected by the change. + * + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author I G D T S B Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * main-1 2024-04-24 c6oechsler X X X X X X CRY-462 Component Migration + * main-2 2024-05-06 group_433_bot_8918be7e278d67622ccce09cfb7f4951 - - - - - - CIA-488 Renovate Update config/common digest to fdda146 + * main-2 2024-05-15 c6oechsler X - - X X - ESCAN00117308 Fix ESCAN00117308 + * main-3 2024-05-16 c6oechsler - - - X - - ESCAN00117308 Fix merge pipeline subsequently + * 14.01.00 - - - - - - - - - SemVer release 14.01.00 based on main-3 + * main-4 2024-05-21 c6oechsler X X X X - - ESCAN00117308 Fix implementation descriptor + * 14.01.01 - - - - - - - - - SemVer release 14.01.01 based on main-4 + * main-5 2024-05-22 c6oechsler X X X X - - CRY-900 Correct implementation descriptor + * main-6 2024-05-23 c6oechsler - - - X - - CRY-902 Change memmap descriptor + * 14.01.02 - - - - - - - - - SemVer release 14.01.02 based on main-6 + * main-7 2024-07-04 c6oechsler X X X X - - ESCAN00117427 Add maximum size of 'Other information' to TechRef + * main-8 2024-07-04 c6oechsler X X X X X - CRY-827 SafetyAnalysis AES CMAC Generation + * main-9 2024-07-09 c6oechsler X - X X X - CRY-829 SafetyAnalysis AES CMAC Verification + * 14.02.00 - - - - - - - - - SemVer release 14.02.00 based on main-9 + * main-10 2024-07-26 coechsler X X X X X - CRY-953 Unify usage of NvMBlockLength + * main-10 2024-08-15 lmangold X X X X X - CRY-892 Support RSA PSS SHA384 Signature Generation and Verification + * main-11 2024-08-21 vismwe X X X X X - CRY-957 Support KeyGetStatus + * main-12 2024-08-29 coechsler X X X X X - CRY-955 Support KeySetInvalid + * 14.03.00 - - - - - - - - - SemVer release 14.03.00 based on main-12 + * main-13 2024-09-11 coechsler X - - X - - ESCAN00118169 Compiler warning due to conversion from uint8_least to uint32 + * main-14 2024-09-16 coechsler X X X X - - CRY-825 Key Id equality check in KeyCopy() + * main-14 2024-09-24 lmangold - - - - X - CRY-823 Analyze R22-11 documents for LibCv + * main-14 2024-09-26 lmangold - - - - X - CRY-850 Analyze R23-11 documents for LibCv + * main-14 2024-10-21 coechsler - - X X X - CRY-1145 Improve internal Safety Analysis Documentation + * main-14 2024-10-30 coechsler X X X X X - CRY-1090 Support NIST SP 800-108 CTR Mode with CMAC AES + * 14.04.00 - - - - - - - - - SemVer release 14.04.00 based on main-14 + * main-15 2024-11-08 viskju X X X X X - CRY-1231 Support SHA512-224 and SHA512-256 + * 14.05.00 - - - - - - - - - SemVer release 14.05.00 based on main-15 + * main-16 2024-11-15 lmangold X X X X X - CRY-1109 Support AES256 CCM + * 14.06.00 - - - - - - - - - SemVer release 14.06.00 based on main-16 + * main-17 2024-11-29 coechsler X - - - - - ESCAN00118414 Compiler Error: Syntax error in Crypto_30_LibCv_KeyDerive.c + * main-17 2024-11-29 coechsler X X X X - - ESCAN00118765 Incorrect parameter description in KeyElementGet()-API + * main-18 2024-12-06 coechsler - - X - X - ESCAN00118833 Add CMI for AEAD decrypted data + * main-19 2024-12-13 lmangold X X X X X - CRY-1101 Support SLHDSA with pure and prehash + * 14.07.00 - - - - - - - - - SemVer release 14.07.00 based on main-19 + * main-20 2025-01-08 coechsler X X X X X - CRY-1360 Update internal infrastructure: Switch to esf-config + * main-21 2025-03-04 lmangold X X X X X - CRY-1184 AES Key Wrap + * main-22 2025-03-06 coechsler X - X X X - CRY-430 Support Process Signature Input in Finish Mode + * 14.08.00 - - - - - - - - - SemVer release 14.08.00 based on main-22 + * main-23 2025-04-08 lmangold X X - X - X ESCAN00119740 KeyUnwrapAes.c and KeyWrapAes.c are missing in Crypto_30_LibCv_rules.mak + * 14.08.01 - - - - - - - - - SemVer release 14.08.01 based on main-23 + * 14.xx.xx-0 2025-05-26 vismwe X X - X - - ESCAN00118376 Add validation and configuration hint + * 14.xx.xx-0 2025-05-26 vismwe X X - X - - ESCAN00117783 Compiler error: unresolved external symbol for RandomSeed functions + * 14.08.02 - - - - - - - - - SemVer release 14.08.02 based on 14.xx.xx-0 + * 14.xx.xx-1 2025-06-16 coechsler X X X X X - CRY-1599 Support ECDH P-224 (CFG5) + * 14.09.00 - - - - - - - - - SemVer release 14.09.00 based on 14.xx.xx-1 + * 14.xx.xx-2 2025-08-13 coechsler X X - X X - ESCAN00120258 Compiler error: vSecPrim_initVerifySLHDSA function declared implicitly (branch-14.xx.xx) + * 14.xx.xx-2 2025-08-14 coechsler X X - X X - ESCAN00120735 Out-of-bound access when using KeyGenerate P256R1 (branch-14.xx.xx) + * 14.09.02 - - - - - - - - - SemVer release 14.09.02 based on 14.xx.xx-2 + * 14.xx.xx-3 2025-08-15 coechsler X X - X X - ESCAN00120484 Out-of-bound memory access if configuration parameter CryptoKeyElementVirtualTargetRef is set (fix on branch-14.xx.xx) + * 14.xx.xx-4 2025-08-18 lmangold X X - - - - ESCAN00120928 Diffie-Hellman key exchange P224R1 is missing in pre-configured primitives + * 14.09.04 - - - - - - - - - SemVer release 14.09.04 based on 14.xx.xx-4 + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Documentation/TechnicalReference_Crypto_30_LibCv.pdf b/Source/bsw/Crypto_30_LibCv/Documentation/TechnicalReference_Crypto_30_LibCv.pdf new file mode 100644 index 0000000..b1d8e59 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Documentation/TechnicalReference_Crypto_30_LibCv.pdf @@ -0,0 +1,5174 @@ +MICROSAR Classic Crypto_30_LibCv + +Technical Reference + +Version 14.09.04 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Contents + +1 Introduction 7 + +1.1 Architecture Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 + +2 Functional Description 8 + +2.1 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 + +2.1.1 Supported Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 + +2.1.2 Algorithm specific . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 + + 2.1.2.1 AEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 + + 2.1.2.2 Cipher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 + + 2.1.2.3 MAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 + + 2.1.2.4 PRNG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 + + 2.1.2.5 Signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 + + 2.1.2.6 Key Derivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 + + 2.1.2.7 Key Exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 + + 2.1.2.8 Key Generate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 + + 2.1.2.9 Key Wrap and Key Unwrap . . . . . . . . . . . . . . . . . . . . . . . 38 + +2.1.3 Crypto Job Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 + + 2.1.3.1 Required Job Input/Output Data . . . . . . . . . . . . . . . . . . . . 40 + + 2.1.3.2 Driver Objects and Jobs . . . . . . . . . . . . . . . . . . . . . . . . 43 + + 2.1.3.3 Save and Restore Context . . . . . . . . . . . . . . . . . . . . . . . 43 + + 2.1.3.4 Long-Term Workspace . . . . . . . . . . . . . . . . . . . . . . . . . 45 + + 2.1.3.5 Verification Jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 + +2.1.4 Elliptic Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 + +2.1.5 Secure Hardware Extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 + + 2.1.5.1 Key Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 + + 2.1.5.2 Load SHE Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 + + 2.1.5.3 Load SHE Plain Key . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 + + 2.1.5.4 Export SHE RAM Key . . . . . . . . . . . . . . . . . . . . . . . . . . 50 + + 2.1.5.5 SHE DEBUG_CMD . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 + + 2.1.5.6 SHE CMD_GET_ID . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 + + 2.1.5.7 SHE Preconditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 + + 2.1.5.8 SHE Error Code Mapping . . . . . . . . . . . . . . . . . . . . . . . . 52 + +2.1.6 Key Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 + + 2.1.6.1 Key Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 + + 2.1.6.2 Custom Key Elements . . . . . . . . . . . . . . . . . . . . . . . . . . 53 + + 2.1.6.3 Key Element Access Rights . . . . . . . . . . . . . . . . . . . . . . 54 + + 2.1.6.4 Write Once Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 + +© 2025 Vector Informatik GmbH Version 14.09.04 2 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + 2.1.6.5 Key Locking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 + 2.1.6.6 Pre-Configured Key Types . . . . . . . . . . . . . . . . . . . . . . . 58 + 2.1.6.7 Key Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 + 2.1.6.8 Key Element Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 + 2.1.6.9 Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 + 2.1.7 Memory Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 + 2.1.7.1 NvM Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 + 2.1.7.2 vStdLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 + 2.1.8 Multi-Partition Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 + 2.1.8.1 Memory Init for Multi-Partition . . . . . . . . . . . . . . . . . . . . . 64 +2.2 Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 + 2.2.1 Production Code Error Reporting . . . . . . . . . . . . . . . . . . . . . . . . . 65 +2.3 Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 + +3 Integration 66 + +3.1 Embedded Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 + +3.2 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 + +3.3 Main Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 + +3.4 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 + +3.4.1 Critical Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 + +3.5 Memory Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 + +3.5.1 Memory Section Group Constant . . . . . . . . . . . . . . . . . . . . . . . . . 69 + +3.5.2 Memory Section Group Shared . . . . . . . . . . . . . . . . . . . . . . . . . . 69 + +3.5.3 Memory Section Group PartitionLocal . . . . . . . . . . . . . . . . . . . . . . 69 + +3.6 Callouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 + +3.7 Best Practice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 + +3.7.1 Bottom to Top . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 + +3.7.2 Linker Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 + +4 API Description 71 + +4.1 Provided Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 + +4.1.1 Crypto_30_LibCv_InitMemory . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 + +4.1.2 Crypto_30_LibCv_Init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 + +4.1.3 Crypto_30_LibCv_MainFunction . . . . . . . . . . . . . . . . . . . . . . . . . 72 + +4.1.4 Crypto_30_LibCv_GetVersionInfo . . . . . . . . . . . . . . . . . . . . . . . . . 72 + +4.1.5 Crypto_30_LibCv_ProcessJob . . . . . . . . . . . . . . . . . . . . . . . . . . 72 + +4.1.6 Crypto_30_LibCv_CancelJob . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 + +4.1.7 Crypto_30_LibCv_KeyCopy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 + +4.1.8 Crypto_30_LibCv_KeyElementCopy . . . . . . . . . . . . . . . . . . . . . . . 75 + +© 2025 Vector Informatik GmbH Version 14.09.04 3 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + 4.1.9 Crypto_30_LibCv_KeyElementCopyPartial . . . . . . . . . . . . . . . . . . . . 75 + 4.1.10 Crypto_30_LibCv_KeyElementIdsGet . . . . . . . . . . . . . . . . . . . . . . 76 + 4.1.11 Crypto_30_LibCv_KeyElementSet . . . . . . . . . . . . . . . . . . . . . . . . 77 + 4.1.12 Crypto_30_LibCv_KeyValidSet . . . . . . . . . . . . . . . . . . . . . . . . . . 78 + 4.1.13 Crypto_30_LibCv_KeySetValid . . . . . . . . . . . . . . . . . . . . . . . . . . 78 + 4.1.14 Crypto_30_LibCv_KeySetInvalid . . . . . . . . . . . . . . . . . . . . . . . . . 79 + 4.1.15 Crypto_30_LibCv_KeyGetStatus . . . . . . . . . . . . . . . . . . . . . . . . . 79 + 4.1.16 Crypto_30_LibCv_KeyElementGet . . . . . . . . . . . . . . . . . . . . . . . . 80 + 4.1.17 Crypto_30_LibCv_RandomSeed . . . . . . . . . . . . . . . . . . . . . . . . . 81 + 4.1.18 Crypto_30_LibCv_KeyGenerate . . . . . . . . . . . . . . . . . . . . . . . . . . 81 + 4.1.19 Crypto_30_LibCv_KeyDerive . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 + 4.1.20 Crypto_30_LibCv_KeyExchangeCalcPubVal . . . . . . . . . . . . . . . . . . . 85 + 4.1.21 Crypto_30_LibCv_KeyExchangeCalcSecret . . . . . . . . . . . . . . . . . . . 86 + 4.1.22 Crypto_30_LibCv_CertificateParse . . . . . . . . . . . . . . . . . . . . . . . . 86 + 4.1.23 Crypto_30_LibCv_CertificateVerify . . . . . . . . . . . . . . . . . . . . . . . . 87 +4.2 Required Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 +4.3 Callback Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 + 4.3.1 Crypto_30_LibCv_NvBlock_Init . . . . . . . . . . . . . . . . . . . . . . . . . . 88 + 4.3.2 Crypto_30_LibCv_NvBlock_ReadFromBlock . . . . . . . . . . . . . . . . . . . 89 + 4.3.3 Crypto_30_LibCv_NvBlock_WriteToBlock . . . . . . . . . . . . . . . . . . . . 89 + 4.3.4 Crypto_30_LibCv_NvBlock_Callback . . . . . . . . . . . . . . . . . . . . . . . 90 + 4.3.5 esl_getBytesRNG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 +4.4 Callout Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 + 4.4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 + 4.4.2 Appl_Crypto_30_LibCv_SaveContextCallout . . . . . . . . . . . . . . . . . . 91 + 4.4.3 Appl_Crypto_30_LibCv_RestoreContextCallout . . . . . . . . . . . . . . . . . 92 + 4.4.4 Crypto_30_LibCv_KeyValueChangedCallout . . . . . . . . . . . . . . . . . . 93 + 4.4.5 Crypto_30_LibCv_KeyValiditySetCallout . . . . . . . . . . . . . . . . . . . . . 93 + +5 Configuration 94 + +5.1 Configuration Variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 + +5.2 NvM Block Needs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 + +5.3 Key Initialization Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 + +6 Cybersecurity 96 + +6.1 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 + +6.1.1 CMI-CRYPTO-ReadAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 + +6.1.2 CMI-CRYPTO-WriteAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 + +6.1.3 CMI-CRYPTO-NvMConsistencyLevel . . . . . . . . . . . . . . . . . . . . . . . 96 + +© 2025 Vector Informatik GmbH Version 14.09.04 4 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + 6.1.4 CMI-CRYPTO-KeyNotUsed . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 + 6.1.5 CMI-CRYPTO-SheKeyReadAccess . . . . . . . . . . . . . . . . . . . . . . . . 97 + 6.1.6 CMI-CRYPTO-SheRamKeyReadAccess . . . . . . . . . . . . . . . . . . . . . 97 + 6.1.7 CMI-CRYPTO-SheKeyWriteAccess . . . . . . . . . . . . . . . . . . . . . . . . 97 + 6.1.8 CMI-CRYPTO-SheDebugCmd . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + 6.1.9 CMI-CRYPTO-ContextNotUsed . . . . . . . . . . . . . . . . . . . . . . . . . . 98 +6.2 Runtime Interfaces: Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + 6.2.1 CMI-CRYPTO-ContextCallout . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + 6.2.2 CMI-CRYPTO-RandomSeed . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 + 6.2.3 CMI-CRYPTO-AeadDecryptVerifyBeforeUse . . . . . . . . . . . . . . . . . . . 99 +6.3 Runtime Interfaces: BSW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 + +7 Glossary and Abbreviations 100 + +7.1 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 + +7.2 Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 + +8 Contact 102 + +© 2025 Vector Informatik GmbH Version 14.09.04 5 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Document Information + +Reference Documents + +No. Source Title Version +[1] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf 4.3.0 +[2] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf 4.3.1 +[3] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf 4.4.0 +[4] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf R19-11 +[5] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf R20-11 +[6] AUTOSAR AUTOSAR_SWS_DET.pdf 4.3.0 +[7] AUTOSAR AUTOSAR_TR_BSWModuleList.pdf 4.3.0 +[8] HIS 2009-04-01 SHE Functional Specification v1.1 (rev439) 1.1 +[9] NIST NIST Special Publication 800-108 2009-10 +[10] NIST FIPS PUB 186-4 2013-07 +[11] NIST NIST Special Publication 800-56A 2 +[12] ISO ISO 15118-2 2014-04-01 +[13] NIST FIPS186-2 2000-01 +[14] NIST SP800-90A 1 +[15] Vector TechnicalReference_vSecPrim.pdf See delivery +[16] NIST NIST Special Publication 800-56C 1 +[17] NIST NIST Special Publication 800-132 1 +[18] NIST NIST Special Publication 800-38C 1 +[19] NIST T. Taubert, C. Wood: SPAKE2+, an Augmented PAKE 2020-03 +[20] ANSI ANSI X9.63-2001 11-2001 +[21] ISO ISO 15118-20 2021-10-08 +[22] GM GM/T 0003.5-2012 SM2 - Part 5: Parameter definition 2012 +[23] Springer M. Burmester, Y. Desmedt: A secure and efficient conference 05-1994 + key distribution system +[24] J. Schaad, R. Housley, Advanced Encryption Standard (AES) September + Key Wrap Algorithm 2002 +[25] AUTOSAR AUTOSAR_SWS_CryptoDriver.pdf R24-11 +[26] NIST FIPS-205 - Stateless Hash-Based Digital Signature Standard 08-2024 +[28] PKCS #1 V2.2: RSA Cryptography Standard October 2012 + +Caution +We have configured the programs in accordance with your specifications in the +questionnaire. Whereas the programs do support other configurations than the +one specified in your questionnaire, Vector's release of the programs delivered +to your company is expressly restricted to the configuration you have specified in +the questionnaire. + +© 2025 Vector Informatik GmbH Version 14.09.04 6 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +1 Introduction + +This document describes the functionality, integration, API and configuration of the Crypto +Driver (CRYPTO). + +The module is specified in AUTOSAR [1]. + +Supported Configuration Variants: pre-compile 30 decimal +Vendor ID: CRYPTO_VENDOR_ID (= Vector-Informatik, according to + HIS) +Module ID: CRYPTO_MODULE_ID + 114 decimal + (according to [7]) + +1.1 Architecture Overview +These are the interfaces of the module: + +CryIf + +CRYPTO NvM + + vSecPrim + +Figure 1.1 Module Architectural Environment + +© 2025 Vector Informatik GmbH Version 14.09.04 7 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2 Functional Description + +This section provides an overview and detailed information about the functions of the mod- +ule. + +2.1 Features + +2.1.1 Supported Algorithms +AEAD +> AES128/256 CCM (refer Section 2.1.2.1.2) +> AES128 GCM (refer Section 2.1.2.1.3) +> ChaCha20 Poly1305 (refer Section 2.1.2.1.4) +Cipher +> AES-128/192/256 with mode ECB/CBC/CTR (refer Section 2.1.2.2.1) + + > PKCS7 padding + > ISO 9797-1 (OneWithZeros) padding + > without padding +> RSA (refer Section 2.1.2.2.2, refer [15] for supported key lengths) + > PKCS1-V1.5; PKCS1-V1.5 public key decryption + > RSA OAEP with SHA-1 and SHA2-256 pre-hashing + > RSA CRT OAEP with SHA-1 and SHA2-256 pre-hashing (decryption only) +> SM4 with block mode ECB/CBC (refer Section 2.1.2.2.3) +Hash +> SHA-1 +> SHA2-224/256/384/512/512-224/512-256 +> SHA3-224/256/384/512 +> SHAKE128/256 +> RIPEMD160 +> MD5 +> SM3 +MAC +> CMAC AES-128/256 (refer Section 2.1.2.3.1) +> GMAC with AES-128/192/256 +> SipHash +> HMAC-SHA-1 +> HMAC-SHA2-256/384/512 + +© 2025 Vector Informatik GmbH Version 14.09.04 8 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> HMAC-RIPEMD-160 +PRNG +> FIPS 186-2 (refer Section 2.1.2.4.3) +> DRBG-AES128/256 with DF and without DF (refer Section 2.1.2.4.4) +> CTR-DRGB-AES128/256 with DF and without DF (refer Section 2.1.2.4.5) +> DRBG-SHA2-512 (refer Section 2.1.2.4.6) +Signature +> ECDSA (refer Section 2.1.2.5.1) + + > SECp160r1 - without pre-hashing + > SECp256r1 / NIST P-256 / ANSI prime256v1 - without pre-hashing - SHA1, + + SHA2-256, SHA2-384 and SHA2-512 pre-hashing + > SECp384r1 / NIST P-384 - without pre-hashing - SHA1, SHA2-256, SHA2-384 and + + SHA2-512 pre-hashing + > SECp521r1 / NIST P-521 - with SHA2-512 pre-hashing +> EdDSA (refer Section 2.1.2.5.2) + > Ed25519 (pureEdDSA) + > Ed25519ctx (contextualized extension of the Ed25519 scheme) + > Ed25519ph (hashEdDSA) + > Ed448 (pureEdDSA) + > Ed448ph (hashEdDSA) +> RSA (refer Section 2.1.2.5.4, refer [15] for supported key lengths) + > PKCS1-V1.5 with SHA-1/SHA2-256 + > PKCS1-V1.5 CRT with SHA-1/SHA2-256 (signature generation only) + > PSS with SHA-1/SHA2-256/SHA2-384 (Note: RSA-PSS refers to the RSASSA-PSS + + signature scheme as defined in [28]) +> IsKeyOnCurve (refer Section 2.1.2.5.3) + + > SECp160r1 + > SECp256r1 / NIST P-256 / ANSI prime256v1 + > SECp384r1 / NIST P-384 + > SECp521r1 / NIST P-521 + > Ed25519 and Ed448 +> SLH-DSA SHA2-128s Verification (refer Section 2.1.2.5.5) +> SM2 with Sm2p256v1-curve [22] (refer Section 2.1.2.5.6) +Key Derivation +> NIST 800-108 KDF in Counter Mode with PRF [9]: + +© 2025 Vector Informatik GmbH Version 14.09.04 9 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + > SHA2-256 (refer Section 2.1.2.6.2) + > CMAC AES128/256 (refer Section 2.1.2.6.3) +> NIST FIPS 186-4 Key Pair Generation Using Extra Random Bits with KDF in Counter + Mode as RBG [10] (refer Section 2.1.2.6.1) +> KDF NIST 800-56A One Pass C1E1S with 'Single Step KDF' with HASHSHA2-256 [11] + (refer Section 2.1.2.6.4) +> ISO 15118-2 certificate installation and update [12] (refer Section 2.1.2.6.5) +> ISO 15118-20 certificate installation [21] (refer Section 2.1.2.6.6) +> KDF X9.63 with SHA2-256/512 [20] (refer Section 2.1.2.6.7) +> PBKDF2 HMAC SHA-1 and SHA2-256 [17] (refer Section 2.1.2.6.8) +> HKDF HASH Option 1 SHA-256/512 (one step variant) [16] (refer Section 2.1.2.6.9) +> HKDF HMAC Option 2 SHA-256/384 (one step and two step variant) [16] (refer Section + 2.1.2.6.10) +> HKDF Expand HMAC Option 2 SHA-256/384 (expansion step of two step variant) [16] + (refer Section 2.1.2.6.11) +> Spake2+ SECp256r1 Preamble [19] (refer Section 2.1.2.6.12) +Key Exchange +Refer Section 2.1.2.7 for Key Element usage +> ECDHE (refer Section 2.1.2.7.1) + > SECp224r1 / NIST P-224 + > SECp256r1 / NIST P-256 / ANSI prime256v1 + > SECp384r1 / NIST P-384 + > SECp521r1 / NIST P-521 + > X25519 + > X448 +> Spake2+ (refer Section 2.1.2.7.2) +> Elliptic Curve Burmester Desmedt [23] (refer Section 2.1.2.7.3) + > SECp224r1 / NIST P-224 + > SECp256r1 / NIST P-256 / ANSI prime256v1 +Key Generate +Refer Section 2.1.2.8 for Key Element usage +> All symmetric keys +> ECC with: + > SECp256r1 / NIST P-256 / ANSI prime256v1 + > SECp384r1 / NIST P-384 + +© 2025 Vector Informatik GmbH Version 14.09.04 10 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + > SECp521r1 / NIST P-521 +> Ed25519 +> ECC with Sm2p256v1 +Key Wrap and Key Unwrap +Refer Section 2.1.2.9 for Key Element usage +> Key Wrap AES128/192/256 (refer Section 2.1.2.9.1) +> Key Unwrap AES128/192/256 (refer Section 2.1.2.9.1) + +2.1.2 Algorithm specific +This section provides further details about supported algorithms. + +2.1.2.1 AEAD +2.1.2.1.1 Additional Authenticated Data + +The AEAD AES GCM, AES128 CCM, AES256 CCM and ChaCha20 Poly1305 encryption/ +decryption can optionally be called with additional authenticated data. If the mentioned +algorithms are called with additional authenticated data, the data must be set during the first +update call. Otherwise, the secondary input pointer must be initialized with a null pointer and +secondary input length must be set to zero. For more information on Verification Jobs, refer +to Section 2.1.3.5. + +2.1.2.1.2 AES CCM + +AES128 CCM and AES256 CCM are supported. The primitive is chosen according to the +length of key element CRYPTO_KE_CIPHER_KEY. Therefore only key lengths of 128 and +256 bits are supported. The AEAD AES CCM encryption/decryption [18] supports only a +single update step and a nonce length of 7-13 byte. The nonce is stored in key element +CRYPTO_KE_CIPHER_IV. In Section 2.1.2.1.1 is a limitation for the AES CCM with AAD. + +2.1.2.1.3 AES GCM + +The module supports AEAD AES GCM with an authentication tag length of 1-16 bytes. +Encrypt: +> If the authentication tag buffer (secondary Output) is 1-16 bytes, the tag will be written + + with the length of the given buffer. +> If the authentication tag buffer is larger than 16 bytes, the tag size will be set to 16 bytes. +Decrypt: +> If the authentication tag (tertiary Input) is 1-16 bytes, the given length will be used for the + + verification. +> If the authentication tag buffer is larger than 16 bytes, the job will fail. + +© 2025 Vector Informatik GmbH Version 14.09.04 11 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.2.1.4 ChaCha20 Poly1305 + +The ChaCha20 Poly1305 encryption/decryption supports only key length of 256 bit and +nonce length of 96 bit. The nonce is stored in key element CRYPTO_KE_CIPHER_IV. In +Section 2.1.2.1.1 is a limitation for the ChaCha20 Poly1305 with AAD. +Encryption: +> The secondary input pointer contains the optional additional authenticated data +> The output length must be equal to or greater than the input length. +Decryption: +> The secondary input pointer contains the optional additional authenticated data +> The output length must be equal to or greater than the input length. +> The tertiary input length must be set to 16 bytes. + +2.1.2.2 Cipher +2.1.2.2.1 AES Encryption/Decryption + +The AES encryption/decryption supports key lengths of 128, 192 and 256 bits. If an AES +job is executed the module distinguishes the AES variant based on the given key length. + + Basic Knowledge + The support of AES192 and AES 256 needs to be activated in the general set- + tings of the module configuration. + + Note + Since the module does not know the expected outputLength, the provided output + buffer and its length need to be at least (AES block size * (N +1)), where N is the + number of complete input blocks to be encrypted. + Depending on the padding mode, AES can add up to one complete block of + encrypted bytes. Hence, the output buffer needs to provide for an additional + block of (block size) many bytes. + This is also applicable for all AES based AEAD jobs (e.g. AES GCM). + +2.1.2.2.2 RSA Encryption/Decryption + +The keys which are required by the RSA Encryption/Decryption algorithm are stored in sep- +arate key elements which are defined in Table 2.30. + +© 2025 Vector Informatik GmbH Version 14.09.04 12 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Key Element RSA_MODULUS + PUBLIC_EXPONENT +RSA Primitive PRIVATE_EXPONENT + RSA_PRIME_P + RSA_PRIME_Q + RSA_EXPONENT_DP + RSA_EXPONENT_DQ + RSA_INVERSE_QI + LABEL + +Encrypt PKCS#1 V1.5 XX + +Decrypt PKCS#1 V1.5 X X + +Encrypt PKCS#1 V2.2 OAEP XX O* + +Decrypt PKCS#1 V2.2 OAEP X X O* + +Decrypt PKCS#1 V2.2 OAEP CRT X X X X X O* +Table 2.1 RSA Encryption/Decryption Key Element Usage + +O*: Optional key element. The key element must be excluded, if it is not used. + +The RSA key elements need to be set as plain binary data without any format (e.g. ASN.1). + + Expert Knowledge + The encryption and decryption does not allow multi update, since this is not spec- + ified for RSA. + +2.1.2.2.3 SM4 Encryption/Decryption + +The module supports the Chinese block cipher SM4. It's block length and cipher key length +are both 16 bytes. The block modes ECB and CBC are supported. If ECB mode is used, the +crypto key shall provide a cipher key KeyElement (e.g. CryptoKeyType CipherWithoutIv). For +CBC, the crypto key shall provide a cipher key KeyElement and an initialization vector (IV) +KeyElement (e.g. CryptoKeyType Cipher). Check the referenced KeyElement(s) for correct +sizes of 16 bytes. +SM4 does not support padding. The overall input data size of each job must be a multiple +of the block length (n*16 bytes) otherwise the job will fail in finish mode. However, if using +streaming, the input data length may vary with each update step. + +2.1.2.3 MAC +Before calling the module to process a CRYPTO_SERVICE_MAC_VERIFY or CRYPTO_ +SERVICE_MAC_GENERATE job, the secret key keyElement (CRYPTO_KE_MAC_KEY) shall + +© 2025 Vector Informatik GmbH Version 14.09.04 13 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +be set to its desired value and the referenced key shall be set valid. For more information on +Verification Jobs, refer to Section 2.1.3.5. + + Caution MAC length + For MAC Verify (CRYPTO_SERVICE_MAC_VERIFY), the expected in + (job->jobPrimitiveInput.secondaryInputLength) is + bits according to [1]. + +2.1.2.3.1 AES CMAC + +The size of the secret key, which is in the key element CRYPTO_KE_MAC_KEY of the refer- +enced key, is used to decide which AES is used for the MAC calculation: + +> AES128: 16 bytes +> AES256: 32 bytes + +A truncation of the MAC is supported. The outputBuffer must have a size of at least 1 byte. +If the outputBuffer is larger than the default MAC size (16 bytes), the outputBufferLength is +adapted to the default MAC size. + +The AES CMAC supports the reuse of calculated AES round keys. If this feature is enabled +the round keys are hold in the driver object. The round keys are hold until a different job type +is processed (not CMAC AES128 resp. AES256) or the corresponding key has changed. + + Expert Knowledge + To ensure the max speedup, configure a driver object for each AES CMAC key. + The driver object can be used for several AES CMAC jobs with the same key. + +2.1.2.4 PRNG + +2.1.2.4.1 Random Seed + +An algorithm for random number generation needs to be seeded before generation. This +is required since the software algorithms are 'Deterministic Random Number Generators' +(DRNG). The algorithm for random number generation is defined by the algorithm key ele- +ment (CRYPTO_KE_RANDOM_ALGORITHM) of the used parent key. + +The following values can be configured: + +ID Name Value + +1 CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1 0u + +2 CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128 1u + +3 CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128_DF 2u + +4 CRYPTO_30_LIBCV_RNG_NIST_800_90A_HASH_DRBG_SHA_512 3u + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 14 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.2 – continued from previous page + +ID Name Value + 4u +5 CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256 5u + +6 CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256_DF + +Table 2.2 Values for Key Random Algorithm Key Element + + Note + If the Det runtime error CRYPTO_E_RE_ENTROPY_EXHAUSTED is reported while + random number generation while RNG job processing, the RNG must be seeded. + It must be ensured that the seed operation was successful. + +For more information on Random Seed, refer to Section 2.1.2.4.3 and Section 2.1.2.4.4 + +2.1.2.4.2 Default Random Source / esl_getBytesRNG + +The callback esl_getBytesRNG (specified in Section 4.3) is required to provide random +data for some algorithm provided by the vSecPrim [15]. The callout is required for RSA, +ECC, Key Exchange and Key Generation. The exact list of the callout usage can be found in +[15]. The callout esl_getBytesRNG can either be provided by the Default Random Source +[4] or implemented within your project. The Default Random Source can be defined by +CryptoDefaultRandomPrimitiveRef and CryptoDefaultRandomKeyRef. For the +Default Random Source only the DRBG can be used. + + Expert Knowledge + Ensure that the provided CRYPTO random number generator is initialized be- + fore RSA, ECC and Key Generation is used. This can be done by calling CSM_ + RandomSeed on CryptoDefaultRandomKeyRef. + + Expert Knowledge + If the system uses Default Random Source and random number generation + at the same time, the runtime can increase due to protection of the inter- + nal state of the RNG. This internal state is saved to the key referenced by + CryptoDefaultRandomKeyRef. If Default Random Source and random num- + ber generation try to use the same key at the same time, the second user will + return CRYPTO_E_BUSY. + This can be prevented by using different keys for Default Random Source and + random number generation. If key locking is disabled, this is enforced. + +© 2025 Vector Informatik GmbH Version 14.09.04 15 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Note + If the Det runtime error CRYPTO_E_RE_ENTROPY_EXHAUSTED is reported + while random number generation with esl_getBytesRNG, the Default Random + Source must be seeded. It must be ensured that the seed operation was suc- + cessful. + If the Det runtime error CRYPTO_E_RE_GET_BYTES_RNG_ERROR is reported + while random number generation with esl_getBytesRNG, any error occurred. + + Caution + If the module is used by multiple partitions, the CryptoDefaultRandomKeyRef + must be different for each partition. Default random keys can include key ele- + ments with persistency. As only the main partition will persist keys, the persis- + tency of default random keys used by the non-main partitions must be handled + manually (See Section 2.1.7.1). + +2.1.2.4.3 FIPS + +The random number generator is implemented according to [13].The FIPS 186-2 can only +have one instance per driver object. The internal state of the RNG is stored in the driver +object. The service RandomSeed is used to set the new entropy. If a new entropy is avail- +able, the RNG is seeded if the generation job is processed. During the random number +generation, the key is locked for writing. +The length of the key element CRYPTO_KE_RANDOM_SEED_STATE needs to be set accord- +ing to the used seed length. Since the FIPS 186-2 need to be reseeded after each startup +the key element CRYPTO_KE_RANDOM_SEED_STATE shall not be persisted. The FIPS 186- +2 requires an entropy length from at least 20 bytes, this is defined by [13]. + + Caution + If one key is used for several RNG jobs, only the first executed random instance + gets seeded with this entropy. Therefore, it is highly recommended that each + random instance has its own key, to avoid side effects. The RNG needs to be + seeded after each startup. + + Expert Knowledge + It is highly recommended to use the RNG DRBG instead of the RNG FIPS186. + +© 2025 Vector Informatik GmbH Version 14.09.04 16 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.2.4.4 DRBG + +The random number generator is implemented according to [14]. The chosen variants are +DRBG-CTR AES 128 with DF, without DF, DRBG-CTR AES 256 with DF, without DF and +DRBG-HASH SHA2-512. + +The DRBG instance saves all required values in the key. Thereby it is possible to have +multiple instances of the DRBG in one driver object. + +There are two ways for the RNG seed state handling. The best way is to not per- +sist CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER and CRYPTO_KE_RANDOM_SEED_ +STATE and seed the RNG after each startup. The other way is to persist CRYPTO_KE_ +CUSTOM_RANDOM_RESEED_COUNTER and CRYPTO_KE_RANDOM_SEED_STATE and con- +tinue random number generation with the old state. The DRBG gets instantiated with the +first Crypto_30_LibCv_RandomSeed call. + +Table 2.3 shows the required length of the key element CRYPTO_KE_RANDOM_SEED_STATE +for the supported DRBG variants. + + CRYPTO_KE_RANDOM_SEED_STATE Length + CTR DRBG AES128 without DF 32 bytes + CTR DRBG AES128 with DF 32 bytes + CTR DRBG AES256 without DF 48 bytes + CTR DRBG AES256 with DF 48 bytes + Hash DRBG SHA 512 222 bytes +Table 2.3 Length for Key Random Seed State Element + +Expert Knowledge +Use only one DRBG instance and reseed this instance as often as possible with +new entropy to increase the numbers randomness. The entropy source is an +important part to increase the numbers randomness. + +Caution +If the key element CRYPTO_KE_RANDOM_SEED_STATE is configured to be per- +sisted, the DRBG will continue random number generation based on the per- +sisted state after restart. If the latest state is not written to NvM while shutdown, +the DRBG will provide random numbers based on the last persisted state and the +same random numbers are generated. + +2.1.2.4.5 CTR DRBG + +The CTR DRBG requires different input parameter for its operations. The required key ele- +ments are shown in the Table 2.4. The optional and recommended key elements must be +excluded from the configured key if the input is not necessary. It is possible to configure + +© 2025 Vector Informatik GmbH Version 14.09.04 17 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +DRBG-CTR AES 128/256 with DF and without DF at the same time. During the random +number generation, the key is locked for writing. + + Key Element RANDOM_SEED_STATE + RANDOM_RESEED_COUNTER +CTR DRBG Operation RANDOM_ADDITIONAL_INPUT + RANDOM_PERSONALIZATION_STRING + RANDOM_NONCE + +without DF: Instantiation X X R + +without DF: Reseed X X O + +without DF: Generate Random Number X X O + +with DF: Instantiation X X R X + +with DF: Reseed X X O + +with DF: Generate Random Number X X O + +Table 2.4 CTR DRBG required Key Elements + +X: required +R:Recommended +O: Optional +For more information, e.g. about the length of the key elements in Table 2.4, please refer to +[15] and Section 2.1.2.4.4. + +2.1.2.4.6 Hash DRBG + +The Hash DRBG requires different input parameter for its operations. The required key +elements are shown in the Table 2.5. The optional and recommended key elements must be +excluded from the configured key if the input is not necessary. + +© 2025 Vector Informatik GmbH Version 14.09.04 18 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Key Element RANDOM_SEED_STATE + RANDOM_RESEED_COUNTER +Hash DRBG Operation RANDOM_ADDITIONAL_INPUT + RANDOM_PERSONALIZATION_STRING + RANDOM_NONCE + +Instantiation X X R X + +Reseed X X O + +Generate Random Number X X O + +Table 2.5 Hash DRBG required Key Elements + +X: required + +R: Recommended + +O: Optional + +For more information, e.g. about the length of the key elements in Table 2.5, please refer to +[15] and Section 2.1.2.4.4. + +2.1.2.5 Signature + +For information on Verification Jobs, refer to Section 2.1.3.5. + +2.1.2.5.1 ECDSA + +ECDSA requires a private key d for signature generation. Generally, the private key is given +as a scalar (in contrast to AUTOSAR, which specifies the private key for ECDSA with the +base point (Point X | Point Y)). + +The ECDSA requires a public key x and a public key y for verification. The public key x and +public key y are stored in the signature key element. Since there is only one key element +used, the key x and key y need to be stored concatenated. The size of the public key x +and the public key y are the same so that the signature key element size is the double. The +ECDSA requires hashed input data, if no pre hash is used the data must be hashed to be +compliant with the algorithm. + +Signature Key Element (Size 2L) public key y (Size L) +public key x (Size L) + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 19 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.6 – continued from previous page + Signature Key Element (Size 2L) +Table 2.6 ECDSA Signature Key Element Storage + +The signature for ECDSA is split in signature R and signature S. The signature is saved in the +job output buffer. To do this, the signature R and signature S are concatenated. Signature R +and signature S have the same size. + + Signature Buffer Signature S + Signature R +Table 2.7 ECDSA Signature Storage + +Expert Knowledge +The SECp160r1 signature contains an R and an S component, the length of the +R component is always 160 bits and the length of the S component can be 161 +bits, therefore the maximum size is fixed at 161 bits. The size of the output length +is variable, if the first byte of the signature s is filled with zero padding, they can +be deleted and the output length is set to 40 bytes (signature R and S). If the first +byte of signature s is not filled with zero padding, the output length is set to 42 +bytes (signature R and S). The signature verification service only requires that R +and S must be equal in size. Since the service can process leading zeros on its +own. + +Note +The streaming approach is not supported in pure mode (primitive without pre- +hash). +This is because the input data cannot be processed in UPDATE mode, as the sig- +nature is already required in this mode. According to [1], however, the signature +is only calculated in FINISH mode. Operation mode SINGLECALL is recom- +mended for signing hashed data. +If the streaming approach shall be used, use the pre-hash mode. + +2.1.2.5.2 EdDSA + +The EdDSA algorithms (ED25519 and ED448) support modes which can use a context. For +this purpose, a special key element CRYPTO_KE_CUSTOM_EDDSA_CONTEXT is used. If it is +set and marked as valid, the content will be treated as context for the algorithm. Otherwise, +the context length will be set to zero. + + Basic Knowledge + The length of the context must not exceed 255 bytes. + +© 2025 Vector Informatik GmbH Version 14.09.04 20 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Note +The streaming approach is not supported for the EdDSA modes pure and context. +This is because the input data cannot be processed in UPDATE mode, as the sig- +nature is already required in this mode. According to [1], however, the signature +is only calculated in FINISH mode. Operation mode SINGLECALL is recom- +mended for these EdDSA modes. +If the streaming approach shall be used, use hashEdDSA (Ed25519ph, +Ed448ph). + +2.1.2.5.3 IsKeyOnCurve + +The module supports a IsKeyOnCurve functionality which verifies if a ECDSA or EdDSA key +lies on a specific elliptic curve. The following elliptic curves are supported: + +> SECp160r1 +> SECp256r1, NIST P-256, ANSI Prime256v1 +> SECp384r1, NIST P-384 +> SECp521r1, NIST P-521 +> ED25519 +> ED448 + +The IsKeyOnCurve is provided via the SIGNATUREVERIFY service. The key to be verified +needs to be provided as a key element CRYPTO_KE_SIGNATURE_KEY of a valid crypto +key. In addition, the job parameters inputPtr and secondaryInputPtr need to be buffers with +a valid address and a length greater than zero (dummy buffers). However, these buffers +are not used for the computation but for compatibility of the SIGNATUREVERIFY service +interface. + + Expert Knowledge + Whether a private key lies on an elliptic curve cannot be checked per se, since a + private key is not coordinates, but an integer. However, private keys are checked + for plausibility: + > ECDSA: based on the curve's order + > EDDSA: based on the key length + +2.1.2.5.4 RSA Signature + +The keys which are required by the RSA Signature algorithm are stored in separate key +elements which are defined in Table 2.30. The RSA PSS requires a salt for calculation +which is always required. For signature verification only, the salt length is required. If the +salt length is not given or shall be calculated automatically the key element CRYPTO_KE_ +CUSTOM_RSA_SALT_LENGTH must be excluded from the used key. + +© 2025 Vector Informatik GmbH Version 14.09.04 21 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Key Element RSA_MODULUS + PUBLIC_EXPONENT +RSA Primitive PRIVATE_EXPONENT + RSA_SALT + RSA_SALT_LENGTH + RSA_PRIME_P + RSA_PRIME_Q + RSA_EXPONENT_DP + RSA_EXPONENT_DQ + RSA_INVERSE_QI + +Signature Generate PKCS#1V1.5 X X + +Signature Verify PKCS#1V1.5 XX + +Signature Generate PKCS#1V1.5 CRT XXXXX + +Signature Generate PKCS#1V2.2 PSS X XX + +Signature Verify PKCS#1V2.2 PSS XX O* + +Table 2.8 RSA Key Element Usage + +O*: Optional key element. The key element must be excluded, if it is not used. +The RSA key elements need to be set as plain binary data without any format (e.g. ASN.1). + +2.1.2.5.5 SLH-DSA + +The module supports signature verification with Stateless Hash-Based Digital Signature Al- +gorithm (SLH-DSA). Currently, only the parameter set SLH-DSA-SHA2-128s is supported +[26]. Note that SLH-DSA is designed to resist against an attacker with access to a quantum +computer. Therefore, it is called a Post-quantum Cryptography (PQC) algorithm [15]. +To use the algorithm the following has to be configured in the crypto job: +1. CryptoPrimitiveService: CRYPTO_SIGNATURE_VERIFY +2. CryptoPrimitiveAlgorithmMode: CRYPTO_ALGOMODE_CUSTOM +3. CryptoPrimitiveAlgorithmModeCustomRef: Crypto_30_LibCv_SHA2_128S +4. CryptoPrimitiveAlgorithmFamily: CRYPTO_ALGOFAM_CUSTOM +5. CryptoPrimitiveAlgorithmFamilyCustomRef: Crypto_30_LibCv_SLH_DSA +6. CryptoPrimitiveAlgorithmSecondaryFamily: for pure: CRYPTO_ALGOFAM_NOT_SET, + + for pre-hash: use dedicated Hash Familiy, e.g. CRYPTO_ALGOFAM_SHA2_256 +The module supports SLH-DSA with the following modes: + +Mode Public Key Length Signature Length Single Call Only + [bytes] [bytes] +SHA2-128s Verify Pure Yes +SHA2-128s Verify 32 7856 No +PreHash + 32 7856 + +© 2025 Vector Informatik GmbH Version 14.09.04 22 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Table 2.9 SLH-DSA supported mode + +Caution +SLH-DSA Verify Pure is single call only, therefore no streaming approach is pos- +sible. + +The following key elements are used by the algorithm: + + SignatureVerifyKey Elements Key Element ID Size [byte] + Public key 1 32 + Context (optional) 3062 0 - 255 (255 included) +Table 2.10 SLH-DSA Signature Verify Key Elements + + Note + The following hash functions can be used as pre-hash functions for SLH-DSA: + 1. SHA2_224 + 2. SHA2_256 + 3. SHA2_384 + 4. SHA2_512 + 5. SHA2_512_224 + 6. SHA2_512_256 + 7. SHA3_224 + 8. SHA3_256 + 9. SHA3_384 +10. SHA3_512 +11. SHAKE128 +12. SHAKE256 + +2.1.2.5.6 SM2 Signature + +The module supports the Chinese signature algorithm SM2 with the elliptic curve +Sm2p256v1 [22]. Similar to ECDSA (refer Section 2.1.2.5.1), the public key is a concatena- +tion of key x and key y. Further, the signature is a concatenation of signature R and signature +S. SM2 uses various key elements for generation and verification, such as an optional key +element for the user ID: + +© 2025 Vector Informatik GmbH Version 14.09.04 23 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +SignatureGener- Key Element ID Size [byte] +ate +KeyElements 32 + 64 +Private key CRYPTO_KE_SIGNATURE_KEY 1 - 8191 + +Public key CRYPTO_KE_CUSTOM_SM2_GENERATE_PUBLIC_KEY + +User ID (optional) CRYPTO_KE_CUSTOM_SM2_ID + +Table 2.11 SM2 Signature Generate Key Elements + +SignatureVeri- Key Element ID Size [byte] +fyKey Elements + 64 +Public key CRYPTO_KE_SIGNATURE_KEY 1 - 8191 + +User ID(optional) CRYPTO_KE_CUSTOM_SM2_ID + +Table 2.12 SM2 Signature Verify Key Elements + +2.1.2.6 Key Derivation + +The KDF to use is specified by the algorithm key element (CRYPTO_KE_KEYDERIVATION_ +ALGORITHM) of the used parent key. + +The following values can be configured: + +Value Name CRYPTO_30_LIBCV_KDF_ALGO... Derived key length + +1u KDF_SYM_NIST_800_108_CNT_MODE_SHA256 See Section 2.1.2.6.2 + +2u KDF_ASYM_NIST_FIPS_186_4_ERB See Section 2.1.2.6.1 + +3u KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_ 32 Byte + KDF_SHA256 + +4u KDF_ISO_15118_CERTIFICATE_HANDLING 32 Byte + +6u KDF_X963_SHA256 Length of target key + +7u KDF_X963_SHA512 Length of target key + +8u NIST800108_CTRMODE_CMAC_AES Length of target key + +9u PBKDF2_HMAC_SHA1 Length of target key + +10u PBKDF2_HMAC_SHA256 Length of target key + +11u HKDF_HMAC_SHA256 Length of target key + +12u SPAKE2_PLUS_P256R1 32 Byte, see Section + 2.1.2.6.12 + +13u HKDF_OPTION1_SHA256 Length of target key + +14u HKDF_HMAC_SHA384 Length of target key + +15u HKDF_OPTION1_SHA512 Length of target key + +16u KDF_ISO_15118_20_CERTIFICATE_HANDLING 66 Byte (for SECP-521R1) + 56 Byte (for Curve448) + +17u HKDF_EXPAND_HMAC_SHA256 Length of target key + +18u HKDF_EXPAND_HMAC_SHA384 Length of target key + +Table 2.13 Values for Key Derivation Algorithm Key Element and derived key length + +© 2025 Vector Informatik GmbH Version 14.09.04 24 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.2.6.1 NIST FIPS186-4 ERB + +The behavior of the key derivation algorithm CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_ +NIST_FIPS_186_4_ERB is configured by further specific key elements. + +These elements are: + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the secret key. + +> CRYPTO_KE_KEYDERIVATION_SALT + This key element contains the salt. For asymmetric keys the salt is the following: + 4 byte Context | 2 byte target key length in bytes (big endian) + ((32 byte curve specific prime) - 1) or (32 byte curve specific + order) - 1) + +> CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL + This key element contains the label. + +The number of iterations is automatically determined by the required key length. The derived +key is stored in the key element with id 1 of the given key. + +The key derivation algorithms are only available on 32 and 64Bit Platforms. + +If not stated differently, the number of iterations the KDF performs is automatically deter- +mined by the required key length and not to be confused with the value of the key element +CRYPTO_KE_KEYDERIVATION_ITERATIONS. + +2.1.2.6.2 NIST800-108 KDF Counter Mode with PRF SHA2-256 + +The behavior of the key derivation algorithm CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_ +NIST_800_108_CNT_MODE_SHA256 is configured by further specific key elements. + +These elements are: + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the secret key. + +> CRYPTO_KE_KEYDERIVATION_SALT + This key element contains the salt. For symmetric keys the salt is the following: + 4 byte Context | 2 byte target key length in bytes (big endian) + +> CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL + This key element contains the label. + +The number of iterations is automatically determined by the required key length. The derived +key is stored in the key element with id 1 of the given key. + +The key derivation algorithms are only available on 32 and 64Bit Platforms. + +If not stated differently, the number of iterations the KDF performs is automatically deter- +mined by the required key length and not to be confused with the value of the key element +CRYPTO_KE_KEYDERIVATION_ITERATIONS. + +© 2025 Vector Informatik GmbH Version 14.09.04 25 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.2.6.3 NIST800-108 KDF Counter Mode with PRF CMAC AES + +The behavior of the key derivation algorithm CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_ +800_108_CTR_CMAC_AES is configured by specific key elements. The following key ele- +ments must be set and marked as valid: +> CRYPTO_KE_KEYDERIVATION_PASSWORD + + This key element contains the secret key. +> CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL (optional) + + This key element contains the label. Length is variable. +> CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT (optional) + + This key element contains the context. Length is variable. +Optional key elements must be excluded, if they are not used. +The derived key is stored in the key element with id 1 of the given key. + + Note + If using CMAC AES, the length of the secret key (PASSWORD) determines + whether AES128 (16 bytes) or AES256 (32 bytes) is used as the CMAC cipher. + +2.1.2.6.4 Concatenation KDF + +The key derive API + +is used to perform the concatenation KDF (CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_ + +800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256) described in [11]. + +Preconditions: + +Before calling the API, the following key elements have to be set and must be marked as +valid: + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the private key. + +> CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO + This key element consists of the "Other Information" (specified by [11]) required for the + algorithm. It is only supported up to a length of 5 bytes for this algorithm. + +> CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY + This key element contains the public key needed for ECDH. + +2.1.2.6.5 ISO15118-2 Certificate Handling + +The key derive API is used to perform the key installation/update (CRYPTO_30_LIBCV_ +KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING) described in [12]. + +The ISO15118-2 certificate handling requires a validity check of the new ECC key pair spec- +ified in ISO15118-2 [12]. This check is currently not part of the implementation. To be +compliant to ISO15118-2, the validity of the ECC key pair needs to be checked by the caller. + +© 2025 Vector Informatik GmbH Version 14.09.04 26 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +To check if the ECC key pair is valid, the new key pair could be used for generating and +verifying a signature. + +Preconditions: + +Before calling the API, the following key elements have to be set and must be marked as +valid: + +> CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY + This key element is the new public part of the encrypted new private key and consists of + the concatenation of the two point coordinates. + pubKey(64 bytes) = X(32 bytes) | Y(32 bytes) + +> CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY + This key element consists of the concatenation of the IV and the encrypted new private + key. + Password(48 bytes) = IV(16 bytes) | ENC_PRIV(32 bytes) + +> CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY + This key element contains the public key needed for ECDH. + +Certificate Installation: + +A provisioning key must be present at the key identified by cryptoKeyId. This can be achieved +by setting the key element CRYPTO_KE_KEYDERIVATION_PASSWORD of cryptoKeyId with +a key pair with KeyElementSet(). The targetCryptoKeyId specifies the destination for the +key which shall be installed. + +Certificate Update: + +A contract key must be present at the key identified by cryptoKeyId. This can be achieved +by doing the certificate installation. The targetCryptoKeyId and cryptoKeyId are the same +during certificate update. + +2.1.2.6.6 ISO15118-20 Certificate Handling + +The key derive API is used to perform the contract key installation (CRYPTO_30_LIBCV_ +KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING) described in [21]. The im- +plementation supports both curves (SECP-521R1 and Curve448). The curve to use +is chosen based on the length of the key element CRYPTO_KE_CUSTOM_SCC_IV_AND_ +ENCRYPTED_PRIVATE_KEY. + +Preconditions: + +Before calling the API, the following key elements have to be set and must be marked as +valid: + +> CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY + This key element is the public counterpart of the encrypted contract private key. + > For curve SECP-521R1, it consists of the concatenation of the two point coordinates: + pubKeySECP-521R1(132 bytes) = X(66 bytes) | Y(66 bytes) + + > For Curve448, only one coordinate is used: + pubKeyCurve448(56 bytes) + +© 2025 Vector Informatik GmbH Version 14.09.04 27 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY + This key element consists of the concatenation of the IV, the encrypted contract private + key, and the corresponding tag value. + > PasswordSECP-521R1 (94 bytes) = IV(12 bytes) | ENC_PRIV(66 bytes) | TAG(16 bytes) + > PasswordCurve448 (84 bytes) = IV(12 bytes) | ENC_PRIV(56 bytes) | TAG(16 bytes) + +> CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD + This key element contains the concatenation of the PCID and the SKI. + AAD(variable size) = PCID | SKI + +> CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY + This key element contains the public key needed for ECDH/EDDH. + +Certificate Installation: + +A provisioning private key must be present at the key identified by cryptoKeyId. This can +be achieved by setting the key element CRYPTO_KE_KEYDERIVATION_PASSWORD of cryp- +toKeyId with KeyElementSet(). The targetCryptoKeyId specifies the destination for the +contract private key which shall be installed. The contract private key will be installed in the +key element CRYPTO_KE_KEYDERIVATION_PASSWORD of the target key. + +2.1.2.6.7 Key Derivation Function X9.63 + +The behavior of the key derivation algorithm CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_ +SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512 is configured by further +specific key elements. + +These elements are + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the secret key. + +> CRYPTO_KE_KEYDERIVATION_SALT (optional) + This key element contains the salt. + The salt key element needs to be excluded from configuration if it is not used. + +The derived key is stored in the key element with id 1 of the given key. + +2.1.2.6.8 Password-Based Key Derivation Function 2 + +The behavior of the key derivation algorithm CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_ +HMAC_SHA1 and CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256 is configured +by further specific key elements. + +These elements are + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the private key. + +> CRYPTO_KE_KEYDERIVATION_SALT + This key element contains the salt. + +> CRYPTO_KE_KEYDERIVATION_ITERATIONS + +© 2025 Vector Informatik GmbH Version 14.09.04 28 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + This key element contains the iterations counter. The key element must always be set + with 4 bytes. + +The derived key is stored in the key element with id 1 of the given key. + +2.1.2.6.9 HKDF HASH Option 1 Sha-256 / Sha-512 + +The behavior of the key derivation algorithms CRYPTO_30_LIBCV_KDF_ALGO_HKDF_ +OPTION1_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512 is con- +figured by further specific key elements. + +These elements are: +> CRYPTO_KE_KEYDERIVATION_PASSWORD + + This key element contains the private key. +> CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (optional) + + This key element contains the additional information. + +Optional key elements must be excluded, if they are not used. + +The derived key is stored in the key element with id 1 of the given key. + +2.1.2.6.10 HKDF HMAC Option 2 Sha-256 / Sha-384 + +The behavior of the key derivation algorithms CRYPTO_30_LIBCV_KDF_ALGO_HKDF_ +HMAC_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384 is config- +ured by further specific key elements. + +These elements are: +> CRYPTO_KE_KEYDERIVATION_PASSWORD + + This key element contains the private key. +> CRYPTO_KE_KEYDERIVATION_SALT (optional) + + This key element contains the salt. +> CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (optional) + + This key element contains the additional information. +> CRYPTO_KE_KEYDERIVATION_ITERATIONS + + This key element contains the number of steps: 1 (one step variant) or 2 (two step + variant) + +Optional key elements must be excluded, if they are not used. + +The derived key is stored in the key element with id 1 of the given key. + +2.1.2.6.11 HKDF Expand HMAC Option 2 Sha-256 / Sha-384 + +The HKDF Expand applies the key expansion step according to HKDF HMAC Option 2 Sha- +256 / Sha-384. The derivation algorithms CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_ +HMAC_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384 are +configured by further specific key elements. + +© 2025 Vector Informatik GmbH Version 14.09.04 29 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +These elements are: + +> CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the pseudorandom key (usually, the output from the extract + step). + +> CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (optional) + This key element contains the additional information. + +2.1.2.6.12 Spake2+ Preamble + +The Spake2+ Preamble (CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1) de- +rives w0, w1 and L from a previously derived secret e.g. with the PBKDF. The lengths of +the values is determined by the used curve, see Section 2.1.4. The used key elements are +described in the following. All values mentioned are in Bytes. + +> Source Key + > CRYPTO_KE_KEYDERIVATION_PASSWORD + This key element contains the concatenation of w0s and w1s. + password = [ w0s | w1s ] + w0s and w1s each have the lengths of the curve's group order nlength: + sizeof(password) = 2 · nlength + +> Target Key + > CRYPTO_KE_CUSTOM_W0 + This key element contains the derived w0. + sizeof(w0) = nlength + + > CRYPTO_KE_CUSTOM_W1 + This key element contains the derived w1. + sizeof(w1) = nlength + + > CRYPTO_KE_CUSTOM_L + This key element contains the derived L. + sizeof(L) = ( 2 · nlength ) + 1 + +2.1.2.7 Key Exchange + +The KEA to use is specified by the algorithm key element (CRYPTO_KE_KEYEXCHANGE_ +ALGORITHM) of the used parent key. + +The following values can be configured: + +ID Name Value +1 CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519 0u +2 CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1 1u +3 CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1 2u +4 CRYPTO_30_LIBCV_KEY_EXCHANGE_NISTP224R1_BD 3u +5 CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1 4u + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 30 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.14 – continued from previous page Value + ID Name 5u + 6 CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8 6u + 7 CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8_1 7u + 8 CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP521R1 8u + 9 CRYPTO_30_LIBCV_KEY_EXCHANGE_X448 9u + 10 CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_BD 10u + 11 CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1 +Table 2.14 Values for Key Exchange Algorithm Key Element + +The public key for p224r1, p256r1, p384r1 and p521r1 is stored in a special format like +described in Table 2.6. + +2.1.2.7.1 Elliptic Curve Diffie-Hellman + +The shared secret is stored into the CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE key ele- +ment. The format in which the shared secret is stored depends on the size of the key +element as shown in Table 2.15: + +Shared Value Key Element Size Shared secret format Partial Access necessary + Yes +> 2 · sizeof(private key) x-coordinate | y-coordinate No + Yes += 2 · sizeof(private key) x-coordinate | y-coordinate + No +< 2 · sizeof(private key) AND x-coordinate +> sizeof(private key) + += sizeof(private key) x-coordinate + +Table 2.15 Size of Shared Secret depending on Key Element Size + +2.1.2.7.2 Spake2+ +The module supports one cipher suite of the Spake2+. + +Suite G Hash KDF Mac + HKDF HMAC SHA2-256 CMAC AES128 +8 SECp256r1 SHA2-256 + +Table 2.16 Spake2+ Cipher Suites + +The key element usage is shown in the following table. All mentioned sizes are in Bytes. The +key element sizes are related to the used elliptic curve whose parameter sizes are shown in +Section 2.1.4. + +Key Element PartyA PartyB Operation Info +CRYPTO_KE_CUSTOM_W0 + X X PubVal Contains w0. + + size = nlength + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 31 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Key Element Table 2.17 – continued from previous page + PartyA PartyB Operation Info + +CRYPTO_KE_CUSTOM_W1 X E PubVal Contains w1. +CRYPTO_KE_CUSTOM_L + size = nlength + + O X PubVal Contains L. + + size = 2 · plength + 1 + +CRYPTO_KE_CUSTOM_ O O Secret1 Contains additional +ADDITIONAL_INFO + information. + +CRYPTO_KE_KEYEXCHANGE_ X X Secret1 Contains the shared value. + +SHAREDVALUE size = Hashlength ÷ 2 + +CRYPTO_KE_CUSTOM_ X X Secret1 Contains the own +VERIFICATION + verification MAC. + + size = MAClength + +CRYPTO_KE_CUSTOM_ X X Secret2 Contains the verification +VERIFICATION_RESULT + result. + + size = 1 + +Table 2.17 Spake2+ Key Element Usage + +X: Required +O: Optional key element. The key element must be excluded, if it is not used. +E: Must be Excluded + +The length of the key element values is determined by the used algorithm: e.g. Elliptic +Curves, SHA2-256 = 32 Bytes and CMAC-AES-128 = 16 Bytes. + +The existence of the key element CRYPTO_KE_CUSTOM_W1 is used to determine if the in- +stance is Party A or Party B. + +The key element CRYPTO_KE_CUSTOM_ADDITIONAL_INFO can contain the additional in- +formation for Info A, Info B and AAD. If the key element is used all information are optional +but at least the length must be set for each information. + +Info = [ A-Length (4 Bytes) | A-Data (Length Bytes) + | B-Length (4 Bytes) | B-Data (Length Bytes) + | AAD-Length (4 Bytes) | AAD-Data (Length Bytes)] + +The Spake2+ Sequence is shown in the following Figure 2.1. The key confirmation step is +optional. + +© 2025 Vector Informatik GmbH Version 14.09.04 32 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +PartyA PartyB + sd Spake2+ + opt Calc Preamble CalcPubVal() + [e.g. PBKDF]:KeyDerive() CalcSecret(PartnerPubVal) + + [Spake2+ Preamble]:KeyDerive() + + SharePreamble() + + par Calc Public + CalcPubVal() + + SharePublic() + SharePublic() + + par Calc Secret + CalcSecret(PartnerPubVal) + +par Confirmation (optional) CalcSecret(PartnerConfirmation) + ShareConfirmation() + ShareConfirmation() + CalcSecret(PartnerConfirmation) + + PartyA PartyB +Figure 2.1 Spake2+ Control Sequence + +© 2025 Vector Informatik GmbH Version 14.09.04 33 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Caution + The Spake2+ uses a long term workspace for the calculation, see Section 2.1.3.4 + for more information. + The long-term workspace will be locked with the call of CalcPubVal and will be + released after the second call to CalcSecret (Verification). + To free the long-term workspace if the verification phase is not used, call the + verification phase with valid input lengths and ignore the result. + The long-term workspace will also be released if there are internal errors while + execution e.g. if the partner public value is invalid, but not if there are execution + errors like a DET. + + Note + The Spake2+ provides two variants of each cipher suite e.g. 8 and 8_1. The + normal one, as specified in [19], is 8 and the one with the mode 1 (8_1) switches + the verification keys, but otherwise uses the same functions as specified in the + cipher suite in [19]. See [15] for more information. + Cipher suite 8 = ESL_SPAKE2P_MODE_CIPHERSUITE_8_1 + Cipher suite 8_1 = ESL_SPAKE2P_MODE_CIPHERSUITE_8_2 + +2.1.2.7.3 Elliptic Curve Burmester Desmedt + +The module supports the Elliptic Curve Burmester Desmedt (ECBD) protocol. The ECBD +protocol is a multi-party key agreement protocol which is implemented using Crypto_ +KeyExchangeCalcPubVal and Crypto_KeyExchangeCalcSecret. The key element +sizes are related to the used elliptic curve whose parameter sizes are shown in Section +2.1.4. + + Caution + The ECBD protocol uses a long-term workspace for the calculation, see Section + 2.1.3.4 for more information. + The long-term workspace will be locked with the call to CalcPubVal and will be + released after the last call to CalcSecret. + The long-term workspace will also be released if there are internal errors while + execution e.g. if the partner public value is invalid, but not if there are execution + errors like a DET. + To restart the protocol, the protocol must either be completed, failed or the public + value calculation (after round 2) must be finished. + If the protocol shall be restarted after first round of public value calculation, call + CalcSecret with valid parameters to unlock the workspace. Ignore the return + value for this operation. After this, the protocol can be started again. + +© 2025 Vector Informatik GmbH Version 14.09.04 34 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Note +The shared secret is stored into the key element CRYPTO_KE_KEYEXCHANGE_ +SHAREDVALUE. The format in which the shared secret is stored depends on the +size of the key element as shown in Table 2.15. All mentioned sizes are in Byte. + +Key Element Operation Info +CRYPTO_KE_CUSTOM_KEYEXCHANGE_NUM_ECU + PubVal Total number of ECU's must + Round 1 be set. + size = 1 +CRYPTO_KE_CUSTOM_KEYEXCHANGE_ECU_ID PubVal + Round 1 ID of the own ECU must be + set. +CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY PubVal size = 1 + Round 1 +CRYPTO_KE_KEYEXCHANGE_PRIVKEY Own public value is set. + PubVal size = 2 · plength +CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_ Round 1 +PUB_KEY Own private value is set. + PubVal size = nlength + Round 2 + Left partner public value must +CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_ PubVal be set. + size = 2 · plength +PUB_KEY_2 Round 2 + Right partner public value +CRYPTO_KE_CUSTOM_KEYEXCHANGE_ PubVal must be set. +INTERMEDIATE Round 2 size = 2 · plength + + CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE Secret Own intermediate value is +Table 2.18 ECBD Key Element usage Round 3 set. + size = 2 · plength + + Shared value is set. + (variable, see Table 2.15) + +The protocol requires 3 or more nodes. The protocol consists of 3 rounds. + +> Round 1: Each node + > chooses a private key + + > computes a public key + + > broadcasts the public key to the left and right nodes + +> Round 2: Each node + > computes an intermediate key (second public key) depending on the received left and + right partner public keys + + > broadcasts the intermediate key to all other nodes + +> Round 3: Each node + > computes the common secret depending on all intermediate values + + > Note: CalcSecret needs to be called for each incoming intermediate value. + +© 2025 Vector Informatik GmbH Version 14.09.04 35 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +The public values which are given to CalcSecret need to contain the partner's ECU ID and +the partner's intermediate value (Sizes in Byte): + +publicValue = [ EcuId | Intermediate value ] +sizeof(EcuId) = 1 +sizeof(Intermediate Value) = 2 · plength + +LeftNode MyNode RightNode + par Round 1 + CalcPubVal() Crypto_KeyExchange CalcPubVal() + CalcPubVal(OwnPubVal) + + BroadcastsPublic() BroadcastsPublic() + +par Round 2 BroadcastsPublic() CalcIntermediate() + BroadcastsPublic() + Crypto_KeyExchange + CalcIntermediate() CalcPubVal + (OwnIntermediate) + + Broadcasts Broadcasts + Intermediate() Intermediate() + +LeftNode MyNode RightNode + +Figure 2.2 Control Sequence Round 1 and 2 + +© 2025 Vector Informatik GmbH Version 14.09.04 36 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + LeftNode MyNode RightNode + + par Round 3 + + Broadcasts + Intermediate() + + Crypto_KeyExchange + CalcSecret(Intermediate) + + Broadcasts + Intermediate() + + Crypto_KeyExchange + CalcSecret(Intermediate) + + The secret is calculated CalcSecret() + if the last intermediate + value is forwarded to + Crypto_KeyExchangeCalcSecret() + + CalcSecret() + + LeftNode MyNode RightNode + +Figure 2.3 ECBD Control Sequence Round 3 + +2.1.2.8 Key Generate + +The Key Generate Algorithm (KGA) to use is specified by the algorithm key element +(CRYPTO_KE_KEYGENERATE_ALGORITHM) of the used parent key. + +The following values can be configured: + +ID Name Value + 0u +1 CRYPTO_30_LIBCV_KEY_GENERATE_SYMMETRIC 1u + 2u +2 CRYPTO_30_LIBCV_KEY_GENERATE_P256R1 3u + 4u +3 CRYPTO_30_LIBCV_KEY_GENERATE_P384R1 5u + continues on next page +4 CRYPTO_30_LIBCV_KEY_GENERATE_ED25519 + +5 CRYPTO_30_LIBCV_KEY_GENERATE_P521R1 + +6 CRYPTO_30_LIBCV_KEY_GENERATE_SM2P256V1 + +© 2025 Vector Informatik GmbH Version 14.09.04 37 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.19 – continued from previous page Value + ID Name +Table 2.19 Values for Key Generate Algorithm Key Element + +For symmetric key generation the target key length will be determined by the configured key +element length. To generate keys with different sizes, it is required to configure different keys +with the required key element size. The key will be generated in the key element with the +id CRYPTO_KE_KEYGENERATE_KEY. The function esl_getBytesRNG is used to provide +random data for the key generation service. + +For elliptic curve key generation, the private key will be generated in the key element +with the id CRYPTO_KE_KEYGENERATE_KEY and the public key in the element with the id +CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY. The public Key for p256r1, p384r1, p521r1 and +sm2p256v1 is stored in a special format like described in Table 2.6. + +For Ed25519 key generation, the private key is generated in the key element with the identi- +fier CRYPTO_KE_KEYGENERATE_KEY and the public key is generated in the element with the +identifier CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY. Both key elements must be 32 bytes +long. + +2.1.2.9 Key Wrap and Key Unwrap + +Generally, key wrapping is also called key encryption, since key material is being encrypted. +Key wrapping belongs to the symmetric encryption algorithms. The following graphic shows +a key (un-)wrapping mechanism. For both, key wrapping and unwrapping, a key encryption +key, also called key wrapping key is needed. Like for ciphers, this key is used to encrypt/ +decrypt data, with the difference, that the data to encrypt/decrypt is key material. + +Figure 2.4 Key Wrap and Unwrap mechanism + +© 2025 Vector Informatik GmbH Version 14.09.04 38 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.2.9.1 AES Key Wrap/Unwrap + +There are two types of keys needed: + +> The key encryption key (KEK), also called key wrapping key. The associated key + element has id CRYPTO_KE_CIPHER_KEY. This key length determines the AES variant. + E.g. for KEK length of 16 bytes, Key Wrap/Unwrap AES128 is used. For KEK length of + 24 bytes, Key Wrap/Unwrap AES192 is used. For KEK length of 32 bytes, Key + Wrap/Unwrap AES256 is used. Note: The name for the key element id + CRYPTO_KE_CIPHER_KEY was chosen as such, since the purpose of this key is to + encrypted another given key, like one does when using a cipher. + +> The key that one likes to wrap/unwrap. The associated key element has id + CRYPTO_KE_KEYWRAP_KEY. + +Before calling the module to process a CRYPTO_SERVICE_KEYWRAP or CRYPTO_SERVICE_ +KEYUNWRAP job, the key encryption keyElement (CRYPTO_KE_CIPHER_KEY) shall be set to +its desired value and the referenced key shall be set valid. + +AES Key Wrap: + +> For AES Key Wrap all input pointers remain empty. +> The Id of the KEK is provided by cryptoKeyId. +> The Id of the plaintext key (the key to be wrapped) is provided by targetCryptoKeyId. +> The wrapped key is then referenced in the job's outputPointer. + +AES Key Unwrap: + +> For AES Key Unwrap the input pointer references the wrapped key. +> The Id of the KEK is provided by cryptoKeyId. +> The Id of the plaintext key (the unwrapped key) is provided in the targetCryptoKeyId. + +For both, key wrap and key unwrap the AUTOSAR specification allows the usage of a so +called authenticator [25], which is an optional parameter and not used by the current im- +plementation. The default initial value [24] is used. For AES Key Wrap, it is still mandatory +to have a valid (not a NULL_PTR) secondary output pointer and secondary output length +pointer (length is 0). For AES Key Unwrap, the secondary input pointer can be a NULL_ +PTR. CRYPTO_KE_KEYWRAP_HEADER is not used for the primitive. + + Caution + When unwrapping a key, the data shall only considered valid if ProcessJob has + returned E_OK and the verifyPtr is CRYPTO_E_VER_OK. + +Note +Both primitives are only available in CRYPTO_OPERATIONMODE_SINGLE- +CALL! + +© 2025 Vector Informatik GmbH Version 14.09.04 39 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.3 Crypto Job Processing +The module supports the processing of crypto jobs as defined in AUTOSAR [1]. + +2.1.3.1 Required Job Input/Output Data +The module requires the following input/output data (Table 2.20 and Table 2.21) for the dif- +ferent job modes. This is a deviation to AUTOSAR [1]. If the configuration parameter Cryp- +toDevErrorDetection is set to true, the module will also check the job input/output data +according to these tables. + + Member input Ptr + input Length +Service secondary InputPtr + secondary InputLength + tertiary InputPtr + tertiary InputLength + mode + +HASH UC U~C SUFC + +MACGENERATE UC U~C SUFC + +MACVERIFY UC U~C F F SUFC + +ENCRYPT UC UC SUFC + +DECRYPT UC UC SUFC + +AEADENCRYPT UC U~C V U~ SUFC + +AEADDECRYPT UC U~C V U~ F F SUFC + +SIGNATUREGENERATE UGC UF~C SUFC + +SIGNATUREVERIFY UGC UF~C F F SUFC + +SECCOUNTERINCREMENT SUF + +SECCOUNTERREAD SUF + +RANDOMGENERATE SUFC + +RANDOMSEED F F SUF + +KEYGENERATE SUF + +KEYDERIVE SUF + +KEYEXCHANGECALCPUBVAL SUF + +KEYEXCHANGECALCSECRET F F SUF + +KEYSETVALID SUF + +KEYSETINVALID SUF + +KEYWRAP SUF + +KEYUNWRAP F F ~G ~G SUF + +Table 2.20 Overview of the required algorithm INPUT parameter + +S: member required in Start mode. + +© 2025 Vector Informatik GmbH Version 14.09.04 40 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +U: member required in Update mode. +V: member optional in Update mode. +F: member required in Finish mode. +C: member required for Context Save/Restore operation. +G: member optional in Finish mode. +~: no Det check required / 0 is a valid value. (U~, F~) + + Member output Ptr + output Length +Service secondary OutputPtr +HASH secondary OutputLength +MACGENERATE Verify Ptr +MACVERIFY Output 64Ptr +ENCRYPT +DECRYPT FC FC +AEADENCRYPT +AEADDECRYPT FC FC +SIGNATUREGENERATE +SIGNATUREVERIFY C C F +SECCOUNTERINCREMENT F +SECCOUNTERREAD UFC UFC +RANDOMGENERATE F +RANDOMSEED UFC UFC F +KEYGENERATE +KEYDERIVE UFC UFC F F +KEYEXCHANGECALCPUBVAL +KEYEXCHANGECALCSECRET UFC UFC continues on next page +KEYSETVALID +KEYSETINVALID FC FC 41 + + C C + + FC FC + + F F + +© 2025 Vector Informatik GmbH Version 14.09.04 + Technical Reference MICROSAR Classic Crypto_30_LibCv + Table 2.21 – continued from previous page + + Member output Ptr + output Length +Service secondary OutputPtr + secondary OutputLength + Verify Ptr + Output 64Ptr + +KEYWRAP F F ~F ~F + +KEYUNWRAP F + +Table 2.21 Overview of the required algorithm OUTPUT parameter + +S: member required in Start mode. +U: member required in Update mode. +V: member optional in Update mode. +F: member required in Finish mode. +C: member required for Context Save/Restore operation. +G: member optional in Finish mode. + + Caution + For signature generation and verification there is a special handling for input data. + If the signature uses a pre-hashing, the input data can only be processed in + update mode. + Input data provided in finish mode will be ignored if pre-hashing is used. + If no pre-hashing is used, the input data can only be processed in finish mode + + Note + Some services (e.g. Hash) allow processing data of zero length (inputLength = + 0). In these cases the inputPtr must still be a valid pointer (non-null-pointer). See + Table 2.20 for the exact services. + +© 2025 Vector Informatik GmbH Version 14.09.04 42 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Caution +The following algorithms are only support operations mode CRYPTO_OPERA- +TIONMODE_SINGLECALL. +> SHE CMD_GET_ID +> AEAD AES CCM +> SLH-DSA Verify Pure +> Key Wrap AES, Key Unwrap AES + +Note +LibCV can only process inputs and outputs of a maximum length of uint16 max +value. This includes primary, secondary and tertiary input pointers as well as +primary and secondary output pointers. + +2.1.3.2 Driver Objects and Jobs + +The module supports multiple driver objects. Each driver object has its own workspace. Al- +gorithms share this workspace so that the size of the workspace depends on the configured +algorithm with the highest RAM usage (e.g. RSA). + +As soon as a job is started on a driver object for one algorithm, driver object is locked and +therefore busy for another algorithm. If it is necessary to execute another job in between, a +further driver object can be created and used for this job. As mentioned above, each driver +object has its own workspace and can therefore be used to execute jobs parallel. + + Caution + Jobs shall be owned and called by a single context (e.g. task) since the driver + cannot distinguish different callers of a job. Ensure that a job is only called once + at a time. + +2.1.3.3 Save and Restore Context + +The save context and restore context [5] is a mode to interrupt the streaming +mode after start or update to continue it again later. The workspace is provided +in save mode and inserted again in restore mode. The customer has the op- +tion to output the workspace encrypted or in plain text, this is possible via the call- +outs Appl_Crypto_30_LibCv_SaveContextCallout and Appl_Crypto_30_LibCv_ +RestoreContextCallout (specified in Section 4.4). To export the data a valid buffer with +a valid length is required, the buffer should be at least as long as the context. In restore +mode the same length of the context is expected therefore the length of the exported data +must be equal to the imported data. Redirection is ignored for save and restore context +modes. + +© 2025 Vector Informatik GmbH Version 14.09.04 43 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +Save and restore context can only be configured per primitive for all driver objects and not +per primitive and driver object. + + Note + This functionality can be activated by enabling /MICROSAR/Crypto_ + 30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/ + CryptoPrimitiveSupportContext + +Save Context +A call to save the context is possible after the start or update mode, a failed save call does +not change the job status, therefore the job can continue without any restrictions. After a +save call the job can be ended with Finish Job to start a new job, the finish call does not +have to be successful, even a failed finish call is sufficient. + + Note + The required buffer size is determined by the used algorithm workspace. For + some algorithm only a subset of the workspace is saved and restored. To obtain + the correct length of the separate workspace, a call with output length zero is ex- + pected. The return value is set to E_NOT_OK and the output length is overwritten + with the required buffer length. + + Note + A call to save the context is not possible if output redirection was used for the + start or update mode. + +Restore Context + +A restore context call is possible at any time as long as the driver object is not locked by +another job. After resetting the workspace, it is possible to restart the job with the restore +context mode and continue with the update mode. For Signature Generate primitive, the +signature key must be re-set for the key to be valid. After a failed restore operation, the job +must be restarted because the workspace may have been overwritten + + Caution + The workspace context is provided as plaintext to the callouts Appl_ + Crypto_30_LibCv_SaveContextCallout and Appl_Crypto_30_LibCv_ + RestoreContextCallout (specified in Section 4.4). The workspace context + contains cryptographic content e.g. keys, so the user should keep this data se- + cure. This can be ensured e.g. by encryption of the content which can be imple- + mented in the callouts. + +© 2025 Vector Informatik GmbH Version 14.09.04 44 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Caution + The workspace context is exported and imported and must be protected for + changes. The data integrity can be ensured e.g. by using CRC which can be + implemented in the callouts. + +2.1.3.4 Long-Term Workspace +The module supports long-term workspaces. These workspaces are required for algorithms +which are executed over several service calls: +> Spake2+ Key Exchange +> ECBD Key Exchange +The long-term workspace will be locked at the start of the algorithm sequence and will be +released at the end of the sequence. In some cases the workspace will be released if an +error occurs. + + Caution + The long-term workspace uses the cryptoKeyId for the locking mechanism. Each + cryptoKeyId can only lock one long-term workspace. + If a service is restarted before the long-term workspace is released, the same + workspace will be used. + Due to this behavior it must be prevented that there are requests for the same + cryptoKeyId at the same time. + + Note + The number of long-term workspaces can be determined by the use case. Useful + information is: + > The number of keys which use long term workspaces + > The number of parallel requests + If all long-term workspaces are in usage the service will return with CRYPTO_E_ + BUSY. + +2.1.3.5 Verification Jobs + +Before starting a job which includes a verification (MACVERIFY, AEADDECRYPT, SIGNA- +TUREVERIFY, KEYUNWRAP), the user shall set the verification result pointer to CRYPTO_ +E_VER_NOT_OK. + +The verification is considered correct only if the return value of the job is equal to E_OK and +the verification result pointer is equal to CRYPTO_E_VER_OK. All other combinations shall be +interpreted as failed verification. + +© 2025 Vector Informatik GmbH Version 14.09.04 45 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.4 Elliptic Curves + +The following Table 2.22 shows information for the supported elliptic curves. The curves +which are listed in a common table entry use the same coefficients. + +Curve Name Field prime byte length (plength) Group order byte length + (nlength) +SECp160r1 20 Byte 21 Byte (161 Bit) + 28 Byte +SECp224r1 28 Byte +NIST P-224 32 Byte + +SECp256r1 32 Byte 32 Byte +NIST P-256 48 Byte +ANSI Prime256v1 + 66 Byte +Sm2p256v1 32 Byte + +SECp384r1 48 Byte +NIST P-384 + +SECp521r1 66 Byte +NIST P-521 + +Table 2.22 Elliptic Curve Parameter Length + +2.1.5 Secure Hardware Extension + +The module has the ability to update a key element by using a simplified SHE [8]. The +simplified protocol does not support all SHE features. The module provides load key, load +plain key, export RAM key, CMD_GET_ID and the CMD_DEBUG. The keys will be hold as +plaintext in the module. The NvM can be encrypted by user. + +Caution +SHE functionality must only be used on the configured main partition. + +2.1.5.1 Key Flags + +The module supports the following key flags (FID). The initial value for the FID is 0. The key +flags are hidden in the module's configuration of the SHE keys and cannot be configured. +The keys can only be set by an update of the SHE key. The flags are included in the M2. +For more information see [8]. + +> WRITE PROTECTION + If the flag is set to '1' the SHE key cannot be written anymore. + +> BOOT PROTECTION + If the flag is set to '1' the key cannot be used if the Boot process is not finished. + +> DEBUGGER PROTECTION + If the flag is set to '1' the key cannot be used if a Debugger is attached. + +> KEY USAGE + If the flag is '1' the key can be used for CMAC otherwise for enc- and decryption. + +© 2025 Vector Informatik GmbH Version 14.09.04 46 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> WILDCARD + If the flag is '1' the wildcard cannot be used within M1 for SHE key update. + +> CMAC USAGE + This flag is only checked if KEY USAGE is '1' otherwise it shall be '0', If the flag is set the + key can only be used for CMAC verification. (Additional to the SHE standard) + +Table 2.23 and Table 2.24 show the usage of the key flags. + + FID WRITE PROTECTION + BOOT PROTECTION +SHE Key DEBUGGER PROTECTION +SECRET_KEY KEY USAGE +MASTER_ECU_KEY WILDCARD +BOOT_MAC_KEY CMAC USAGE +BOOT_MAC Counter +KEY_{n} +RAM_KEY_{Page} X* X* +Table 2.23 FID Usage of SHE Keys + X X X X X + + X X X X + + X X X X + + X X X X X X X + +X* use flags from master key + +For key usage, the counter is not checked. If the key is valid (e.g. set by the user), it can be +used. + + FID WRITE PROTECTION + BOOT PROTECTION + Service DEBUGGER PROTECTION + Decrypt KEY USAGE + Encrypt WILDCARD + Mac Generate CMAC USAGE + Mac Verify Counter + +© 2025 Vector Informatik GmbH X X + + X X + + X X X X + + X X X X + + continues on next page + + Version 14.09.04 47 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.24 – continued from previous page + +KeyElementSet X X X X X + +KeyElementGet X* X* +Table 2.24 Relevance of FIDs for the Services + +* Read Access Rights are checked as well + +2.1.5.2 Load SHE Key +The SHE update implementation allows up to 255 SHE pages with up to 10 User and 1 RAM +key per page. Secret key, Master key, Boot key as well as Boot Mac key are only allowed to +exist on Page 0. This is illustrated in the following Table 2.25. + + SHE Key SHE Id Page + SECRET_KEY 0 0 + MASTER_ECU_KEY 1 0 + BOOT_MAC_KEY 2 0 + BOOT_MAC 3 0 + KEY_1_PAGE_M 4 M + KEY_2_PAGE_M 5 M + KEY_3_PAGE_M 6 M + KEY_4_PAGE_M 7 M + KEY_5_PAGE_M 8 M + KEY_6_PAGE_M 9 M + KEY_7_PAGE_M 10 M + KEY_8_PAGE_M 11 M + KEY_9_PAGE_M 12 M + KEY_10_PAGE_M 13 M + RAM_KEY_PAGE_M 14 M +Table 2.25 SHE Key Mapping + +Before updating a SHE key, the corresponding update rights must be checked. The key +rights depend on the used key and the used service. The dependencies are shown in Table +2.26 and Table 2.27. + + Authentication Key SECRET_KEY + MASTER_ECU_KEY +Update Key BOOT_MAC_KEY +SECRET_KEY BOOT_MAC + KEY_{n} + RAM_KEY{Page} + +© 2025 Vector Informatik GmbH Version 14.09.04 continues on next page + + 48 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.26 – continued from previous page + +MASTER_ECU_KEY X + +BOOT_MAC_KEY X X + +BOOT_MAC X X + +KEY_{n} X X + +RAM_KEY_{Page} X X* + +Table 2.26 SHE Key Update Rights + +X* only keys on the same SHE page + + SHE Key SECRET_KEY + MASTER_ECU_KEY +Service BOOT_MAC_KEY + BOOT_MAC + KEY_{n} + RAM_KEY_{Page} + +Decrypt X° X + +Encrypt X° X + +Mac Generate X° X + +Mac Verify X X° X + +KeyElementSet X° X° X° X° X + +Authentication Key X X X X + +KeyElementGet* X* X* X* X* X* X*^ + +CMD_DEBUG X + +CMD_GET_ID X + +Table 2.27 SHE Key Service Usage + +* Read Access Rights allow reading / Key will be provided as plaintext key. +° Depends on the FID. +^ Read Access Rights only allows encrypted reading / Key will be provided as encrypted key. + +2.1.5.3 Load SHE Plain Key + +In addition to other SHE keys, the RAM key can be either loaded in an encrypted manner +as specified in Section 2.1.5.2 or as plaintext key. Therefore, the write access right needs +to be WA_ALLOWED. If the access is set to WA_ALLOWED, the RAM key can still be loaded +encrypted. + +© 2025 Vector Informatik GmbH Version 14.09.04 49 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.5.4 Export SHE RAM Key + +The module supports to export SHE RAM keys. A key can be exported via Crypto_30_ +LibCv_KeyElementGet. The service provides M1-M3 for a request with a 64-byte buffer +and M1-M5 for a 112-byte buffer. The SHE RAM key can only be exported if it was set as +plaintext. To export the key, the read access right needs to be RA_ENCRYPTED. The Secret +Key is required for the export. + +2.1.5.5 SHE DEBUG_CMD + +The SHE Debug Command allows to set the SHE back to an initial state. The command +deletes the current keys and restores the initial values. The command is executed on the +SHE key and in the additionally configured debug command keys. This is only possible if +none of these keys are write-protected. + +> Get Challenge via + KeyElementGet(SHE-Info-Key, CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD) + > This service checks if it is allowed to execute the DEBUG_CMD. + +> Set Authorization via + KeyElementSet(SHE-Info-Key, CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD) + > This service verifies the Authorization and set SHE to initial state. + +2.1.5.6 SHE CMD_GET_ID + +The SHE Get ID command returns the identity (UID) and the value of the status register +protected by a MAC over a challenge and the data. If MASTER_ECU_KEY is empty, the +returned MAC is set to 0. The primitive job is called as Mac generate job. There is a pre +configuration for the SHE command get id job in the BSWMD. + +> The challenge must be set in the input pointer with a length of 16 bytes +> The crypto key ID must be set to SHE master key and must also be valid +> The output pointer must have a length of 32 bytes + +The output contains the following information: + +Output = [ 15 bytes UID | 1 byte STATUS | 16 bytes CMAC ] + +2.1.5.6.1 SHE STATUS + +The SHE status can be determined by SHE CMD_GET_ID. Only the status of the boot pro- +tection and debugger protection is checked. + +Bit Name Description + +0 BUSY Not supported + +1 SECURE_BOOT Not supported + +2 BOOT_INIT Not supported + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 50 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.28 – continued from previous page + +Bit Name Description + +3 BOOT_FINISHED The bit is set when the secure booting has been finished by determining + + CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION. See Section 2.1.5.7 + +4 BOOT_OK The bit is set when the secure booting has been finished by determining + CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION. See Section 2.1.5.7 + +5 RND_INIT Not supported + +6 EXT_DEBUGGER The bit is set if an external debugger is connected to the chip, this is + + determined by CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION. + + See Section 2.1.5.7 + +7 INT_DEBUGGER Not supported + +Table 2.28 SHE Status Flags + +2.1.5.7 SHE Preconditions + +If a key shall be updated using the SHE Key Update Protocol the + +2.1.5.7.1 SHE Key + +> Access Rights have to be + > WA_ENCRYPTED for SHE key + > WA_ALLOWED and RA_ENCRYPTED for SHE RAM key + +> Key material must be a 64 byte long concatenated M1|M2|M3 message. +> The SHE key element needs to be configured with the size of 16 bytes. +> If M4 and M5 are needed, the 'proof' key element must be of size 48 bytes. If the 'proof' + + key element is not present, the SHE Key Update will be performed without calculating + the proof. +> Enable check of FID. + If the check is disabled, all flags will be interpreted as 0. +> Enable check of Counter. + If the check is disabled, the counter will be ignored. If the counter is enabled the SHE + key needs the CRYPTO_KE_CUSTOM_SHE_COUNTER key element, otherwise it can be + excluded from configuration. The CRYPTO_KE_CUSTOM_SHE_COUNTER key element + must be 4 bytes of size with an initialization value. + +2.1.5.7.2 SHE Info Key + +The SHE info key holds the information for UID, Debugger- and Boot-Protection. + +> UID + If the UID is used the key element CRYPTO_KE_CUSTOM_SHE_UID must be configured + with a size of at least 15 bytes. + +> Debugger-Protection + If the Debugger-Protection is used the key element + CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION must be configured with the size + +© 2025 Vector Informatik GmbH Version 14.09.04 51 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + of 1 byte. Otherwise it can be excluded from configuration. Setting this key element to + 0x01u means that no debugger is attached and the keys with set Debugger-Protection + will be accessible. Any other value will restrict the usage. + +> Boot-Protection + If the Boot -Protection is used the key element + CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION must be configured with the size of 1 + byte. Otherwise it can be excluded from configuration. Setting this key element to 0x01u + means that the boot process is interpreted as passed and the keys with Boot-Protection + will be accessible. Any other value will restrict the usage. + + Caution + The keys with Debugger- and Boot-Protection will be hold in RAM but will not be + usable if the access protection is activated. The access protection is never set by + the module itself, so corresponding key elements need to be set by the integrator + getting this information from the hardware. + SHE Keys cannot be copied or exported. + +Expert Knowledge +SHE Keys with an initialization value are not set to valid during initialization like it +is done for normal keys. + +2.1.5.8 SHE Error Code Mapping + +This chapter is only a conceptual guide to the mapping of the error codes. Some Crypto_ +Services may only return a subset of the given errors and the mapping is limited accordingly. + +SHE Error Code Service Error Code Description +ERC_NO_ERROR +ERC_SEQUENCE_ERROR E_OK +ERC_KEY_NOT_AVAILABLE + E_NOT_OK, CRYPTO_E_BUSY +ERC_KEY_INVALID + E_NOT_OK, +ERC_KEY_EMPTY CRYPTO_E_KEY_NOT_VALID + +ERC_NO_SECURE_BOOT E_NOT_OK, +ERC_KEY_WRITE_PROTECTED CRYPTO_E_KEY_NOT_VALID + +ERC_KEY_UPDATE_ERROR E_NOT_OK, +ERC_RNG_SEED CRYPTO_E_KEY_NOT_VALID + + - + + CRYPTO_E_KEY_WRITE_FAIL, + E_NOT_OK + + E_NOT_OK + + CRYPTO_E_ENTROPY_EXHAUSTION, + CRYPTO_E_KEY_NOT_VALID + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 52 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +SHE Error Code Table 2.29 – continued from previous page Description +ERC_NO_DEBUGGING Service Error Code +ERC_BUSY - CRYPTO is busy. + CRYPTO_E_BUSY Driver Object or Key + is already used for + an other operation. + + ERC_MEMORY_FAILURE - + ERC_GENERAL_ERROR E_NOT_OK +Table 2.29 ERC Mapping + +2.1.6 Key Usage +To simplify the key usage this section describes some basic aspects. + +Note +The callouts Crypto_30_LibCv_KeyValueChangedCallout and Crypto_ +30_LibCv_KeyValiditySetCallout (specified in Section 4.4) are not called +if keys are set to their initial value. The keys are set to their initial values during +start-up or initialization of the NvM blocks. + +2.1.6.1 Key Length + +Even if the length of the key is designed as uint32 in [1], the max key length is restricted to +a value of 65535 (uint16 max value) due to internal limitations. + +2.1.6.2 Custom Key Elements + +There are custom key elements defined, which are used to fulfill the algorithm requirements. +These custom elements are defined in the Crypto_30_LibCv_Custom.h which need to be +included in the Csm, e.g. via CsmCustomIncludeFiles. + +Custom Key Element Value +CRYPTO_KE_CUSTOM_MAC_AES_ROUNDKEY 129u +CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL 130u +CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO 131u +CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT 3061u +CRYPTO_KE_CUSTOM_RSA_MODULUS 160u +CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT 161u +CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT 162u +CRYPTO_KE_CUSTOM_RSA_SALT 163u +CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH 164u +CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY 3003u + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 53 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.30 – continued from previous page Value + Custom Key Element 3004u + CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY_2 3005u + CRYPTO_KE_CUSTOM_KEYEXCHANGE_INTERMEDIATE 3006u + CRYPTO_KE_CUSTOM_KEYEXCHANGE_NUM_ECU 3007u + CRYPTO_KE_CUSTOM_KEYEXCHANGE_ECU_ID 3013u + CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY 3014u + CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY 3015u + CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING 3016u + CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT 3017u + CRYPTO_KE_CUSTOM_RANDOM_NONCE 3018u + CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER 3019u + CRYPTO_KE_CUSTOM_SHE_COUNTER 3021u + CRYPTO_KE_CUSTOM_SHE_UID 3051u + CRYPTO_KE_CUSTOM_RSA_PRIME_P 3052u + CRYPTO_KE_CUSTOM_RSA_PRIME_Q 3053u + CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP 3054u + CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ 3055u + CRYPTO_KE_CUSTOM_RSA_INVERSE_QI 3056u + CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION 3057u + CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION 3058u + CRYPTO_KE_CUSTOM_LABEL 3059u + CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD 3060u + CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD 3061u + CRYPTO_KE_CUSTOM_EDDSA_CONTEXT 3084u + CRYPTO_KE_CUSTOM_W0 3085u + CRYPTO_KE_CUSTOM_W1 3086u + CRYPTO_KE_CUSTOM_L 3092u + CRYPTO_KE_CUSTOM_SM2_ID 3093u + CRYPTO_KE_CUSTOM_SM2_GENERATE_PUBLIC_KEY +Table 2.30 Custom Key Elements + +2.1.6.3 Key Element Access Rights +The module provides the following key access rights with the shown security strength. + +Access Right Value Access Strength Description + Accessible by plaintext. +ALLOWED 0 Lowermost Encrypted external access only. + No external access, only internal access. +ENCRYPTED 1 No external access, only internal job usage. + +INTERNAL_COPY 2 + +DENIED 3 Highest + +Table 2.31 Key Element Access Rights Ranking + +© 2025 Vector Informatik GmbH Version 14.09.04 54 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Expert Knowledge + The read access right of key elements should be stricter or equal to the write + access right to avoid secret keys easily read in plaintext. + +Access Key Read Access Right Write Access Right Recommended + Setting +KeyElementGet Key RA_ALLOWED - - + SHE RAM Key RA_ENCRYPTED - - +GET Key ALL - - +whileProcessJob +KeyElementSet Key - WA_ALLOWED - + SHE Key RA_DENIED + SHE RAM Key ALL WA_ENCRYPTED RA_ + ENCRYPTED + ALL WA_ALLOWED - + +KeyElementCopy* Source RA right <= RA_ - - + INTERNAL_COPY + Destination RA right >= Source WA right <= WA_ - + Key INTERNAL_COPY - +KeyDerive Source ALL - + Destination - WA right <= WA_ RA_ALLOWED + INTERNAL_COPY +KeyExchange Own Public ALL WA right <= WA_ - + INTERNAL_COPY + Private ALL WA right <= WA_ - + INTERNAL_COPY + Shared ALL WA right <= WA_ RA_ALLOWED + INTERNAL_COPY +KeyGenerate Key ALL WA right <= WA_ - + INTERNAL_COPY +KeyUnwrap PlaintextKey - WA right <= WA_ - + INTERNAL_COPY - + KEK ALL - - + - WA_ALLOWED - +RandomSeed Seed FIPS RA_DENIED WA_ALLOWED + ALL WA_DENIED + Seed DRBG + + ReseedCnt +Table 2.32 Key Element Access Rights + +- : no effect, not used in function +ALL : key is accessed in function but all access rights are accepted +* : SHE keys cannot be copied + +© 2025 Vector Informatik GmbH Version 14.09.04 55 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.6.4 Write Once Keys + +The module supports to configure key elements as write once. This allows that non-persist +keys can only be written once after start-up and persist keys can only be written once for all +time. Write once keys are not supported by all services the exact list can be found in the +following table. + + Service Write Once Support + GET while ProcessJob Not effected + SET while ProcessJob(Redirection) Access will be denied + KeyElementGet Not effected + KeyElementSet Supported + KeyElementCopy Supported + KeyElementCopyPartial Supported + KeyCopy Supported + KeyDerive Supported + KeyExchange Supported + KeyGenerate Supported + KeyUnwrap Supported + RandomSeed Access will be denied +Table 2.33 Write Once Support + +2.1.6.5 Key Locking + +The key is locked during the complete processing to hold the key and its key elements +consistent. To allow a high performance it is possible to lock a key from several jobs for +reading. A key can only be written if there is neither a read nor a write lock yet. If there is a +write lock the key cannot be read. + +The following table shows which service sets a key to read or write lock while process- +ing. Some ProcessJob services may read-lock the Default Random Source Key (R), refer +2.1.2.4.2 Default Random Source / esl_getBytesRNG. + + Read Lock + Write Lock + Service Locking + ProcessJob RandomGenerate X + ProcessJob All other services X (R) + ProcessJob Input Redirection X X + ProcessJob Output Redirection X T + KeyCopy X T + KeyElementCopy X T + KeyElementCopyPartial continues on next page + Version 14.09.04 +© 2025 Vector Informatik GmbH 56 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 2.34 – continued from previous page + + Locking Read Lock + Write Lock +Service + +KeyElementSet X + +KeyValidSet/KeySetValid* X + +KeySetInvalid* X + +KeyElementGet X + +RandomSeed* X + +KeyGenerate* R X + +KeyDerive* X T + +KeyUnwrap* X T + +KeyWrap* X, T + +KeyExchangeCalcPubVal* R X + +KeyExchangeCalcSecret* X + +Callback Crypto_30_LibCv_NvBlock_ReadFromBlock X + +Callback Crypto_30_LibCv_NvBlock_WriteToBlock X + +Table 2.34 Key Locking per Service + +*: Including ProcessJob Service, T: Target key, R: Random Source Key + + Caution + If key locking is disabled, the user must ensure, that keys are only changed if + they are not accessed (read or write) by any other user (different contexts or + cores). To see which service functions modify keys, please see Table 2.35 and + the individual API definitions for the table entries. + If dedicated keys for each partition are used, the condition above only must be + ensured for different contexts on the same core. + If a key is changed while being used, this can lead to wrong calculations of the + using primitive. + Keys also must not be changed while they are read by NvM to persist them. + + Caution + If key locking is disabled, immediate NvM Blocks (see Section 2.1.7.1) cannot be + used. + + Note + If default random source is used, the key will also be locked. + +© 2025 Vector Informatik GmbH Version 14.09.04 57 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.6.6 Pre-Configured Key Types +The module provides a range of pre-configured key types. These pre-configured key types +shall provide the most recommended usage scenarios. Further key types may be added by +the user. Pre-configured key types could be used as template by duplicating them. +Not used key types will be skipped by the generator and have therefore no negative influence +on the code and RAM size. + + Expert Knowledge + To reduce the RAM usage configure the key type only with the required key ele- + ments. Also configure the key elements only with the required size. + +2.1.6.7 Key Validity +The validity of the key is checked and modified by the service function according to the +following table. If the key element has an init value the key element is set valid during the +initialization excluding SHE keys. +A key can be explicitly set to valid using service KeyValidSet [1] or KeySetValid [2]. It can +also be explicitly set to invalid by using the service KeySetInvalid [5]. + +Service Validity read key need to be valid +ProcessJob RandomGenerate X modified key is valid afterwards +ProcessJob All others X modified key is invalid afterwards +ProcessJob Redirection X +KeyElementGet X X° +KeyElementSet X^ +KeyElementCopy X +KeyCopy X +KeyValidSet/KeySetValid* X X +KeySetInvalid* X +KeyDerive* X +KeyUnwrap Job X° + X° + X° + X° + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 58 + Technical Reference MICROSAR Classic Crypto_30_LibCv + Table 2.35 – continued from previous page + +Service Validity read key need to be valid +KeyExchangeCalcSecret* modified key is valid afterwards +KeyExchangeCalcPubVal* X modified key is invalid afterwards +KeyGenerate* X +RandomSeed* X X +esl_getBytesRNG X X +Table 2.35 Key Validity X X + X° + X° + +* including ProcessJob +^ SHE key update +° Callout for KeyValidity is invoked + +2.1.6.8 Key Element Delete + +The module supports a feature to delete a key element. To do this, the service Crypto_30_ +LibCv_KeyElementSet needs to be called with a valid keyPtr and the keyLength 0. The DET +check for the keyLength will be disabled if the feature is enabled. If the key is set valid and +read out the module will return a key element with the length 0, which is not accepted by the +most primitives. + + Note + The key element will be overwritten once with zeros. + +2.1.6.9 Redirection + +The redirection allows to use key elements as in- and output-buffer. The streaming approach +is allowed if only output keys are redirected. For the output redirection key elements can be +written up to write access right WA_INTERNAL_COPY. For the input redirection key elements + +© 2025 Vector Informatik GmbH Version 14.09.04 59 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +can be read up to RA_INTERNAL_COPY for the most services. If Encrypt, Decrypt, Aead- +Encrypt or Aead-Decrypt is used only input keys with read access RA_ALLOWED can be +used. + + Property Need to be Valid + Redirected Key If in valid afterwards + Partial Access required + + PRIMARY_INPUT X + + SECONDARY_IN- X + PUT + + TERTIARY_INPUT X + + PRIMARY_OUTPUT X X + + SECONDARY_OUT- X X + PUT + +Table 2.36 Redirection Key Properties + +Note +Key Redirection is a feature of [3] therefore a crypto stack is required which also +provides this feature including the change of the job structure. +The key element used for the primitive and the key elements used for redirection +must be located in different crypto keys. + +2.1.7 Memory Access + +2.1.7.1 NvM Support + +The module supports persisting of key elements to the NvM. Therefore, references to NvM +blocks must be configured in CryptoNvStorage. The validation of the DaVinci Configurator +5 configures the block automatically to the needs of the module. Key element persistence +is triggered if a key is validated. This can be done by KeyValidSet/KeySetValid (including +ProcessJob), KeyDerive (including ProcessJob), RandomSeed (including ProcessJob) and +ProcessJob Random Generate according to Table 2.35. It is also triggered if a key is invali- +dated by KeySetInvalid (including ProcessJob). + +The module provides an optional feature to notify the NvM that a referenced memory block +has changed (e.g. by calling NvM_SetRamBlockStatus). This occurs if a key is set to +valid which either can be triggered by the application or internally. It also occurs if a key +is explicitly set to invalid by KeySetInvalid. The need for a valid key can be found in Ta- +ble 2.35. If the feature is disabled, the module does not mark a block as modified (NvM_ +SetRamBlockStatus), it is up to the NvM to detect the need of writing the block. + +© 2025 Vector Informatik GmbH Version 14.09.04 60 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Note + KeySetValid/KeyValidSet and KeySetInvalid differ in the condition when the NvM + is requested to write the block of the key: + > SetValid: Key validity has changed (invalid -> valid) + + > SetInvalid: always + +The module provides two modes for Block Processing: + +> DEFERRED + The block will only be marked as changed via NvM_SetRamBlockStatus. + +> IMMEDIATE + The block is marked as changed via NvM_SetRamBlockStatus and the + NvM_WriteBlock is called. It is possible to overwrite the NvM write function and + configure it for NvM writing by the CRYPTO module. For this purpose, the name of the + function must be entered in the configuration /MICROSAR/Crypto_30_LibCv/ + Crypto/CryptoNvStorage/CryptoNvWriteBlockFctName. Therefore, there is a + delay until the block is written to NvM. + + Caution + Key element persistence is triggered if a key is validated (see Table 2.35). + Depending on the Block Processing mode the module tries to trigger the write op- + eration. If the request to start write operation fails (NvM_SetRamBlockStatus + and NvM_WriteBlock), the CRYPTO service function will not return with an + error. The module will retry the operation in the next Crypto_30_LibCv_ + MainFunction. + If the NvM operation fails and one of the configured callbacks will report an error + the write operation will not be retried. The failure needs to be detected by the + customer using NvM. The retire of an NvM write error need to handle by the + customer e.g. with NvM_WriteBlock for the effected block. + The Information of the NvM block status need to be retrieved via NvM. + +Caution +If the multi-partition functionality is used, NvM operations on Crypto blocks must +only be done on the main partition. +The module itself will only call NvM APIs from the main partition. This means, +that key elements are only persisted if they are validated (see Table 2.35) by the +configured main partition (the partition where the NvM is located). +If such key elements are written by other partitions, they will not be persisted +automatically. Also, a subsequent validation of the key on the main partition +will not trigger the persist. Instead, the key can either manually be marked as +changed (by calling NvM_SetRamBlockStatus) or directly written (by calling +NvM_WriteBlock). + +© 2025 Vector Informatik GmbH Version 14.09.04 61 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +The module provides two modes for Consistency Level: +> Level_None (deprecated) + + No checking for consistency. +> Level_Detect + + The module uses a CRC over the block key structure to detect changes. If changes are + detected, the init values are restored. Otherwise the old block is used. + + Expert Knowledge + For simplicity, persistent keys as well as non-persistent keys are processed and + held in a variable called Crypto_30_KeyStorage. Therefore, the configured + length of the corresponding NvM block can differ from the real length of this vari- + able if there are keys which shall not be persisted. Persistent keys are located + in the lowermost bytes of the Crypto_30_KeyStorage whereas non-persistent + keys are located in the uppermost bytes. + + Note + It is recommended to ensure that Crypto_30_LibCv data, which are stored in one + or more NvM blocks configured by /MICROSAR/Crypto_30_LibCv/Crypto/ + CryptoNvStorage/CryptoNvBlock, are restored unchanged. The data in- + tegrity can be ensured e.g. by NvM using CRC. + +The module does handle its configured NvM blocks. Therefore, the module provides a call- +back for block initialization, reading from blocks and writing to blocks. These callbacks are +specified in Section 4.3. All blocks need to be mapped to the NvM_ReadAll operation and +it is recommended to map DEFERRED blocks to the NvM_WriteAll operation. + + Caution + Persisted key elements must not be used until they are read from NvM (usually + via Nvm_ReadAll). This is usually ensured by the initialization phases of the + ECU. + + Caution + Each Crypto_30_LibCv_NvBlock_Callback_ must always be + called for a write operation concerning , this includes NvM_ + WriteBlock and NvM_WriteAll. This can be either ensured by configuration + (see Section 5.2) or by user code. + +© 2025 Vector Informatik GmbH Version 14.09.04 62 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.7.1.1 Layout Change Detection + +The module provides CRC calculation to detect Nv layout changes. The CRC Layout calcu- +lation includes: + +> CRYPTO_ALIGN_KEY_STORAGE +> CRYPTO_NV_MANAGEMENT_DATA_PER_KEY +> For each Block + + > CRYPTO_NV_BLOCK_REVISION + > For each Key within the Block + + > CRYPTO_KEY_NV_ID + > For each Key Element within the Key + + > CRYPTO_KEY_ELEMENT_ID + > CRYPTO_KEY_ELEMENT_SIZE + +An explicit change for the Layout Detection can be accomplish by changing the CRYPTO_ +NV_BLOCK_REVISION. + + Note + The CRYPTO_KEY_NV_ID is used to give a key an unique id for the complete + lifecycle even if the CRYPTO_KEY_ID changed. The CRYPTO_KEY_NV_ID is + used to identify a key within the Nv Block over several different configurations. + Thereby it is possible to keep old NvBlock data instead of initializing them. + + Caution + The required NvM size and key location depends on the configuration of per- + sistent keys and its members. If any changes on persistent keys will be made + or any persistent keys will be added or removed, the memory layout changes. + This leads to the loss of the key material. Non-persistent keys do not affect the + memory layout and therefore do not cause this change. + The loss of key material can be prevented by these two options: + > Configuration of new keys in a new NvM Block. + > Preallocation of additional keys for future use (e.g. SecOC keys for additional + + PDUs which are not known at the beginning). This is only applicable if the + structure of the key is known before. This can be achieved by configuring + these keys as empty keys from the beginning. + Deletion or change of keys is not possible. If this is required, old keys need to + stay for compatibility reasons as configured and new keys have to be added as + described above. It is highly recommend to set the old key to RA_DENIED and + WA_DENIED. + +© 2025 Vector Informatik GmbH Version 14.09.04 63 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +2.1.7.2 vStdLib +The module can use the vStdLib to speed up extensive memory writings. + +2.1.8 Multi-Partition Support +The module supports being used on multiple partitions, which can be located on different +cores. The accessing partitions have to be configured properly in /MICROSAR/Crypto_ +30_LibCv/Crypto/CryptoGeneral/CryptoEcucPartitionRef. + + Caution + The user must ensure that a partition only calls the CRYPTO using driver objects + which were assigned to the accessing partition during configuration. A check + for this can be done by enabling /MICROSAR/Crypto_30_LibCv/Crypto/ + CryptoGeneral/CryptoMultiPartitionRuntimeCheck + +Caution +There is additional information in the feature specific sections which must be +considered: +> 2.1.5 Secure Hardware Extension + +> 2.1.2.4.2 Default Random Source / esl_getBytesRNG + +> 2.1.6.5 Key Locking + +> 2.1.7.1 NvM Support + +> 3.4.1 Critical Sections + +Caution +All partitions using the module have to use the same ASIL level. + +2.1.8.1 Memory Init for Multi-Partition + +For each configured partition, the module generates one dedicated Crypto_30_LibCv_ +InitMemory_() function which takes care of initializing the par- +tition dependent init variables to 0. + +Initializing can be done in the following ways: + +> Startup core calls all available + Crypto_30_LibCv_InitMemory_() functions. + > This requires that the startup core can write to the memory of all partitions. + + > This might require mapping the partition specific init variables to shared memory. + + > This would require a dedicated MPU regions for the init variables of the partitions. + +© 2025 Vector Informatik GmbH Version 14.09.04 64 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> Each core calls the Crypto_30_LibCv_InitMemory_() + functions for its partitions. + > This can be used if init variables shall be mapped to core local memory which might + not be accessible from other cores. + +> Do not call the Crypto_30_LibCv_InitMemory_() at all if + ZERO_INIT variables are already correctly initialized. + > Initialization is usually done by vLinkGen or Compiler specific startup code. + + Expert Knowledge + Typically, InitMemory() is called before OsStart() so that MPU is not con- + figured yet. + +2.2 Error Handling + +The module supports development error detection and reporting using the AUTOSAR Det. +If enabled, these errors are reported using the service Det_ReportError() as specified +in [6]. +The reported service IDs and error IDs are contained and documented in the module header +file. + +2.2.1 Production Code Error Reporting + +The module does not support production error detection and reporting using the AUTOSAR +Dem. + +2.3 Compliance + +The following features specified by AUTOSAR [1] are not supported: +> All algorithms not stated in Section 2.1.1. +> Certificate Handling, however the API exists for compatibility. +> Virtual Key Elements. +> Queueing is not supported, the queue size is always set to 1. +The following features from AUTOSAR have deviations: +> Generally, return values of APIs can differ to preserve compatibility. +> The access rights are mapped to different values according to Section 2.1.6.3 (Deviation + + from [1] and newer). +> Usage of additional input data if redirection is used (Deviation from [1] and newer). +> Crypto_JobType is according to [2]. +> Only Runtime Det CRYPTO_E_RE_ENTROPY_EXHAUSTED is supported (Deviation from + + [2] and newer). +> Buffered internal data handling for cancelled jobs (Deviation from [1] and newer). + +© 2025 Vector Informatik GmbH Version 14.09.04 65 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +3 Integration + +This section gives necessary information for the integration of the MICROSAR Classic into +an application environment of an ECU. + +3.1 Embedded Implementation + +The module contains these source code files. Some files are generated by the configuration +tool DaVinci Configurator Classic. + +File Name Description Integration +Crypto_30_LibCv.c Tasks +Crypto_30_LibCv.h +Crypto_30_LibCv_Aead.c This is the main source file of the - +Crypto_30_LibCv_AeadDecrypt.h +Crypto_30_LibCv_AeadEncrypt.h module. +Crypto_30_LibCv_Cipher.c +Crypto_30_LibCv_Decrypt.h This is the header file of the module. - +Crypto_30_LibCv_Encrypt.h +Crypto_30_LibCv_Hash.c This source contains AEAD algorithms. - +Crypto_30_LibCv_Hash.h +Crypto_30_LibCv_InternalApi.h This header file is used for the internal - +Crypto_30_LibCv_KeyDerive.c AEAD dispatcher. +Crypto_30_LibCv_KeyDerive.h +Crypto_30_LibCv_KeyExchange.c This header file is used for the internal - +Crypto_30_LibCv_KeyExchange.h AEAD dispatcher. +Crypto_30_LibCv_KeyGenerate.c +Crypto_30_LibCv_KeyGenerate.h This source contains cipher algorithms. - +Crypto_30_LibCv_KeyManagement.c +Crypto_30_LibCv_KeyManagement.h This header file is used for the internal - + cipher dispatcher. + + This header file is used for the internal - + cipher dispatcher. + + This source contains hash algorithms. - + + This header file is used for the internal - + hash dispatcher. + + This header file is used for the internal - + key management functions. + + This source contains key derive - + + algorithms. + + This header file is used for the internal - + key derive dispatcher. + + This source contains key exchange - + + algorithms. + + This header file is used for the internal - + key exchange dispatcher. + + This source contains key generate - + + algorithms. + + This header file is used for the internal - + key generate dispatcher. + + This source contains the module's key - + management functions. + + This header contains the module's key - + management functions. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 66 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +File Name Table 3.1 – continued from previous page Integration + Description Tasks + - + Crypto_30_LibCv_KeySetValid.h This header file is used for the internal + Crypto_30_LibCv_KeySetInvalid.h key set valid dispatcher. - + Crypto_30_LibCv_KeyWrap.c + Crypto_30_LibCv_KeyUnwrap.h This header file is used for the internal - + Crypto_30_LibCv_KeyWrap.h key set invalid dispatcher. + Crypto_30_LibCv_Mac.c - + Crypto_30_LibCv_MacGenerate.h This source contains key wrap + Crypto_30_LibCv_MacVerify.h algorithms. - + Crypto_30_LibCv_Random.c + Crypto_30_LibCv_RandomGenerate.h This header file is used for the internal - + Crypto_30_LibCv_RandomSeed.h key unwrap dispatcher. - + Crypto_30_LibCv_Services.h + Crypto_30_LibCv_Signature.c This header file is used for the internal - + Crypto_30_LibCv_SignatureGenerate.h key wrap dispatcher. + Crypto_30_LibCv_SignatureVerify.h - + Crypto_30_LibCv_Custom.h This source contains MAC algorithms. - + Crypto_30_LibCv_Curve.h + Crypto_30_LibCv_Curve.c This header file is used for the internal - + Crypto_30_LibCv_Cfg.c mac dispatcher. + Crypto_30_LibCv_Cfg.h - + Crypto_30_LibCv_MemMap.h This header file is used for the internal + mac dispatcher. - +Table 3.1 Source Code Files + This source contains PRNG algorithms. - + + This header file is used for the internal - + PRNG dispatcher. + - + This header file is used for the internal - + PRNG seed dispatcher. + - + This header file is used for the internal + functions. - + - + This source contains signature - + algorithms. + + This header file is used for the internal + signature dispatcher. + + This header file is used for the internal + signature dispatcher. + + This header contains internal defines. + + This header contains internal elliptic + curve parameter declaration. + + This source contains internal elliptic + curve parameter definition. + + This is configuration source file. + + This is configuration header file. + + This header file contains the memory + section mapping. In deliveries of + MICROSAR Classic R27 and newer, this + file is generated. In older releases, it is + static. + +© 2025 Vector Informatik GmbH Version 14.09.04 67 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +3.2 Initialization + +Before any other functionality of the module can be called, the initialization function Crypto_ +30_LibCv_Init() must be called by the BSWM on each partition where the module +should be used. + +For manual null initialization of RAM variables, the module offers the function Crypto_30_ +LibCv_InitMemory() which can be called before the Crypto_30_LibCv_Init(). See +Section 2.1.8.1 for more details if multiple partitions are used. + +3.3 Main Functions + +The module implementation provides one main function. If the usage of asynchronous job +processing is enabled, this main function has to be called cyclically on task level. The main +function is responsible to start processing of the job. + +3.4 Synchronization + +3.4.1 Critical Sections + +The module uses the following critical sections: + +> CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0 + This critical section protects workspace locking resources, the job queue and the + NvBlock state. Furthermore, it ensures the consistency of the global RAM variables for + the last job and default random source data. + +> CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1 + This critical section protects key locking resources and ensures the consistency of the + key data. + If the module is accessed by multiple cores, either key locking must be disabled (then + this critical section implementation can be configured as None) or this critical section + implementation has to be configured as Spinlock (using Spinlock Lock Method at least + LOCK_CAT2_INTERRUPTS). + +> CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2 + This critical section protects long-term workspace locking resources. + If the module is accessed by multiple cores, either the services which use a long-term + workspace (see Section 2.1.3.4) must only be used on one core or this critical section + implementation has to be configured as Spinlock (using Spinlock Lock Method at least + LOCK_CAT2_INTERRUPTS). + +3.5 Memory Sections + +The objects (e.g. variables, functions, constants) are assigned to a specific memory section. + +The memory sections can be grouped according to the necessary access permissions. +Within this document these groups are called Memory Section Groups. + +For the module, the following groups can be identified: + +© 2025 Vector Informatik GmbH Version 14.09.04 68 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> Memory Section Group Constant +> Memory Section Group Shared +> Memory Section Groups PartitionLocal +The following sections explain the memory section groups of the module. + +3.5.1 Memory Section Group Constant +This shows the constant sections used by the module. +All parts of the module need read access to these memory sections. +> CRYPTO_30_LIBCV_*_SEC_CODE +> CRYPTO_30_LIBCV_*_SEC_CONST_ + +3.5.2 Memory Section Group Shared +This shows the variable memory sections which are shared between all partitions. +All parts of the module need read and write access to these memory sections. If multiple +partitions are accessing this section, it must not be cached. +> CRYPTO_30_LIBCV_*_SEC_VAR_NOINIT_ +> CRYPTO_30_LIBCV_*_SEC_VAR_ZERO_INIT_ + +3.5.3 Memory Section Group PartitionLocal +This shows the partition local variable memory sections. There is one such group per con- +figured partition. +Each partition needs read and write access to its PartitionLocal Memory Section Group. +Other partitions don't need read or write access to it. +> CRYPTO_30_LIBCV_*_SEC__VAR_*_ + + Note + If only one partition is used the is generated as + CRYPTO_SINGLE_PARTITION. + +3.6 Callouts + +The module has callout functions. Provide an implementation for them based on their API +description in Section 4.4. + +© 2025 Vector Informatik GmbH Version 14.09.04 69 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +3.7 Best Practice + +This section offers some best practice to simplify the crypto stack configuration. + +3.7.1 Bottom to Top +The best way to configure keys, key types and key elements, is to start configuration at this +module (CRYPTO) before doing this step in CryIf and Csm. Using this way, the DaVinci +Configurator offers a solving action to propagate the keys from the CRYPTO to the upper +layers. +This also applies to the CRYPTO objects and CSM job assignment. First plan which CSM +jobs shall be processed and check the calling conditions. Secondly create the CRYPTO +objects with the CRYPTO primitives to fulfill the conditions. Thirdly create the CSM Jobs and +reference the CRYPTO objects. + +3.7.2 Linker Options +The module provides domain parameters for all supported elliptic curves, independent from +whether the corresponding cryptographic primitives are enabled or not. In order to avoid +increased ROM consumption, it is recommended to enable linker options, such that the +linker will remove unused symbols, if this is not enabled by default. + +© 2025 Vector Informatik GmbH Version 14.09.04 70 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4 API Description + +4.1 Provided Functions + +The module provides these functions. +Service functions are implemented by the module and are typically called by upper-layer +modules. They are declared in Crypto_30_LibCv.h. + +4.1.1 Crypto_30_LibCv_InitMemory + + Prototype + void Crypto_30_LibCv_InitMemory() + Functional Description + Initializes Crypto_30_LibCv variables + Service to initialize module global variables at power up. + Options + callcontext: TASK + reentrant: FALSE + synchronous: TRUE +Table 4.1 Crypto_30_LibCv_InitMemory + +4.1.2 Crypto_30_LibCv_Init + + Prototype + void Crypto_30_LibCv_Init() + Functional Description + Initializes the Crypto Driver + This function initializes the module Crypto_30_LibCv. It initializes all variables relevant for the partition and + sets the module state for the partition to initialized. It has to be called once from the main partition and also + from each other partition where the module is used. + + Note + Specification of module initialization + + Particularities + Interrupts are disabled. + Module is uninitialized. + Options + callcontext: TASK + reentrant: FALSE + synchronous: TRUE +Table 4.2 Crypto_30_LibCv_Init + +© 2025 Vector Informatik GmbH Version 14.09.04 71 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4.1.3 Crypto_30_LibCv_MainFunction + + Prototype + void Crypto_30_LibCv_MainFunction() + Functional Description + Execute cyclic tasks + Options + callcontext: TASK + reentrant: FALSE + synchronous: TRUE +Table 4.3 Crypto_30_LibCv_MainFunction + +4.1.4 Crypto_30_LibCv_GetVersionInfo + +Prototype + +void Crypto_30_LibCv_GetVersionInfo(Std_VersionInfoType * versioninfo) + +Parameters + +versioninfo [out] Pointer to where to store the version information. + Parameter must not be NULL. + +Functional Description + +Returns the version information +Crypto_30_LibCv_GetVersionInfo() returns version information, vendor ID and AUTOSAR module ID of the +component. + +Particularities + +Configuration Dependency: CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON + +Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE + +Table 4.4 Crypto_30_LibCv_GetVersionInfo + +4.1.5 Crypto_30_LibCv_ProcessJob + +Prototype + +Std_ReturnType Crypto_30_LibCv_ProcessJob(uint32 objectId, Crypto_JobType * job) + +Parameters + +objectId [in] Holds the identifier of the Crypto Driver Object. + If multi-partition support is enabled, only the + objectId which belongs to the calling partition is + allowed to be used. + +job [in,out] Pointer to the configuration of the job. Contains + structures with job and primitive relevant + information but also pointer to result buffers. + +Return Codes + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 72 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.5 – continued from previous page +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. +CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. +CRYPTO_E_QUEUE_FULL Request failed, the queue is full. +CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. +CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. +CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. +CRYPTO_E_ENTROPY_EXHAUSTION Request failed, the entropy is exhausted. +CRYPTO_E_JOB_CANCELED The service request failed because the synchronous Job has been can- +celed. +Functional Description +Processes the received job +Performs the crypto primitive, that is configured in the job parameter. + + Caution + Any job must be called fully synchronously or asynchronously. It is not al- + lowed to start the streaming mode synchronously and execute the finish step + in asynchronous mode or vice versa. It is also not allowed to change other job + parameters during streaming except the input and output buffer. + + Caution + Any job must have been fully executed before starting a new job with the same + job ID. + + Options + + callcontext: TASK + reentrant: TRUE, for jobs with different job ids + synchronous: TRUE|FALSE +Table 4.5 Crypto_30_LibCv_ProcessJob + +4.1.6 Crypto_30_LibCv_CancelJob + +Prototype + +Std_ReturnType Crypto_30_LibCv_CancelJob(uint32 objectId, Crypto_JobType * job) + +Parameters + +objectId [in] Holds the identifier of the Crypto Driver Object. + +job [in,out] Pointer to the configuration of the job. Contains + structures with user and primitive relevant + information. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 73 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.6 – continued from previous page + + Return Codes + + E_OK Request successful, job has been removed. + E_NOT_OK Request failed, job could not be removed. + Functional Description + + Cancels the received job + This interface removes the provided job from the queue and cancels the processing of the job if possible. + Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE +Table 4.6 Crypto_30_LibCv_CancelJob + +4.1.7 Crypto_30_LibCv_KeyCopy + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyCopy(uint32 cryptoKeyId, uint32 targetCryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key element + shall be the source element. + +targetCryptoKeyId [in] Holds the identifier of the key whose key element + shall be the destination element. + +Return Codes + +E_OK Request successful, at least one keyElement was successfully copied. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. +CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + +Functional Description + +Copy the key +Copies a key with all its elements to another key in the same crypto driver. +The key element can only be copied, if the destination key element write access right is less than WA_ +INTERNAL_COPY. +Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination +read access right must be higher or equal than the source read access right. +The function returns E_OK if at least one keyElement has been successfully copied. +cryptoKeyId and targetCryptoKeyId shall not be identical, otherwise the function returns E_NOT_OK. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.7 Crypto_30_LibCv_KeyCopy + +© 2025 Vector Informatik GmbH Version 14.09.04 74 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4.1.8 Crypto_30_LibCv_KeyElementCopy + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyElementCopy(uint32 cryptoKeyId, uint32 keyElementId, uint32 +targetCryptoKeyId, uint32 targetKeyElementId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key element + shall be the source element. + +keyElementId [in] Holds the identifier of the key element which shall + be the source for the copy operation. + +targetCryptoKeyId [in] Holds the identifier of the key whose key element + shall be the destination element. + +targetKeyElementId [in] Holds the identifier of the key element which shall + be the destination for the copy operation. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. +CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + +Functional Description + +Copy key element +Copies a key element to another key element in the same crypto driver. +The key element can only be copied, if the destination key element write access right is less than WA_ +INTERNAL_COPY. +Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination +read access right must be higher or equal than the source read access right. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.8 Crypto_30_LibCv_KeyElementCopy + +4.1.9 Crypto_30_LibCv_KeyElementCopyPartial + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyElementCopyPartial(uint32 cryptoKeyId, uint32 keyElementId, +uint32 keyElementSourceOffset, uint32 keyElementTargetOffset, uint32 keyElementCopyLength, uint32 tar- +getCryptoKeyId, uint32 targetKeyElementId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key element + shall be the source element. + +keyElementId [in] Holds the identifier of the key element which shall + be the source for the copy operation. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 75 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.9 – continued from previous page + +keyElementSourceOffset [in] Holds the offset of the of the source key element + indicating the start index of the copy operation. + +keyElementTargetOffset [in] Holds the offset of the of the target key element + indicating the start index of the copy operation. + +keyElementCopyLength [in] Holds the number of bytes that shall be copied. + +targetCryptoKeyId [in] Holds the identifier of the key whose key element + shall be the destination element. + +targetKeyElementId [in] Holds the identifier of the key element which shall + be the destination for the copy operation. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. +CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. +CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + +Functional Description + +Copy key element partial +Copies a key element to another key element in the same crypto driver. The keyElementSourceOffset and +keyElementCopyLength allows to copy just a part of the source key element into the destination. +The offset of the target key is also specified with this function. +The target key element needs to have partial access. +The key element can only be copied, if the destination key element write access right is less than WA_ +INTERNAL_COPY. +Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination +read access right must be higher or equal than the source read access right. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.9 Crypto_30_LibCv_KeyElementCopyPartial + +4.1.10 Crypto_30_LibCv_KeyElementIdsGet + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyElementIdsGet(uint32 cryptoKeyId, uint32 * keyElementIdsPtr, +uint32 * keyElementIdsLengthPtr) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose available + element ids shall be exported. + +keyElementIdsPtr [out] Contains the pointer to the array where the ids of + the key elements shall be stored. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 76 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.10 – continued from previous page + +keyElementIdsLengthPtr [out] Holds a pointer to the memory location in which the + number of key element in the given key is stored. + On calling this function, this parameter shall contain + the size of the buffer provided by keyElementIdsPtr. + When the request has finished, the actual number + of key elements is stored. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + +Functional Description + +Used to retrieve information which key elements are available in a given key. +The service provides a list of key element which are available in the given key. + +Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE + +Table 4.10 Crypto_30_LibCv_KeyElementIdsGet + +4.1.11 Crypto_30_LibCv_KeyElementSet + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyElementSet(uint32 cryptoKeyId, uint32 keyElementId, const uint8 +* keyPtr, uint32 keyLength) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key element + shall be set. + +keyElementId [in] Holds the identifier of the key element which shall + be set. + +keyPtr [in] Holds the pointer to the key data which shall be set + as key element. + +keyLength [in] Contains the length of the key element in bytes. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided +data. + +Functional Description + +Sets a key element. +Sets the given key element bytes to the key identified by cryptoKeyId. The key element can only be set, if +the write access right is WA_ALLOWED or WA_ENCRYPTED. The access right need to be WA_ALLOWED +for normal key, WA_ENCRYPTED for SHE key and WA_ALLOWED for SHE RAM key. If keyLength is zero +the old value is deleted. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 77 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.11 – continued from previous page + + Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE +Table 4.11 Crypto_30_LibCv_KeyElementSet + +4.1.12 Crypto_30_LibCv_KeyValidSet + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyValidSet(uint32 cryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key elements + shall be set to valid. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Sets the key state of the key identified by cryptoKeyId to valid. +Sets all key elements of the given cryptoKey to valid. If the key contains at least one invalid persistent key +element when called, the NvM is requested to write the block to which the cryptoKey refers. This API is an +alias for KeySetValid() and does not differ in functionality, but is used for compliance with AUTOSAR 4.3.0 +in terms of naming. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.12 Crypto_30_LibCv_KeyValidSet + +4.1.13 Crypto_30_LibCv_KeySetValid + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeySetValid(uint32 cryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key elements + shall be set to valid. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 78 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.13 – continued from previous page + + Sets the key state of the key identified by cryptoKeyId to valid. + Sets all key elements of the given cryptoKey to valid. If the key contains at least one invalid persistent key + element when called, the NvM is requested to write the block to which the cryptoKey refers. This API is an + alias for KeyValidSet() and does not differ in functionality, but is used for compliance with AUTOSAR 4.3.1 + (and higher) in terms of naming. + + Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE +Table 4.13 Crypto_30_LibCv_KeySetValid + +4.1.14 Crypto_30_LibCv_KeySetInvalid + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeySetInvalid(uint32 cryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key for which the status + shall be set to invalid. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Sets invalid for the status of the key identified by cryptoKeyId. +Sets all key elements of the given cryptoKey to invalid. If the key has at least one persistent key element, +the NvM is requested to write the block to which the cryptoKey refers. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.14 Crypto_30_LibCv_KeySetInvalid + +4.1.15 Crypto_30_LibCv_KeyGetStatus + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyGetStatus(uint32 cryptoKeyId, Crypto_KeyStatusType * keySta- +tusPtr) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key for which the key + state shall be returned. + +keyStatusPtr [out] Contains the pointer to the data where the status of + the key shall be stored. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 79 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.15 – continued from previous page + + Functional Description + + Returns the key state of the key identified by cryptoKeyId. + This function reports the validity of a key. If the key is currently written by the NVM e.g. KeyElementSet() + followed by KeySetValid(), it reports UPDATE_IN_PROGRESS until the key was successfully written by the + NVM. If the update was not successful the status remains on UPDATE_IN_PROGRESS. The reported state + reflects the state of the last initiated update routine. Which means if the key is changed again during the + NVM update, the UPDATE_IN_PROGRESS is no longer reported. + + Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE +Table 4.15 Crypto_30_LibCv_KeyGetStatus + +4.1.16 Crypto_30_LibCv_KeyElementGet + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyElementGet(uint32 cryptoKeyId, uint32 keyElementId, uint8 * re- +sultPtr, uint32 * resultLengthPtr) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key whose key element + shall be returned. + +keyElementId [in] Holds the identifier of the key element which shall + be returned. + +resultPtr [out] Holds the pointer of the buffer for the returned key + element. + +resultLengthPtr [in,out] Holds a pointer to a memory location in which the + length information is stored. On calling this function + this parameter shall contain the size of the buffer + provided by resultPtr. If the key element is + configured to allow partial access, this parameter + contains the amount of data which should be read + from the key element. The size may not be equal to + the size of the provided buffer anymore. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. +CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. +CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + +Functional Description + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 80 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.16 – continued from previous page + + This interface shall be used to get a key element of the key identified by the cryptoKeyId and store the key + element in the memory location pointed to by the result pointer. + The key element can only be provided, if the read access right is RA_ALLOWED. If the key element is + configured to allow partial access, resultLengthPtr contains the amount of data which should be read from + the key element. + The behavior for partial access can be switched on or off in the configuration. + If the read access right is RA_ENCRYPTED the She ram key can be exported. + (64 Bytes for M1-M3 and 112Bytes for M1-M5) + + Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE +Table 4.16 Crypto_30_LibCv_KeyElementGet + +4.1.17 Crypto_30_LibCv_RandomSeed + +Prototype + +Std_ReturnType Crypto_30_LibCv_RandomSeed(uint32 cryptoKeyId, const uint8 * entropyPtr, uint32 en- +tropyLength) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key for which a new seed + shall be generated. + +entropyPtr [in] Holds a pointer to the memory location which + contains the data to feed the entropy. + +entropyLength [in] Contains the length of the entropy in bytes. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Initialize the seed +This function generates the internal seed state using the provided entropy source. +Furthermore, this function can be used to update the seed state with new entropy + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.17 Crypto_30_LibCv_RandomSeed + +4.1.18 Crypto_30_LibCv_KeyGenerate + + Prototype + Std_ReturnType Crypto_30_LibCv_KeyGenerate(uint32 cryptoKeyId) + Parameters + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 81 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.18 – continued from previous page + +cryptoKeyId [in] Holds the identifier of the key which is to be + updated with the generated value. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Generates a key +This function shall dispatch the key generate function to the configured crypto driver object. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.18 Crypto_30_LibCv_KeyGenerate + +4.1.19 Crypto_30_LibCv_KeyDerive + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyDerive(uint32 cryptoKeyId, uint32 targetCryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key which is used for key + derivation. + +targetCryptoKeyId [in] Holds the identifier of the key which is used to store + the derived key. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Derives a key +Derives a new key by using the key elements in the given key identified by the cryptoKeyId. +The key derivation function supports different algorithm which are specified by the algorithm key ele- +ment(CRYPTO_KE_KEYDERIVATION_ALGORITHM). +For further details, see below. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.19 Crypto_30_LibCv_KeyDerive + +Additional information: + +> For + CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 + and CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB: + The given key must contain the key elements for the password + (CRYPTO_KE_KEYDERIVATION_PASSWORD), salt + +© 2025 Vector Informatik GmbH Version 14.09.04 82 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + (CRYPTO_KE_KEYDERIVATION_SALT), algorithm + (CRYPTO_KE_KEYDERIVATION_ALGORITHM) and the custom element + label(CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL). The number of iterations is + automatically determined by the needed key length. The derived key is stored in the key + element with id 1 of the given key identified by targetCryptoKeyId. The write access right + for the destination key element must be less than or equal to WA_INTERNAL_COPY. + +> For CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_ + SINGLE_STEP_KDF_SHA256: The KDF reads the algorithm configuration from the + cryptoKeyId key elements. The KDF requires the following key elements: the private key + (CRYPTO_KE_KEYDERIVATION_PASSWORD), the public key + (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY) and the other + Information (CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO). Other + Information is only supported up to a length of 5 bytes. + The derived key is set at the target key element + (CRYPTO_KE_KEYDERIVATION_PASSWORD). + +> For CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING: + For certificate installation the cryptoKeyId need to be the root certificate. + For certificate update the cryptoKeyId and targetCryptoKeyId need to be the same key Id. + The KDF is reads the algorithm configuration from the cryptoKeyId key elements. The + KDF requires the following key element the private key + (CRYPTO_KE_KEYDERIVATION_PASSWORD). + The following key elements need to be set at the targetCryptoKeyId: the contract/new + public key (CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY), the IV and + encrypted private key + (CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY) and the public + key (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY). + The derived key is set at the target key element + (CRYPTO_KE_KEYDERIVATION_PASSWORD). + +> For + CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING: + The KDF reads the algorithm configuration from the cryptoKeyId key elements. + The following key element need to be set at the cryptoKeyId: the private key of the + provision certificate (CRYPTO_KE_KEYDERIVATION_PASSWORD). + The following key elements need to be set at the targetCryptoKeyId: the contract public + key (CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY), the IV, encrypted + private key and tag + (CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY), the PCID and + SKI (CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD) and the public key needed for + ECDH (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY). + The derived key is set at the target key element + (CRYPTO_KE_KEYDERIVATION_PASSWORD). + +> For CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256 and + CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512: Derives a key according to + KDF X9.63 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) and + optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + +© 2025 Vector Informatik GmbH Version 14.09.04 83 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +> For CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1 and + CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256: The given key must + contain the key elements for the password + (CRYPTO_KE_KEYDERIVATION_PASSWORD), salt + (CRYPTO_KE_KEYDERIVATION_SALT), algorithm + (CRYPTO_KE_KEYDERIVATION_ALGORITHM) and the iteration element + (CRYPTO_KE_KEYDERIVATION_ITERATIONS). + The number of iterations is determined by the + CRYPTO_KE_KEYDERIVATION_ITERATIONS element and must always be set with 4 + bytes. The derived key is stored in the key element with id 1 of the given key identified by + targetCryptoKeyId. + The write access right for the destination key element must be less than or equal to + WA_INTERNAL_COPY. + +> For CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256 and + CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384: The given key must contain + the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD), salt + (CRYPTO_KE_KEYDERIVATION_SALT), algorithm + (CRYPTO_KE_KEYDERIVATION_ALGORITHM) iteration element + (CRYPTO_KE_KEYDERIVATION_ITERATIONS) and optionally + CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional + information). + The iteration element specifies whether the one-step or two-step variant is to be used. + The derived key is stored in the key element with id 1 of the given key identified by + targetCryptoKeyId. + The write access right for the destination key element must be less than or equal to + WA_INTERNAL_COPY. + +> For CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256 and + CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384: The given key must contain + the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD) and + optionally CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional + information). + The derived key is stored in the key element with id 1 of the given key identified by + targetCryptoKeyId. + The write access right for the destination key element must be less than or equal to + WA_INTERNAL_COPY. + +> For CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256 and + CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512: The given key must + contain the key elements for the password + (CRYPTO_KE_KEYDERIVATION_PASSWORD), algorithm + (CRYPTO_KE_KEYDERIVATION_ALGORITHM) and optionally + CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional + information). + The Algorithm element specifies which hash variant is to be used. + The derived key is stored in the key element with id 1 of the given key identified by + targetCryptoKeyId. + The write access right for the destination key element must be less than or equal to + +© 2025 Vector Informatik GmbH Version 14.09.04 84 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + WA_INTERNAL_COPY. + +> For CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1: The given key must + contain the key element for the password + (CRYPTO_KE_KEYDERIVATION_PASSWORD). + The derived key is stored in the key element with id 1 of the given key identified by + targetCryptoKeyId. + The write access right for the destination key element must be less than or equal to + WA_INTERNAL_COPY. + +> For CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_108_CTR_CMAC_AES: + The given key must contain key elements for the password + (CRYPTO_KE_KEYDERIVATION_PASSWORD) and algorithm + (CRYPTO_KE_KEYDERIVATION_ALGORITHM). Optional additional inputs are label + (CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL) and context + (CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT). The password length defines + the CMAC cipher: 16 Bytes (AES128) or 32 Bytes (AES256). The derived key is stored + in the key element with id 1 of the given key identified by targetCryptoKeyId. The write + access right for the destination key element must be less than or equal to + WA_INTERNAL_COPY. + +4.1.20 Crypto_30_LibCv_KeyExchangeCalcPubVal + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyExchangeCalcPubVal(uint32 cryptoKeyId, uint8 * publicValuePtr, +uint32 * publicValueLengthPtr) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key which shall be used + for the key exchange protocol. + +publicValuePtr [out] Contains the pointer to the data where the public + value shall be stored. + +publicValueLengthPtr [in,out] Holds a pointer to the memory location in which the + public value length information is stored. On calling + this function, this parameter shall contain the size of + the buffer provided by publicValuePtr. When the + request has finished, the actual length of the + returned value shall be stored. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. +CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + +Functional Description + +Calculation of the public value +Calculates the public value for the key exchange and stores the public key in the memory location pointed +to by the public value pointer. The write access right for the destination key element must be less than or +equal to WA_INTERNAL_COPY. + +Options + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 85 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.20 – continued from previous page + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE +Table 4.20 Crypto_30_LibCv_KeyExchangeCalcPubVal + +4.1.21 Crypto_30_LibCv_KeyExchangeCalcSecret + +Prototype + +Std_ReturnType Crypto_30_LibCv_KeyExchangeCalcSecret(uint32 cryptoKeyId, const uint8 * partner- +PublicValuePtr, uint32 partnerPublicValueLength) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key which shall be used + for the key exchange protocol. + +partnerPublicValuePtr [in] Holds the pointer to the memory location which + contains the partners public value. + +partnerPublicValueLength [in] Contains the length of the partners public value in + bytes. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Calculation of the secret +Calculates the shared secret key for the key exchange with the key material of the key identified by the +cryptoKeyId and the partner public key. The shared secret key is stored as a key element in the same key. +The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.21 Crypto_30_LibCv_KeyExchangeCalcSecret + +4.1.22 Crypto_30_LibCv_CertificateParse + +Prototype + +Std_ReturnType Crypto_30_LibCv_CertificateParse(uint32 cryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key slot in which the + certificate has been stored. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 86 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.22 – continued from previous page + + Parse stored certificate + Parses the certificate data stored in the key element CRYPTO_KE_CERT_DATA and fills the key el- + ements CRYPTO_KE_CERT_SIGNEDDATA, CRYPTO_KE_CERT_PARSEDPUBLICKEY and CRYPTO_ + KE_CERT_SIGNATURE + + Particularities + + Currently there is no implementation to parse certificates. However, the API is still available for compatibility + reasons. + + Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE +Table 4.22 Crypto_30_LibCv_CertificateParse + +4.1.23 Crypto_30_LibCv_CertificateVerify + +Prototype + +Std_ReturnType Crypto_30_LibCv_CertificateVerify(uint32 cryptoKeyId, uint32 verifyCryptoKeyId, +Crypto_VerifyResultType * verifyPtr) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key which shall be used to + validate the certificate. + +verifyCryptoKeyId [in] Holds the identifier of the key containing the + certificate, which shall be verified. + +verifyPtr [out] Holds a pointer to the memory location which will + contain the result of the certificate verification. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. +CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + +Functional Description + +Certificate verification +Verifies the certificate stored in the key referenced by verifyCryptoKeyId with the certificate stored in the key +referenced by cryptoKeyId. + +Particularities + +Currently there is no implementation to verify certificates. However, the API is still available for compatibility +reasons. + +Options + + callcontext: TASK + reentrant: TRUE, for different crypto keys + synchronous: TRUE + +Table 4.23 Crypto_30_LibCv_CertificateVerify + +© 2025 Vector Informatik GmbH Version 14.09.04 87 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4.2 Required Functions + +The module requires these functions from other modules. Refer to their documentation for +API details. + + Component API + DET Det_ReportError + CryIf CryIf_CallbackNotification + NvM NvM_SetRamBlockStatus NvM_WriteBlock + VStdLib VStdLib_MemCpy + VStdLib_MemClr + vSecPrim VStdLib_MemSet +Table 4.24 Required Functions Several APIs which start with esl_ + +4.3 Callback Functions + +This section describes the callback functions that are implemented by the module and can +be invoked by other modules. The prototypes of the callback functions are provided in the +header file Crypto_30_LibCv_Cfg.h. + +4.3.1 Crypto_30_LibCv_NvBlock_Init + +Prototype + +Std_ReturnType Crypto_30_LibCv_NvBlock_Init(Crypto_30_LibCv_SizeOfNvBlockType blockIdx) + +Parameters + +blockIdx [in] The internal identifier of the NvM block. + +Return Codes + +E_OK Data initialized. +E_NOT_OK Any error occurred. + +Functional Description + +Init Block callback routine. +Block specific callback routine which is called by NvM in order to let the Crypto driver copy default data to a +RAM block. + +Particularities + +blockIdx need to be valid. + +Options + + callcontext: TASK + reentrant: FALSE + synchronous: TRUE + +Table 4.25 Crypto_30_LibCv_NvBlock_Init + +© 2025 Vector Informatik GmbH Version 14.09.04 88 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4.3.2 Crypto_30_LibCv_NvBlock_ReadFromBlock + +Prototype + +Std_ReturnType Crypto_30_LibCv_NvBlock_ReadFromBlock(Crypto_30_LibCv_SizeOfNvBlockType +blockIdx, const void * NvMBuffer) + +Parameters + +blockIdx [in] The internal identifier of the NvM block. + +NvMBuffer [in] RAM mirror where Ram block data can be read + from. + +Return Codes + +E_OK Data was copied from buffer. +E_NOT_OK Data was not copied. + +Functional Description + +Read from Block callback routine. +Block specific callback routine which is called by NvM in order to let the Crypto driver copy data from NvM +RAM mirror to Crypto RAM block. + +Particularities + +blockIdx need to be valid. + +Options + + callcontext: TASK + reentrant: FALSE + synchronous: TRUE + +Table 4.26 Crypto_30_LibCv_NvBlock_ReadFromBlock + +4.3.3 Crypto_30_LibCv_NvBlock_WriteToBlock + +Prototype + +Std_ReturnType Crypto_30_LibCv_NvBlock_WriteToBlock(Crypto_30_LibCv_SizeOfNvBlockType +blockIdx, void * NvMBuffer) + +Parameters + +blockIdx [in] The internal identifier of the NvM block. + +NvMBuffer [out] RAM mirror where Ram block data shall be written + to. + +Return Codes + +E_OK Data was copied to buffer. +E_NOT_OK No data was copied. + +Functional Description + +Write to Block callback routine. +Block specific callback routine which is called by NvM in order to let the Crypto driver copy data from RAM +block to NvM RAM mirror. + +Particularities + +blockIdx need to be valid. + +Options + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 89 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.27 – continued from previous page + + callcontext: TASK + reentrant: FALSE + synchronous: TRUE +Table 4.27 Crypto_30_LibCv_NvBlock_WriteToBlock + +4.3.4 Crypto_30_LibCv_NvBlock_Callback + +Prototype + +Std_ReturnType Crypto_30_LibCv_NvBlock_Callback(Crypto_30_LibCv_SizeOfNvBlockType blockIdx, +uint8 ServiceId, NvM_RequestResultType JobResult) + +Parameters + +blockIdx [in] The internal identifier of the NvM block. + +ServiceId [in] NvM_The service identifier of the completed + request. + +JobResult [in] NvM_Result of the single block job. + +Return Codes + +E_OK Callback function has been processed successfully. +E_NOT_OK Callback function has not been processed successfully. + +Functional Description + +Request finished Block callback routine. +Block specific callback routine which is called by NvM in order to notify the Crypto driver that an asyn- +chronous single block request has been finished. + +Particularities + +blockIdx need to be valid. + +Options + + callcontext: TASK + reentrant: FALSE + synchronous: TRUE + +Table 4.28 Crypto_30_LibCv_NvBlock_Callback + +4.3.5 esl_getBytesRNG + +Prototype + +eslt_ErrorCode esl_getBytesRNG(const eslt_Length targetLength, eslt_Byte * target) + +Parameters + +targetLength [in] The number of bytes that shall be generated + +target [in,out] Holds the pointer to the location where the random + bytes shall be stored. This buffer has to be at least + target_length + +Return Codes + +ESL_ERC_ERROR input Request successful. +ESL_ERC_NO_ERROR Request failed. + +Functional Description + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 90 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.29 – continued from previous page + + Get random byte + This function generates random numbers for primitives which requires random numbers for algorithm exe- + cution. + Particularities + + Configuration Dependency: CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON + + Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE +Table 4.29 esl_getBytesRNG + +4.4 Callout Functions + +At its configurable interfaces the module defines callout functions. The declarations of the +callout functions are provided by the BSW module, i.e. this module (CRYPTO). It is the +integrator's task to provide the corresponding function definitions. The definitions of the +callouts can be adjusted to the system's needs. The module's callout function declarations +are described in the following tables: + +4.4.1 + + Prototype + void () + Functional Description + This function is called to trigger the Watchdog. + Options + callcontext: TASK + reentrant: FALSE + synchronous: TRUE +Table 4.30 + +4.4.2 Appl_Crypto_30_LibCv_SaveContextCallout + +Prototype + +Std_ReturnType Appl_Crypto_30_LibCv_SaveContextCallout(uint32 objectId, uint32 jobId, const uint8 * +context, uint32 contextLength, uint8 * outputPtr, uint32 * outputLengthPtr) + +Parameters + +objectId [in] Holds the identifier of the Crypto Driver Object. + +jobId [in] Holds the identifier of the Job. + +context [in] Holds the Address of the source context data. + +contextLength [in] Holds the length of the source context. + +outputPtr [out] Pointer to output buffer + +outputLengthPtr [in,out] Pointer to output length buffer + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 91 + Technical Reference MICROSAR Classic Crypto_30_LibCv + + Table 4.31 – continued from previous page + + Return Codes + + E_OK Request successful. + E_NOT_OK Request failed. + Functional Description + + Saves the context to the output buffer. + The customer can choose whether the context data is to be written encrypted or in plain text to the output + buffer. The outputLengthPtr must be set to the written length. + The JobId and ObjectId can be used to check whether the data originates from the correct job and object. + Particularities + + Configuration Dependency: CRYPTO_SAVEANDRESTOREWORKSPACE == STD_ON + + Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE +Table 4.31 Appl_Crypto_30_LibCv_SaveContextCallout + +4.4.3 Appl_Crypto_30_LibCv_RestoreContextCallout + +Prototype + +Std_ReturnType Appl_Crypto_30_LibCv_RestoreContextCallout(uint32 objectId, uint32 jobId, uint8 * +context, uint32 contextLength, const uint8 * inputPtr, uint32 inputLength) + +Parameters + +objectId [in] Holds the identifier of the Crypto Driver Object. + +jobId [in] Holds the identifier of the Job. + +context [out] Holds the Address of the destination context data. + +contextLength [in] Holds the length of the destination context. + +inputPtr [in] Pointer to source input buffer. + +inputLength [in] Holds the input buffer length. + +Return Codes + +E_OK Request successful. +E_NOT_OK Request failed. + +Functional Description + +Restores the context from the output buffer. +The customer can choose to write the data encrypted or in plain text to the destination context address. +The data shall only be copied if the plain context matches the contextLength. +If the context data is encrypted, it must be decrypted first and then written to the workspace address. +The JobId and ObjectId can be used to check whether the data originates from the correct job and object. + +Particularities + +Configuration Dependency: CRYPTO_SAVEANDRESTOREWORKSPACE == STD_ON + +Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE + +Table 4.32 Appl_Crypto_30_LibCv_RestoreContextCallout + +© 2025 Vector Informatik GmbH Version 14.09.04 92 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +4.4.4 Crypto_30_LibCv_KeyValueChangedCallout + +Prototype + +LOCAL_INLINE void Crypto_30_LibCv_KeyValueChangedCallout(uint32 cryptoKeyId) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key. + +Functional Description + +Call key value changed callout. + +Particularities + +cryptoKeyId must identify a valid key. + +Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE + +Table 4.33 Crypto_30_LibCv_KeyValueChangedCallout + +4.4.5 Crypto_30_LibCv_KeyValiditySetCallout + +Prototype + +void Crypto_30_LibCv_KeyValiditySetCallout(uint32 cryptoKeyId, boolean validity) + +Parameters + +cryptoKeyId [in] Holds the identifier of the key which validity was + changed. + +validity [in] Contains the information which validity was set. + True: Valid, False: invalid. + +Functional Description + +This function is called by the module to notify the application when the validity of the key has changed. +This function is only available if the callout name is set, otherwise it is disabled. +The limitations are documented in the Section 2.1.6.7. + +Particularities + +The callout is not called if the validity of a key has changed when a key is set. +If the keys are set to their initial value during start-up or initialization of the NvM blocks, the callout will not +be called. +During the Key validity changed callout, the key is still locked for the pending request and cannot be used. + +Options + + callcontext: TASK + reentrant: TRUE + synchronous: TRUE + +Table 4.34 Crypto_30_LibCv_KeyValiditySetCallout + +© 2025 Vector Informatik GmbH Version 14.09.04 93 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +5 Configuration + +The functionalities of the module are configured with DaVinci Configurator Classic. + +For details on configuration options refer to the module-specific description that is shown in +DaVinci Configurator Classic. + +5.1 Configuration Variants + +This module supports these configuration variants: +> VARIANT-PRE-COMPILE +The configuration classes of the parameters depend on the supported configuration vari- +ants. For their definitions please see the module-specific BSWMD ARXML file Crypto_30_ +LibCv_bswmd.arxml. + +5.2 NvM Block Needs + +The parameter /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage/ +CryptoNvBlock/CryptoNvBlockLength describes the size of the NvBlock that is ac- +tually used by the CRYPTO. Each referenced NvBlock shall have at least the size of this +parameter. + +The following table includes the configuration constraint for the used NvM blocks. + + Parameter Block Type Expected Value + NvMBlockUseSetRamBlockStatus - TRUE + NvMBlockUseSyncMechanism - TRUE + NvMInitBlockCallback - Init Block Callback + NvMReadRamBlockFromNvCallback - Read from Block Callback + NvMSelectBlockForReadAll - TRUE + NvMSelectBlockForWriteAll DEFERRED TRUE + IMMEDIATE FALSE + NvMSetRamBlockStatusApi - TRUE + NvMSingleBlockCallback - Block Callback + NvMWriteRamBlockToNvCallback - Write to Block Callback + MICROSAR/NvMInvokeCallbacksForWriteAll - TRUE + MICROSAR/NvMUseInitCallback - TRUE + MICROSAR/NvMUseJobendCallback - TRUE +Table 5.1 NvM Block Needs + +5.3 Key Initialization Value + +A crypto key element can be initialized with a specific value, which can be configured in + +the DaVinci Configurator Clas- + +sic via the parameter /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/ + +© 2025 Vector Informatik GmbH Version 14.09.04 94 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +CryptoKeyElement/CryptoKeyElementInitValue. If this value has not been over- +written by the user (e.g. Crypto_30_LibCv_KeyElementSet()), it is used for the algo- +rithm that uses this key element. If the contained values are not correct, the corresponding +cryptographic operation will not yield the expected result. + +© 2025 Vector Informatik GmbH Version 14.09.04 95 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +6 Cybersecurity + +This chapter describes relevant information for a secure integration and configuration, so- +called Cybersecurity Manual Instructions (CMI), of this component to fulfill identified Tech- +nical Cybersecurity Requirements (TCR). Additionally, functional security dependencies to +other components are described. +The following TCRs are allocated to this component: +> TCR-MSRC-ProvideCryptoPrimitives +> TCR-MSRC-AccessCryptoMaterial +> TCR-MSRC-AccessCertificates + +6.1 Configuration + +6.1.1 CMI-CRYPTO-ReadAccess +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates +The user of MICROSAR Classic shall restrict read access to cryptographic material accord- +ing to their cybersecurity concept. +Rationale: +The restriction of access rights to cryptographic material leads to a smaller attack surface to +read confidential data. + +6.1.2 CMI-CRYPTO-WriteAccess +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates +The user of MICROSAR Classic shall restrict write access to cryptographic material accord- +ing to their cybersecurity concept. +Rationale: +The restriction of access rights to cryptographic material leads to a smaller attack surface to +tamper with cryptographic material. + +6.1.3 CMI-CRYPTO-NvMConsistencyLevel +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates +The user of MICROSAR Classic shall use consistency level NV_CONSISTENCY_LEVEL_ +DETECT for all NvM blocks. +Rationale: +The access rights of a key element can be changed by a firmware update through a changed +configuration. By setting the consistency level to NV_CONSISTENCY_LEVEL_DETECT, + +© 2025 Vector Informatik GmbH Version 14.09.04 96 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +such a change is detected, and the already existing key element is replaced by the newly +configured initial key element value. This prevents the existing key, which originally had +different access rights, from being used with the modified access rights. + +6.1.4 CMI-CRYPTO-KeyNotUsed +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates +If a key element is not used or not used anymore, the user of MICROSAR Classic shall +restrict the access to RA_DENIED and WA_DENIED. +Rationale: +A restriction of the access prevents both compromising and accidental use of this key. + +6.1.5 CMI-CRYPTO-SheKeyReadAccess +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial +The user of MICROSAR Classic shall set the read access of SHE key elements to RA_ +ENCRYPTED. +Rationale: +Without encryption, the key content could be read as plaintext and thus violate confidentially +of cryptographic material. + +6.1.6 CMI-CRYPTO-SheRamKeyReadAccess +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial +The user of MICROSAR Classic shall set the read access of SHE RAM key elements to +RA_ENCRYPTED. +Rationale: +Without encryption, the key content could be read as plaintext and thus violate confidentially +of cryptographic material. + +6.1.7 CMI-CRYPTO-SheKeyWriteAccess +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial +The user of MICROSAR Classic shall set the write access of SHE key elements to WA_ +ENCRYPTED. This does not apply to SHE RAM key elements (see 2.4.8). +Rationale: +Without authentication, the key content could be written unauthorized. This could lead to +loss of confidentially, integrity, and authenticity of cryptographic material. + +© 2025 Vector Informatik GmbH Version 14.09.04 97 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +6.1.8 CMI-CRYPTO-SheDebugCmd + +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial + +The user of MICROSAR Classic shall disable SHE CMD_DEBUG. + +Rationale: + +By disabling the SHE CMD_DEBUG, the attack surface is decreased. Resetting all keys +to their initial states by this command would lead to a violation of integrity of cryptographic +material. In addition, if the initial values are known, the contents of all keys would no longer +be secret. + +6.1.9 CMI-CRYPTO-ContextNotUsed + +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates + +The user of MICROSAR Classic shall set Primitive Support Context to false if Save and +Restore Context is not used. + +Rationale: + +By disabling the Primitive Support Context, the attack surface is decreased to read or ma- +nipulate cryptographic material. + +6.2 Runtime Interfaces: Application + +6.2.1 CMI-CRYPTO-ContextCallout + +Technical Cybersecurity Requirements: TCR-MSRC-AccessCryptoMaterial, TCR-MSRC- +AccessCertificates, TCR-MSRC-ProvideCryptoPrimitives + +The user of MICROSAR Classic shall ensure the confidentiality, integrity, and authenticity +of the saved context data if using the callout functions Appl_Crypto_30_LibCv_SaveCon- +textCallout and Appl_Crypto_30_LibCv_RestoreContextCallout. + +Rationale: + +The saved context may contain confidential cryptographic material that could be read or +manipulated if stored in unprotected memory. + +6.2.2 CMI-CRYPTO-RandomSeed + +Technical Cybersecurity Requirements: TCR-MSRC-ProvideCryptoPrimitives + +Before using the functionality Random Number Generation, the user of MICROSAR Classic +shall ensure the used key is seeded according to the algorithm. For details, refer Section +2.1.2.4.1 and Section 2.1.2.4.2. + +Rationale: + +A random number generator which is not seeded properly may produce predictable data and +thus introduce security issues in cryptographic primitives processing the random number +generator output. + +© 2025 Vector Informatik GmbH Version 14.09.04 98 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +6.2.3 CMI-CRYPTO-AeadDecryptVerifyBeforeUse + +Technical Cybersecurity Requirements: TCR-MSRC-ProvideCryptoPrimitives, TCR-MSRC- +AccessCryptoMaterial + +The user of MICROSAR classic using any AEAD decrypt primitive (AesGCMDecrypt, AesC- +CMDecrypt, AeadChaCha20Poly1305Decrypt) shall ensure that any decrypted data written +to the job's outputPtr is only used or moved across trust domain borders after the tag ver- +ification in job mode FINISH has succeeded. The verification is considered correct only +if the return value of the job is equal to E_OK and the verification result pointer is equal to +CRYPTO_E_VER_OK. All other combinations shall be interpreted as failed verification. Other- +wise, the algorithms are not compliant with their respective standards and the prerequisites +for their security proofs are not fulfilled. + +Rationale: + +The integrity of the received ciphertext can only be verified after the complete ciphertext has +been decrypted and processed. Due to hardware limitations, in general, it is not possible +to buffer the whole message before returning anything without significantly reducing the +usability of AEAD algorithms. Therefore, data is returned before the verification. In order +to be compliant with the respective standards, one has to ensure that the data is only used +after the verification was successful. + +6.3 Runtime Interfaces: BSW + +TCR Depends on Comment + Component(s) +TCR-MSRC-AccessCryptoMaterial, NvM Needed for reading and writing +TCR-MSRC-AccessCertificates keys and certificates +TCR-MSRC-ProvideCryptoPrimitives vSecPrim Needed for cryptographic + primitives + +Table 6.1 Cybersecurity-relevant Dependencies for Runtime Interfaces + +© 2025 Vector Informatik GmbH Version 14.09.04 99 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +7 Glossary and Abbreviations + +7.1 Glossary + + Term Description + DaVinci Configurator Generation tool for MICROSAR Classic modules + CSM Crypto Service Manager + CRYIF Crypto Interface + CRYPTO Crypto Driver +Table 7.1 Glossary + +7.2 Abbreviations Description + Additional Authenticated Data + Abbreviation Authenticated Encryption with Associated Data + AAD Advanced Encryption Standard + AEAD Algorithm Family + AES Algorithm Mode + ALGOFAM American National Standards Institute + ALGOMODE Application Programming Interface + ANSI Automotive Open System Architecture + API Basis Software + AUTOSAR Cipher Block Chaining + BSW Cipher-based Message Authentication Code + CBC Cybersecurity Manual Items + CMAC Chinese Remainder Theorem + CMI Crypto Driver + CRT Counter + CRYPTO Diagnostic Event Manager + CTR Development Error Tracer + DEM Derivation Function + DET Embedded Architecture Designer + DF Electronic Code Book + EAD Elliptic Curve Burmester Desmedt + ECB Elliptic-curve-cryptography + ECBD Elliptic-curve Diffie–Hellman + ECC Elliptic-curve Digital Signature Algorithm + ECDHE Electronic Control Unit + ECDSA Edwards-curve Digital Signature Algorithm + ECU Functional identification + EdDSA + FID + + continues on next page + +© 2025 Vector Informatik GmbH Version 14.09.04 100 + Abbreviation Technical Reference MICROSAR Classic Crypto_30_LibCv + FIPS + GCM Table 7.2 – continued from previous page + HIS Description + HMAC Federal Information Processing Standards Publication + ISO Galois Counter Mode + ISR Hersteller Initiative Software + IV Keyed-Hash Message Authentication Code + KDF International Organization for Standardization + KE Interrupt Service Routine + KEA Initialization Vector + KEK Key Derivation Function + MAC Key Element + MD5 Key Exchange Algorithm + MICROSAR Key Encryption Key + NIST Message Authentication Code + PBKDF Message-Digest Algorithm 5 + PPORT Microcontroller Open System Architecture (the Vector AUTOSAR solution) + PQC National Institute of Standards and Technology + PRF Password-Based Key Derivation Function + PRNG Provide Port + RIPEMD Post-Quantum Cryptography + RNG Pseudorandom Function + RPORT Pseudo Random Number Generator + RSA RACE Integrity Primitives Evaluation Message Digest + RTE Random Number Generator + SCC Require Port + SEC Rivest-Shamir-Adleman + SHA Runtime Environment + SHE Smart Charge Communication + SipHash Standards for Efficient Cryptography + SLH-DSA Secure Hash Algorithm + SM Secure Hardware Extension + SRS short-input PRF Hash + SWC Stateless Hash-Based Digital Signature Algorithm + SWS ShangMi (Chinese cryptography standards) + TCR Software Requirement Specification + TRNG Software Component + UID Software Specification +Table 7.2 Abbreviations Technical Cybersecurity Requirement + True Random Number Generator + Unique identification + +© 2025 Vector Informatik GmbH Version 14.09.04 101 + Technical Reference MICROSAR Classic Crypto_30_LibCv + +8 Contact + +Visit our website for more information on +> News +> Products +> Demo software +> Support +> Training data +> Addresses +www.vector.com + +© 2025 Vector Informatik GmbH Version 14.09.04 102 + diff --git a/Source/bsw/Crypto_30_LibCv/GeneratorMsr/Crypto_30_LibCv.jar b/Source/bsw/Crypto_30_LibCv/GeneratorMsr/Crypto_30_LibCv.jar new file mode 100644 index 0000000..27d33fb Binary files /dev/null and b/Source/bsw/Crypto_30_LibCv/GeneratorMsr/Crypto_30_LibCv.jar differ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.c new file mode 100644 index 0000000..74bd47d --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.c @@ -0,0 +1,5051 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------ + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------ + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of the MICROSAR Crypto Driver (Crypto) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_InternalApi.h" +#include "CryIf_Cbk.h" + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + +/* Check the version of CRYPTO header file */ +#if ( (CRYPTO_30_LIBCV_SW_MAJOR_VERSION != (14u)) \ + || (CRYPTO_30_LIBCV_SW_MINOR_VERSION != (9u)) \ + || (CRYPTO_30_LIBCV_SW_PATCH_VERSION != (4u))) +# error "Vendor specific version numbers of Crypto_30_LibCv.c and Crypto_30_LibCv.h are inconsistent" +#endif + +#if ( (CRYPTO_30_LIBCV_SW_MAJOR_VERSION != CRYPTO_30_LIBCV_CFG_MAJOR_VERSION) \ + || (CRYPTO_30_LIBCV_SW_MINOR_VERSION != CRYPTO_30_LIBCV_CFG_MINOR_VERSION) \ + || (CRYPTO_30_LIBCV_SW_PATCH_VERSION != CRYPTO_30_LIBCV_CFG_PATCH_VERSION)) +# error "Version numbers of Crypto_30_LibCv.c and Crypto_30_LibCv_Cfg.h are inconsistent" +#endif + +#if ( (CRYPTO_30_LIBCV_GENERATOR_MAJOR_VERSION != (14u)) \ + || (CRYPTO_30_LIBCV_GENERATOR_MINOR_VERSION != (9u))) +# error "Module version numbers of Crypto_30_LibCv.c and generator are inconsistent" +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_LOCAL) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL static +#endif + +#if !defined (CRYPTO_30_LIBCV_LOCAL_INLINE) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL_INLINE LOCAL_INLINE +#endif + +#define CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE (0x00u) +#define CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_PROCESSING (0x01u) + +/* Redirection */ +#define CRYPTO_30_LIBCV_REDIRECTION_MASK_NOT_USED (0x00u) +#define Crypto_30_LibCv_IsRedirection(redir, mask) (((redir) & (mask)) == (mask)) + +/* IO Check */ +#define Crypto_30_LibCv_IsIOLengthInvalid(length) ((length) > CRYPTO_30_LIBCV_UINT16_MAX) +#define Crypto_30_LibCv_IsIOMask(value, mask) (((value) & (mask)) == (mask)) + +#define CRYPTO_30_LIBCV_IOMASK_EMPTY CRYPTO_30_LIBCV_REDIRECTION_MASK_NOT_USED + +#ifdef CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT +#else +# define CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT (0x01u) +#endif +#define CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT_INV (0xFEu) + +#ifdef CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT +#else +# define CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT (0x02u) +#endif + +#ifdef CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_30_LIBCV_IOMASK_TERTIARY_INPUT CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT +#else +# define CRYPTO_30_LIBCV_IOMASK_TERTIARY_INPUT (0x04u) +#endif + +#ifdef CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT +#else +# define CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT (0x10u) +#endif + +#ifdef CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT +#else +# define CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT (0x20u) +#endif + +#define CRYPTO_30_LIBCV_IOMASK_VERIFY_OUTPUT (0x40u) + +#define CRYPTO_30_LIBCV_OBJECTID_LENGTH (0x04u) +#define CRYPTO_30_LIBCV_ADDITIONAL_INFO_LENGTH (0x04u) +#define CRYPTO_30_LIBCV_WORKSPACE_SETTINGS_LENGTH (CRYPTO_30_LIBCV_OBJECTID_LENGTH + CRYPTO_30_LIBCV_ADDITIONAL_INFO_LENGTH) + +/* for each driver object --------------------------- */ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_VAR_ZERO_INIT_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! Initialization state of the module */ +VAR(uint8, CRYPTO_30_LIBCV_VAR_ZERO_INIT) Crypto_30_LibCv_ModuleInitialized = CRYPTO_30_LIBCV_UNINIT; +#endif + +#define CRYPTO_30_LIBCV_STOP_SEC_VAR_ZERO_INIT_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +#define CRYPTO_30_LIBCV_START_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) || (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskUpdate[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY +}; +#endif + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskUpdateOptional[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY +}; +#endif + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskUpdateOptionalKeepFromFinish[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT +}; +#endif + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskUpdateZeroLength[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_EMPTY +}; +#endif + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) || (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskFinish[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT | CRYPTO_30_LIBCV_IOMASK_VERIFY_OUTPUT, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_TERTIARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT | CRYPTO_30_LIBCV_IOMASK_VERIFY_OUTPUT, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT | CRYPTO_30_LIBCV_IOMASK_VERIFY_OUTPUT, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_TERTIARY_INPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT | CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT +}; +#endif + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_IOServiceMaskFinishOptional[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_IOMASK_EMPTY, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT +}; +#endif + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_RedirectReadAccessRight[CRYPTO_KEYUNWRAP + 1u] = { /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ + /* 0x00 CRYPTO_HASH */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x01 CRYPTO_MACGENERATE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x02 CRYPTO_MACVERIFY */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x03 CRYPTO_ENCRYPT */ CRYPTO_30_LIBCV_RA_ALLOWED, + /* 0x04 CRYPTO_DECRYPT */ CRYPTO_30_LIBCV_RA_ALLOWED, + /* 0x05 CRYPTO_AEADENCRYPT */ CRYPTO_30_LIBCV_RA_ALLOWED, + /* 0x06 CRYPTO_AEADDECRYPT */ CRYPTO_30_LIBCV_RA_ALLOWED, + /* 0x07 CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x08 CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x09 CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0A CRYPTO_SECCOUNTERREAD */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0B CRYPTO_RANDOMGENERATE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0C CRYPTO_RANDOMSEED */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0D CRYPTO_KEYGENERATE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0E CRYPTO_KEYDERIVE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x0F CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x10 CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x11 CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x12 CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x13 CRYPTO_KEYSETVALID */ CRYPTO_30_LIBCV_RA_DENIED, + /* 0x14 CRYPTO_KEYSETINVALID */ CRYPTO_30_LIBCV_RA_DENIED, + /* 0x15 CRYPTO_CUSTOM_SERVICE */ CRYPTO_30_LIBCV_RA_DENIED, + /* 0x16 CRYPTO_KEYWRAP */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY, + /* 0x17 CRYPTO_KEYUNWRAP */ CRYPTO_30_LIBCV_RA_INTERNAL_COPY +}; +#endif +#define CRYPTO_30_LIBCV_STOP_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsIsLockNotProtected() + **********************************************************************************************************************/ +/*! \brief Check if long term workspace is locked. + * \details This function checks if the long term workspace is locked and provides the workspace idx. + * \param[in] cryptoKeyId Holds the key id which will lock the workspace + * \param[out] longWsIdxPtr Provided long term workspace idx. + * \return E_OK Lock is obtained or was already obtained. + * E_NOT_OK Request Failed + * \pre longWsIdxPtr has to be a valid pointer. + * Has to be called inside an exclusive area which protects the lock. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsIsLockNotProtected( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr); +#endif /* (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_IsKeyListValid() + **********************************************************************************************************************/ +/*! \brief Checks provided key list for validity of key Ids. + * \details - + * \param[in] keyList Holds the keylist which should be checked. Must not be NULL_PTR. + * \return TRUE Keys in keyList have valid Ids. + * FALSE At least one key in keyList has an invalid Id. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_IsKeyListValid( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); +#endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryObtainingLockAndSetProcessing() + *********************************************************************************************************************/ +/*! \brief Try to obtain the workspace lock and set object state to processing. + * \details This function tries to lock the workspace with the job. + * If that succeeds, it sets the object state to processing. + * This access is not protected by a exclusive area. + * \param[in] objectId Holds the identifier of the object to lock. + * \param[in] job Pointer to the job. Must not be NULL_PTR. + * \param[out] keyListNeedsLock Pointer to a boolean where the information should be stored if the keys + * belonging to job must be locked. Must not be NULL_PTR. + * \return E_OK Lock is obtained or was already obtained. + * E_NOT_OK Request Failed + * CRYPTO_E_BUSY Lock is occupied by other job. + * \pre objectId has to be a valid object id. + * job has to be a valid job object. + * The caller must ensure that this call is protected by a exclusive area. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryObtainingLockAndSetProcessing( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyListNeedsLock); + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryObtainingLockAndLockKeys() + *********************************************************************************************************************/ +/*! \brief Try to obtain lock workspace and set object state to processing. + * \details This function tries to lock the workspace and keys with the job. + * If that succeeds, it sets the object state to processing. + * \param[in] objectId Holds the identifier of the object to lock. + * \param[in] job Pointer to the job. Must not be NULL_PTR. + * \param[in] keyList Pointer to the key lock list. Must not be NULL_PTR. + * \return E_OK Lock is obtained or was already obtained. + * E_NOT_OK Request Failed + * CRYPTO_E_BUSY Lock is occupied by other job. + * \pre objectId has to be a valid object id. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryObtainingLockAndLockKeys( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_CheckQueueAndLockAndProcess() + *********************************************************************************************************************/ +/*! \brief If a job is in queue, try to obtain lock workspace and process the job. + * \details This function tries to lock the workspace and keys with the job next in the queue. + * If that succeeds, it sets the object state to processing and processes the job. + * \param[in] objectId Holds the identifier of the object queue to check. + * \pre objectId has to be a valid object id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CheckQueueAndLockAndProcess( + uint32 objectId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_UpdateJobState() + *********************************************************************************************************************/ +/*! \brief Updates the state of the job according to retVal of dispatcher. + * \details This function updates the state of job according to retVal of dispatcher as long as dispatcher is not busy. + * \param[in] retVal Return value of the dispatcher + * \param[in,out] job Pointer to the job whose state shall be updated + * \pre job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_UpdateJobState( + Std_ReturnType retVal, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SearchService() + *********************************************************************************************************************/ +/*! \brief Search Service in List + * \details This function searches the provided job to the service as specified in the job configuration. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[out] primitiveInfoIdx Provide the primitive info index. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * primitiveInfoIdx has to be a valid Id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SearchService( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_SizeOfPrimitiveInfoType, AUTOMATIC, AUTOMATIC) primitiveInfoIdx); + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Verify() + **********************************************************************************************************************/ +/*! \brief Det Checks for the verify parameters. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in,out] dataPtr data pointer + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note The verification pointer is set to CRYPTO_E_VER_NOT_OK by default, + * as it is required to hold the ECDSA safety requirement. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Verify( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Input() + **********************************************************************************************************************/ +/*! \brief Det Checks for the input parameters. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] dataPtr data pointer + * \param[in] dataLength data length + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Input( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional() + **********************************************************************************************************************/ +/*! \brief Det Checks for the input parameters. + * \details DataLength 0 is a valid value. If dataLength is 0 the dataPtr can be a NULL_PTR. + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] dataPtr data pointer + * \param[in] dataLength data length + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength() + **********************************************************************************************************************/ +/*! \brief Det Checks for the input parameters. + * \details DataLength 0 is a valid value. + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] dataPtr data pointer + * \param[in] dataLength data length + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory() + **********************************************************************************************************************/ +/*! \brief Det Checks for the output parameters. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] dataPtr data pointer + * \param[in] dataLengthPtr data length pointer + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr); + +# if((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional() + **********************************************************************************************************************/ +/*! \brief Det Checks for the output parameters. + * \details DataLength 0 is a valid value. + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] dataPtr data pointer + * \param[in] dataLengthPtr data length pointer + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note Only SaveAndRestore and KeyWrap Aes have optional secondary output pointers + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr); +# endif /* ((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput() + **********************************************************************************************************************/ +/*! \brief Dispatches Det checks for primary input. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] optionalMask Mask which optional parameter shall be checked. + * \param[in] zeroLengthMask Mask which zero-length-enabled parameter shall be checked. + * \pre job has to be a valid job object. errorId pointer has to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 optionalMask, + uint8 zeroLengthMask); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput() + **********************************************************************************************************************/ +/*! \brief Dispatches Det checks for secondary input. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] optionalMask Mask which optional parameter shall be checked. + * \pre job has to be a valid job object. errorId pointer has to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 optionalMask); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Output() + **********************************************************************************************************************/ +/*! \brief Dispatches Det checks for primary and secondary output. + * \details - + * \param[out] errorId Output pointer to the detected Error-Type-Id + * \param[in] optionalMask Mask which optional parameter shall be checked. + * \param[in] outputType Type of output, can be either: + * - CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT or + * - CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT + * \param[in] dataPtr data pointer (e.g. jobs' outputPtr or secondaryOutputPtr) + * \param[in] dataLengthPtr data length pointer (e.g. jobs' outputLengthPtr or secondaryOutputLengthPtr) + * \pre errorId pointer has to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Output( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + uint8 optionalMask, + uint8 outputType, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_All() + **********************************************************************************************************************/ +/*! \brief Det Checks for the Service Parameters + * \details This function checks the Det-Checks for all required in- and output-values. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] mask Mask which parameter shall be checked. + * \param[in] optionalMask Mask which optional parameter shall be checked. + * \param[in] zeroLengthMask Mask which zero-length-enabled parameter shall be checked. + * \return CRYPTO_E_NO_ERROR No Det error detected. + * CRYPTO_E_PARAM_POINTER Det error detected, invalid pointer. + * CRYPTO_E_PARAM_VALUE Det error detected, invalid value. + * \pre job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(uint8, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_All( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 mask, + uint8 optionalMask, + uint8 zeroLengthMask); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues() + *********************************************************************************************************************/ +/*! \brief Det Checks for the Service Parameters + * \details This function checks the Det-Checks for all required in- and output-values. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[out] errorId Output Pointer to the detected Error-Type-Id + * \return E_OK No Det error detected. + * E_NOT_OK Det error detected. + * \pre objectId has to be a valid driver object handle. + * errorId has to be a valid pointer. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorId); +#endif /* (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Process() + *********************************************************************************************************************/ +/*! \brief Processes the received job + * \details Performs the crypto primitive, that is configured in the job parameter. Takes care of jobs operation mode. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with job and + * primitive relevant information but also pointer to result buffers. + * \param[in,out] keyList Pointer to the key lock list + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_QUEUE_FULL Request failed, the queue is full. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, the entropy is exhausted + * CRYPTO_E_JOB_CANCELED The service request failed because the synchronous Job has been canceled. + * \pre Lock has to be reserved for the job object. + * objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Process( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); + +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_UpdateObjectWorkspace() + *********************************************************************************************************************/ +/*! \brief Save the last driver object workspace type. + * \details - + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * Has to be called inside an exclusive area which protects the consistency of the last job data. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_UpdateObjectWorkspace( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_ClearObjectWorkspace() + *********************************************************************************************************************/ +/*! \brief Clear the last driver object workspace type. + * \details - + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * Has to be called inside an exclusive area which protects the consistency of the last job data. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ClearObjectWorkspace( + uint32 objectId); +#endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_IsRedirectUsed() + **********************************************************************************************************************/ +/*! \brief Is redirection used. + * \details Check if redirection is used in the current Job. + * \param[in] job Pointer to the job which shall checked. + * \return TRUE Job is redirected. + * FALSE Job is not redirected. + * \pre job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_IsRedirectUsed( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPreSetBufferForKey() + **********************************************************************************************************************/ +/*! \brief Check access rights for given key element. + * \details Check access rights according to their read/write access. + * \param[in] cryptoKeyId Holds the crypto key id. + * \param[in] keyElementId Holds the key element id. + * \param[out] elementPtr Pointer to the key element storage. + * \param[out] resultLengthPtr Pointer to the key element length. + * \param[in] readWrite Read or write access. + * \param[in] cryptoService Holds the crypto service. + * \return E_OK Request success. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_EMPTY Request failed, key is empty. + * \pre cryptoKeyId need to be valid. + * cryptoService need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPreSetBufferForKey( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) elementPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + uint8 readWrite, + Crypto_ServiceInfoType cryptoService); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPostSaveKeyResult() + **********************************************************************************************************************/ +/*! \brief Save result for output key elements. + * \details - + * \param[in] cryptoKeyId Holds the crypto key id. + * \param[in] keyElementId Holds the key element id. + * \param[in] resultLength Holds the result length. (current update length) + * \param[in,out] writtenLengthPtr Holds the a pointer to the already written length. (last update length) + * \param[in] result Current update result + * \pre cryptoKeyId need to be valid. + * cryptoService need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPostSaveKeyResult( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 resultLength, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) writtenLengthPtr, + Std_ReturnType result); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyListRedirection() + **********************************************************************************************************************/ +/*! \brief Create list of keys for redirection. + * \details A key is only referenced once in the list with the highest access. + * \param[in] job Pointer to the job which shall checked. + * \param[in,out] keyList Pointer to the keyList. + * \pre job has to be a valid job object. + * keyList has to be a valid keyList object with at least 6 elements if redirection is used, otherwise 1. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyListRedirection( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPreRedirKeys() + **********************************************************************************************************************/ +/*! \brief Pre redirect keys and in- and out-buffer. + * \details Set the in- and out-buffer to the redirected keys. + * \param[in,out] redirectBuffer Pointer to the redirection buffer. + * \param[in,out] job Pointer to the configuration of the job. + * \return E_OK Request success. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_EMPTY Request failed, key is empty. + * \pre Lock has to be reserved for the job object. + * redirectBuffer has to be a valid pointer. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPreRedirKeys( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPostRestoreBuffer() + **********************************************************************************************************************/ +/*! \brief Post redirect keys and in- and out-buffer. + * \details Save result and restore in- and out-buffer. + * \param[in,out] redirectBuffer Pointer to the redirection buffer. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] result Current update result + * \pre Lock has to be reserved for the job object. + * redirectBuffer has to be a valid pointer. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPostRestoreBuffer( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Std_ReturnType result); +#endif /* (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SaveContextJob() + **********************************************************************************************************************/ +/*! \brief Save the context. + * \details Stores the current workspace context in the output buffer. + * If the output length pointer is set to 0, the expected buffer length is written to the output + * length pointer. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * length of the output buffer must be greater than or equal to the context length. + * Also refer to SMI-722498 + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SaveContextJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RestoreContextJob() + **********************************************************************************************************************/ +/*! \brief Restore the context. + * \details Restores the workspace context with the information from the job input pointer. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * length of the input buffer must be greater than or equal to the context length. + * Also refer to SMI-722498 + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RestoreContextJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); +#endif /* (CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) */ + +#if((CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON) || (CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_HandleOptionalInputDataInFinish() + **********************************************************************************************************************/ +/*! \brief This function calls the dispatch function in UPDATE mode to process optional input data in finish mode. + * \details This applies only for signature services. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HandleOptionalInputDataInFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); +#endif /* (CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON) || (CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchJob() + **********************************************************************************************************************/ +/*! \brief Dispatch the job. + * \details Forward the job to the correct primitive. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[out] unlockingNecessary Is set when unlocking is required + * \param[out] contextMode Is set when context mode is enabled + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, the entropy is exhausted + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * length of the input buffer must be greater than or equal to the context length. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchJob( + uint32 objectId, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) unlockingNecessary, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) contextMode, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryToSetJobInQueue() + **********************************************************************************************************************/ +/*! \brief Handles an asynchronous job request and tries to push it into the queue for deferred processing. + * \details - + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] primitiveInfoIdx Holds the identifier of the primitive. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_QUEUE_FULL The queue for the async job is full. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * primitiveInfoIdx has to be a valid Id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryToSetJobInQueue( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitMainPartition() + *********************************************************************************************************************/ +/*! \brief Initializes the shared data of the Crypto Driver + * \details This function initializes all shared variables relevant for all + * partitions and sets the module state for this data to initialized. It has to be called once from + * the main partition. + * \param[out] errorIdPtr Pointer to where the errorId should be written. + * Must not be NULL_PTR and have enough space for a uint8. + * \pre Interrupts are disabled. + * Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitMainPartition( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitPartitionSpecificData() + *********************************************************************************************************************/ +/*! \brief Initializes the partition specific data of the Crypto Driver + * \details This function initializes all partition specific variables relevant for the provided + * partitionIdx and sets the module state for the partition to initialized. It has to be called once from + * each partition where the module is used. + * \param[in] partitionIdx Holds the index of the partition which should be initialized. + * \param[out] errorIdPtr Pointer to where the errorId should be written. + * Must not be NULL_PTR and have enough space for a uint8. + * \pre Interrupts are disabled. + * Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitPartitionSpecificData(uint32 partitionIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr); + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsIsLockNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsIsLockNotProtected( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_LongTermWsLockIterType id; + + /* ----- Implementation ------------------------------------------------- */ + for (id = 0u; id < Crypto_30_LibCv_GetSizeOfLongTermWsLock(); id++) + { + if (Crypto_30_LibCv_IsLongTermWsLock(id, cryptoKeyId)) + { + *longWsIdxPtr = (Crypto_30_LibCv_SizeOfLongTermWsLockType)id; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_LongWsIsLockNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsLockGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsLockGet( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + Crypto_30_LibCv_LongTermWsLockIterType id; + + /* ----- Implementation ------------------------------------------------- */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + + /* Lock already occupied */ + retVal = Crypto_30_LibCv_Local_LongWsIsLockNotProtected(cryptoKeyId, longWsIdxPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + /* Check if a lock is free and can be occupied. */ + if (retVal != E_OK) + { + for (id = 0u; id < Crypto_30_LibCv_GetSizeOfLongTermWsLock(); id++) + { + if (Crypto_30_LibCv_GetLongTermWsLock(id) == CRYPTO_30_LIBCV_LONG_TERM_WS_LOCK_FREE) + { + Crypto_30_LibCv_SetLongTermWsLock(id, cryptoKeyId);/* SBSW_CRYPTO_30_LIBCV_CSL01 */ + *longWsIdxPtr = (Crypto_30_LibCv_SizeOfLongTermWsLockType)id; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + break; + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + + return retVal; +} /* Crypto_30_LibCv_Local_LongWsLockGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsIsLock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsIsLock( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + retVal = Crypto_30_LibCv_Local_LongWsIsLockNotProtected(cryptoKeyId, longWsIdxPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + + return retVal; +} /* Crypto_30_LibCv_Local_LongWsIsLock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsLockRelease() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsLockRelease( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + if (Crypto_30_LibCv_IsLongTermWsLock(longWsIdx, cryptoKeyId)) /* COV_CRYPTO_30_LIBCV_KEY_LOCKING_RELEASE */ + { + Crypto_30_LibCv_SetLongTermWsLock(longWsIdx, CRYPTO_30_LIBCV_LONG_TERM_WS_LOCK_FREE);/* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2(); + +} /* Crypto_30_LibCv_Local_LongWsLockRelease() */ +#endif /* (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryObtainingLockAndSetProcessing() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryObtainingLockAndSetProcessing( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyListNeedsLock) +{ + Std_ReturnType retVal = E_NOT_OK; + + *keyListNeedsLock = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* #5 Lock driver object for the given job if it is not already locked. */ + if (Crypto_30_LibCv_IsLockOccupiedByJob(objectId, job->CRYPTO_30_LIBCV_JOB_ID_MEMBER)) + { + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_PROCESSING); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + retVal = E_OK; + } +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + else if ((Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START)) || (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT))) +#else + else if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START)) +#endif + { + if (Crypto_30_LibCv_IsLockFree(objectId)) + { + Crypto_30_LibCv_SetLock(objectId, job->CRYPTO_30_LIBCV_JOB_ID_MEMBER); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* #10 Set object state to processing */ + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_PROCESSING); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + *keyListNeedsLock = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ +#endif + retVal = E_OK; + } + else + { + retVal = CRYPTO_E_BUSY; + } + } + else + { + /* [SWS_Crypto_00118] No Start flag while in idle mode */ + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_TryObtainingLockAndSetProcessing() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryObtainingLockAndLockKeys() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryObtainingLockAndLockKeys( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_NOT_OK; + boolean keysNeedToBeLocked = FALSE; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* #10 Try to lock driver object for the given job */ + retVal = Crypto_30_LibCv_TryObtainingLockAndSetProcessing(objectId, job, &keysNeedToBeLocked); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + if ((retVal == E_OK) && (keysNeedToBeLocked == TRUE)) + { + /* #20 Lock key if operation mode is start or restore */ + retVal = Crypto_30_LibCv_Local_KeyListPreLockKeysProtected(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + if (retVal != E_OK) + { + /* #30 If any lock fails, revert all locks and processing states */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + Crypto_30_LibCv_FreeLock(objectId); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + retVal = CRYPTO_E_BUSY; + } + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_TryObtainingLockAndLockKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_CheckQueueAndLockAndProcess() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CheckQueueAndLockAndProcess( + uint32 objectId) +{ + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job; + Crypto_30_LibCv_KeyLockListType keyList = {0}; + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx = 0u; + Std_ReturnType localRetVal = E_NOT_OK; + boolean keysNeedToBeLocked = FALSE; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* #1 Check if there is a job in the queue */ + job = Crypto_30_LibCv_GetQueue(Crypto_30_LibCv_GetQueueIdxOfObjectInfo(objectId)); + + if (job != NULL_PTR) + { + Crypto_30_LibCv_Local_GetKeyList(job, &keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + primitiveInfoIdx = Crypto_30_LibCv_GetDispatch_QueuePrimitiveInfoIdx(objectId); + +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + if (Crypto_30_LibCv_IsDefaultRandomSourceOfPrimitiveInfo(primitiveInfoIdx)) + { + uint32 defaultRandomKey = Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId)); + Crypto_30_LibCv_Local_KeyListAddKey(&keyList, defaultRandomKey, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } +#endif + + /* #10 Try to lock driver object for the given job */ + localRetVal = Crypto_30_LibCv_TryObtainingLockAndSetProcessing(objectId, job, &keysNeedToBeLocked); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + if (localRetVal == E_OK) + { + if (keysNeedToBeLocked == TRUE) + { + /* #20 Lock key if operation mode is start or restore */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + localRetVal = Crypto_30_LibCv_Local_KeyListPreLockKeysProtected(&keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (localRetVal != E_OK) + { + /* #30 If any lock fails, revert all locks */ + Crypto_30_LibCv_FreeLock(objectId); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + } + } +#endif + + if (localRetVal == E_OK) + { + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + localRetVal = Crypto_30_LibCv_Process((uint32)objectId, job, &keyList, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* PRQA S 2973 */ /* MD_CRYPTO_30_LIBCV_2973 */ + + /* #40 Release Queue */ + Crypto_30_LibCv_SetQueue(Crypto_30_LibCv_GetQueueIdxOfObjectInfo(objectId), NULL_PTR); /* SBSW_CRYPTO_30_LIBCV_CSL02_QUEUE_VIA_DRIVEROBJECT */ + + /* #50 Notify CryIf about the result of the job */ + CryIf_CallbackNotification(job, localRetVal); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_CheckQueueAndLockAndProcess() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_UpdateJobState() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_UpdateJobState( + Std_ReturnType retVal, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* #5 Set job state based on parameter return value. */ + if (retVal == E_OK) + { + job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_ACTIVE; /* SBSW_CRYPTO_30_LIBCV_UPDATE_OF_JOB_STATE */ + } + else + { + /* [SWS_Crypto_00025] [SWS_Crypto_00119] Set job to IDLE if error occurred */ + job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_IDLE; /* SBSW_CRYPTO_30_LIBCV_UPDATE_OF_JOB_STATE */ + } +} /* Crypto_30_LibCv_UpdateJobState() */ + +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_ObjectWorkspaceHasChanged() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ObjectWorkspaceHasChanged( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + boolean retVal = TRUE; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Check if the cryptoKeyId is the same as in the last job. */ + if (job->cryptoKeyId == Crypto_30_LibCv_GetKeyIdOfLastJob(objectId)) + { + /* Check if the algorithm family and the algorithm mode is the same as in the last job. */ + if ((job->jobPrimitiveInfo->primitiveInfo->algorithm.family == Crypto_30_LibCv_GetFamilyOfLastJob(objectId))&& + (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == Crypto_30_LibCv_GetModeOfLastJob(objectId))) + { + /* Return false - object workspace type has NOT changed. */ + retVal = FALSE; + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + return retVal; +} /* Crypto_30_LibCv_ObjectWorkspaceHasChanged() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey( + uint32 cryptoKeyId) +{ + uint32 objectId; + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* #1 check if key is used in any object workspace type */ + for (objectId = 0; objectId < Crypto_30_LibCv_GetSizeOfObjectInfo(); objectId++) + { + if (Crypto_30_LibCv_GetKeyIdOfLastJob(objectId) == cryptoKeyId) + { + /* #2 clear the last object workspace type */ + Crypto_30_LibCv_SetKeyIdOfLastJob(objectId, CRYPTO_30_LIBCV_UINT32_MAX); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetFamilyOfLastJob(objectId, CRYPTO_ALGOFAM_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetModeOfLastJob(objectId, CRYPTO_ALGOMODE_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_UpdateObjectWorkspace() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_UpdateObjectWorkspace( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* #1 update the last object workspace type */ + Crypto_30_LibCv_SetKeyIdOfLastJob(objectId, job->cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetFamilyOfLastJob(objectId, job->jobPrimitiveInfo->primitiveInfo->algorithm.family); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetModeOfLastJob(objectId, job->jobPrimitiveInfo->primitiveInfo->algorithm.mode); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +} /* Crypto_30_LibCv_UpdateObjectWorkspace() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_ClearObjectWorkspace() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ClearObjectWorkspace( + uint32 objectId) +{ + /* #1 clear the last object workspace type */ + Crypto_30_LibCv_SetKeyIdOfLastJob(objectId, CRYPTO_30_LIBCV_UINT32_MAX); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetFamilyOfLastJob(objectId, CRYPTO_ALGOFAM_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetModeOfLastJob(objectId, CRYPTO_ALGOMODE_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +} /* Crypto_30_LibCv_ClearObjectWorkspace() */ +#endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Verify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Verify( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr) +{ + + /* Check Pointer */ + if (dataPtr == NULL_PTR) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + else + { + /* In all primitives in which the verification pointer is usage, it is set to CRYPTO_E_VER_NOT_OK by default. + The verification pointer should be set to CRYPTO_E_VER_OK only in successful run. */ + *dataPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_Verify() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Input() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Input( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength) +{ + + /* Check Pointer */ + if (dataPtr == NULL_PTR) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + /* Check Length */ +# if(CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_ON) + else if (dataLength == 0u) +# else + else if ((dataLength == 0u) || + Crypto_30_LibCv_IsIOLengthInvalid(dataLength)) +# endif + { + *errorId = CRYPTO_E_PARAM_VALUE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + else + { + /* Det Checks passed. Nothing has to be done. */ + } + +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_Input() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength) +{ + /* Check Pointer */ + if ((dataPtr == NULL_PTR) && + (dataLength != 0u)) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } +# if(CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_OFF) + /* Check Length */ + else if (Crypto_30_LibCv_IsIOLengthInvalid(dataLength)) + { + *errorId = CRYPTO_E_PARAM_VALUE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } +# endif + else + { + /* Det Checks passed. Nothing has to be done. */ + } +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 dataLength) +{ + /* Check Pointer */ + if (dataPtr == NULL_PTR) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + /* Check Length */ +# if(CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_OFF) + else if Crypto_30_LibCv_IsIOLengthInvalid(dataLength) + { + *errorId = CRYPTO_E_PARAM_VALUE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } +# endif + else + { + /* Det Checks passed. Nothing has to be done. */ + } + +# if(CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_ON) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr) +{ + + /* Check Pointer */ + if ((dataPtr == NULL_PTR) || + (dataLengthPtr == NULL_PTR)) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + /* Check Length */ +# if (CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_ON) + else if (*dataLengthPtr == 0u) +# else + else if ((*dataLengthPtr == 0u) || + Crypto_30_LibCv_IsIOLengthInvalid(*dataLengthPtr)) +# endif + { + *errorId = CRYPTO_E_PARAM_VALUE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + else + { + /* Det Checks passed. Nothing has to be done. */ + } + +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory() */ + +# if((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr) +{ + /* Check Pointer */ + if ((dataPtr == NULL_PTR) || (dataLengthPtr == NULL_PTR)) + { + *errorId = CRYPTO_E_PARAM_POINTER; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } +# if(CRYPTO_30_LIBCV_VSEC_PRIM_ESLT_LENGTH_32 == STD_OFF) + /* Check Length */ + else if (Crypto_30_LibCv_IsIOLengthInvalid(*dataLengthPtr)) + { + *errorId = CRYPTO_E_PARAM_VALUE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } +# endif + else + { + /* Det Checks passed. Nothing has to be done. */ + } +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional() */ +# endif /* ((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 optionalMask, + uint8 zeroLengthMask) +{ + if (Crypto_30_LibCv_IsIOMask(optionalMask, CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional(errorId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + else if (Crypto_30_LibCv_IsIOMask(zeroLengthMask, CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_InputZeroLength(errorId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + else + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Input(errorId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 optionalMask) +{ + if (Crypto_30_LibCv_IsIOMask(optionalMask, CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_InputOptional(errorId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + else + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Input(errorId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_Output() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_Output( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + uint8 optionalMask, + uint8 outputType, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataLengthPtr) +{ +# if((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) + if (Crypto_30_LibCv_IsIOMask(optionalMask, outputType)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_OutputOptional(errorId, dataPtr, dataLengthPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + else +# endif /* ((CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON)) */ + { + Crypto_30_LibCv_Local_DetChecksServiceValues_OutputMandatory(errorId, dataPtr, dataLengthPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(optionalMask); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(outputType); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + } +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_Output() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues_All() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* PRQA S 6010 4 */ /* MD_MSR_STPTH */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(uint8, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues_All( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 mask, + uint8 optionalMask, + uint8 zeroLengthMask + ) +{ + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* Dispatch Det checks. */ + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_PrimaryInput(&errorId, job, optionalMask, zeroLengthMask); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_SECONDARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_SecondaryInput(&errorId, job, optionalMask); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_TERTIARY_INPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Input(&errorId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputLength); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Output(&errorId, + optionalMask, CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Output(&errorId, + optionalMask, CRYPTO_30_LIBCV_IOMASK_SECONDARY_OUTPUT, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(mask, CRYPTO_30_LIBCV_IOMASK_VERIFY_OUTPUT)) + { + Crypto_30_LibCv_Local_DetChecksServiceValues_Verify(&errorId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + return errorId; +} /* Crypto_30_LibCv_Local_DetChecksServiceValues_All() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_DetChecksServiceValues() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6010, 6030, 6050 3 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_DetChecksServiceValues( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + Crypto_ServiceInfoType cryptoService = job->jobPrimitiveInfo->primitiveInfo->service; + uint8 mask = CRYPTO_30_LIBCV_IOMASK_EMPTY; + uint8 optional = CRYPTO_30_LIBCV_IOMASK_EMPTY; + uint8 zeroLength = CRYPTO_30_LIBCV_IOMASK_EMPTY; + + /* ----- Development Error Checks --------------------------------------- */ + + /* #0 Check plausibility of parameters */ + if (cryptoService > CRYPTO_KEYUNWRAP) + { + /* #11 requested service is not valid (out of range of possible services) */ + /* [SWS_Crypto_00064] check if job->jobPrimitiveInfo->primitiveInfo->service is supported by Crypto Driver Object */ + *errorId = CRYPTO_E_PARAM_HANDLE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ + } + else + { + /* Check first FINISH then UPDATE this is required for optional special handling. */ + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH)) + { + mask = Crypto_30_LibCv_IOServiceMaskFinish[cryptoService]; + optional = Crypto_30_LibCv_IOServiceMaskFinishOptional[cryptoService]; + } + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_UPDATE)) + { + mask |= Crypto_30_LibCv_IOServiceMaskUpdate[cryptoService]; + + /* optional mask is reset since there might be optional parameters in update */ + optional &= Crypto_30_LibCv_IOServiceMaskUpdateOptionalKeepFromFinish[cryptoService]; + optional |= Crypto_30_LibCv_IOServiceMaskUpdateOptional[cryptoService]; + zeroLength = Crypto_30_LibCv_IOServiceMaskUpdateZeroLength[cryptoService]; + } + +# if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SAVE_CONTEXT)) + { + mask |= CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT; + optional |= CRYPTO_30_LIBCV_IOMASK_PRIMARY_OUTPUT; + } + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT)) + { + mask |= CRYPTO_30_LIBCV_IOMASK_PRIMARY_INPUT; + } +# endif +# if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) + if (Crypto_30_LibCv_Local_IsRedirectUsed(job) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + { + mask &= (uint8)~(job->jobRedirectionInfoRef->redirectionConfig); + optional &= (uint8)~(job->jobRedirectionInfoRef->redirectionConfig); + } +# endif + + if (mask != CRYPTO_30_LIBCV_IOMASK_EMPTY) + { + *errorId = Crypto_30_LibCv_Local_DetChecksServiceValues_All(job, mask, optional, zeroLength); /* SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + } + + /* #12 Set return Value to E_NOT_OK if a failure was detected. */ + if ((*errorId == CRYPTO_E_PARAM_POINTER) || + (*errorId == CRYPTO_E_PARAM_VALUE) || (*errorId == CRYPTO_E_PARAM_HANDLE)) + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_DetChecksServiceValues() */ +#endif /* (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListAddKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListAddKey( + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, + uint32 cryptoKeyId, + uint8 keyAccess) +{ + boolean found = FALSE; + uint8 i; + /* Check if key is already in key list. */ + for (i = 0; i < keyList->numKeys; i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[i].keyId == cryptoKeyId) + { + found = TRUE; + /* Add key access to found key. */ + /* 0 if read lock / >0 if write lock */ + keyList->keyLockList[i].keyAccess = (uint8)(keyList->keyLockList[i].keyAccess + keyAccess); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + break; + } + } + + /* Add new key to list. */ + if (found == FALSE) + { + keyList->keyLockList[keyList->numKeys].keyId = cryptoKeyId; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + keyList->keyLockList[keyList->numKeys].keyAccess = keyAccess; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + keyList->numKeys++; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } +} /* Crypto_30_LibCv_Local_KeyListAddKey() */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyListRedirection() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyListRedirection( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + + /* # Check if redirection is used. */ + if (Crypto_30_LibCv_Local_IsRedirectUsed(job) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + { + P2CONST(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirInfoRef = job->jobRedirectionInfoRef; + Crypto_InputOutputRedirectionConfigType redirConfig = redirInfoRef->redirectionConfig; + + /* # Add redirected keys to key list. */ + if (Crypto_30_LibCv_IsRedirection(redirConfig, CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT)) + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, redirInfoRef->inputKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsRedirection(redirConfig, CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT)) + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, redirInfoRef->secondaryInputKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsRedirection(redirConfig, CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT)) + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, redirInfoRef->tertiaryInputKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsRedirection(redirConfig, CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT)) + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, redirInfoRef->outputKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsRedirection(redirConfig, CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT)) + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, redirInfoRef->secondaryOutputKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + } +} /* Crypto_30_LibCv_Local_GetKeyListRedirection() */ +#endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyList() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6030 3 */ /* MD_MSR_STCYC */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyList( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + keyList->numKeys = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) + Crypto_30_LibCv_Local_GetKeyListRedirection(job, keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ +#endif + + /* # Add Job key to key list. */ + switch (job->jobPrimitiveInfo->primitiveInfo->service) /* PRQA S 3315 */ /* MD_CRYPTO_30_LIBCV_3315 */ + { +#if (CRYPTO_30_LIBCV_SERVICE_RANDOM == STD_ON) + case CRYPTO_RANDOMGENERATE: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEY_SET_VALID == STD_ON) + case CRYPTO_KEYSETVALID: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEYSETINVALID == STD_ON) + case CRYPTO_KEYSETINVALID: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_RANDOM_SEED == STD_ON) + case CRYPTO_RANDOMSEED: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEY_DERIVE == STD_ON) + case CRYPTO_KEYDERIVE: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEY_EXCHANGE_CALC_PUBVAL == STD_ON) + case CRYPTO_KEYEXCHANGECALCPUBVAL: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEY_EXCHANGE_CALC_SECRET == STD_ON) + case CRYPTO_KEYEXCHANGECALCSECRET: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEY_GENERATE == STD_ON) + case CRYPTO_KEYGENERATE: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEYUNWRAP == STD_ON) + case CRYPTO_KEYUNWRAP: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_WRITE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif +#if (CRYPTO_30_LIBCV_SERVICE_KEYWRAP == STD_ON) + case CRYPTO_KEYWRAP: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; +#endif + default: + Crypto_30_LibCv_Local_KeyListAddKey(keyList, job->cryptoKeyId, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + break; + } +} /* Crypto_30_LibCv_Local_GetKeyList() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyListAndDet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyListAndDet( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_OK; + uint8 i; + + /* Get key list */ + Crypto_30_LibCv_Local_GetKeyList(job, keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + /* Check if the redirected keys have valid keyIds. */ + for (i = 0; i < keyList->numKeys; i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[i].keyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + break; + } + else + { + /* Check key list for other restrictions */ +#if ((CRYPTO_30_LIBCV_SERVICE_RANDOM == STD_ON) && (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON)) +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_OFF) + if (job->jobPrimitiveInfo->primitiveInfo->service == CRYPTO_RANDOMGENERATE) + { + Crypto_30_LibCv_PartitionInfoIterType partitionInfoIdx = 0u; + /* Check if default random key is used */ + for (partitionInfoIdx = 0u; partitionInfoIdx < Crypto_30_LibCv_GetSizeOfPartitionInfo(); partitionInfoIdx++) + { + if(Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(partitionInfoIdx) == keyList->keyLockList[i].keyId) + { + retVal = E_NOT_OK; + break; + } + } + } +# endif +#endif + } + } + return retVal; +} /* Crypto_30_LibCv_Local_GetKeyListAndDet() */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPreLockKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPreLockKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + uint8_least i; + uint8_least j; + + /* Try to obtain key locks for key list. */ + for (i = 0; i < keyList->numKeys; i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[i].keyAccess == CRYPTO_30_LIBCV_KEY_ACCESS_READ) /* 0 if read lock / >0 if write lock */ + { + retVal = Crypto_30_LibCv_Local_KeyReadLockGetNotProtected(keyList->keyLockList[i].keyId); + } + else + { + retVal = Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected(keyList->keyLockList[i].keyId); + } + + if (retVal != E_OK) + { + break; + } + } + + /* Locking failed, release already locked keys. */ + if (retVal != E_OK) + { + for (j = 0; j < i; j++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[j].keyAccess == CRYPTO_30_LIBCV_KEY_ACCESS_READ) /* 0 if read lock / >0 if write lock */ + { + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(keyList->keyLockList[j].keyId); + } + else + { + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(keyList->keyLockList[j].keyId); + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyListPreLockKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPostFreeKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPostFreeKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + uint8 i; + + /* Release already locked keys from key list. */ + for (i = 0; i < keyList->numKeys; i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[i].keyAccess == CRYPTO_30_LIBCV_KEY_ACCESS_READ) /* 0 if read lock / >0 if write lock */ + { + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(keyList->keyLockList[i].keyId); + } + else + { + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(keyList->keyLockList[i].keyId); + } + } +} /* Crypto_30_LibCv_Local_KeyListPostFreeKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPreLockKeysProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPreLockKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + retVal = Crypto_30_LibCv_Local_KeyListPreLockKeys(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + return retVal; +} /* Crypto_30_LibCv_Local_KeyListPreLockKeysProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + Crypto_30_LibCv_Local_KeyListPostFreeKeys(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +} /* Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_IsKeyListValid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_IsKeyListValid( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + boolean keysValid = TRUE; + uint8 currentKeyIdx = 0; + + /* Check if the keyList keys have valid keyIds. */ + for (currentKeyIdx = 0; currentKeyIdx < keyList->numKeys; currentKeyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR */ + { + if (keyList->keyLockList[currentKeyIdx].keyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + keysValid = FALSE; + break; + } + } + + return keysValid; +} /* Crypto_30_LibCv_Local_IsKeyListValid() */ +#endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_IsRedirectUsed() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_IsRedirectUsed( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + boolean retVal = FALSE; + +# if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + /* Check if save or restore mode is used and ignore redirection for these modes */ + if(Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SAVE_CONTEXT) || Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT)) + { + retVal = FALSE; + } + else +# endif + /* # Check if redirection is used in the current Job. */ + if (job->jobRedirectionInfoRef != NULL_PTR) + { + retVal = TRUE; + } + else + { + /* retVal already set to FALSE */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_IsRedirectUsed() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPreSetBufferForKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPreSetBufferForKey( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) elementPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + uint8 readWrite, + Crypto_ServiceInfoType cryptoService) +{ + Std_ReturnType retVal = E_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + + /* ----- Implementation ------------------------------------------------- */ + /* #20 Search Key Element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + /* #40 Check if read access is allowed */ + if (readWrite == CRYPTO_30_LIBCV_KEY_ACCESS_READ) + { + if (Crypto_30_LibCv_RedirectReadAccessRight[cryptoService] < (Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)))) + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + else if (!Crypto_30_LibCv_IsKeyElementValid(elementIndex)) + { + retVal = CRYPTO_E_KEY_NOT_VALID; + } + else + { + /* retVal is already set */ + } + } + else + { + if ((CRYPTO_30_LIBCV_WA_DENIED == (Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex))))|| + (!Crypto_30_LibCv_IsKeyElementPartial(elementIndex)) || Crypto_30_LibCv_IsKeyElementWriteOnce(elementIndex)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + } + + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( elementIndex, elementPtr, resultLengthPtr, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE, CRYPTO_30_LIBCV_SHE_SERVICE_OTHER); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + + if (readWrite == CRYPTO_30_LIBCV_KEY_ACCESS_WRITE) + { + *resultLengthPtr = Crypto_30_LibCv_GetKeyElementLength(elementIndex); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + if (*resultLengthPtr == 0u) + { + retVal = CRYPTO_E_KEY_EMPTY; + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_RedirectPreSetBufferForKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPreRedirKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6030 3 */ /* MD_MSR_STPTH , MD_MSR_STCYC */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPreRedirKeys( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_OK; + uint32 redirKeyLength = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType elementStorageIndex = 0u; + P2CONST(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirInfoRef = job->jobRedirectionInfoRef; + P2VAR(Crypto_JobPrimitiveInputOutputType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inOutRef = &job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER; + Crypto_ServiceInfoType cryptoService = job->jobPrimitiveInfo->primitiveInfo->service; + Crypto_InputOutputRedirectionConfigType redir; + + /* # Reset buffer length in start mode. */ + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START)) + { + redirectBuffer->firstOutputLengthWritten = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + redirectBuffer->secondaryOutputLengthWritten = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* # If redirection is used. */ + if (Crypto_30_LibCv_Local_IsRedirectUsed(job) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + { + redir = job->jobRedirectionInfoRef->redirectionConfig; + redir &= (Crypto_30_LibCv_IOServiceMaskUpdate[cryptoService] | Crypto_30_LibCv_IOServiceMaskFinish[cryptoService]); + + redirectBuffer->jobPrimitiveInputOutput_Restore = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* # Set redirection for primary input. */ + if (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT)) + { + retVal = Crypto_30_LibCv_Local_RedirectPreSetBufferForKey(redirInfoRef->inputKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + redirInfoRef->inputKeyElementId, + &elementStorageIndex, + &redirKeyLength, + CRYPTO_30_LIBCV_KEY_ACCESS_READ, + cryptoService); + inOutRef->inputPtr = Crypto_30_LibCv_GetAddrKeyStorage(elementStorageIndex); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + inOutRef->inputLength = redirKeyLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Set redirection for secondary input. */ + if ((retVal == E_OK) && + (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT))) + { + retVal = Crypto_30_LibCv_Local_RedirectPreSetBufferForKey(redirInfoRef->secondaryInputKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + redirInfoRef->secondaryInputKeyElementId, + &elementStorageIndex, + &redirKeyLength, + CRYPTO_30_LIBCV_KEY_ACCESS_READ, + cryptoService); + inOutRef->secondaryInputPtr = Crypto_30_LibCv_GetAddrKeyStorage(elementStorageIndex); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + inOutRef->secondaryInputLength = redirKeyLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Set redirection for tertiary input. */ + if ((retVal == E_OK) && + (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT))) + { + retVal = Crypto_30_LibCv_Local_RedirectPreSetBufferForKey(redirInfoRef->tertiaryInputKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + redirInfoRef->tertiaryInputKeyElementId, + &elementStorageIndex, + &redirKeyLength, + CRYPTO_30_LIBCV_KEY_ACCESS_READ, + cryptoService); + inOutRef->tertiaryInputPtr = Crypto_30_LibCv_GetAddrKeyStorage(elementStorageIndex); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + inOutRef->tertiaryInputLength = redirKeyLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Set redirection for primary output. */ + if ((retVal == E_OK) && + (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT))) + { + retVal = Crypto_30_LibCv_Local_RedirectPreSetBufferForKey(redirInfoRef->outputKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + redirInfoRef->outputKeyElementId, + &elementStorageIndex, + &redirKeyLength, + CRYPTO_30_LIBCV_KEY_ACCESS_WRITE, + cryptoService); + inOutRef->outputPtr = &Crypto_30_LibCv_GetAddrKeyStorage(elementStorageIndex)[redirectBuffer->firstOutputLengthWritten]; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + redirectBuffer->firstOutputLength = redirKeyLength - redirectBuffer->firstOutputLengthWritten; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + inOutRef->outputLengthPtr = &redirectBuffer->firstOutputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Set redirection for secondary output. */ + if ((retVal == E_OK) && + (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT))) + { + retVal = Crypto_30_LibCv_Local_RedirectPreSetBufferForKey(redirInfoRef->secondaryOutputKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + redirInfoRef->secondaryOutputKeyElementId, + &elementStorageIndex, + &redirKeyLength, + CRYPTO_30_LIBCV_KEY_ACCESS_WRITE, + cryptoService); + inOutRef->secondaryOutputPtr = &Crypto_30_LibCv_GetAddrKeyStorage(elementStorageIndex)[redirectBuffer->secondaryOutputLengthWritten]; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + redirectBuffer->secondaryOutputLength = redirKeyLength - redirectBuffer->secondaryOutputLengthWritten; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + inOutRef->secondaryOutputLengthPtr = &redirectBuffer->secondaryOutputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Restore buffer if there was a failure. */ + if (retVal != E_OK) + { + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER = redirectBuffer->jobPrimitiveInputOutput_Restore; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_RedirectPreRedirKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPostSaveKeyResult() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPostSaveKeyResult( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 resultLength, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) writtenLengthPtr, + Std_ReturnType result) +{ + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + + /* This can only work if the key was already redirected. */ + (void)Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + Crypto_30_LibCv_ClearKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_NORMAL_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + + if (result == E_OK) + { + *writtenLengthPtr += resultLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(cryptoKeyId, elementIndex, *writtenLengthPtr); +} /* Crypto_30_LibCv_Local_RedirectPostSaveKeyResult() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RedirectPostRestoreBuffer() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RedirectPostRestoreBuffer( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Std_ReturnType result) +{ + Crypto_InputOutputRedirectionConfigType redir; + Crypto_InputOutputRedirectionConfigType redirMask = 0; + P2CONST(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirInfoRef = job->jobRedirectionInfoRef; + + if (Crypto_30_LibCv_Local_IsRedirectUsed(job) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + { + redir = job->jobRedirectionInfoRef->redirectionConfig; + + if(Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_UPDATE)) + { + redirMask = Crypto_30_LibCv_IOServiceMaskUpdate[job->jobPrimitiveInfo->primitiveInfo->service]; + } + if(Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH)) + { + redirMask |= Crypto_30_LibCv_IOServiceMaskFinish[job->jobPrimitiveInfo->primitiveInfo->service]; + } + + redir &= redirMask; + + /* Restore IO buffer */ + if (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT)) + { + Crypto_30_LibCv_Local_RedirectPostSaveKeyResult(redirInfoRef->outputKeyId, redirInfoRef->outputKeyElementId, + redirectBuffer->firstOutputLength, &(redirectBuffer->firstOutputLengthWritten), result); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + if (Crypto_30_LibCv_IsIOMask(redir, CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT)) + { + Crypto_30_LibCv_Local_RedirectPostSaveKeyResult(redirInfoRef->secondaryOutputKeyId, redirInfoRef->secondaryOutputKeyElementId, + redirectBuffer->secondaryOutputLength, &(redirectBuffer->secondaryOutputLengthWritten), result); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER = redirectBuffer->jobPrimitiveInputOutput_Restore; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } +} /* Crypto_30_LibCv_Local_RedirectPostRestoreBuffer() */ +#endif /* (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Process() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6030, 6050 5 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Process( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) +{ + Std_ReturnType retVal; + boolean unlockingNecessary = FALSE; + boolean contextMode = FALSE; + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, FALSE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) + retVal = Crypto_30_LibCv_Local_RedirectPreRedirKeys(&Crypto_30_LibCv_GetRedirect_Buffer(objectId), job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_AND_GLOBAL_ARRAY_PTR */ + if (retVal == E_OK) +#endif + { + retVal = Crypto_30_LibCv_DispatchJob(objectId, &unlockingNecessary, &contextMode, job, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) + Crypto_30_LibCv_Local_RedirectPostRestoreBuffer(&Crypto_30_LibCv_GetRedirect_Buffer(objectId), job, retVal); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_AND_GLOBAL_ARRAY_PTR */ +#endif + } + + /* #14 Free keys in case of an error or if FINISH mode completed. */ +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + if (((retVal != E_OK) && (contextMode == FALSE)) || (unlockingNecessary == TRUE)) +#else + if ((retVal != E_OK) || (unlockingNecessary == TRUE)) +#endif + { +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +#endif +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (Crypto_30_LibCv_IsProcessJob_Trigger_Write(objectId)) /* COV_CRYPTO_30_LIBCV_SERVICE_CONFIGURATION_2 */ + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(job->cryptoKeyId)); + } +#endif + } + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + if (retVal == E_OK) + { + Crypto_30_LibCv_UpdateObjectWorkspace(objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } +# if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + else if (contextMode == TRUE) + { + /* Workspace of the object should remain untouched for operation mode save or restore */ + } +# endif + else + { + Crypto_30_LibCv_ClearObjectWorkspace(objectId); + } +#endif + + /* Remove job from queue and release processing */ + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* #15 Free workspace in case of an error or if FINISH mode completed. */ +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + if (((retVal != E_OK) && (contextMode == FALSE)) || (unlockingNecessary == TRUE)) +#else + if ((retVal != E_OK) || (unlockingNecessary == TRUE)) +#endif + { + Crypto_30_LibCv_FreeLock(objectId); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_OFF) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Process() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SearchService() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SearchService( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_SizeOfPrimitiveInfoType, AUTOMATIC, AUTOMATIC) primitiveInfoIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_PrimitiveInfoIterType primitiveInfoStartIdx, primitiveInfoEndIdx, primitiveInfoIteratorIdx; + + Crypto_30_LibCv_ObjectInfoIndIterType objectInfoIndStartIdx, objectInfoIndEndIdx, objectInfoIndIdx; + + Crypto_30_LibCv_PrimitiveFctIterType functionIdx; + + P2CONST(Crypto_PrimitiveInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) primitive = job->jobPrimitiveInfo->primitiveInfo; + P2CONST(Crypto_AlgorithmInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) algo = &primitive->algorithm; + + uint32 combi; + + /* ----- Implementation ----------------------------------------------- */ + /* # Check if primitive info is used */ + if (Crypto_30_LibCv_IsPrimitiveInfoUsedOfPrimitiveServiceInfo(primitive->service) == TRUE) /* COV_CRYPTO_30_LIBCV_SERVICE_CONFIGURATION */ + { + /* Get scope for iteration */ + primitiveInfoStartIdx = Crypto_30_LibCv_GetPrimitiveInfoStartIdxOfPrimitiveServiceInfo(primitive->service); + primitiveInfoEndIdx = Crypto_30_LibCv_GetPrimitiveInfoEndIdxOfPrimitiveServiceInfo(primitive->service); + + /* Generate combined value */ + combi = (((uint32)primitive->service << 24) | ((uint32)algo->family << 16) | ((uint32)algo->mode << 8) | ((uint32)algo->secondaryFamily)); + + /* # Iterate over primitive info elements */ + for (primitiveInfoIteratorIdx = primitiveInfoStartIdx; primitiveInfoIteratorIdx < primitiveInfoEndIdx; primitiveInfoIteratorIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* # Check for match with combined value */ + if (Crypto_30_LibCv_GetCombinedOfPrimitiveInfo(primitiveInfoIteratorIdx) == combi) + { + /* Get primitive function index */ + functionIdx = Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIteratorIdx); + + /* Get scope for iteration */ + objectInfoIndStartIdx = Crypto_30_LibCv_GetObjectInfoIndStartIdxOfPrimitiveFct(functionIdx); + objectInfoIndEndIdx = Crypto_30_LibCv_GetObjectInfoIndEndIdxOfPrimitiveFct(functionIdx); + + /* # Iterate over object info elements */ + for (objectInfoIndIdx = objectInfoIndStartIdx; objectInfoIndIdx < objectInfoIndEndIdx; objectInfoIndIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* # Check for match with object ID */ + if (Crypto_30_LibCv_GetObjectInfoInd(objectInfoIndIdx) == objectId) + { + /* Reference primitive function pointer */ + *primitiveInfoIdx = (Crypto_30_LibCv_SizeOfPrimitiveInfoType)primitiveInfoIteratorIdx; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + break; + } + } + } + + /* If found break loop */ + if (retVal == E_OK) + { + break; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_SearchService() */ + +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SaveContextJob() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SaveContextJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32 outputLength; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ----------------------------------------------- */ + outputLength = CRYPTO_30_LIBCV_WORKSPACE_SETTINGS_LENGTH + Crypto_30_LibCv_GetLengthOfSaveAndRestoreWorkspace(objectId); + + /* Check primitive context and output length */ + if ((job->jobPrimitiveInfo->primitiveInfo->service <= CRYPTO_SIGNATUREVERIFY) && (Crypto_30_LibCv_IsContextOfPrimitiveInfo(primitiveInfoIdx))) + { +# if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) + /* Check if output redirection was used in the previous calls of the current job */ + if(Crypto_30_LibCv_GetRedirect_Buffer(objectId).firstOutputLengthWritten != 0u) + { + /* No saving of output redirected job allowed. retVal already set to E_NOT_OK */ + } + else +# endif + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr == 0u) + { + /* If the output buffer does not have the sufficient length, the expected length is written into the output buffer */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr >= outputLength) + { + /* Copy context to output [ 4 Byte ObjectId | 4 Byte Additional Info | x byte Workspace data ] */ + Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(Crypto_30_LibCv_GetWorkspaceAddrOfObjectInfo(objectId), objectId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + retVal = Appl_Crypto_30_LibCv_SaveContextCallout(objectId, + job->CRYPTO_30_LIBCV_JOB_ID_MEMBER, + (P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))Crypto_30_LibCv_GetWorkspaceAddrOfObjectInfo(objectId), + outputLength, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + } + else + { + /* retval already set */ + } + } + + return retVal; +} /* Crypto_30_LibCv_SaveContextJob() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RestoreContextJob() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RestoreContextJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32 inputLength; + uint32 inputObjectId; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ----------------------------------------------- */ + /* Check if primitive context is set */ + if ((job->jobPrimitiveInfo->primitiveInfo->service <= CRYPTO_SIGNATUREVERIFY) && (Crypto_30_LibCv_IsContextOfPrimitiveInfo(primitiveInfoIdx))) + { + /* Get workspace address and length [ 4 byte ObjectId | 4 Byte Additional Info | x byte Workspace Data ] */ + (void) Crypto_30_LibCv_GetDispatchOfPrimitiveFct(Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIdx))(objectId, job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + inputLength = CRYPTO_30_LIBCV_WORKSPACE_SETTINGS_LENGTH + Crypto_30_LibCv_GetLengthOfSaveAndRestoreWorkspace(objectId); + + /* Check if the input length is correct */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength >= inputLength) + { + /* Write Workspace data to the Workspace address */ + retVal = Appl_Crypto_30_LibCv_RestoreContextCallout(objectId, + job->CRYPTO_30_LIBCV_JOB_ID_MEMBER, + (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))Crypto_30_LibCv_GetWorkspaceAddrOfObjectInfo(objectId), + inputLength, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + + if (retVal == E_OK) + { + /* Get objectId */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&inputObjectId, Crypto_30_LibCv_GetWorkspaceAddrOfObjectInfo(objectId)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (inputObjectId == objectId) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_RestoreContextJob() */ +#endif + +#if(CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON || CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_HandleOptionalInputDataInFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HandleOptionalInputDataInFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_ServiceInfoType jobService = job->jobPrimitiveInfo->primitiveInfo->service; + + switch (jobService) + { +# if(CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON) + case CRYPTO_SIGNATUREGENERATE: +# endif +# if(CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON) + case CRYPTO_SIGNATUREVERIFY: +# endif + /* Check that the current job mode does not include UPDATE to omit that the input data is processed twice (in UPDATE and in FINISH) */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength > 0u) && (!Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_UPDATE))) + { + retVal = Crypto_30_LibCv_GetDispatchOfPrimitiveFct(Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIdx))(objectId, job, CRYPTO_OPERATIONMODE_UPDATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + else + { + retVal = E_OK; + } + break; + + default: + /* Do not handle input data, retVal already E_OK */ + retVal = E_OK; + break; + } + return retVal; +} /* Crypto_30_LibCv_HandleOptionalInputDataInFinish() */ +#endif /* ((CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON) || (CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchJob() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchJob( + uint32 objectId, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) unlockingNecessary, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) contextMode, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* #10 Dispatch job according to job mode in START, UPDATE, FINISH, SAVE or Restore. */ + /* [SWS_Crypto_00017] [SWS_Crypto_00020] START while IDLE or ACTIVE */ + if (((job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER == CRYPTO_JOBSTATE_IDLE) || + (job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER == CRYPTO_JOBSTATE_ACTIVE)) && + Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START)) + { + retVal = Crypto_30_LibCv_GetDispatchOfPrimitiveFct(Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIdx))(objectId, job, CRYPTO_OPERATIONMODE_START); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + Crypto_30_LibCv_UpdateJobState(retVal, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + + /* UPDATE while ACTIVE */ + if ((job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER == CRYPTO_JOBSTATE_ACTIVE) && + Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_UPDATE)) /* [SWS_Crypto_00024] */ + { + retVal = Crypto_30_LibCv_GetDispatchOfPrimitiveFct(Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIdx))(objectId, job, CRYPTO_OPERATIONMODE_UPDATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + Crypto_30_LibCv_UpdateJobState(retVal, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + + /* [SWS_Crypto_00023] FINISH while ACTIVE */ + if ((job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER == CRYPTO_JOBSTATE_ACTIVE) && + Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH)) /* [SWS_Crypto_00024] */ + { +#if(CRYPTO_30_LIBCV_SERVICE_SIGNATURE_GENERATE == STD_ON || CRYPTO_30_LIBCV_SERVICE_SIGNATURE_VERIFY == STD_ON) + /* Enable signature services to process optional input data. */ + retVal = Crypto_30_LibCv_HandleOptionalInputDataInFinish(objectId, job, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + + if(retVal == E_OK) +#endif + { + retVal = Crypto_30_LibCv_GetDispatchOfPrimitiveFct(Crypto_30_LibCv_GetPrimitiveFctIdxOfPrimitiveInfo(primitiveInfoIdx))(objectId, job, CRYPTO_OPERATIONMODE_FINISH); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_IDLE; /* SBSW_CRYPTO_30_LIBCV_DIRECT_ACCESS_TO_JOB_STATE */ + *unlockingNecessary = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + /* SAVE while ACTIVE */ + if ((job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER == CRYPTO_JOBSTATE_ACTIVE) && + Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SAVE_CONTEXT)) /* [SWS_Crypto_00024] */ + { + retVal = Crypto_30_LibCv_SaveContextJob(objectId, job, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_ACTIVE; /* SBSW_CRYPTO_30_LIBCV_DIRECT_ACCESS_TO_JOB_STATE */ + *contextMode = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + /* RESTORE the workspace */ + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT)) /* [SWS_Crypto_00024] */ + { + retVal = Crypto_30_LibCv_RestoreContextJob(objectId, job, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + Crypto_30_LibCv_UpdateJobState(retVal, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + *contextMode = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(*contextMode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ +#endif + + return retVal; +} /* Crypto_30_LibCv_DispatchJob() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_TryToSetJobInQueue() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_TryToSetJobInQueue( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_QueueIdxOfObjectInfoType queueIdx = Crypto_30_LibCv_GetQueueIdxOfObjectInfo(objectId); + boolean queueJob = FALSE; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* #10 Check if queue is full */ + if (Crypto_30_LibCv_GetQueue(queueIdx) != NULL_PTR) + { + retVal = CRYPTO_E_QUEUE_FULL; + } + /* #20 Queue job if driver object lock is already set by the same job */ + else if ((Crypto_30_LibCv_IsLockOccupiedByJob(objectId, job->CRYPTO_30_LIBCV_JOB_ID_MEMBER)) == TRUE) + { + /* Previously already a start or restore job was processed, therefore the lock is set */ + queueJob = TRUE; + } + /* #30 Check if job is a start or restore job */ +#if (CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + else if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START) || Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_RESTORE_CONTEXT)) +#else + else if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_START)) +#endif + { + /* #35 Queue job if the driver object lock is not set */ + if (Crypto_30_LibCv_IsLockFree(objectId)) + { + /* Job is start or restore job */ + queueJob = TRUE; + } + else + { + /* Another job is currently processing */ + retVal = CRYPTO_E_QUEUE_FULL; + } + } + else + { + retVal = E_NOT_OK; + } + + if (queueJob) + { + Crypto_30_LibCv_SetQueue(queueIdx, job); /* SBSW_CRYPTO_30_LIBCV_CSL02_QUEUE_VIA_DRIVEROBJECT */ + Crypto_30_LibCv_SetDispatch_QueuePrimitiveInfoIdx(objectId, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + retVal = E_OK; + } + + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + return retVal; +} /* Crypto_30_LibCv_TryToSetJobInQueue() */ + +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetPartitionIdx() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(uint32, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetPartitionIdx(void) +{ + uint32 partitionIdx = Crypto_30_LibCv_GetSizeOfPartitionIdentifiers(); + + Crypto_30_LibCv_PartitionIdentifiersIterType partitionIdentifierIdx = 0u; + ApplicationType applicationId = GetApplicationID(); + + for(partitionIdentifierIdx = 0u; partitionIdentifierIdx < Crypto_30_LibCv_GetSizeOfPartitionIdentifiers(); partitionIdentifierIdx++) + { + if(applicationId == Crypto_30_LibCv_GetPartitionSNVOfPartitionIdentifiers(partitionIdentifierIdx)) + { + partitionIdx = Crypto_30_LibCv_GetPCPartitionConfigIdxOfPartitionIdentifiers(partitionIdentifierIdx); + break; + } + } + return (uint32)partitionIdx; +} /* Crypto_30_LibCv_GetPartitionIdx() */ +#endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitMainPartition() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ + /* PRQA S 6010 1 */ /* MD_MSR_STPTH */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitMainPartition( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ +{ + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #5 Check initialization state of the component. */ + if (Crypto_30_LibCv_IsModuleSharedInitialized()) + { + *errorIdPtr = CRYPTO_E_INIT_FAILED; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else +#endif + { + Crypto_30_LibCv_KeyElementsIterType elementIndex; + Crypto_30_LibCv_SizeOfKeyType keyIndex; +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + Crypto_30_LibCv_SheKeysIterType sheKeyIndex; +#endif + Crypto_30_LibCv_QueueIterType queueIdx; + Crypto_30_LibCv_LockIterType lockIdx; +#if (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) + Crypto_30_LibCv_LongTermWsLockIterType longWsLockIdx; +#endif +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + Crypto_30_LibCv_SizeOfNvBlockType blockIdx; +#endif + + /* #10 Initialize key elements which have a configured initial value. */ + for (elementIndex = 0u; elementIndex < Crypto_30_LibCv_GetSizeOfKeyElements(); elementIndex++) + { +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + Crypto_30_LibCv_Init_KeySimple(elementIndex); + } + else +#endif + { + Crypto_30_LibCv_Init_Key(elementIndex, FALSE); + } + } + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + for (sheKeyIndex = 0u; sheKeyIndex < Crypto_30_LibCv_GetSizeOfSheKeys(); sheKeyIndex++) + { + + elementIndex = Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(sheKeyIndex); + Crypto_30_LibCv_Init_KeySheAdditional(elementIndex); + } +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) + /* It is only allowed to access this data if the SheInfoKey is locked */ + Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag = FALSE; +# endif +#endif +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + for (blockIdx = 0u; blockIdx < Crypto_30_LibCv_GetSizeOfNvBlock(); blockIdx++) + { + Crypto_30_LibCv_NvBlock_State_Init(blockIdx); + } +#endif + /* #15 Free all locks of workspaces. */ + for (lockIdx = 0u; lockIdx < Crypto_30_LibCv_GetSizeOfLock(); lockIdx++) + { + Crypto_30_LibCv_FreeLock(lockIdx); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + +#if (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) + /* #17 Free all locks of long term workspaces. */ + for (longWsLockIdx = 0u; longWsLockIdx < Crypto_30_LibCv_GetSizeOfLongTermWsLock(); longWsLockIdx++) + { + Crypto_30_LibCv_SetLongTermWsLock(longWsLockIdx, CRYPTO_30_LIBCV_LONG_TERM_WS_LOCK_FREE); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } +#endif + + /* #20 Clear job queue. */ + for (queueIdx = 0u; queueIdx < Crypto_30_LibCv_GetSizeOfQueue(); queueIdx++) + { + Crypto_30_LibCv_SetQueue(queueIdx, NULL_PTR); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + + for (keyIndex = 0u; keyIndex < Crypto_30_LibCv_GetSizeOfKey(); keyIndex++) + { + /* #21 Init key locks. */ + Crypto_30_LibCv_SetKeyLock(keyIndex, CRYPTO_30_LIBCV_KEY_LOCK_FREE); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + +#if(CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + /* #22 Init key Nv status */ + Crypto_30_LibCv_KeyNvStatus_InitKey(keyIndex); +#endif + } + + /* Set module partition state to initialized */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Set shared data and general module state to initialized */ + Crypto_30_LibCv_ModuleInitialized = CRYPTO_30_LIBCV_INITIALIZED; +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_OFF) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorIdPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif +} /* Crypto_30_LibCv_InitMainPartition() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitPartitionSpecificData() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitPartitionSpecificData(uint32 partitionIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ +{ + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #5 Check initialization state of the partition. */ + if (Crypto_30_LibCv_IsModulePartitionInitialized(partitionIdx)) + { + *errorIdPtr = CRYPTO_E_INIT_FAILED; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else +#endif + { + Crypto_30_LibCv_ObjectInfoIterType objectId; + +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + Crypto_30_LibCv_SetRandomSourceGenerateCount(0u, partitionIdx); /* SBSW_CRYPTO_30_LIBCV_WRITE_PARTITION_DATA */ +#endif + + /* #25 Init Driver Object State. */ + for (objectId = 0u; objectId < Crypto_30_LibCv_GetSizeOfObjectInfo(); objectId++) + { +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (partitionIdx == Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId)) +#endif + { + Crypto_30_LibCv_SetDriverObjectState(objectId, CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + /* clear the last object workspace type */ + Crypto_30_LibCv_SetKeyIdOfLastJob(objectId, CRYPTO_30_LIBCV_UINT32_MAX); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetFamilyOfLastJob(objectId, CRYPTO_ALGOFAM_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetModeOfLastJob(objectId, CRYPTO_ALGOMODE_NOT_SET); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +#endif + +#if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) + if (Crypto_30_LibCv_GetRandomSeedBufferStartIdxOfObjectInfo(objectId) != CRYPTO_30_LIBCV_NO_RANDOMSEEDBUFFERENDIDXOFOBJECTINFO) + { + Crypto_30_LibCv_SetRandomSeedBuffer(Crypto_30_LibCv_GetRandomSeedBufferStartIdxOfObjectInfo(objectId), CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_ALL_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } +#endif + +#if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetWorkspaceAddrOfObjectInfo(objectId), Crypto_30_LibCv_GetWorkspaceLengthOfObjectInfo(objectId)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ +#endif + } + } + + /* Set module partition state to initialized */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + Crypto_30_LibCv_SetPartitionInitialized(CRYPTO_30_LIBCV_INITIALIZED, partitionIdx); /* SBSW_CRYPTO_30_LIBCV_WRITE_PARTITION_DATA */ +#endif + } + +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_OFF) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorIdPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS < 2u) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif +} /* Crypto_30_LibCv_InitPartitionSpecificData() */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitMemoryHandler() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitMemoryHandler(uint32 partitionIdx) +{ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #5 Uninitialize module. */ +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (partitionIdx == Crypto_30_LibCv_MainPartitionIdx) +# endif + { + Crypto_30_LibCv_ModuleInitialized = (uint8)CRYPTO_30_LIBCV_UNINIT; + } + + Crypto_30_LibCv_SetPartitionInitialized(CRYPTO_30_LIBCV_UNINIT, partitionIdx); /* SBSW_CRYPTO_30_LIBCV_WRITE_PARTITION_DATA */ +#endif + + CRYPTO_30_LIBCV_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +} /* Crypto_30_LibCv_InitMemoryHandler() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_KeySimple() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_KeySimple( + Crypto_30_LibCv_KeyElementsIterType elementIndex) +{ + Crypto_30_LibCv_SizeOfKeyStorageType keyStorageIdx; + + /* clear extension */ + Crypto_30_LibCv_SetKeyElementExtension(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_CLEAR_ALL_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + keyStorageIdx = Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(elementIndex); + Crypto_30_LibCv_SetKeyStorage(keyStorageIdx, 0u); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + Crypto_30_LibCv_SetKeyStorage(keyStorageIdx + 1u, 0u); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + Crypto_30_LibCv_SetKeyElementState(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_ALL_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + +} /* Crypto_30_LibCv_Init_KeySimple() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_Key() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_Key( + Crypto_30_LibCv_KeyElementsIterType elementIndex, + boolean initAllBytes) +{ +#if (CRYPTO_30_LIBCV_INITVALUE == STD_ON) + Crypto_30_LibCv_InitValueStartIdxOfKeyElementInfoType initValueIdx; + uint16 initValueLength; +#endif + Crypto_30_LibCv_SizeOfKeyStorageType keyStorageIdx; + uint32 keyElementLength; + + keyStorageIdx = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndex); + keyElementLength = (uint32)Crypto_30_LibCv_GetLengthOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)); + +#if (CRYPTO_30_LIBCV_INITVALUE == STD_ON) + /* Fill elements with init values */ + if (Crypto_30_LibCv_HasKeyElementInitValue(elementIndex)) + { + initValueIdx = Crypto_30_LibCv_GetInitValueStartIdxOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)); + initValueLength = (uint16)Crypto_30_LibCv_GetKeyElementInitValueLength(elementIndex); + + /* Store the init value t the key element */ + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIdx), Crypto_30_LibCv_GetAddrInitValue(initValueIdx), (uint32)initValueLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + if (initAllBytes) + { + /* Initialize remaining bytes with zeros. */ + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIdx + initValueLength), (uint32)(keyElementLength- initValueLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + /* clear extension */ + Crypto_30_LibCv_SetKeyElementExtension(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_CLEAR_ALL_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + + /* Set the size of the init value written to the element */ + keyStorageIdx = Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(elementIndex); + Crypto_30_LibCv_SetKeyStorage(keyStorageIdx, (uint8)(Crypto_30_LibCv_GetKeyElementInitValueLength(elementIndex) >> 8)); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + Crypto_30_LibCv_SetKeyStorage(keyStorageIdx + 1u, (uint8)(Crypto_30_LibCv_GetKeyElementInitValueLength(elementIndex))); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + Crypto_30_LibCv_SetKeyElementState(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + } + else +#endif + { + Crypto_30_LibCv_Init_KeySimple(elementIndex); + if (initAllBytes) + { + /* Initialize data bytes with zeros. */ + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIdx), keyElementLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + } +} /* Crypto_30_LibCv_Init_Key() */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_KeySheAdditional() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_KeySheAdditional( + Crypto_30_LibCv_KeyElementsIterType elementIndex) +{ + Crypto_30_LibCv_SetKeyElementExtension(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_KEY_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ + /* SHE keys are invalid also if they have an init value. */ + Crypto_30_LibCv_SetKeyElementState(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_ALL_MASK); /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT */ +} /* Crypto_30_LibCv_Init_KeySheAdditional() */ +#endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init(void) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + uint32 partitionIdx = Crypto_30_LibCv_CurrentPartitionIdx(); + +#if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (partitionIdx < Crypto_30_LibCv_GetSizeOfPartitionIdentifiers()) +#endif + { +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (partitionIdx == Crypto_30_LibCv_MainPartitionIdx) +#endif + { + /* #10 Initialize shared data */ + Crypto_30_LibCv_InitMainPartition(&errorId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if(errorId == CRYPTO_E_NO_ERROR) +#endif + { + /* #20 Initialize partition specific data */ + Crypto_30_LibCv_InitPartitionSpecificData(partitionIdx, &errorId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } +#if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + else + { + errorId = CRYPTO_E_INIT_FAILED; + } +#endif + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError(CRYPTO_30_LIBCV_MODULE_ID, CRYPTO_30_LIBCV_INSTANCE_ID, CRYPTO_30_LIBCV_SID_INIT, errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif +} /* Crypto_30_LibCv_Init() */ + +#if (CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetVersionInfo() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetVersionInfo( + P2VAR(Std_VersionInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) versioninfo) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #5 Check plausibility of parameters. */ + if (versioninfo == NULL_PTR) + { + /* [SWS_Crypto_00042] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #10 Write versionInfo pointer with modules versions. */ + versioninfo->vendorID = (uint16)CRYPTO_30_LIBCV_VENDOR_ID; /* SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO */ + versioninfo->moduleID = (uint8)CRYPTO_30_LIBCV_MODULE_ID; /* SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO */ + versioninfo->sw_major_version = (uint8)CRYPTO_30_LIBCV_SW_MAJOR_VERSION; /* SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO */ + versioninfo->sw_minor_version = (uint8)CRYPTO_30_LIBCV_SW_MINOR_VERSION; /* SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO */ + versioninfo->sw_patch_version = (uint8)CRYPTO_30_LIBCV_SW_PATCH_VERSION; /* SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + (uint8)CRYPTO_30_LIBCV_SID_GET_VERSION_INFO, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif +} /* Crypto_30_LibCv_GetVersionInfo() */ +#endif /* (CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_MainFunctionHandler() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_MainFunctionHandler(uint32 partitionIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Crypto_30_LibCv_ObjectInfoIterType objectId; + + /* ----- Implementation ----------------------------------------------- */ + +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #1 Check initialization state of the component. */ + if (Crypto_30_LibCv_IsModulePartitionInitialized(partitionIdx) && Crypto_30_LibCv_IsModuleSharedInitialized()) /* PRQA S 3415 */ /* MD_CRYPTO_30_LIBCV_3415_LOGICAL_OPERATOR */ +#endif + { + /* #2 Process NvM handling */ +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (partitionIdx == Crypto_30_LibCv_MainPartitionIdx) +# endif + { + Crypto_30_LibCv_NvBlock_MainFunction(); + } +#endif + + /* #5 Process next enqueued job for all available queues. */ + for (objectId = 0u; objectId < Crypto_30_LibCv_GetSizeOfObjectInfo(); objectId++) + { +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (partitionIdx == Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId)) +#endif + { + Crypto_30_LibCv_CheckQueueAndLockAndProcess((uint32)objectId); + } + } + } + +#if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS < 2u) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif +} /* Crypto_30_LibCv_MainFunctionHandler() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_ProcessJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030,6050,6080 3 */ /* MD_MSR_STCYC,MD_MSR_STCAL,MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ProcessJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_LibCv_KeyLockListType keyList; + Crypto_30_LibCv_SizeOfPrimitiveInfoType primitiveInfoIdx = 0u; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* [SWS_Crypto_00057] */ + /* #5 Check initialization state of the component. */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + /* [SWS_Crypto_00058] */ + /* #10 Check plausibility of parameters. */ + + /* [SWS_Crypto_00059] Check if job is a null pointer */ + else if (job == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (Crypto_30_LibCv_Local_DetChecksServiceValues(job, &errorId) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + /* Error Id is set by sub-function */ + } + else +#endif + if (objectId >= Crypto_30_LibCv_GetSizeOfObjectInfo()) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* [SWS_Crypto_00057] */ + /* #5 Check initialization state of the component. */ + else if (Crypto_30_LibCv_IsModulePartitionNotInitialized(Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId))) + { + errorId = CRYPTO_E_UNINIT; + } +#endif + else if (Crypto_30_LibCv_Local_GetKeyListAndDet(job, &keyList) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (Crypto_30_LibCv_SearchService(objectId, job, &primitiveInfoIdx) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00064], [SWS_Crypto_00067] combination of service, (secondary) family and mode is not supported */ + errorId = CRYPTO_E_PARAM_HANDLE; + } +#if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + else if (Crypto_30_LibCv_CurrentPartitionIdx() != Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId)) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } +#endif + else + { +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + if (Crypto_30_LibCv_IsDefaultRandomSourceOfPrimitiveInfo(primitiveInfoIdx)) + { + uint32 defaultRandomKey = Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId)); + Crypto_30_LibCv_Local_KeyListAddKey(&keyList, defaultRandomKey, CRYPTO_30_LIBCV_KEY_ACCESS_READ); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } +#endif + + /* #15 Directly process job if it is synchronous. */ + if (job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_SYNC) + { + retVal = Crypto_30_LibCv_TryObtainingLockAndLockKeys(objectId, job, &keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Process(objectId, job, &keyList, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + } + else + { + /* #20 Otherwise handle job asynchronously. */ + retVal = Crypto_30_LibCv_TryToSetJobInQueue(objectId, job, primitiveInfoIdx); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError(CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_PROCESS_JOB, + errorId); + } +# if (CRYPTO_30_LIBCV_SERVICE_RANDOM == STD_ON) + if (retVal == CRYPTO_E_ENTROPY_EXHAUSTION) + { + (void)Det_ReportRuntimeError(CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_PROCESS_JOB, + CRYPTO_E_RE_ENTROPY_EXHAUSTED); + } +# endif +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_ProcessJob() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_CancelJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6080 3 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CancelJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* [SWS_Crypto_00123] */ + /* #5 Check initialization state of the component. */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + /* [SWS_Crypto_00124] */ + /* #10 Check plausibility of parameters. */ + /* [SWS_Crypto_00125] Check if job is a null pointer */ + else if (job == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif + if (objectId >= Crypto_30_LibCv_GetSizeOfObjectInfo()) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + else +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_LibCv_IsModulePartitionNotInitialized(Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId))) + { + errorId = CRYPTO_E_UNINIT; + } + else +#endif + { + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Driver object is not processing anything at the moment */ + if (Crypto_30_LibCv_GetDriverObjectState(objectId) == CRYPTO_30_LIBCV_DRIVEROBJECTSTATE_IDLE) + { + Crypto_30_LibCv_QueueIdxOfObjectInfoType queueIdx = Crypto_30_LibCv_GetQueueIdxOfObjectInfo(objectId); + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) queuedJob = Crypto_30_LibCv_GetQueue(queueIdx); + + if ((queuedJob != NULL_PTR) && + (queuedJob->CRYPTO_30_LIBCV_JOB_ID_MEMBER == job->CRYPTO_30_LIBCV_JOB_ID_MEMBER)) + { + Crypto_30_LibCv_SetQueue(queueIdx, NULL_PTR); /* SBSW_CRYPTO_30_LIBCV_CSL02_QUEUE_VIA_DRIVEROBJECT */ +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + Crypto_30_LibCv_ClearObjectWorkspace(objectId); +#endif + retVal = E_OK; + } + + if (Crypto_30_LibCv_IsLockOccupiedByJob(objectId, job->CRYPTO_30_LIBCV_JOB_ID_MEMBER)) + { + Crypto_30_LibCv_KeyLockListType keyList; + Crypto_30_LibCv_Local_GetKeyList(job, &keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + Crypto_30_LibCv_FreeLock(objectId); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + job->CRYPTO_30_LIBCV_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_IDLE; /* SBSW_CRYPTO_30_LIBCV_ACCESS_OF_JOB_MEMBER_CANCEL_JOB */ +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + Crypto_30_LibCv_ClearObjectWorkspace(objectId); +#endif +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected(&keyList); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +#endif + retVal = E_OK; + } + } + + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (retVal == E_OK) + { + if (job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_ASYNC) + { + CryIf_CallbackNotification(job, CRYPTO_E_JOB_CANCELED); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + } + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError(CRYPTO_30_LIBCV_MODULE_ID, CRYPTO_30_LIBCV_INSTANCE_ID, CRYPTO_30_LIBCV_SID_CANCEL_JOB, errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_CancelJob() */ + +#if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_GetKeyListRedirection() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_GetKeyListRedirection( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Crypto_30_LibCv_Local_GetKeyListRedirection(job, keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +} /* Crypto_30_LibCv_Api_GetKeyListRedirection() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_RedirectPreRedirKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_RedirectPreRedirKeys( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_KeyLockListType keyList; + + if (Crypto_30_LibCv_Local_GetKeyListAndDet(job, &keyList) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + { + retVal = E_NOT_OK; + } + else + { + retVal = Crypto_30_LibCv_Local_RedirectPreRedirKeys(redirectBuffer, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_Api_RedirectPreRedirKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_RedirectPostRestoreBuffer() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_RedirectPostRestoreBuffer( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Std_ReturnType result) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_KeyLockListType keyList; + + if (Crypto_30_LibCv_Local_GetKeyListAndDet(job, &keyList) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_LibCv_Local_RedirectPostRestoreBuffer(redirectBuffer, job, result); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Api_RedirectPostRestoreBuffer() */ +#endif /* (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListAddKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListAddKey( + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, + uint32 cryptoKeyId, + uint8 keyAccess) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_LibCv_Local_KeyListAddKey(keyList, cryptoKeyId, keyAccess); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyListAddKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPreLockKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPreLockKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + boolean keysValid = FALSE; + + /* Check if the keyList keys have valid keyIds. */ + keysValid = Crypto_30_LibCv_Local_IsKeyListValid(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + if (keysValid) + { + retVal = Crypto_30_LibCv_Local_KeyListPreLockKeys(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } +#else + retVal = E_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyListPreLockKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPostFreeKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPostFreeKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + boolean keysValid = FALSE; + + /* Check if the keyList keys have valid keyIds. */ + keysValid = Crypto_30_LibCv_Local_IsKeyListValid(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + if (keysValid) + { + Crypto_30_LibCv_Local_KeyListPostFreeKeys(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + retVal = E_OK; + } +#else + retVal = E_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyListPostFreeKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPreLockKeysProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPreLockKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + boolean keysValid = FALSE; + + /* Check if the keyList keys have valid keyIds. */ + keysValid = Crypto_30_LibCv_Local_IsKeyListValid(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + if (keysValid) + { + retVal = Crypto_30_LibCv_Local_KeyListPreLockKeysProtected(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } +#else + retVal = E_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyListPreLockKeysProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPostFreeKeysProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPostFreeKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + boolean keysValid = FALSE; + + /* Check if the keyList keys have valid keyIds. */ + keysValid = Crypto_30_LibCv_Local_IsKeyListValid(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + + if (keysValid) + { + Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected(keyList); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + retVal = E_OK; + } +#else + retVal = E_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(keyList); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyListPostFreeKeysProtected() */ +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Module specific MISRA deviations + *********************************************************************************************************************/ +/* Module specific MISRA deviations: + +MD_CRYPTO_30_LIBCV_STPAR_ASR: +Reason: Internal forwarding of parameters of an AUTOSAR API. +Risk: Code is difficult to maintain. Poor readability of the code due to too many input parameters. +Prevention: Design and code review. Clearly structured and commented code. + +MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM: +Reason: Parameters are required by vSecPrim, due to code design and metrics code need to be split in subfunctions. +Risk: Code is difficult to maintain. Poor readability of the code due to too many input parameters. +Prevention: Design and code review. Clearly structured and commented code. + +MD_CRYPTO_30_LIBCV_STPAR: +Reason: Parameters are required by code design and to hold other code metrics. +Risk: Code is difficult to maintain. Poor readability of the code due to too many input parameters. +Prevention: Design and code review. Clearly structured and commented code. + +MD_CRYPTO_30_LIBCV_8.7: +Reason: The deceleration is on block. However the static source is only required by one function. +Risk: None +Prevention: Not necessary + +MD_CRYPTO_30_LIBCV_3.1: +Reason: Cast is needed since lower layer crypto library expects -1 as parameter value. +Risk: Cast from signed to unsigned results in an invalid value. +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_0310: +Reason: Cast is needed since lower layer crypto library expects super type as parameter. Internally it is casted back to concrete workspace type. +Risk: Wrong workspace type is casted or size does not match. +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_0311: +Reason: Parameter has to be casted to var since lower layer crypto library expects a var parameter even if it does not write to it. +Risk: Lower layer API could modify the given parameter. +Prevention: Covered by code review and component test. + +MD_CRYPTO_30_LIBCV_0316: +Reason: Cast is needed since upper layer NvM expects super type as parameter. +Risk: Wrong type is casted or size does not match. +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_2963: +Reason: The value does not need to be initialized because it was initialized in the previous steps or the value is not used. +Risk: None +Prevention: N/A + +MD_CRYPTO_30_LIBCV_2985: +Reason: The redundant operation is a side effect of a better readability of the code. +Risk: None +Prevention: N/A + +MD_CRYPTO_30_LIBCV_3219: +Reason: This function is inlined and therefore it has to be implemented here. The function is not used by all configurations of the implementation. +Risk: None. +Prevention: None. + +MD_CRYPTO_30_LIBCV_3219_1: +Reason: The function is not used by all configurations of the implementation. +Risk: None. +Prevention: None. + +MD_CRYPTO_30_LIBCV_2973: +Reason: Parameter is set in future code execution. The code section is only reachable if the value is already set before. +Risk: This function argument points to data that is possibly unset. +Prevention: Covered by code review and component test. + +MD_CRYPTO_30_LIBCV_3395: +Reason: Define is provided by header of lower layer crypto library. +Risk: Compiler wrongly calculates the value. +Prevention: Covered by component test. + +MD_CRYPTO_30_LIBCV_3315: +Reason: This 'switch' statement contains only a single path - it is redundant. +Risk: None. +Prevention: None. + +MD_CRYPTO_30_LIBCV_3673_1: +Reason: Parameter cannot be set to const since it is passed as var parameter to lower layer crypto library. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_3673_2: +Reason: Pointer can only be const when method is empty and only Dummy statements are used. +Risk: None +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_3673_3: +Reason: Parameter cannot be set to const since it is used as var parameter. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_3673_API_REQUIREMENT +Reason: Pointer cannot be const because of the Autosar API requirements. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_3678: +Reason: Parameter cannot be set to const since it is passed as var parameter to lower layer crypto library. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_4394: +Reason: Signed integer type is given as parameter to the lower layer crypto library, the cast has to be applied. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_5013: +Reason: Signed integer type is given as return type by lower layer crypto library. Size does not matter since only -1 and 0 is returned. +Risk: None +Prevention: None + +MD_CRYPTO_30_LIBCV_0310_CRYPTOLIBRARY_CAST: +Reason: It is necessary to access inner members of the structure and therefore, the cast has to be applied. +Risk: None +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_3305_CRYPTOLIBRARY_CAST: +Reason: It is necessary to access inner members of the structure and therefore, the cast has to be applied. +Risk: None +Prevention: Covered by code review. + +MD_CRYPTO_30_LIBCV_3415_LOGICAL_OPERATOR: +Reason: Volatile reads could have side-effects. Ihe right side of the logical operator may not get evaluated and therefore doesn't produce the side-effect. +Risk: None, as no registers with side-effects are read. +Prevention: Covered by code review. + + */ + +/* +\CM CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITH_SIZE The stack arrays are given with its size to the called API. +\CM CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITHOUT_SIZE The stack array has the same length as expected by the called API. +\CM CM_CRYPTO_30_LIBCV_WORKSPACE_STACK The workspace is located on the stack and the pointer is valid throughout the call. +\CM CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME The workspace is received via ComStackLib access macros. As it is an 0:1 relation, a runtime check for availability is performed in the Dispatching function. +\CM CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME All job concerning in- and output buffer were checked in Crypto_30_LibCv_DetChecksServiceValues before based on service and mode and therefore are valid in this context. + */ + +/* SBSW_JUSTIFICATION_BEGIN + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR +\DESCRIPTION The caller forwards as parameter one or more pointer. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE +\DESCRIPTION The caller passes the address of the workspace of the respective object as a parameter. It is used to save and restore context. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH +\DESCRIPTION The caller provides the length of the workspace and the respective objectId as a parameter. +\COUNTERMEASURE \N The objectId is provided as a function parameter to the caller. The caller requires it to be within the array boundaries. + +\ID SBSW_CRYPTO_30_LIBCV_ACCESS_TO_WORKSPACE_RESTORE +\DESCRIPTION Write access to a pointer of the workspace object which is determined by primitive dispatcher. +\COUNTERMEASURE \R The pointer is forwarded and assumed to be valid and the length values which are set by dispatcher are correct. + According to SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE, SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH and [SMI-722498]. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR +\DESCRIPTION The caller forwards as parameters a pointer and a member of a job pointer. +\COUNTERMEASURE \N The pointers are forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA +\DESCRIPTION The caller forwards pointers from parameters and pointer from global Ecc curve data. +\COUNTERMEASURE \N The pointers are forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER +\DESCRIPTION The function is called with pointers pointing to stack buffers. +\COUNTERMEASURE \N Either the sizes of the buffers are given in the call or the sizes are according to the callee requirements. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_STACK_WORKSPACE +\DESCRIPTION The function is called with a pointer pointing to a workspace located on the stack within the caller function. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER +\DESCRIPTION The function is called with pointers pointing to stack buffers and pointer given as parameter to the caller. +\COUNTERMEASURE \N Either the sizes of the buffers are given in the call or the sizes are according to the callee requirements. + The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace and its members is valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_WORKSPACE_MEMBER +\DESCRIPTION The function is called with pointers pointing to workspace members. The workspace itself is given as parameter to the caller. +\COUNTERMEASURE \N Either the sizes of the workspace members are given in the call or the sizes are according to the callee requirements. It is assumed that the workspace given as parameter to the caller are valid. + +\ID SBSW_CRYPTO_30_LIBCV_KEY_OUTPUT_BUFFER_PARAMETER_KEY_STACK +\DESCRIPTION Crypto_30_LibCv_SheKeyUpdateDecrypt is called and a pointer to a keybuffer and to an output buffer is passed as parameter. In addition to that, a pointer to a local key buffer located on the stack is passed as parameter. +\COUNTERMEASURE \N The output buffer and the keybuffer are passed as argument to the caller and are assumed to be valid and of the correct size as requested by the callee. +The size of the local key buffer is according to the requirements of the callee. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_KEY_PTR +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. A pointer to a key buffer is provided with a size which is smaller then the provided buffer. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +The key pointer is checked in function Crypto_30_LibCv_Local_KeyElementSet for size. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR +\DESCRIPTION The esl library is called with a pointer to a workspace and one (or multiple) pointer to a key buffer is provided with a size which is equal or smaller than the provided buffer. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace is valid. +The pointers to the key buffers are ensured to be valid by the caller. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_PTR +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. A pointer to a data buffer is given with a size which is smaller then or equal to the provided buffer. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +The data buffer is passed as argument to the caller and is assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_OUTPUT_PTR +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. A pointer to an output buffer is provided without a reference to the size of the buffer. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +The output buffer is passed as argument to the caller and is assumed to be valid and of the correct size as requested by the callee. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_OUTPUT +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. A pointer to an output buffer is given without a reference to the size of the buffer. +In addition to that, a pointer to a data buffer is given with a size which is smaller or equal to the provided buffer. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +The output buffer is passed as argument to the caller and is assumed to be valid and of the correct size as requested by the callee. +The data buffer is passed as argument to the caller and is assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] + +\ID SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE +\DESCRIPTION The esl library is called with a pointer to the workspace, which is provided to the caller as parameter. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace and the workspace header are valid. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the const ram. +\COUNTERMEASURE \N The workspace is located on the const ram and the pointer is valid throughout the call. + +\ID SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM +\DESCRIPTION The function is called and one (or more) domain pointer to a const buffer provided as parameters is forwarded. +The const buffer provides domain parameters of a specific elliptic curve. +The domain parameters are provided in a known structure (ASN1 structure for EC domain parameters) where the size of the buffer +can be determined from a known field in the structure itself. +\COUNTERMEASURE \N The caller requires the provided domain pointer and the domain parameters to be valid. +Therefore it can be safely assumed that the domain pointer and the domain parameters are valid. +Thus, the length of the const buffer can be determined by the callee from a known field from the structure itself. + +\ID SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR +\DESCRIPTION The function is called and one (or more) domain pointer to a const buffer is forwarded. +The const buffer provides domain parameters of a specific elliptic curve. +The domain parameters are provided in a known structure (ASN1 structure for EC domain parameters) where the size of the buffer +can be determined from a known field in the structure itself. +\COUNTERMEASURE \N The function implementation itself guarantees that the domain pointer and the domain parameters are valid. +Thus, the length of the const buffer can be determined by the callee from a known field from the structure itself. + +\ID SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. Other parameters are located on the stack and have the same size as expected from the called API. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITHOUT_SIZE] + +\ID SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded which is located on the stack. +Other parameters are located on the stack and have the same size as expected from the called API. +In addition, there is one pointer which is already given as parameter to the calling function. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +[CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITHOUT_SIZE] + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER +\DESCRIPTION A function is called and a pointer to a workspace is forwarded which is located on the stack. +Other parameters are located on the stack and have the same size as expected from the called API. +In addition, there is one pointer which is already given as parameter to the calling function. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_STACK] +[CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITHOUT_SIZE] + +\ID SBSW_CRYPTO_30_LIBCV_PTR_ACCESS +\DESCRIPTION Write access to a pointer which is passed to the function. +\COUNTERMEASURE \N The pointer is assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK +\DESCRIPTION Write access to a pointer which is passed to the inlined function. The memory pointed to by the pointer is located in the stack of the calling function. +\COUNTERMEASURE \N The pointer points to memory located on the stack. The call context is synchronous and therefore, the memory stays valid throughout the call. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_KEYPTR_AND_LENGTH +\DESCRIPTION A pointer to a key buffer is given to the callee with its actual length. +\COUNTERMEASURE \R The key pointer points to a valid key buffer and the length was determined and +checked by Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR +\DESCRIPTION A pointer to a key buffer is forwarded to the callee without a size. +\COUNTERMEASURE \R The key pointer is checked in function Crypto_30_LibCv_Local_KeyElementSet for size and matches the requirements of the callee. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR_KEY_OUTPUT +\DESCRIPTION A pointer to a key buffer is provided with its size and a pointer to another key array located on the stack is provided without size. In addition to that, an output buffer is forwarded to the callee. +\COUNTERMEASURE \R The key pointer is checked in function Crypto_30_LibCv_Local_KeyElementSet for size. +The array located on the stack is sufficiently large and the call context is synchronous. The output buffer is only forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY +\DESCRIPTION The KDFbuffer is forwarded to the callee with its size. The key ptr is pointing to a stack array which corresponds to the API requirements. +\COUNTERMEASURE \N KDFbuffer is only forwarded and assumed to be valid. The buffer is located on the stack and the call is synchronous. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER +\DESCRIPTION The KDFbuffer is located on the stack and given with its size to the callee. The outputbuffer is also located on the stack and matches the callees requirements in terms of size. The pointer to the key is given as parameter to the caller and only forwarded to the callee. +\COUNTERMEASURE \N The call is synchronous and the stack arrays stay valid throughout the call. The key pointer is assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS +\DESCRIPTION Write access to array given by pointer through a parameter. The API requires the array to have a certain size and it is assumed that the size is available in the given pointer. +\COUNTERMEASURE \R The caller has to assure that the API requirements are matched and the size of the buffer is according to these requirements. + +\ID SBSW_CRYPTO_30_LIBCV_CSL01 +\DESCRIPTION Access of Queue, KeyElementWrittenLength, KeyElement, RandomSeedBuffer, KeyNvStatus and Lock using ComStackLib. +\COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID +\DESCRIPTION Access of WrittenLength, BufferLength, DriverObjectState, QueuePrimitiveInfoIdx, ProcessJob_Trigger_Write, Redirect_Buffer and Lock using ComStackLib. The GetSizeOf-check is performed in one of the global APIs Crypto_30_LibCv_CancelJob, Crypto_30_LibCv_ProcessJob or Crypto_30_LibCv_MainFunction. +\COUNTERMEASURE \N Qualified use case CSL01 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_CSL02_QUEUE_VIA_DRIVEROBJECT +\DESCRIPTION Access of Queue (via indirection over DriverObject) with same index using ComStackLib. +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT +\DESCRIPTION Access of KeyStorage (via indirection over keyElement) with same index using ComStackLib. +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_VOLATILE_KEY_STORAGE_VIA_KEY_ELEMENT +\DESCRIPTION Access of KeyStorage via volatile pointer. Pointer is set using ComStackLib (via indirection over keyElement). +\COUNTERMEASURE \N Setting of pointer is done via indirection using ComStackLib. Access of data is done through unmodified pointer. + +\ID SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY +\DESCRIPTION Access of KeyElement (via indirection over Key) with same index using ComStackLib. +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK +\DESCRIPTION Access of NvBlock (via indirection NvBlockId) with same index using ComStackLib. +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE +\DESCRIPTION Access of array located on stack. +\COUNTERMEASURE \N The static size of the array is used as upper bound and therefore no illegal write access is done. + +\ID SBSW_CRYPTO_30_LIBCV_GLOBAL_ARRAY_ACCESS_WITH_SIZE +\DESCRIPTION Access of global array located in data segment. +\COUNTERMEASURE \N The static size of the array is used as upper bound and therefore no illegal write access is done. + +\ID SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR +\DESCRIPTION One or more variables located on the stack are given as parameter pointer to a function. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR +\DESCRIPTION One or more variables located on the stack and one or more members of job pointer are given as parameter pointer to a function. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR +\DESCRIPTION A pointer to an array located on the stack is given as parameter to a function including its size. +\COUNTERMEASURE \N The function call is synchronous and the size of the array is given, therefore the stack array is valid for the function call. + +\ID SBSW_CRYPTO_30_LIBCV_ACCESS_TO_ERRORID_PTR +\DESCRIPTION Access of errorId pointer to set the errorId. The context is an inlined function which is always called synchronously from Crypto_30_LibCv_Process, +where the variable is located on the stack. +\COUNTERMEASURE \N The function call is synchronous and the variable errorId has to be located on the stack. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR +\DESCRIPTION The call is only forwarded and has as parameter a job pointer. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_UPDATE_OF_JOB_STATE +\DESCRIPTION Direct write access to state member of job ptr. The context is the inlined function Crypto_30_LibCv_UpdateJobState, +which is always called synchronously from Crypto_30_LibCv_Process. +\COUNTERMEASURE \R The ptr is checked in the global API Crypto_ProcessJob or Crypto_MainFunction. + +\ID SBSW_CRYPTO_30_LIBCV_DIRECT_ACCESS_TO_JOB_STATE +\DESCRIPTION Direct write access to state member of job ptr. The context is the inlined function Crypto_30_LibCv_Process, +which is always called synchronously from Crypto_30_LibCv_ProcessJob or Crypto_30_LibCv_MainFunction. +\COUNTERMEASURE \R The job object is already checked in global API. + +\ID SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR +\DESCRIPTION Write access to a pointer of the jobs primitive input output object. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME] + +\ID SBSW_CRYPTO_30_LIBCV_ACCESS_OF_JOB_MEMBER_CANCEL_JOB +\DESCRIPTION Write access to the state member of job pointer. +\COUNTERMEASURE \N The pointer is checked for validity in the beginning of the Crypto_30_LibCv_CancelJob function. + +\ID SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_INIT +\DESCRIPTION Direct array access to key storage array generated by ComStackLib. +The access is in bounds since it is iterated over all key elements and the access is either direct or via indirection (KeyElement to KeyStorage). +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_NV +\DESCRIPTION Direct array access to key storage array generated by ComStackLib. +The access is in bounds since it is iterated over all key elements and the access is either direct or via indirection (KeyElement to KeyStorage). +\COUNTERMEASURE \N Qualified use case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE +\DESCRIPTION The function esl_initWorkSpaceHeader is called with a pointer to the workspace header and a size. +The workspace pointer was received by calling Crypto_30_LibCv_GetWorkspaceOf which is provided by the ComStackLib. +\COUNTERMEASURE \R CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME + +\ID SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE +\DESCRIPTION The function esl_initWorkSpaceHeader is called with a pointer to the workspace header and a size. The workspace is located on the stack. +\COUNTERMEASURE \N The call to esl_initWorkSpaceHeader is synchronous and therefore, the workspace stays valid during the lifetime of the call. + +\ID SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE_PARAMETER +\DESCRIPTION The function esl_initWorkSpaceHeader is called with a pointer to the workspace header, a size and a function pointer. The workspace is provided to the caller as parameter. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace and the workspace header are valid. + The function pointer is a static generated value and therefore it can be assumed that it is valid. + +\ID SBSW_CRYPTO_30_LIBCV_ACT_RANDOM_WORKSPACE_ARRAY_ACCESS +\DESCRIPTION Array access to X_KEY member of random workspace pointer of type ActFIPS186STRUCT. +\COUNTERMEASURE \N The validity of the pointer to the random workspace is given since the workspace is provided by the ComStackLib and the access is in bounds. +Since the accessing index is limited by the static size of the X_KEY array, it is ensured that is in range. + +\ID SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS +\DESCRIPTION Access to member of workspace pointer. +\COUNTERMEASURE \N The validity of the pointer to the workspace is given since the workspace is provided by the ComStackLib. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE +\DESCRIPTION The esl library is called and a pointer to a workspace is forwarded. The workspace pointer points to a workspace provided by ComStackLibrary via Indirection over ObjectId. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS +\DESCRIPTION The esl library is called and a pointer to a workspace as well as in - and output buffers are forwarded. +The pointer to the workspace is already initialized before and therefore valid. All other buffers are checked before in local function Crypto_30_LibCv_Local_DetChecksServiceValues, +which is called in the context of the global API Crypto_30_LibCv_Process. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +\R [CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME] + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS_AND_NULL_PTR +\DESCRIPTION The esl library is called and a pointer to a workspace as well as in - and output buffers are forwarded. +The pointer to the workspace is already initialized before and therefore valid. All other buffers are checked before in local function Crypto_30_LibCv_Local_DetChecksServiceValues, +which is called in the context of the global API Crypto_30_LibCv_Process. +There is a optional pointer which is allowed to be a NULL_PTR. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +\R [CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME] +\R The called function allows that the param pointer is a NULL_PTR. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER +\DESCRIPTION The esl library is called and a pointer to a workspace as well as buffer and lengths of stack variables are given as parameter to the function call. +The pointer to the workspace is already initialized before and therefore valid. All other buffers are located on the stack and the function call is synchronous. Therefore, the memory +stays valid throughout the call. +\COUNTERMEASURE \N All pointers point to stack variables and the length is also provided to the called function. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER +\DESCRIPTION The esl library is called with a pointer to a workspace, +a pointer located at the job object (pointing to a buffer) with an length denoting the length of the buffer +and a pointer to an buffer which is located on the stack and without size. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +[CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME] +[CM_CRYPTO_30_LIBCV_STACK_ARRAY_WITHOUT_SIZE] + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER +\DESCRIPTION The esl library is called with a pointer to a workspace, +a pointer to a buffer provided to the caller via parameter and a length denoting the length of the buffer. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace is valid. + The caller requires the buffer to be valid, therefore it can be safely assumed that the buffer is valid during the call. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER +\DESCRIPTION The esl library is called with a pointer to a workspace, +a pointer to one or multiple const buffers and a length denoting the length of the buffers. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace is valid. + As the const buffers are constant, they cannot be written to, making them irrelevant for this analysis. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER_AND_PARAMETER_BUFFER +\DESCRIPTION The esl library is called with a pointer to a workspace, +a pointer to one or multiple const buffer, a length denoting the length of the const buffers, +a pointer to one or multiple buffers provided to the caller via parameter and a length denoting the length of the buffers. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace is valid. + As the const buffers are constant, they cannot be written to, making them irrelevant for this analysis. + The caller requires the parameter buffers to be valid, therefore it can be safely assumed that they are valid during the call. + The caller also provides the length of the parameter buffers as required by the API of the callee. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER_AND_STACK_BUFFER +\DESCRIPTION The esl library is called with a pointer to a workspace, +a pointer to one or multiple const buffer, a length denoting the length of the const buffers, +a pointer to one or multiple stack buffers provided located on the stack and a length denoting the length of the buffers. +\COUNTERMEASURE \N The caller requires the workspace to be valid, therefore it can be safely assumed that the workspace is valid. + As the const buffers are constant, they cannot be written to, making them irrelevant for this analysis. + The caller creates the stack buffers before and ensures their validity. + The caller also provides the length of the stack buffers as required by the API of the callee. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR +\DESCRIPTION The esl library is called with a pointer to a workspace and a null pointer is given to the library as parameter. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +The null pointer is a valid input to the calling function. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_NULL_PTR +\DESCRIPTION The NvM is called with a null pointer is given as parameter. +\COUNTERMEASURE \N The null pointer is a valid input to the calling function. + +\ID SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN +\DESCRIPTION The esl library is called and a pointer to a workspace as well as pointer to stack arrays are given without an information how large the arrays are. +This is due to the fact that these esl library functions do not provide a parameter for the length of the buffer. +\COUNTERMEASURE \N The stack arrays have the same length as the esl library expects. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE +\DESCRIPTION The service is called and a pointer to a workspace is forwarded. The workspace pointer points to a workspace provided by ComStackLibrary via Indirection over ObjectId. +\COUNTERMEASURE \R [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR_AND_CONST_BUFFER +\DESCRIPTION The pointers of workspace and job are forwarded. +The workspace pointer points to a workspace provided by ComStackLibrary via Indirection over ObjectId. +A pointer to a const buffer is passed to the called function. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +The job pointer is forwarded and assumed to be valid. +As the const buffer is constant, it cannot be written to, making them irrelevant for this analysis. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR +\DESCRIPTION The call is only forwarded and has as parameter a pointer to a workspace a job pointer. +The workspace pointer points to a workspace provided by ComStackLibrary via Indirection over ObjectId. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +The job pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR +\DESCRIPTION The call is only forwarded and has as parameter a pointer to a workspace a job pointer. +The workspace pointer points to a workspace provided by ComStackLibrary via Indirection over ObjectId. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +The job pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_AND_GLOBAL_ARRAY_PTR +\DESCRIPTION The call is only forwarded and has as parameter a pointer to a job and a pointer to a global +array located in data segment. +\COUNTERMEASURE \N The job pointer is forwarded and assumed to be valid. For the pointer to a global array +the static size of the array is used as upper bound and therefore no illegal access is done. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_GLOBAL_WORKSPACE_AND_CONST_BUFFER +\DESCRIPTION A function is called with a pointer to a workspace, which is provided by ComStackLibrary via Indirection over ObjectId, +and a pointer to one or multiple const buffers. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +As the const buffers are constant, they cannot be written to, making them irrelevant for this analysis. + +\ID SBSW_CRYPTO_30_LIBCV_CALL_WITH_GLOBAL_WORKSPACE_AND_JOB_BUFFER +\DESCRIPTION A function is called with a pointer to a workspace, which is provided by ComStackLibrary via Indirection over ObjectId, +and pointers pointing to workspace members. +\COUNTERMEASURE \N [CM_CRYPTO_30_LIBCV_WORKSPACE_VIA_COMSTACKLIB_RUNTIME] +[CM_CRYPTO_30_LIBCV_JOB_INPUT_OUTPUT_BUFFERS_RUNTIME] + +\ID SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK +\DESCRIPTION The value of a pointer to a variable located on the stack is written. +\COUNTERMEASURE \N The function call is synchronous and there is no array access. + +\ID SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK +\DESCRIPTION The array is written with an index, the size of the array is known in this context. +\COUNTERMEASURE \R It is checked that there is no out of bounds via the provided length. + +\ID SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK +\DESCRIPTION Write access to a pointer. +\COUNTERMEASURE \R The pointer is checked for validity before. + +\ID SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK +\DESCRIPTION One or more pointer are forwarded as parameter to the caller. +\COUNTERMEASURE \R The pointer are checked for validity before. + +\ID SBSW_CRYPTO_30_LIBCV_RNG_SEED +\DESCRIPTION Access to KeyElementState via indirection over Key. +\COUNTERMEASURE \N The index is not explicitly checked. Since the code is only executed if the Crypto_30_LibCv_KeyElementSet has successfully written the same KeyElement, it is guaranteed that the key element exist and therefore the index is also valid. + +\ID SBSW_CRYPTO_30_LIBCV_GETVERSIONINFO +\DESCRIPTION The function Crypto_30_LibCv_GetVersionInfo writes to the object referenced by parameter VersionInfo +\COUNTERMEASURE \N The caller ensures that the pointers passed to the parameter VersionInfo is valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER +\DESCRIPTION The NvBuffer is forwarded and accessed without a length given to the service. +\COUNTERMEASURE \S SMI-863486 ensures, that the NvM block length is as expected from the component. Therefore read and write access is within correct boundaries. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_ACCESS_TO_NVBUFFER +\DESCRIPTION A pointer to a stack variable is forwarded and a NvBuffer is forwarded and accessed without a length given to the service. +\COUNTERMEASURE \S SMI-863486 ensures, that the NvM block length is as expected from the component. Therefore read and write access is within correct boundaries. + Stack pointer assumed to be valid, pointer to NvM block is forwarded by the caller and assumed to be valid. + +\ID SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_KEYSTORE_BUFFER +\DESCRIPTION The function is called with pointers pointing to stack and keystorage buffers. +\COUNTERMEASURE \N Either the sizes of the buffers are given in the call or the the caller ensures that the sizes are according to the callee requirements. + +\ID SBSW_CRYPTO_30_LIBCV_WRITE_PARTITION_DATA +\DESCRIPTION Write of Partition specific data using ComStackLib. +\COUNTERMEASURE \N The index for the Partition specific data is either fixed (for single partition usecase) or provided by searching the current application id + in the PartitionIdentifiers and using its corresponding partitionIdx (Qualified use-case CSL05 of ComStackLib). + If no partitionIdx can be found, usage of an invalid index is prevented by checking the index to be in acceptable range. + Therefore it is always guaranteed to be in the acceptable range. + +SBSW_JUSTIFICATION_END */ + +/* COV_JUSTIFICATION_BEGIN + + \ID COV_CRYPTO_30_LIBCV_LOCAL_DEFINE + \ACCEPT XF + \ACCEPT TX + \REASON CRYPTO_30_LIBCV_LOCAL is always defined externally. + + \ID COV_CRYPTO_30_LIBCV_COMPATIBILITY_DEFINE + \ACCEPT TX + \REASON Define is always defined internally but cane be overwritten for compatibility. + + \ID COV_CRYPTO_30_LIBCV_CSM_DEFINES + \ACCEPT XF + \ACCEPT TX + \REASON This defines could be defined in other crypto drivers as well. In order to increase flexibility, defines are defined in crypto driver if not provided yet. + + \ID COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT + \ACCEPT X + \REASON This else/default statements are required by misra but cannot be reached in code. The statement is captured by upper Api. + + \ID COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE + \ACCEPT XF + \ACCEPT TX + \REASON This encapsulation is for different platform types. Not all platform types can be covered by development test. Covered by code review and integration test. + + \ID COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS + \ACCEPT TX + \REASON The Crypto needs custom key elements, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM + \ACCEPT TX + \REASON The Crypto needs custom algorithm and algorithm mode defines, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM + \ACCEPT TX + \REASON The Crypto needs custom key algorithm, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_LIBCV_KEY_LOCKING_RELEASE + \ACCEPT TX + \REASON This check can only be false if there is a implementation mistake. + + \ID COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT + \ACCEPT TX + \REASON This check can only be false if the parameter is defined externally. + + \ID COV_CRYPTO_30_LIBCV_SHE_ECU_MASTER_KEY + \ACCEPT TX + \ACCEPT XF + \REASON The result of the check depends of the SHE configuration. If the ECU_MASTER_KEY is configured the result can be TX otherwise XF. + + \ID COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION + \ACCEPT TF + \ACCEPT XF + \REASON The result of the check depends of the SHE configuration. If the required key is not configured the result can be XF. + + \ID COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 + \ACCEPT TF + \ACCEPT TX + \REASON The result of the check depends of the SHE configuration. If the required key is not configured the result can be TX. + + \ID COV_CRYPTO_30_LIBCV_SERVICE_CONFIGURATION + \ACCEPT TX + \ACCEPT TF + \REASON The result of the check depends of the service configuration. If all services are enabled the result can be TX. + + \ID COV_CRYPTO_30_LIBCV_SERVICE_CONFIGURATION_2 + \ACCEPT XF + \ACCEPT TF + \REASON The result of the check depends of the service configuration. If no service with key write access is enabled the result can be XX. + + \ID COV_CRYPTO_30_LIBCV_ECDSA_CONFIGURATION + \ACCEPT TF + \ACCEPT TX + \ACCEPT XF + \REASON The result of the check depends of the ECDSA configuration. If pre hash length is longer than the curve length the result is always TX. If pre hash length is shorter than the curve length the result is always TX. + + \ID COV_CRYPTO_30_LIBCV_ECDSA_PREHASHING_ENABLED + \ACCEPT TF + \ACCEPT TX + \ACCEPT XF + \REASON The result of the check depends of the ECDSA configuration. In a configuration where only curve SECp521r1 is supported, the ECDSA is always used together with SHA512 prehashing and thus, + the algorithm secondary family is always set. + + \ID COV_CRYPTO_30_LIBCV_ASR_COMPATIBILITY + \ACCEPT XF + \ACCEPT TX + \REASON The Crypto_JobType differs between the different ASR version to support ASR 4.3.0 the defines ca be overwritten. Standard is ASR 4.3.1. + + \ID COV_CRYPTO_30_LIBCV_BINARYSEARCH + \ACCEPT TX + \REASON This check can never be false, as the searched list is generated as an ordered list without gaps. + Consequently, the used binary search algorithm will always find the searched entry if the list was generated correctly, + and the check will never be false. + +\ID COV_CRYPTO_30_LIBCV_USER_DEFINES + \ACCEPT TX + \ACCEPT XF + \REASON Ifndef is present for redefinition prevention. This allows the user or CSM to override this value + while also ensuring that the constant is present if the user or CSM does not override it. + +COV_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * FETA JUSTIFICATIONS + *********************************************************************************************************************/ + + /* FETA_JUSTIFICATION_BEGIN + + \ID FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA + \DESCRIPTION Loop bounds are determined by static GenData which is accessed via ComStackLib. + \COUNTERMEASURE \N The here applied loop uses variables as lower and upper bound which are set via a ComStackLib macro + and remain unchanged during loop execution. The lower bound variable is guaranteed to be less + than or equal to the upper bound variable. The loop's type of the counter variable is appropriate + for the loop's type of lower and upper bound determining variables as it is an iteration type suitable for the + used CSL indirection. The counter variable is increased once within each single loop iteration (strictly monotonically increasing) + until it reaches a value that makes the loop stop without any occurrences of overflows. This + is done by a comparison used as loop termination condition that considers the amount of the + increment that is applied within each single loop. + + \ID FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA + \DESCRIPTION Loop upper bound is determined by static GenData which is accessed via ComStackLib. + \COUNTERMEASURE \N The here applied loop uses a variables as upper bound which is set via a ComStackLib macro + and remains unchanged during loop execution. The loop's type of the counter variable is appropriate + for the loop's type of lower and upper bound determining variables as it is an iteration type suitable for the + used CSL indirection. The counter variable is increased once within each single loop iteration (strictly monotonically increasing) + until it reaches a value that makes the loop stop without any occurrences of overflows. This + is done by a comparison used as loop termination condition that considers the amount of the + increment that is applied within each single loop. + + \ID FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_WITH_CHECK + \DESCRIPTION Loop upper bound is determined by a constant parameter which is passed to the function. + \COUNTERMEASURE \R The caller ensures correctness of the parameter by checking it for boundary conditions + described in the function doxygen comment. + [CM_CRYPTO_LIBCV_FOR_LOOP_WITH_NON_CHANGING_UPPER_BOUND] + + \ID FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_PTR + \DESCRIPTION Loop upper bound is determined by a pointer parameter which is passed to the function. + \COUNTERMEASURE \N [CM_CRYPTO_LIBCV_FOR_LOOP_WITH_NON_CHANGING_UPPER_BOUND] + + \ID FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND + \DESCRIPTION Loop upper bound is determined by a constant parameter which is passed to the function. + \COUNTERMEASURE \N [CM_CRYPTO_LIBCV_FOR_LOOP_WITH_NON_CHANGING_UPPER_BOUND] + + \ID FETA_CRYPTO_30_LIBCV_BINARY_SEARCH + \DESCRIPTION While loop which is used for a binary search of a cryptoKeyId via its elementIndex. + \COUNTERMEASURE \N The here applied while loop is controlled by a comparison of the variables minKey and maxKey, + which are of the same type. + Within each single loop execution: + - the value of variable middleKey, which is of an appropriate type, is calculated and then it is: minKey <= middleKey < maxKey, + - Then + - either maxKey becomes middleKey, so right decreases + - or minKey becomes (middleKey + 1), so left increases + - or keyFound becomes TRUE which makes the loop stop by a call of break + So with each single loop the difference (maxKey - minKey) becomes smaller (strictly monotonically decreasing) and + the loop will finally stop after a maximum of (maxKey - minKey) loop executions. + + \CM CM_CRYPTO_LIBCV_FOR_LOOP_WITH_NON_CHANGING_UPPER_BOUND + The loop's type of the counter variable is appropriate for the loop's type of upper bound + variable as it is the same type as the bound determining variables. The upper bound remains unchanged during loop execution. + The counter variable is increased once within each single loop iteration (strictly monotonically increasing) + until it reaches a value that makes the loop stop without any occurrences of overflows. This + is done by a comparison used as loop termination condition that considers the amount of the + increment that is applied within each single loop. + + FETA_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.h new file mode 100644 index 0000000..033463c --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv.h @@ -0,0 +1,600 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------ + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------ + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of the MICROSAR Crypto Driver (Crypto) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-10-31 vismss Initial creation for ASR 4.3 + * 01.00.01 2016-12-06 vismss Minor adaptions to the specification + * 01.00.02 2016-12-07 vismss Fixed rng and key storage init + * 01.00.03 2016-12-14 vismss ESCAN00093302 Fixed AES enc/dec and EdDSA + * 01.00.04 2017-01-24 vismss ESCAN00093690 Support of simplified SHE Key Update Protocol + * ESCAN00093350 Fixed workspace casts + * ESCAN00093365 DET encapsulation + * Adaptions to ASR spec and coding style patterns + * 01.01.00 visros Fixed DET ServiceIds + * Added DET for process job + * visgut Fixed processing of asynchronous jobs in mainfunction. + * Include SchM_Crypto_30_LibCv.h + * Support multiple driver objects and locking of workspaces. + * ESCAN00094360 Compiler warning: GetVersionInfo API missing return statement at end of non-void function + * vistof Moved Crypto_30_LibCv_QueueStateType from Csm_types.h to Crypto + * Added Cancel API + * vismss Added SipHash + * Adapted EDDSA + * 01.01.01 vismaw ESCAN00094769 Calling of services always returns false + * 01.02.00 2017-05-05 vismaw FEATC-1229 Release of component + * ESCAN00093105 Release of component + * ESCAN00095032 AEAD Encrypt does not check if output buffer for authentication tag has a wrong size + * ESCAN00095030 Crypto_30_LibCv_KeyElementIdsGet always returns E_NOT_OK + * ESCAN00095028 Wrong output length returned for AEAD Encrypt + * ESCAN00095033 KeyElementSet with SHE Key update mechanism does not set the new key + * 02.00.00 2017-08-06 vismwe ESCAN00095629 Crypto_30_LibCv_KeyElementIdsGet returns E_NOT_OK instead of CRYPTO_E_SMALL_BUFFER + * ESCAN00096063 Crypto_30_LibCv_KeyElementSet calculates wrong values for M4 proof if a SHE update key flags is set. + * ESCAN00096032 Crypto_30_LibCv_KeyDerive returns suspect values, if the calculation failed. + * ESCAN00095987 Crypto_30_LibCv_KeyElementSet returns always E_NOT_OK for SHE key update without the key element "proof" + * ESCAN00095985 Compiler error: undeclared identifier for virtual key usage + * ESCAN00095928 Crypto_30_LibCv_KeyExchangeCalcSecret does not reject calls with invalid length of public key + * ESCAN00096031 Crypto_30_LibCv_KeyCopy copies key elements with different lengths without enabled partial access. + * ESCAN00096176 Crypto_30_LibCv_KeyElementGet returns CRYPTO_E_KEY_NOT_VALID instead of CRYPTO_E_KEY_NOT_AVAILABLE + * 02.01.00 2017-08-15 vistof ESCAN00096308 MAC verification only done for complete bytes. + * vismaw STORYC-934 Optimize AES runtime through keeping the SubKey and Roundkeys of former used Keys + * vismwe ESCAN00096452 Error is returned when IV key element is missing during AES-ECB. + * STORYC-281 Safe BSW Release + * 03.00.00 2017-09-11 vismwe STORYC-1851 Support of RSA + * STORYC-2438 SHE Key Update Protocol - Use and check key slot mentioned in M1 + * STORYC-2485 Support Access Rights of Key Elements + * 03.01.00 2017-09-11 vismwe STORYC-2700 Support Key Locking + * ESCAN00096711 The key element is set valid if Crypto_30_LibCv_KeyElementSet failed + * ESCAN00096872 Crypto_30_LibCv_ProcessJob: Missing Det report if the Crypro is not supported on the driver object + * STORYC-2159 Support ECC with NIST P-256 (ECDSA) + * STORYC-2600 Support ECDSA for SECGp256r1 + * ESCAN00097178 ProcessJob returned with E_NOT_OK if the RSA signature verification failed + * 03.02.00 2017-11-06 vismwe STORYC-2606 Support ECDHE for ANSIp256r1 + * STORYC-2599 Support RSA Encrypt/Decrypt + * STORYC-2604 Support HMAC with SHA1 and SHA256 + * ESCAN00097356 Compiler error: C2065: 'actX25519Struct' : undeclared identifier + * ESCAN00097524 Crypto_30_LibCv_ProcessJob returns CRYPTO_E_KEY_NOT_VALID, if RSA signature is generated. + * 03.03.00 2017-11-29 vismwe STORYC-2601 Support concatenation KDF + * STORYC-2603 Support certificate installation and update according to ISO15118 + * ESCAN00097542 Compiler error: unresolved external Crypto_30_LibCv_Local_ReadTwoKeyElements + * 03.04.00 2018-01-08 vismwe STORYC-2605 Support ECDSA for ANSIp256r1 with SHA-1 + * ESCAN00097921 Compiler error: 'CRYPTO_RANDOM' : undeclared identifier + * 03.05.00 2018-01-22 vismwe STORYC-3392 Support CTR-DRBG using AES-128 according to NIST SP 800-90A + * STORYC-2607 Support RSA CRT DSA SHA-1 and SHA-256 and PKCS1_V15 + * ESCAN00098171 Compiler warning: uninitialized variable retVal. + * ESCAN00098173 Compiler warning: incompatible types uint8* and uint8_least* + * STORYC-2602 Support ECDHE for SECp256r1 + * STORYC-4075 Support delete key element + * ESCAN00098280 Compiler error: Crypto_30_LibCv.c undefined identifier "Crypto_30_LibCv_QueueElementType" + * ESCAN00098328 AES encryption/decryption does not fail if the key is too short. + * ESCAN00098330 EDDSA 25519 generate/verify does not fail if the key is too short. + * ESCAN00098322 AES CMAC Round-key Reuse does not reduce the runtime. + * ESCAN00098354 Crypto_ProcessJob returned CRYPTO_E_BUSY for async job update in streaming mode. + * 03.06.00 2018-02-19 vismwe STORYC-4373 Support AES 128 encryption and decryption without padding + * ESCAN00098488 Crypto_30_LibCv_ProcessJob return CRYPTO_E_KEY_NOT_VALID instead of E_NOT_OK if AES key length is not correct. + * ESCAN00098501 Compiler error: undeclared identifiers for Ecc Curve Parameters. + * ESCAN00098502 Crypto_30_LibCv_RandomSeed returns always E_NOT_OK if DRBG is used. + * ESCAN00098593 Crypto_30_LibCv_ProcessJob returns E_OK instead of E_NOT_OK if key element seed state is missing for FIPS186. + * 03.06.01 2018-04-09 vismwe ESCAN00098720 Compiler warning: incompatible types - from 'eslt_WorkSpace *' to 'eslt_WorkSpaceEd25519 *' relevant if SysService_CryptoCv is greater 3.02.00 + * 04.00.00 2018-05-23 vismwe STORYC-5043 Support for ECDSA 384 + * STORYC-5044 Support for AES 256 + * 04.01.00 2018-05-23 vismwe STORYC-5529 SHE Key Update Protocol - Support UID, Fid and counter + * ESCAN00098947 No error generated when length greater than 65535 (0xFFFF) bytes is passed to an algorithm + * 04.02.00 2018-08-20 vismwe ESCAN00100198 Compiler error: function Crypto_30_LibCv_CompareMac undefined + * ESCAN00099294 Keys will not be persist in NVM + * ESCAN00100597 AES-GCM output size check is not sufficient in streaming mode. + * 05.00.00 2018-09-20 vismwe STORYC-6301 Support RSAES-OAEP with SHA-1 and SHA-256 + * ESCAN00100617 A SHE key with debugger/boot-protection will not be provided + * 05.01.00 2018-11-05 vismwe STORYC-6543 Support redirection of input/output buffers from/to key elements + * STORYC-6544 Support partial key element copy + * STORYC-7031 Support vSecPrim watchdog trigger function + * ESCAN00101150 AES 256 CBC: Crypto_ProcessJob returns CRYPTO_E_KEY_SIZE_MISMATCH in case of IV != 32Bytes + * ESCAN00101246 Memory Corruption if ProcessJob is called with an invalid cryptoKeyId + * ESCAN00101340 HMAC returns CRYPTO_E_KEY_NOT_VALID if key length is longer than Hash length + * 05.02.00 2018-11-21 visivg STORYC-7065 Support of SHA384 and SHA512 pre-hashing for ECDSA + * STORYC-5518 Support of SHA384 hashing + * STORYC-5520 Support of ECDHE for SECp384r1 + * vismwe ESCAN00101561 Compiler warning: Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected is undefined + * ESCAN00101562 Compiler warning: Incompatible types - of "Crypto_30_LibCv_SizeOfKeyStorageType *" and "Crypto_30_LibCv_SizeOfKeyElementsType *" + * 05.03.00 2019-01-02 visivg STORYC-5807 Support GMAC AES-256, AES-192 and AES-128 + * 05.04.00 2019-01-25 visivg STORYC-7447 Support HMAC SHA-384 + * 05.05.00 2019-02-26 visivg STORYC-7655 Prepare Release of Crypto 5.x + * ESCAN00102255 Compiler warning: 'Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt' and 'Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt' : undeclared identifier in Crypto_30_LibCv_cfg.c + * ESCAN00099936 ProcessJob returns different values for different primitives if the key size is not matching. + * vismwe ESCAN00101248 CMAC wrong calculation for updated CMAC key, if CMAC key reuse is enabled. + * ESCAN00100548 Random Number Generator FIPS186 will provide the same random numbers after restart + * ESCAN00102474 Key Derivation according to ISO15118 returns always E_NOT_OK + * ESCAN00102491 Unexpected behavior if a job is executed which configuration is not supported in the crypto configuration. + * 05.06.00 2019-05-11 vismwe STORYC-7979 Support RSAES PKCS#1 v1.5 public key decryption + * STORYC-5721 MISRA-C:2012 Compliance + * STORYC-7161 Support KDF X9.63 with Sha256 in Crypto Driver + * ESCAN00102689 Primitive execution always fails with an error for a specific primitive. + * 06.00.00 2019-07-08 vismwe SEC-62 Support Export of She RAM Keys + * SEC-27 Support of She DEBUG_CMD + * SEC-61 Introduce multiple NvM Blocks + * 06.01.00 2019-08-05 vismwe SEC-667 Introduce Immediate write of NvM Blocks + * 06.01.01 2019-08-20 vismaw ESCAN00104069 LibCv causes endless loop in NvM_Readall + * 07.00.00 2019-12-03 vismwe SEC-934 Trigger Persist only if effected persist keys are changed + * ESCAN00102474 Key Derivation according to ISO15118 returns always E_NOT_OK + * ESCAN00105277 Crypto_30_LibCv_ProcessJob provides wrong Det errorId if KeyId is wrong + * visenc SEC-54 Support Asynchronous Key Handling + * 07.00.01 2020-01-20 vismwe ESCAN00105402 Compiler error: Crypto_30_LibCv_KeyManagement.c(8760): 'writeBlock' : undeclared identifier + * 07.01.00 2020-01-20 vismwe SEC-10 Add callout implementation for esl_getBytesRNG + * ESCAN00105358 Memory Corruption if a DRBG Random Generate job is called with less than 16 Bytes of output. + * ESCAN00093129 esl_getBytesRNG is missing + * 07.02.00 2020-03-09 vismwe SEC-881 Remove 64k single call limitation for all security algorithms + * SEC-1005 Remove limitation for signature input data pointers + * ESCAN00105884 Exception caused by access to uninitialized memory. + * ESCAN00105886 She Debug Command corrupts key storage data. + * visenc SEC-885 Support AES Padding One with Zeros + * 07.03.00 2020-03-23 visenc SEC-902 Support CryptoStack KeyGenerate Interfaces + * 08.00.00 2020-04-17 visenc SEC-1280 Support HMAC RIPEMD-160 + * ESCAN00106153 Crypto_30_LibCv_ProcessJob for RSA PKCS1 CRT returns always E_NOT_OK. + * 08.00.01 2020-04-20 vismwe ESCAN00106180 Primitive execution fails or provides wrong calculation for asynchronous jobs + * 08.01.00 2020-04-29 visenc SEC-1276 Support of ECDSA with SECP160R1 + * ESCAN00106259 Compiler error: Missing functions for key generation + * 08.02.00 2020-05-25 visenc SEC-1278 Support of HASH with RIPEMD-160 + * SEC-796 Support of AES CTR-Mode + * SEC-954 Support of PBKDF2 HMAC SHA-1 and SHA-256 + * 08.03.00 2020-06-12 visenc SEC-1534 Support KDF963 in combination with SHA512 + * ESCAN00106613 Useless access of uninitialized stack variable reseedCnt. + * 08.04.00 2020-06-29 visenc SEC-1250 Support ChaCha20 with Poly1305 as authenticator for AEAD + * ESCAN00106735 Access of uninitialized stack variable while ProcessJob redirection and negative error code + * 08.05.00 2020-07-20 visenc SEC-1164 Support CTR_DRBG based on AES-128 from vSecPrim + * SEC-1375 Harmonize Crypto_JobType according to different ASR version + * SEC-1215 Support PRNG based on SHA512 according to SP800-90A + * SEC-1472 Support SHA-3-256 + * ESCAN00106930 Key Init Value is not Correct or leads to compile Error + * ESCAN00106936 She key update fails or compile Error + * ESCAN00106783 Memory Corruption: Crypto_KeyElementCopyPartial with invalid values. + * ESCAN00106807 Changed keys are not persisted with KeySetValid after WriteAll + * vismwe SEC-1687 Support Write Once Keys + * 09.00.00 2020-08-31 visenc SEC-1691 Support CTR-DRBG using AES-256 according to NIST SP 800-90A + * SEC-1665 Support SHE command CMD_GET_ID + * ESCAN00107335 MacVerify fails on Big-Endian Platforms for truncated MACs when length in bits is not divisible by 8 + * ESCAN00107666 Primitive execution fails or provides wrong calculation + * 09.01.00 2020-10-27 visenc SEC-1801 Support CMAC AES-256 + * SEC-1805 Support HKDF HMAC SHA256 + * SEC-1809 Support AES-CCM + * ESCAN00107841 Access of uninitialized memory, RandomSeedBuffer in Crypto_30_LibCv_Init + * vismwe SEC-1812 Support SPAKE2+ + * 09.02.00 2020-11-20 visenc SEC-2080 Support Hash MD5 + * SEC-1677 Support Key Generation for Ed25519 Keys + * 09.03.00 2021-01-12 vismxe SEC-1887 Support Custom Mode Synchronization according to AUTOSAR R20-11 + * vismwe SEC-2263 Support Runtime DET for CRYPTO_E_ENTROPY_EXHAUSTION + * 10.00.00 2021-05-11 visenc SEC-2714 Support save and restore context for running crypto operations + * ESCAN00109421 Crypto_30_LibCv_Local_KeyElementGet_Standard access to uninitialized memory + * ESCAN00109433 Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws forwards uninitialized key length variable + * ESCAN00108731 SHE DEBUG Command Due to Write Lock bit Enabled Crypto Driver won't provide data to NVM during Zero Value write in to D flash + * 10.01.00 2021-08-31 vismwe SEC-3114 Support Elliptic Curve Burmester Desmedt (ECBD) + * ESCAN00109930 SHE DEBUG Command: Key access issues after DEBUG_CMD execution. + * 11.00.00 2021-11-29 visenc SEC-3388 Support Key Derivation NIST SP 800-56C Option 1 + * 11.01.00 2021-12-20 visenc SEC-3570 Support key value changed callouts + * visenc ESCAN00111088 Persistency fails or unexpected behaviour when calling KeyDerive API + * viseag SEC-3640 Usage of _MemMap.h + * 12.00.00 2022-05-16 visenc SEC-4482 Support of ECDSA secp521r1 with SHA2-512 + * 2022-09-01 viseag SEC-4863 Support of AES-192 + * 2022-10-24 viskju ESCAN00111536 Missing validation can lead to undefined behavior + * ESCAN00111597 Missing Partial Access Limitation + * ESCAN00111639 Algorithm message length limitation too strict + * 12.01.00 2022-11-11 viskju HSM-3249 Support of ECDHE secp521r1 + * HSM-3317 Provide APIs for redirection for Hwa Use-Case + * HSM-3096 Support SHA-3 and SHAKE according to FIPS 202 + * ESCAN00113238 Redirection will provide wrong data in output key element for Encrypt, Decrypt, Aead Encrypt and Aead Decrypt + * ESCAN00113241 Undefined behavior after restoring context of job with configured redirection + * ESCAN00113214 RSA PKCS1 decryption fails after restore + * ESCAN00113213 RSA PSS signature verification fails after restore + * 12.02.00 2023-01-24 viskju HSM-3086 Support of HKDF HMAC SHA384 + * HSM-3703 FETA Analysis + * 12.03.00 2023-03-15 viskju HSM-3819 Support HKDF HASH Option 1 Sha-512 + * ESCAN00114135 RSA signature verification job with invalid input data returns unexpectedly with E_NOT_OK + * 12.04.00 2023-04-03 viskju HSM-3826 Support ISO-15118-20 Key Derivation for P521 + * ESCAN00114495 CMAC generation or verification produces the wrong output + * ESCAN00114531 CMAC generation or verification fails unexpectedly + * 13.00.00 2023-04-13 viskju HSM-3728 Support multicore with shared memory + * ESCAN00114693 Invalid sequence of asynchronous jobs leads to blockage of queue + * 13.01.00 2023-06-06 viskju HSM-4098 Support X448/ECDH based on curve Edwards448 + * HSM-3956 Harmonize Crypto_JobType usage to ASR 21-11 + * HSM-4090 Support ISO-15118-20 Key Derivation for ED448 + * HSM-4390 Rework InitMemory for LibCv + * coechsler SEC-6446 Support Ed448 Signature generation and verification, support Ed25519 context mode + * SEC-6572 Use NvM defines for service identification + * 13.02.00 2023-07-31 coechsler SEC-6310 Support HMAC with SHA2-512 generation and verification + * SEC-6306 Support HKDF Expand SHA2-256 and SHA2-384 + * SEC-6683 Support IsKeyOnCurve for P160R1, P256R1, P384R1, P521R1 + * 13.03.00 2023-08-21 coechsler SEC-6734 Support IsKeyOnCurve for Ed25519 and Ed448 + * SEC-6768 Support ECBD KeyExchange based on P256R1 + * ESCAN00115701 Missing length check for AES GCM Decrypt Authentication Tag + * 13.04.00 2023-10-04 viskju HSM-4583 Support for secp521r1 Key Generation + * 13.04.01 2023-10-16 viskju ESCAN00115928 For ChaCha20-Poly1305-Crypto jobs in finish mode the outputLength is not updated + * 13.05.00 2023-10-27 coechsler CRY-418 Support ECDHE with x-coordinate shared secret only + * 13.05.01 2024-01-05 coechsler ESCAN00116209 Added length check of CRYPTO_KE_RANDOM_SEED_STATE in DRBG + * ESCAN00116431 Support ECBD with x-coordinate shared secret only + * 13.06.00 2024-01-16 coechsler CRY-58 Support SLH-DSA SHA2-128s Verify + * CRY-391 Support SM4 Cipher Encrypt/Decrypt + * CRY-389 Support SM3 Hash + * CRY-395 Support SM2 Signature Generate/Verify + * 14.00.00 2024-03-15 coechsler CRY-759 Support AES GCM variable tag length + * main-1 2024-03-25 coechsler CRY-462 Change history is maintained in the global ChangeHistory.txt file starting with this release. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_H) +# define CRYPTO_30_LIBCV_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Csm_Types.h" +# include "Crypto_30_LibCv_Cfg.h" +# include "Crypto_30_LibCv_KeyManagement.h" +# include "SchM_Crypto_30_LibCv.h" + +# include "Crypto_30_LibCv_Custom.h" + +# if (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_ON) +# include "vstdlib.h" +# endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Vendor and module identification */ +# define CRYPTO_30_LIBCV_VENDOR_ID (30u) +# define CRYPTO_30_LIBCV_MODULE_ID (114u) +# define CRYPTO_30_LIBCV_INSTANCE_ID (0u) + +/* AUTOSAR Software specification version information */ +# define CRYPTO_30_LIBCV_AR_RELEASE_MAJOR_VERSION (0x04u) +# define CRYPTO_30_LIBCV_AR_RELEASE_MINOR_VERSION (0x03u) +# define CRYPTO_30_LIBCV_AR_RELEASE_REVISION_VERSION (0x00u) + +/* Component version information (decimal version of ALM implementation package) */ +# define CRYPTO_30_LIBCV_SW_MAJOR_VERSION (14u) +# define CRYPTO_30_LIBCV_SW_MINOR_VERSION (9u) +# define CRYPTO_30_LIBCV_SW_PATCH_VERSION (4u) + +/* API service IDs */ +/* these Ids are used for DET, therefore only "services" which are not handled by ProcessJob (thus, are provided as APIs) + * have a define here. */ +# define CRYPTO_30_LIBCV_SID_INIT (0x00u) /*!< Service ID: Crypto_30_LibCv_Init() */ +# define CRYPTO_30_LIBCV_SID_GET_VERSION_INFO (0x01u) /*!< Service ID: Crypto_30_LibCv_GetVersionInfo() */ +# define CRYPTO_30_LIBCV_SID_PROCESS_JOB (0x03u) /*!< Service ID: Crypto_30_LibCv_ProcessJob() */ +# define CRYPTO_30_LIBCV_SID_KEY_ELEMENT_SET (0x04u) /*!< Service ID: Crypto_30_LibCv_KeyElementSet() */ +# define CRYPTO_30_LIBCV_SID_KEY_SET_VALID (0x05u) /*!< Service ID: Crypto_30_LibCv_KeySetValid() */ +# define CRYPTO_30_LIBCV_SID_KEY_ELEMENT_GET (0x06u) /*!< Service ID: Crypto_30_LibCv_KeyElementGet() */ +# define CRYPTO_30_LIBCV_SID_KEY_GENERATE (0x07u) /*!< Service ID: Crypto_30_LibCv_KeyGenerate() */ +# define CRYPTO_30_LIBCV_SID_KEY_DERIVE (0x08u) /*!< Service ID: Crypto_30_LibCv_KeyDerive() */ +# define CRYPTO_30_LIBCV_SID_KEY_EXCHANGE_CALC_PUB_VAL (0x09u) /*!< Service ID: Crypto_30_LibCv_KeyExchangeCalcPubVal() */ +# define CRYPTO_30_LIBCV_SID_KEY_EXCHANGE_CALC_SECRET (0x0Au) /*!< Service ID: Crypto_30_LibCv_KeyExchangeCalcSecret() */ +# define CRYPTO_30_LIBCV_SID_CERTIFICATE_PARSE (0x0Bu) /*!< Service ID: Crypto_30_LibCv_CertificateParse() */ /* not supported */ +# define CRYPTO_30_LIBCV_SID_MAIN_FUNCTION (0x0Cu) /*!< Service ID: Crypto_30_LibCv_MainFunction() */ +# define CRYPTO_30_LIBCV_SID_RANDOM_SEED (0x0Du) /*!< Service ID: Crypto_30_LibCv_RandomSeed() */ +# define CRYPTO_30_LIBCV_SID_CANCEL_JOB (0x0Eu) /*!< Service ID: Crypto_30_LibCv_CancelJob() */ +# define CRYPTO_30_LIBCV_SID_KEY_ELEMENT_COPY (0x0Fu) /*!< Service ID: Crypto_30_LibCv_KeyElementCopy() */ +# define CRYPTO_30_LIBCV_SID_KEY_COPY (0x10u) /*!< Service ID: Crypto_30_LibCv_KeyCopy() */ +# define CRYPTO_30_LIBCV_SID_KEY_ELEMENT_IDS_GET (0x11u) /*!< Service ID: Crypto_30_LibCv_KeyElementIdsGet() */ +# define CRYPTO_30_LIBCV_SID_CERTIFICATE_VERIFY (0x12u) /*!< Service ID: Crypto_30_LibCv_CertificateVerify() */ /* not supported */ +# define CRYPTO_30_LIBCV_SID_KEY_ELEMENT_COPY_PARTIAL (0x13u) /*!< Service ID: Crypto_30_LibCv_KeyElementCopyPartial() */ +# define CRYPTO_30_LIBCV_SID_KEY_GET_STATUS (0x14u) /*!< Service ID: Crypto_30_LibCv_KeyGetStatus() */ +# define CRYPTO_30_LIBCV_SID_KEY_SET_INVALID (0x15u) /*!< Service ID: Crypto_30_LibCv_KeySetInvalid() */ +# define CRYPTO_30_LIBCV_SID_NVBLOCK_READFROMBLOCK (0x80u) /*!< Service ID: Crypto_30_LibCv_NvBlock_ReadFromBlock() */ +# define CRYPTO_30_LIBCV_SID_NVBLOCK_WRITETOBLOCK (0x81u) /*!< Service ID: Crypto_30_LibCv_NvBlock_WriteToBlock() */ +# define CRYPTO_30_LIBCV_SID_NVBLOCK_INIT (0x82u) /*!< Service ID: Crypto_30_LibCv_NvBlock_Init() */ +# define CRYPTO_30_LIBCV_SID_NVBLOCK_CALLBACK (0x83u) /*!< Service ID: Crypto_30_LibCv_NvBlock_Callback() */ +# define CRYPTO_30_LIBCV_SID_ESL_GETBYTESRNG (0x84u) /*!< Service ID: esl_getBytesRNG() */ +# define CRYPTO_30_LIBCV_SID_KEY_VALID_SET (CRYPTO_30_LIBCV_SID_KEY_SET_VALID) /*!< Service ID: Crypto_30_LibCv_KeyValidSet() */ + +/* Modes */ +/* State: Uninitialized */ +# define CRYPTO_30_LIBCV_UNINIT (0x00u) +/* State: Initialized */ +# define CRYPTO_30_LIBCV_INITIALIZED (0x01u) + +/* Development Error Types [SWS_Crypto_00040] */ +# ifndef CRYPTO_E_NO_ERROR /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_NO_ERROR (255u) +# endif +# ifndef CRYPTO_E_UNINIT /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_UNINIT (0u) +# endif +# ifndef CRYPTO_E_INIT_FAILED /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_INIT_FAILED (1u) +# endif +# ifndef CRYPTO_E_PARAM_POINTER /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_PARAM_POINTER (2u) +# endif +# ifndef CRYPTO_E_PARAM_HANDLE /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_PARAM_HANDLE (4u) +# endif +# ifndef CRYPTO_E_PARAM_VALUE /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_PARAM_VALUE (5u) +# endif + +/* Crypto Stack Error Codes used from Autosar 4.4 */ +# ifndef CRYPTO_E_KEY_EMPTY /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_KEY_EMPTY (13u) +# endif + +/* Runtime Error Types [SWS_Crypto_00194] */ +# ifndef CRYPTO_E_RE_ENTROPY_EXHAUSTED /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_RE_ENTROPY_EXHAUSTED (3u) +# endif +# ifndef CRYPTO_E_RE_GET_BYTES_RNG_ERROR /* COV_CRYPTO_30_LIBCV_CSM_DEFINES */ +# define CRYPTO_E_RE_GET_BYTES_RNG_ERROR (30u) +# endif + +/* Data Services */ +# if (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_ON) +/* Use VStdLib */ +# define Crypto_30_LibCv_CopyData(destinationPtr, sourcePtr, length) (VStdLib_MemCpy((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(destinationPtr), (P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(sourcePtr), (VStdLib_CntType)(length))) +# define Crypto_30_LibCv_ClearData(dataPtr, length) (VStdLib_MemClr((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(dataPtr), (VStdLib_CntType)(length))) +# define Crypto_30_LibCv_SetData(dataPtr, pattern, length) (VStdLib_MemSet((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(dataPtr), (pattern), (VStdLib_CntType)(length))) +# else +/* Use internal implementation */ +# define Crypto_30_LibCv_CopyData(destinationPtr, sourcePtr, length) (Crypto_30_LibCv_Local_CopyData_Implementation((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(destinationPtr), (P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(sourcePtr), (length))) +# define Crypto_30_LibCv_ClearData(dataPtr, length) (Crypto_30_LibCv_Local_ClearData_Implementation((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(dataPtr), (length))) +# define Crypto_30_LibCv_SetData(dataPtr, pattern, length) (Crypto_30_LibCv_Local_SetData_Implementation((P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(dataPtr), (pattern), (length))) +# endif + +/* Watchdog Trigger Function */ +# if (CRYPTO_30_LIBCV_WATCHDOGTRIGGERFUNCTIONOFGENERAL == STD_ON) +# define CRYPTO_30_LIBCV_WATCHDOG_PTR Crypto_30_LibCv_GetWatchdogTriggerFunctionOfGeneral() +# else +# define CRYPTO_30_LIBCV_WATCHDOG_PTR (NULL_PTR) +# endif + +/* Macros for Job access */ +# ifndef CRYPTO_30_LIBCV_JOB_STATE_MEMBER /* COV_CRYPTO_30_LIBCV_ASR_COMPATIBILITY */ +# define CRYPTO_30_LIBCV_JOB_STATE_MEMBER jobState +# endif + +# ifndef CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER /* COV_CRYPTO_30_LIBCV_ASR_COMPATIBILITY */ +# define CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER jobPrimitiveInputOutput +# endif + +# ifndef CRYPTO_30_LIBCV_JOB_ID_MEMBER /* COV_CRYPTO_30_LIBCV_ASR_COMPATIBILITY */ +# define CRYPTO_30_LIBCV_JOB_ID_MEMBER jobId +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init() + *********************************************************************************************************************/ +/*! \brief Initializes the Crypto Driver + * \details This function initializes the module Crypto_30_LibCv. It initializes all variables relevant for the + * partition and sets the module state for the partition to initialized. It has to be called once from + * the main partition and also from each other partition where the module is used. + * \pre Interrupts are disabled. + * Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Specification of module initialization + * \trace DSGN-DrvCrypto_Libcv_Initialization + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init(void); + +# if (CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetVersionInfo() + *********************************************************************************************************************/ +/*! \brief Returns the version information + * \details Crypto_30_LibCv_GetVersionInfo() returns version information, vendor ID and AUTOSAR module ID of the component. + * \param[out] versioninfo Pointer to where to store the version information. Parameter must not be NULL. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \config CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON + * \trace CREQ-131329 + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetVersionInfo( + P2VAR(Std_VersionInfoType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) versioninfo); +# endif /* (CRYPTO_30_LIBCV_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_ProcessJob() + *********************************************************************************************************************/ +/*! \brief Processes the received job + * \details Performs the crypto primitive, that is configured in the job parameter. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * If multi-partition support is enabled, only the objectId which belongs to + * the calling partition is allowed to be used. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with job and + * primitive relevant information but also pointer to result buffers. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_QUEUE_FULL Request failed, the queue is full. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, the entropy is exhausted. + * CRYPTO_E_JOB_CANCELED The service request failed because the synchronous Job has been canceled. + * \pre - + * \context TASK + * \reentrant TRUE, for jobs with different job ids + * \synchronous TRUE|FALSE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ProcessJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_CancelJob() + *********************************************************************************************************************/ +/*! \brief Cancels the received job + * \details This interface removes the provided job from the queue and cancels the processing of the job if possible. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \return E_OK Request successful, job has been removed. + * E_NOT_OK Request failed, job could not be removed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CancelJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +# if(CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON) +/********************************************************************************************************************** + * Appl_Crypto_30_LibCv_SaveContextCallout() + *********************************************************************************************************************/ +/*! \brief Saves the context to the output buffer. + * \details The customer can choose whether the context data is to be written encrypted or in plain text + * to the output buffer. The outputLengthPtr must be set to the written length. + * The JobId and ObjectId can be used to check whether the data originates + * from the correct job and object. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] jobId Holds the identifier of the Job. + * \param[in] context Holds the Address of the source context data. + * \param[in] contextLength Holds the length of the source context. + * \param[out] outputPtr Pointer to output buffer + * \param[in,out] outputLengthPtr Pointer to output length buffer + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \config CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CRYPTO_30_LIBCV_APPL_CODE) Appl_Crypto_30_LibCv_SaveContextCallout( + uint32 objectId, + uint32 jobId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) context, + uint32 contextLength, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputLengthPtr); + +/********************************************************************************************************************** + * Appl_Crypto_30_LibCv_RestoreContextCallout() + *********************************************************************************************************************/ +/*! \brief Restores the context from the output buffer. + * \details The customer can choose to write the data encrypted or in plain text to the destination context address. + * The data shall only be copied if the plain context matches the contextLength. + * If the context data is encrypted, it must be decrypted first and then written to the workspace address. + * The JobId and ObjectId can be used to check whether the data originates from the correct job and object. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] jobId Holds the identifier of the Job. + * \param[out] context Holds the Address of the destination context data. + * \param[in] contextLength Holds the length of the destination context. + * \param[in] inputPtr Pointer to source input buffer. + * \param[in] inputLength Holds the input buffer length. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \config CRYPTO_30_LIBCV_SAVEANDRESTOREWORKSPACE == STD_ON + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CRYPTO_30_LIBCV_APPL_CODE) Appl_Crypto_30_LibCv_RestoreContextCallout( + uint32 objectId, + uint32 jobId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) context, + uint32 contextLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inputPtr, + uint32 inputLength); +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_MainFunction<_OS_APPLICATION>() + *********************************************************************************************************************/ +/*! \fn FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_MainFunction(void) + * \brief Main function of the module. Is called cyclically and handles asynchronous jobs. + * \details This interface process the provided asynchronous jobs from the queue. + * <_OS_APPLICATION> is only used if module is used by multiple partitions. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Declared and called by SchM. Due to long runtimes, it is advisable to map function to a preemptive task. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * esl_getBytesRNG() + *********************************************************************************************************************/ +/*! \fn VSECPRIM_FUNC(eslt_ErrorCode) esl_getBytesRNG( const eslt_Length targetLength, VSECPRIM_P2VAR_PARA(eslt_Byte) target); + * \brief Get random byte + * \details This function generates random numbers for primitives which requires random numbers for algorithm execution. + * \param[in] targetLength the number of bytes that shall be generated + * \param[in,out] target (in) pointer to output buffer + * (out) pointer to generated random bytes + * \return ESL_ERC_ERROR input generation failed + * ESL_ERC_NO_ERROR else + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \config CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*! + * \exclusivearea CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0 + * Ensures consistency of common global RAM variables. + * \protects Crypto_30_LibCv_Lock, Crypto_30_LibCv_LastJob, Crypto_30_LibCv_Queue, Crypto_30_LibCv_NvBlock_State, Crypto_30_LibCv_RandomSourceGenerateCount, Crypto_30_LibCv_KeyNvStatus + * \usedin Crypto_30_LibCv_MainFunction, Crypto_30_LibCv_ProcessJob, Crypto_30_LibCv_CancelJob, Crypto_30_LibCv_KeyValidSet, Crypto_30_LibCv_KeyElementSet, Crypto_30_LibCv_KeyElementCopy, Crypto_30_LibCv_KeyCopy, Crypto_30_LibCv_KeyExchangeCalcSecret, Crypto_30_LibCv_KeyExchangeCalcPub, Crypto_30_LibCv_KeyGenerate, Crypto_30_LibCv_KeyDerive, Crypto_30_LibCv_RandomGenerate, Crypto_30_LibCv_RandomSeed, esl_getBytesRNG, Crypto_30_LibCv_KeyGetStatus, Crypto_30_LibCv_NvBlock_Callback and Crypto_30_LibCv_NvBlock_WriteToBlock. + * \exclude All functions in which this exclusive area is used in. + * \length LONG in esl_getBytesRNG, SHORT in rest. + * \endexclusivearea + + * \exclusivearea CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1 + * Ensures consistency of global RAM variables used for key locking. + * \protects Crypto_30_LibCv_KeyLock + * \usedin Crypto_30_LibCv_MainFunction, Crypto_30_LibCv_ProcessJob, Crypto_30_LibCv_CancelJob, Crypto_30_LibCv_KeyExchangeCalcPubVal, Crypto_30_LibCv_KeyExchangeCalcSecret, Crypto_30_LibCv_KeyGenerate, Crypto_30_LibCv_KeyElementSet, Crypto_30_LibCv_KeyValidSet, Crypto_30_LibCv_KeyElementGet, Crypto_30_LibCv_KeyCopy, Crypto_30_LibCv_KeyElementCopy, Crypto_30_LibCv_KeyElementCopyPartial, Crypto_30_LibCv_KeyDerive, Crypto_30_LibCv_RandomSeed + * \exclude All functions in which this exclusive area is used in. + * \length MEDIUM as runtime depends on number of to be locked keys. + * \endexclusivearea + + * \exclusivearea CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2 + * Ensures consistency of global RAM variables used for the primitives Spake2+ and ECBD. + * \protects Crypto_30_LibCv_LongTermWsLock + * \usedin Crypto_30_LibCv_MainFunction, Crypto_30_LibCv_ProcessJob, Crypto_30_LibCv_KeyExchangeCalcPubVal, Crypto_30_LibCv_KeyExchangeCalcSecret + * \exclude All functions in which this exclusive area is used in. + * \length SHORT as only one operation is secured. + * \endexclusivearea + */ + +#endif /* CRYPTO_30_LIBCV_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Aead.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Aead.c new file mode 100644 index 0000000..e29067f --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Aead.c @@ -0,0 +1,1695 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Aead.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for AEAD Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_AEAD_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_AeadEncrypt.h" +#include "Crypto_30_LibCv_AeadDecrypt.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_AESGCM_MAX_OUT_SIZE (16u) +#define CRYPTO_30_LIBCV_AESCCM_MAX_OUT_SIZE (16u) + +#define CRYPTO_30_LIBCV_AES128CCM_KEY_SIZE (ESL_SIZEOF_AES128_KEY) +#define CRYPTO_30_LIBCV_AES256CCM_KEY_SIZE (ESL_SIZEOF_AES256_KEY) + +#define CRYPTO_30_LIBCV_CHACHA20POLY1305_KEY_LENGTH ESL_SIZEOF_ChaCha20_KEY +#define CRYPTO_30_LIBCV_CHACHA20POLY1305_NONCE_LENGTH ESL_SIZEOF_ChaCha20_NONCE +#define CRYPTO_30_LIBCV_POLY1305_OUT_SIZE ESL_SIZEOF_Poly1305_TAG + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmEncrypt start job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmEncrypt update job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmEncrypt finish job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +#endif /* (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmDecrypt start job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmDecrypt update job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmDecrypt finish job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmEncrypt start job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service + * by passing the workspace to Crypto_30_LibCv_Dispatch_AesCcm_Start. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmEncrypt update job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmEncrypt finish job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +#endif /* (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmDecrypt start job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * By passing a suitable workspace to Crypto_30_LibCv_Dispatch_AesCcm_Start + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmDecrypt update job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmDecrypt finish job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcm_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcm start job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] authenticationFieldSize Holds the length of authentication field size. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcm_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 authenticationFieldSize); +#endif /* ((CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON)) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode START. */ + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CIPHER_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CIPHER_IV); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_GCM, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initEncryptGCM(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode UPDATE. */ + + /* Update GCM Calculation */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* # Check if output size is sufficient otherwise return error. */ + if (((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength + (CRYPTO_30_LIBCV_AESGCM_MAX_OUT_SIZE - 1u)) & 0xFFFFFFF0u) > (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + retValCv = ESL_ERC_NO_ERROR; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if ((retValCv == ESL_ERC_NO_ERROR) && (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength != 0u)) + { + /* # Process authentic data. */ + retValCv = esl_updateAuthDataEncryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Process plaintext data. */ + retValCv = esl_updatePlaintextEncryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + } + + /* # Store current written length and remaining buffer length for operationmode FINISH. */ + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + /* Get outputLength in local variable to omit type mismatches */ + eslt_Length secondaryOutputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr); + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode FINISH. */ + /* # Reinitialize written length and remaining buffer if UPDATE was not part of this job. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + + /* # Check if output size is sufficient otherwise return error. */ + if (Crypto_30_LibCv_GetBufferLength(objectId) < CRYPTO_30_LIBCV_AESGCM_MAX_OUT_SIZE) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = Crypto_30_LibCv_GetWrittenLength(objectId); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Write results in output buffers. */ + retValCv = esl_finalizeEncryptGCMVariableTagLength(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)], + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&secondaryOutputLength); + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr = secondaryOutputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish() */ +#endif /* (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode START. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CIPHER_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CIPHER_IV); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_GCM, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initDecryptGCM(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode UPDATE. */ + /* Update GCM Calculation */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + /* # Check if output size is sufficient otherwise return error. */ + if (((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength + (CRYPTO_30_LIBCV_AESGCM_MAX_OUT_SIZE - 1u)) & 0xFFFFFFF0u) > (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + retValCv = ESL_ERC_NO_ERROR; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Process authentic data. */ + if ((retValCv == ESL_ERC_NO_ERROR) && (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength != 0u)) + { + retValCv = esl_updateAuthDataDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } + + /* # Process plaintext data. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + retValCv = esl_updateCiphertextDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + } + + /* # Store current written length and remaining buffer length for operationmode FINISH. */ + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Init verify result to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Handle operationmode FINISH. */ + /* # Reinitialize written length and remaining buffer if UPDATE was not part of this job. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + + /* # Check if output size is sufficient otherwise return error. */ + if (Crypto_30_LibCv_GetBufferLength(objectId) < CRYPTO_30_LIBCV_AESGCM_MAX_OUT_SIZE) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + retValCv = ESL_ERC_NO_ERROR; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = Crypto_30_LibCv_GetWrittenLength(objectId); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Write results in output buffers. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + retValCv = esl_finalizeDecryptGCMVariableTagLength(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)], + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputLength); + } + + /* # Check if verification was successful. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else if (retValCv == ESL_ERC_GCM_TAG_VERIFICATION_FAILED) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + /* For all other errors do nothing */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish() */ +#endif /* (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Call Crypto_30_LibCv_Dispatch_AesCcm_Start */ + retVal = Crypto_30_LibCv_Dispatch_AesCcm_Start( + workspace, + job, + (uint8)*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_ErrorCode retValCv; + eslt_Length outlength; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode UPDATE. */ + + /* Update CCM Calculation */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + outlength = (eslt_Length)*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr; + + /* # Process plaintext data. */ + retValCv = esl_updateAESCCMEncrypt(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outlength); + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outlength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Store current written length and remaining buffer length for operationmode FINISH. */ + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + /* buffer holding Auth Tag */ + eslt_Length outlength, secOutlength; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode FINISH. */ + outlength = (eslt_Length)Crypto_30_LibCv_GetBufferLength(objectId); + secOutlength = (eslt_Length)*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr; + + /* # Write results in output buffers. */ + retValCv = esl_finalizeAESCCMEncrypt(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)], + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outlength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&secOutlength); + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr += outlength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish() */ +#endif /* (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Call Crypto_30_LibCv_Dispatch_AesCcm_Start */ + retVal = Crypto_30_LibCv_Dispatch_AesCcm_Start( + workspace, + job, + (uint8)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_ErrorCode retValCv; + eslt_Length outlength; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode UPDATE. */ + /* Update CCM Calculation */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + outlength = (eslt_Length)*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr; + /* # Process plaintext data. */ + retValCv = esl_updateAESCCMDecrypt(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outlength); + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outlength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Store current written length and remaining buffer length for operationmode FINISH. */ + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_ErrorCode retValCv; + eslt_Length outlength; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode FINISH. */ + outlength = (eslt_Length)Crypto_30_LibCv_GetBufferLength(objectId); + + /* # Write results in output buffers. */ + retValCv = esl_finalizeAESCCMDecrypt(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)], + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outlength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputPtr); + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr += outlength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Check if verification was successful. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else if (retValCv == ESL_ERC_INCORRECT_TAG) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + /* For all other errors do nothing */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish() */ +#endif /* (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcm_Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcm_Start( + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint8 authenticationFieldSize) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Handle operationmode START. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CIPHER_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CIPHER_IV); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_AESCCM, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + eslt_Byte lengthFieldSize = (eslt_Byte)(CRYPTO_30_LIBCV_AESCCM_SUM_OF_NONCE_LENGTH_AND_L - keyElements[1u].keyElementLength); + eslt_Length keyLength = (eslt_Length) keyElements[0u].keyElementLength; + retVal = E_NOT_OK; + + /* # Check key length */ + if ((keyLength == CRYPTO_30_LIBCV_AES128CCM_KEY_SIZE) || (keyLength == CRYPTO_30_LIBCV_AES256CCM_KEY_SIZE)) + { + /* # Initialize algorithm. */ + retValCv = esl_initAESCCM(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + keyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (eslt_Byte)authenticationFieldSize, + lengthFieldSize); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + else + { + /* retVal has already been set before */ + } + + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcm_Start() */ +#endif /* ((CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON)) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesGcmEncrypt(Crypto_30_LibCv_GetAesGcmEncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceGCM)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Start(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Update(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmEncrypt_Finish(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmEncrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesGcmDecrypt(Crypto_30_LibCv_GetAesGcmDecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceGCM)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Start(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Update(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_AesGcmDecrypt_Finish(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesGcmDecrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesCcmEncrypt(Crypto_30_LibCv_GetAesCcmEncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceAESCCM)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Start(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Update(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmEncrypt_Finish(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmEncrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceAESCCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesCcmDecrypt(Crypto_30_LibCv_GetAesCcmDecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceAESCCM)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Start(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Update(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_AesCcmDecrypt_Finish(workspace, objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesCcmDecrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Encrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceChaChaPoly, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAEADChaChaPoly1305Encrypt(Crypto_30_LibCv_GetAEADChaChaPoly1305EncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceChaChaPoly)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_CIPHER_KEY, CRYPTO_30_LIBCV_CHACHA20POLY1305_KEY_LENGTH); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 1u, CRYPTO_KE_CIPHER_IV, CRYPTO_30_LIBCV_CHACHA20POLY1305_NONCE_LENGTH); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_AEAD_ChaCha_Poly, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initEncryptChaChaPoly(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex)); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + } + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Get output length in local variable to omit type mismatches */ + eslt_Length outputLength; + outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Check if output size is sufficient otherwise return error. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength) > (outputLength)) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + retValCv = ESL_ERC_NO_ERROR; + } + + if ((retValCv == ESL_ERC_NO_ERROR) && (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength != 0u)) + { + /* # Process authentic data. */ + retValCv = esl_updateAADChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Process plaintext data. */ + retValCv = esl_updateDataChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength); + + /* copy back written output length */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* buffer holding Auth Tag */ + uint8 authTagTempBuffer[CRYPTO_30_LIBCV_POLY1305_OUT_SIZE] = { 0u }; + + /* # For finish only mode, adapt output length */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + retValCv = esl_finalizeChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))authTagTempBuffer); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Adapt output size of auth tag. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr > CRYPTO_30_LIBCV_POLY1305_OUT_SIZE) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr = CRYPTO_30_LIBCV_POLY1305_OUT_SIZE; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Copy auth tag to output buffer. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, authTagTempBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Encrypt() */ +#endif /* (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Decrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030 4 */ /* MD_MSR_STCYC */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceChaChaPoly, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAEADChaChaPoly1305Decrypt(Crypto_30_LibCv_GetAEADChaChaPoly1305DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceChaChaPoly)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_CIPHER_KEY, CRYPTO_30_LIBCV_CHACHA20POLY1305_KEY_LENGTH); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 1u, CRYPTO_KE_CIPHER_IV, CRYPTO_30_LIBCV_CHACHA20POLY1305_NONCE_LENGTH); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_AEAD_ChaCha_Poly, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initDecryptChaChaPoly(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex)); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + } + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Get output length in local variable to omit type mismatches */ + eslt_Length outputLength; + outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Check if output size is sufficient otherwise return error. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength) > (outputLength)) + { + retValCv = ESL_ERC_OUTPUT_SIZE_TOO_SHORT; + } + else + { + retValCv = ESL_ERC_NO_ERROR; + } + + /* # Process authentic data. */ + if ((retValCv == ESL_ERC_NO_ERROR) && (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength != 0u)) + { + retValCv = esl_updateAADChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } + + /* # Process plaintext data. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + retValCv = esl_updateDataChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength); + + /* copy back written output length */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* # For finish only mode, adapt output length */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Check if output size is sufficient otherwise return error. */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputLength == CRYPTO_30_LIBCV_POLY1305_OUT_SIZE) + { + /* # Verify tag. */ + retValCv = esl_verifyChaChaPoly(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputPtr); + } + else + { + retValCv = ESL_ERC_INCORRECT_TAG; + } + + /* # Check if verification was successful. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else if (retValCv == ESL_ERC_INCORRECT_TAG) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + /* For all other errors do nothing */ + } + + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305DECRYPT == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Aead.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadDecrypt.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadDecrypt.h new file mode 100644 index 0000000..e1c34d1 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadDecrypt.h @@ -0,0 +1,132 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_AeadDecrypt.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for AEAD Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_AEADDECRYPT_H) +# define CRYPTO_30_LIBCV_AEADDECRYPT_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmDecrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmDecrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139103 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESGCMDECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmDecrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmDecrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-266237 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESCCMDECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AEAD ChaCha Poly1305 Decrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-251277 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305DECRYPT == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_AEADDECRYPT_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_AeadDecrypt.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadEncrypt.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadEncrypt.h new file mode 100644 index 0000000..3194f34 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AeadEncrypt.h @@ -0,0 +1,132 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_AeadEncrypt.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for AEAD Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_AEADENCRYPT_H) +# define CRYPTO_30_LIBCV_AEADENCRYPT_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesGcmEncrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesGcmEncrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139104 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesGcmEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESGCMENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesCcmEncrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesCcmEncrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-266236 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesCcmEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESCCMENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Encrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AEAD ChaCha Poly1305 Encrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-251276 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AEADChaChaPoly1305Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AEADCHACHAPOLY1305ENCRYPT == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_AEADENCRYPT_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_AeadEncrypt.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AutosarDefines.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AutosarDefines.h new file mode 100644 index 0000000..3d3161a --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_AutosarDefines.h @@ -0,0 +1,390 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_30_LibCv_AutosarDefines.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for fallback AUTOSAR definitions and necessary AUTOSAR definition checks. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_AUTOSARDEFINES_H) +# define CRYPTO_30_LIBCV_AUTOSARDEFINES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Algorithm type definitions are normally provided by Csm, here only as fallback */ +# ifndef CRYPTO_ALGOFAM_NOT_SET /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_NOT_SET 0x00u +# endif +# ifndef CRYPTO_ALGOFAM_SHA1 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA1 0x01u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_224 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_224 0x02u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_256 0x03u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_384 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_384 0x04u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_512 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512 0x05u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_512_224 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512_224 0x06u +# endif +# ifndef CRYPTO_ALGOFAM_SHA2_512_256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512_256 0x07u +# endif +# ifndef CRYPTO_ALGOFAM_SHA3_224 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_224 0x08u +# endif +# ifndef CRYPTO_ALGOFAM_SHA3_256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_256 0x09u +# endif +# ifndef CRYPTO_ALGOFAM_SHA3_384 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_384 0x0Au +# endif +# ifndef CRYPTO_ALGOFAM_SHA3_512 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_512 0x0Bu +# endif +# ifndef CRYPTO_ALGOFAM_SHAKE128 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHAKE128 0x0Cu +# endif +# ifndef CRYPTO_ALGOFAM_SHAKE256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHAKE256 0x0Du +# endif +# ifndef CRYPTO_ALGOFAM_RIPEMD160 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RIPEMD160 0x0Eu +# endif +# ifndef CRYPTO_ALGOFAM_BLAKE_1_256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_1_256 0x0Fu +# endif +# ifndef CRYPTO_ALGOFAM_BLAKE_1_512 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_1_512 0x10u +# endif +# ifndef CRYPTO_ALGOFAM_BLAKE_2s_256 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_2s_256 0x11u +# endif +# ifndef CRYPTO_ALGOFAM_BLAKE_2s_512 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_2s_512 0x12u +# endif +# ifndef CRYPTO_ALGOFAM_3DES /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_3DES 0x13u +# endif +# ifndef CRYPTO_ALGOFAM_AES /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_AES 0x14u +# endif +# ifndef CRYPTO_ALGOFAM_CHACHA /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_CHACHA 0x15u +# endif +# ifndef CRYPTO_ALGOFAM_RSA /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RSA 0x16u +# endif +# ifndef CRYPTO_ALGOFAM_ED25519 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ED25519 0x17u +# endif +# ifndef CRYPTO_ALGOFAM_BRAINPOOL /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BRAINPOOL 0x18u +# endif +# ifndef CRYPTO_ALGOFAM_ECCNIST /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCNIST 0x19u +# endif +# ifndef CRYPTO_ALGOFAM_SECURECOUNTER /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SECURECOUNTER 0x1Au +# endif +# ifndef CRYPTO_ALGOFAM_RNG /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RNG 0x1Bu +# endif +# ifndef CRYPTO_ALGOFAM_SIPHASH /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SIPHASH 0x1Cu +# endif +# ifndef CRYPTO_ALGOFAM_ECIES /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECIES 0x1Du +# endif +# ifndef CRYPTO_ALGOFAM_ECCANSI /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCANSI 0x1Eu +# endif +# ifndef CRYPTO_ALGOFAM_ECCSEC /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCSEC 0x1Fu +# endif +# ifndef CRYPTO_ALGOFAM_DRBG /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_DRBG 0x20u +# endif +# ifndef CRYPTO_ALGOFAM_FIPS186 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_FIPS186 0x21u +# endif +# ifndef CRYPTO_ALGOFAM_PADDING_PKCS7 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PADDING_PKCS7 0x22u +# endif +# ifndef CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS 0x23u +# endif +# ifndef CRYPTO_ALGOFAM_PBKDF2 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PBKDF2 0x24u +# endif +# ifndef CRYPTO_ALGOFAM_KDFX963 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_KDFX963 0x25u +# endif +# ifndef CRYPTO_ALGOFAM_DH /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_DH 0x26u +# endif +# ifndef CRYPTO_ALGOFAM_SM2 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SM2 0x27u +# endif +# ifndef CRYPTO_ALGOFAM_EEA3 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_EEA3 0x28u +# endif +# ifndef CRYPTO_ALGOFAM_SM3 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SM3 0x29u +# endif +# ifndef CRYPTO_ALGOFAM_EIA3 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_EIA3 0x2Au +# endif +# ifndef CRYPTO_ALGOFAM_HKDF /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_HKDF 0x2Bu +# endif +# ifndef CRYPTO_ALGOFAM_ECDSA /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECDSA 0x2Cu +# endif +# ifndef CRYPTO_ALGOFAM_POLY1305 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_POLY1305 0x2Du +# endif +# ifndef CRYPTO_ALGOFAM_X25519 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_X25519 0x2Eu +# endif +# ifndef CRYPTO_ALGOFAM_ECDH /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECDH 0x2Fu +# endif +# ifndef CRYPTO_ALGOFAM_CUSTOM /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOFAM_CUSTOM 0xFFu +# endif + +# ifndef CRYPTO_ALGOMODE_NOT_SET /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_NOT_SET 0x00u +# endif +# ifndef CRYPTO_ALGOMODE_ECB /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_ECB 0x01u +# endif +# ifndef CRYPTO_ALGOMODE_CBC /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CBC 0x02u +# endif +# ifndef CRYPTO_ALGOMODE_CFB /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CFB 0x03u +# endif +# ifndef CRYPTO_ALGOMODE_OFB /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_OFB 0x04u +# endif +# ifndef CRYPTO_ALGOMODE_CTR /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CTR 0x05u +# endif +# ifndef CRYPTO_ALGOMODE_XTS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_XTS 0x06u +# endif +# ifndef CRYPTO_ALGOMODE_GCM /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_GCM 0x07u +# endif +# ifndef CRYPTO_ALGOMODE_RSAES_OAEP /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSAES_OAEP 0x08u +# endif +# ifndef CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 0x09u +# endif +# ifndef CRYPTO_ALGOMODE_RSASSA_PSS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSASSA_PSS 0x0Au +# endif +# ifndef CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 0x0Bu +# endif +# ifndef CRYPTO_ALGOMODE_8ROUNDS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_8ROUNDS 0x0Cu +# endif +# ifndef CRYPTO_ALGOMODE_12ROUNDS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_12ROUNDS 0x0Du +# endif +# ifndef CRYPTO_ALGOMODE_20ROUNDS /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_20ROUNDS 0x0Eu +# endif +# ifndef CRYPTO_ALGOMODE_HMAC /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_HMAC 0x0Fu +# endif +# ifndef CRYPTO_ALGOMODE_CMAC /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CMAC 0x10u +# endif +# ifndef CRYPTO_ALGOMODE_GMAC /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_GMAC 0x11u +# endif +# ifndef CRYPTO_ALGOMODE_CTRDRBG /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CTRDRBG 0x12u +# endif +# ifndef CRYPTO_ALGOMODE_SIPHASH_2_4 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_SIPHASH_2_4 0x13u +# endif +# ifndef CRYPTO_ALGOMODE_SIPHASH_4_8 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_SIPHASH_4_8 0x14u +# endif +# ifndef CRYPTO_ALGOMODE_PXXXR1 /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_PXXXR1 0x15u +# endif +# ifndef CRYPTO_ALGOMODE_CUSTOM /* COV_CRYPTO_30_LIBCV_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CUSTOM 0xFFu +# endif + +/* Check Autosar defines for array access */ +/*! + * + * Internal comment removed. + * + * + */ +# if (CRYPTO_HASH != 0x00u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_MACGENERATE != 0x01u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_MACVERIFY != 0x02u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ENCRYPT != 0x03u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_DECRYPT != 0x04u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_AEADENCRYPT != 0x05u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_AEADDECRYPT != 0x06u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_SIGNATUREGENERATE != 0x07u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_SIGNATUREVERIFY != 0x08u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_RANDOMGENERATE != 0x0Bu) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_RANDOMSEED != 0x0Cu) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYGENERATE != 0x0Du) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYDERIVE != 0x0Eu) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYEXCHANGECALCPUBVAL != 0x0Fu) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYEXCHANGECALCSECRET != 0x10u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYSETVALID != 0x13u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYSETINVALID != 0x14u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYWRAP != 0x16u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_KEYUNWRAP != 0x17u) +# error "Define is not Autosar conform." +# endif + +/*! + * + * Internal comment removed. + * + * + */ +# if (CRYPTO_ALGOFAM_NOT_SET != 0u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA1 != 1u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_224 != 2u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_256 != 3u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_384 != 4u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_512 != 5u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_512_224 != 6u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA2_512_256 != 7u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA3_224 != 8u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA3_256 != 9u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA3_384 != 10u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHA3_512 != 11u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHAKE128 != 12u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_SHAKE256 != 13u) +# error "Define is not Autosar conform." +# endif +# if (CRYPTO_ALGOFAM_RIPEMD160 != 14u) +# error "Define is not Autosar conform." +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#endif /* CRYPTO_30_LIBCV_AUTOSARDEFINES_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_AutosarDefines.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Cipher.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Cipher.c new file mode 100644 index 0000000..49322ec --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Cipher.c @@ -0,0 +1,3018 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Cipher.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for CIPHER Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_CIPHER_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_Encrypt.h" +#include "Crypto_30_LibCv_Decrypt.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_AES128_KEY_LENGTH CRYPTO_30_LIBCV_AES_BLOCK_SIZE +#define CRYPTO_30_LIBCV_AES128_IV_LENGTH CRYPTO_30_LIBCV_AES_BLOCK_SIZE +#define CRYPTO_30_LIBCV_AES192_KEY_LENGTH (24u) +#define CRYPTO_30_LIBCV_AES192_IV_LENGTH CRYPTO_30_LIBCV_AES_BLOCK_SIZE +#define CRYPTO_30_LIBCV_AES256_KEY_LENGTH (32u) +#define CRYPTO_30_LIBCV_AES256_IV_LENGTH CRYPTO_30_LIBCV_AES_BLOCK_SIZE +#define CRYPTO_30_LIBCV_AES_MODE_128 (0u) +#define CRYPTO_30_LIBCV_AES_MODE_192 (1u) +#define CRYPTO_30_LIBCV_AES_MODE_256 (2u) + +/* SM4 defines */ +#define CRYPTO_30_LIBCV_SM4_KEY_LENGTH ESL_SIZEOF_SM4_BLOCK +#define CRYPTO_30_LIBCV_SM4_IV_LENGTH ESL_SIZEOF_SM4_BLOCK + +/* RSA decryption mode */ +/* normal mode */ +#define CRYPTO_30_LIBCV_RSA_DECRYPT_MODE_PRIVATE (0u) +/* inverse mode */ +#define CRYPTO_30_LIBCV_RSA_DECRYPT_MODE_PUBLIC (1u) + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if ((CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesKey() + *********************************************************************************************************************/ +/*! \brief Load AES key and iv. + * \details This function loads the AES key and iv and checks the AES key length. + * The iv is used as counter in CTR mode. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \param[out] keyIndexPtr Pointer to the key storage index which holds the key. + * \param[out] ivIndexPtr Pointer to the key storage index which holds the iv or counter, according to the aes-mode. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre all pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesKey( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) keyIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) ivIndexPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesPaddingMode() + *********************************************************************************************************************/ +/*! \brief Load AES padding mode. + * \details This function loads the AES padding mode. + * \param[in] secondaryAlgorithmFamilyOfJob secondary algorithm family of the job which shall be dispatched. + * \return AES paddingMode + * \pre all pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_PaddingMode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesPaddingMode( + Crypto_AlgorithmSecondaryFamilyType secondaryAlgorithmFamilyOfJob); +#endif + +#if (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptStart() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesEncrypt job for key sizes 128, 192 and 256 bit in operation mode start + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptStart( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptUpdate() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesEncrypt job for key sizes 128, 192 and 256 bit in operation mode update + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptUpdate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptFinish() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesEncrypt job for key sizes 128, 192 and 256 bit in operation mode finish + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +#endif /* (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm() + *********************************************************************************************************************/ +/*! \brief Inits the SM4 algorithm. + * \details Inits either encryption or decryption based on the job service. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \param[in] keyLength Length of the cipher key. + * \param[in] keyPtr Pointer to the cipher key. + * \param[in] blockMode Block mode of cipher algorithm, ESL_BM_CBC or ESL_BM_ECB. + * \param[in] ivLength Length of the initialization vector (IV) + * \param[in] ivPtr Pointer to the initialization vector + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid eslt_WorkSpaceSM4 workspace. + * keyPtr has to be valid. + * ivPtr has to be valid if blockMode is ESL_BM_CBC. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 keyLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) keyPtr, + eslt_BlockMode blockMode, + uint32 ivLength, + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ivPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherSm4 job in operation mode start to the lower layer. + * \details Loads necessary key elements and inits the SM4 algorithm. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key size is not correct. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid eslt_WorkSpaceSM4 workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Start( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherSm4 job in operation mode update to the lower layer. + * \details Encrypts/Decrypts the provided data using the SM4 algorithm. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid eslt_WorkSpaceSM4 workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Update( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherSm4 job in operation mode finish to the lower layer. + * \details Finalizes the SM4 encryption or decryption based on the job service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid eslt_WorkSpaceSM4 workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Finish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +#endif /* (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON || CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptStart() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesDecrypt job for key sizes 128, 192 and 256 bit in operation mode start + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptStart( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptUpdate() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesDecrypt job for key sizes 128, 192 and 256 bit in operation mode update + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptUpdate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptFinish() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesDecrypt job for key sizes 128, 192 and 256 bit in operation mode finish + * to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * workspace has to be a valid Crypto_30_LibCv_WorkSpaceAES workspace. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +#endif /* (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ENCRYPT_RSA == STD_ON) || (CRYPTO_30_LIBCV_DECRYPT_RSA == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsa_Finish() + *********************************************************************************************************************/ +/*! \brief Handle operation mode finish for Rsa cipher. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \pre job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsa_Finish( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ENCRYPT_RSA == STD_ON) || (CRYPTO_30_LIBCV_DECRYPT_RSA == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaPkcs1Decrypt job to the lower layer for operation mode start. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation start, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaDecrypt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaPkcs1Decrypt job to the lower layer for operation mode start. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation start, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid esLib workspace. + * objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaDecrypt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start() + *********************************************************************************************************************/ +/*! \brief Handle operation mode start for RsaOaep Encrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start( + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update() + *********************************************************************************************************************/ +/*! \brief Handle operation mode update for RsaOaep Encrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update( + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start() + *********************************************************************************************************************/ +/*! \brief Handle operation mode start for RsaOaep Decrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start( + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update() + *********************************************************************************************************************/ +/*! \brief Handle operation mode update for RsaOaep Decrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update( + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start() + *********************************************************************************************************************/ +/*! \brief Handle operation mode start for RsaOaep Crt Decrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start( + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update() + *********************************************************************************************************************/ +/*! \brief Handle operation mode update for RsaOaep Crt Decrypt Sha1 and Sha256. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in,out] workspace Holds the workspace of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] secondaryFamily Holds the secondary algorithm family. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre workspace has to be a valid esLib workspace. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update( + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily); +#endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if ((CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) || (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesKey( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) keyIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) ivIndexPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint32 aesKeyLength, aesIvLength; + Std_ReturnType retVal = E_NOT_OK, localRetVal; +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 != STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 != STD_ON)) + uint8 errorId = CRYPTO_E_NO_ERROR; +# endif + + /* ----- Implementation ------------------------------------------------- */ + /* Load key element from storage. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended(job->cryptoKeyId, CRYPTO_KE_CIPHER_KEY, keyIndexPtr, &aesKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE, CRYPTO_30_LIBCV_SHE_SERVICE_ENCRYPT_DECRYPT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* check the key length and differ algorithm */ + if (localRetVal == E_OK) + { + if (aesKeyLength == CRYPTO_30_LIBCV_AES128_KEY_LENGTH) + { + workspace->mode = CRYPTO_30_LIBCV_AES_MODE_128; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + aesIvLength = CRYPTO_30_LIBCV_AES128_IV_LENGTH; + } + else if (aesKeyLength == CRYPTO_30_LIBCV_AES192_KEY_LENGTH) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + workspace->mode = CRYPTO_30_LIBCV_AES_MODE_192; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + aesIvLength = CRYPTO_30_LIBCV_AES192_IV_LENGTH; +# else + errorId = CRYPTO_E_PARAM_HANDLE; + localRetVal = E_NOT_OK; +# endif + } + else if (aesKeyLength == CRYPTO_30_LIBCV_AES256_KEY_LENGTH) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + workspace->mode = CRYPTO_30_LIBCV_AES_MODE_256; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + aesIvLength = CRYPTO_30_LIBCV_AES256_IV_LENGTH; +# else + errorId = CRYPTO_E_PARAM_HANDLE; + localRetVal = E_NOT_OK; +# endif + + } + else + { + localRetVal = E_NOT_OK; + } + + if (localRetVal == E_OK) + { + /* Load iv for CBC or CTR mode, iv is used as counter in CTR mode */ + if ((job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CBC) + || (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CTR)) + { + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_CIPHER_IV, ivIndexPtr, &aesIvLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + else + { + retVal = E_OK; + } + } + } + else if (localRetVal == CRYPTO_E_KEY_NOT_VALID) + { + retVal = CRYPTO_E_KEY_NOT_VALID; + } + else + { + /* retVal is already set */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (((CRYPTO_30_LIBCV_ENABLE_AES192 != STD_ON)) || (CRYPTO_30_LIBCV_ENABLE_AES256 != STD_ON)) +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError(CRYPTO_30_LIBCV_MODULE_ID, CRYPTO_30_LIBCV_INSTANCE_ID, CRYPTO_30_LIBCV_SID_PROCESS_JOB, errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif +# endif + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesPaddingMode() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_PaddingMode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesPaddingMode( + Crypto_AlgorithmSecondaryFamilyType secondaryAlgorithmFamilyOfJob) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_PaddingMode paddingMode = ESL_PM_OFF; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Set AES padding mode from the primitive's secondary family. */ + if (secondaryAlgorithmFamilyOfJob == CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_PADDING_PKCS7) + { + /* esLib uses PKCS5 define for PKCS7 padding */ + paddingMode = ESL_PM_PKCS5; + } + else if (secondaryAlgorithmFamilyOfJob == CRYPTO_ALGOFAM_PADDING_PKCS7) + { + /* esLib uses PKCS5 define for PKCS7 padding */ + paddingMode = ESL_PM_PKCS5; + } + else if (secondaryAlgorithmFamilyOfJob == CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS) + { + /* esLib uses zero padding */ + paddingMode = ESL_PM_ONEWITHZEROES; + } + else /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Additional misra statement */ + } + + return paddingMode; +} /* Crypto_30_LibCv_DispatchCipherAesPaddingMode() */ +#endif /* AES decrypt and encrypt */ + +#if (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptStart( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_SizeOfKeyStorageType aesEncryptKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType aesEncryptIvIndex; + + eslt_BlockMode blockMode; + eslt_PaddingMode paddingMode = ESL_PM_OFF; + + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) aesEncryptIvPtr = NULL_PTR; + + /* ----- Implementation ------------------------------------------------- */ + + /* Init workspace variables */ + Crypto_30_LibCv_SetBufferLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* #15 Load key element from storage. */ + retVal = Crypto_30_LibCv_DispatchCipherAesKey(job, workspace, &aesEncryptKeyIndex, &aesEncryptIvIndex); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + /* #20 Set AES mode and padding mode. */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CBC) + { + blockMode = ESL_BM_CBC; + aesEncryptIvPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesEncryptIvIndex); + } + else if (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CTR) + { + blockMode = ESL_BM_CTR; + aesEncryptIvPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesEncryptIvIndex); + } + else + { + blockMode = ESL_BM_ECB; + } + + paddingMode = Crypto_30_LibCv_DispatchCipherAesPaddingMode(job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily); + + /* #25 Initialize algorithm with keys depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + if (esl_initWorkSpaceHeader(&workspace->wsAES.wsAES256.header, ESL_MAXSIZEOF_WS_AES256, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initEncryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesEncryptKeyIndex), + blockMode, + paddingMode, + aesEncryptIvPtr); + } + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + if (esl_initWorkSpaceHeader(&workspace->wsAES.wsAES192.header, ESL_MAXSIZEOF_WS_AES192, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initEncryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesEncryptKeyIndex), + blockMode, + paddingMode, + aesEncryptIvPtr); + } + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + if (esl_initWorkSpaceHeader(&workspace->wsAES.wsAES128.header, ESL_MAXSIZEOF_WS_AES128, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initEncryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesEncryptKeyIndex), + blockMode, + paddingMode, + aesEncryptIvPtr); + } + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesEncryptStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptUpdate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptUpdate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* Get output length in local variable to omit type mismatches */ + outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* #45 Process input data depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + retValCv = esl_encryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + retValCv = esl_encryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + retValCv = esl_encryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + /* copy back written output length */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesEncryptUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesEncryptFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesEncryptFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + /* #75 Reinitialize written length and remaining buffer if UPDATE was not part of this job. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + + /* Get output length in local variable to omit type mismatches */ + outputLength = (eslt_Length)(Crypto_30_LibCv_GetBufferLength(objectId)); + + /* #80 Write results in output buffers depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + retValCv = esl_finalizeEncryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + retValCv = esl_finalizeEncryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + retValCv = esl_finalizeEncryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* copy back written output length and add writtenLength */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength + Crypto_30_LibCv_GetWrittenLength(objectId); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesEncryptFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesEncrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesEncrypt(Crypto_30_LibCv_GetAesEncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceAES)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + retVal = Crypto_30_LibCv_DispatchCipherAesEncryptStart(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* #40 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = Crypto_30_LibCv_DispatchCipherAesEncryptUpdate(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_DispatchCipherAesEncryptFinish(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesEncrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6010, 6030 4 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptStart( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_SizeOfKeyStorageType aesDecryptKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType aesDecryptIvIndex; + + eslt_BlockMode blockMode; + eslt_PaddingMode paddingMode = ESL_PM_OFF; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) aesDecryptIvPtr = NULL_PTR; + + /* ----- Implementation ------------------------------------------------- */ + /* Init workspace variables */ + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* #15 Load key element from storage. */ + retVal = Crypto_30_LibCv_DispatchCipherAesKey(job, workspace, &aesDecryptKeyIndex, &aesDecryptIvIndex); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + /* #20 Set AES mode and padding mode. */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CBC) + { + blockMode = ESL_BM_CBC; + aesDecryptIvPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesDecryptIvIndex); + } + else if (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CTR) + { + blockMode = ESL_BM_CTR; + aesDecryptIvPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesDecryptIvIndex); + } + else + { + blockMode = ESL_BM_ECB; + } + + paddingMode = Crypto_30_LibCv_DispatchCipherAesPaddingMode(job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily); + + /* #25 Initialize algorithm with keys depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + if (esl_initWorkSpaceHeader(&(workspace->wsAES.wsAES256.header), ESL_MAXSIZEOF_WS_AES256, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initDecryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesDecryptKeyIndex), + blockMode, + paddingMode, + aesDecryptIvPtr); + } + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + if (esl_initWorkSpaceHeader(&(workspace->wsAES.wsAES192.header), ESL_MAXSIZEOF_WS_AES192, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initDecryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesDecryptKeyIndex), + blockMode, + paddingMode, + aesDecryptIvPtr); + } + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + if (esl_initWorkSpaceHeader(&(workspace->wsAES.wsAES128.header), ESL_MAXSIZEOF_WS_AES128, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retValCv = esl_initDecryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(aesDecryptKeyIndex), + blockMode, + paddingMode, + aesDecryptIvPtr); + } + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesDecryptStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptUpdate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptUpdate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + /* Get output length in local variable to omit type mismatches */ + outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* #45 Process input data depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + retValCv = esl_decryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + retValCv = esl_decryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + retValCv = esl_decryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) - outputLength); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetWrittenLength(objectId, outputLength); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* copy back written output length */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesDecryptUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherAesDecryptFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherAesDecryptFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + /* #75 Reinitialize written length and remaining buffer if UPDATE was not part of this job. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + + /* Get output length in local variable to omit type mismatches */ + outputLength = (eslt_Length)Crypto_30_LibCv_GetBufferLength(objectId); + + /* #80 Write results in output buffers depending on the key size: 256, 192 or 128 (default) bit. */ +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_256: + retValCv = esl_finalizeDecryptAES256(&workspace->wsAES.wsAES256, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) + case CRYPTO_30_LIBCV_AES_MODE_192: + retValCv = esl_finalizeDecryptAES192(&workspace->wsAES.wsAES192, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif /* (CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) */ + + default: + /* case CRYPTO_30_LIBCV_AES_MODE_128 */ +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + retValCv = esl_finalizeDecryptAES128(&workspace->wsAES.wsAES128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + +# if ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) + break; + } +# endif /* ((CRYPTO_30_LIBCV_ENABLE_AES192 == STD_ON) || (CRYPTO_30_LIBCV_ENABLE_AES256 == STD_ON)) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength + Crypto_30_LibCv_GetWrittenLength(objectId); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherAesDecryptFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesDecrypt() + **********************************************************************************************************************/ +/*! + * # + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(Crypto_30_LibCv_WorkSpaceAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfAesDecrypt(Crypto_30_LibCv_GetAesDecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceAES)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + retVal = Crypto_30_LibCv_DispatchCipherAesDecryptStart(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* #40 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = Crypto_30_LibCv_DispatchCipherAesDecryptUpdate(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_DispatchCipherAesDecryptFinish(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_AesDecrypt() */ +#endif /* (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON || CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 keyLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) keyPtr, + eslt_BlockMode blockMode, + uint32 ivLength, + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ivPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Init workspace header. */ + if ((esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_SM4, CRYPTO_30_LIBCV_WATCHDOG_PTR)) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* # Distinguish between ENCRYPT and DECRYPT based on job primitive service. */ + switch (job->jobPrimitiveInfo->primitiveInfo->service) + { +# if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) + case CRYPTO_ENCRYPT: + /* # Init SM4 Encrypt algorithm. */ + retValCv = esl_initEncryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + (eslt_Length)keyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr, + blockMode, + (eslt_Length)ivLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))ivPtr); + break; +# endif +# if (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) + case CRYPTO_DECRYPT: + /* # Init SM4 Decrypt algorithm. */ + retValCv = esl_initDecryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + (eslt_Length)keyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr, + blockMode, + (eslt_Length)ivLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))ivPtr); + break; +# endif + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Only ENCRYPT and DECRYPT supported */ + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Start() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Start( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_BlockMode blockMode = 0xFF; + + /* # Init stack variables for cipher key and initialization vector. */ + Crypto_30_LibCv_SizeOfKeyStorageType keyIndex = 0u; + uint32 keyLength = CRYPTO_30_LIBCV_SM4_KEY_LENGTH; + + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ivPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType ivIndex = 0u; + uint32 ivLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Set workspace lengths to zero. */ + Crypto_30_LibCv_SetBufferLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* # Load cipher key element from storage. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_CIPHER_KEY, &keyIndex, &keyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + retVal = E_NOT_OK; + + /* # Set SM4 mode and load IV key element if necessary. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CBC: + blockMode = ESL_BM_CBC; + + /* # If block mode CBC is used, load IV key element from storage. */ + ivLength = CRYPTO_30_LIBCV_SM4_IV_LENGTH; /* IV has to be as long as the cipher block size */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_CIPHER_IV, &ivIndex, &ivLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + ivPtr = Crypto_30_LibCv_GetAddrKeyStorage(ivIndex); + } + break; + + case CRYPTO_ALGOMODE_ECB: + blockMode = ESL_BM_ECB; + + /* # If block mode ECB is used, ivPtr remains NULL_PTR and ivLength remains 0u. */ + retVal = E_OK; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + if (retVal == E_OK) + { + /* # Init the SM4 algorithm with determined parameters. */ + retVal = Crypto_30_LibCv_DispatchCipherSm4Start_InitAlgorithm( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_KEYPTR_AND_LENGTH */ + job, workspace, + keyLength, Crypto_30_LibCv_GetAddrKeyStorage(keyIndex), + blockMode, + ivLength, ivPtr); + } + } + return retVal; +} /* Crypto_30_LibCv_DispatchCipherSm4Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Update( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + /* Copy output length in local variable to omit type mismatches. */ + outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Distinguish between ENCRYPT and DECRYPT based on job primitive service. */ + switch (job->jobPrimitiveInfo->primitiveInfo->service) + { +# if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) + case CRYPTO_ENCRYPT: + /* # Encrypt provided input data via SM4 Encrypt algorithm. */ + retValCv = esl_encryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif +# if (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) + case CRYPTO_DECRYPT: + /* # Decrypt provided input data via SM4 Encrypt algorithm. */ + retValCv = esl_decryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; +# endif + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Only ENCRYPT and DECRYPT supported */ + } + + /* Copy back written output length. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Update the workspace lengths based on the actual output data. */ + Crypto_30_LibCv_SetWrittenLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, Crypto_30_LibCv_GetBufferLength(objectId) - Crypto_30_LibCv_GetWrittenLength(objectId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else if (retValCv == ESL_ERC_OUTPUT_SIZE_TOO_SHORT) + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + else + { + /* retVal remains E_NOT_OK */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherSm4Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherSm4Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherSm4Finish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_Length outputLength = 0u; + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + /* # Reinitialize written length and remaining buffer if UPDATE was not part of this job. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_UPDATE) != CRYPTO_OPERATIONMODE_UPDATE) + { + Crypto_30_LibCv_SetWrittenLength(objectId, 0u); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + Crypto_30_LibCv_SetBufferLength(objectId, *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + + /* Copy output length in local variable to omit type mismatches. */ + outputLength = (eslt_Length)(Crypto_30_LibCv_GetBufferLength(objectId)); + + /* # Distinguish between ENCRYPT and DECRYPT based on job primitive service. */ + switch (job->jobPrimitiveInfo->primitiveInfo->service) + { +# if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) + case CRYPTO_ENCRYPT: + /* # Finalize SM4 Encrypt algorithm. */ + retValCv = esl_finalizeEncryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif +# if (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) + case CRYPTO_DECRYPT: + /* # Finalize SM4 Decrypt algorithm. */ + retValCv = esl_finalizeDecryptSM4(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[Crypto_30_LibCv_GetWrittenLength(objectId)]); + break; +# endif + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Only ENCRYPT and DECRYPT supported */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* Copy back written output length and add writtenLength */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength + Crypto_30_LibCv_GetWrittenLength(objectId); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else if (retValCv == ESL_ERC_OUTPUT_SIZE_TOO_SHORT) + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + else + { + /* retVal remains E_NOT_OK */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherSm4Finish() */ +#endif /*(CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON || CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON)*/ + +#if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm4Encrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm4Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSm4Encrypt(Crypto_30_LibCv_GetSm4EncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSM4)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + retVal = Crypto_30_LibCv_DispatchCipherSm4Start(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = Crypto_30_LibCv_DispatchCipherSm4Update(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_DispatchCipherSm4Finish(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm4Encrypt() */ +#endif /* (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm4Decrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm4Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSM4, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSm4Decrypt(Crypto_30_LibCv_GetSm4DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSM4)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + retVal = Crypto_30_LibCv_DispatchCipherSm4Start(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = Crypto_30_LibCv_DispatchCipherSm4Update(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_DispatchCipherSm4Finish(objectId, job, workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm4Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Encrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceRSAenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPkcs1Encrypt(Crypto_30_LibCv_GetRsaPkcs1EncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAenc)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* #15 Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_ENC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* #20 Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* #25 Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initEncryptRSA_V15(workspace, + /* Modulus */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + /* Public Exponent */ + (eslt_Length)keyElements[1u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + } + } + break; + } + + /* #40 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* #45 Update algorithm and save result. */ + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + /* #75 Copy Result to output PTR. */ + + retValCv = esl_encryptRSA_V15(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + break; + } + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = E_OK; + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Encrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaDecrypt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType retValKey; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* ----- Implementation ------------------------------------------------ */ + + /* # Handle operationmode START. */ + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Check if key element is accessible */ + /* # Read key elements. */ + retValKey = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retValKey == E_OK) + { + retValKey = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT, &keyElements[1u].keyElementIndex, &keyElements[1u].keyElementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # If private exponent is not available use check if decryption with public exponent is used. */ + if (retValKey == CRYPTO_E_KEY_NOT_AVAILABLE) + { + workspace->decryptionMode = CRYPTO_30_LIBCV_RSA_DECRYPT_MODE_PUBLIC; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retValKey = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT, &keyElements[1u].keyElementIndex, &keyElements[1u].keyElementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + else + { + workspace->decryptionMode = CRYPTO_30_LIBCV_RSA_DECRYPT_MODE_PRIVATE; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + } + + if (retValKey == CRYPTO_E_KEY_NOT_AVAILABLE) + { + retValKey = E_NOT_OK; + } + } + + if (retValKey == E_OK) + { + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->wsRsa.header), ESL_MAXSIZEOF_WS_RSA_DEC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + + /* # Initialize algorithm. */ + retValCv = esl_initDecryptRSA_V15(&(workspace->wsRsa), + /* Modulus */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + /* Private/Public Exponent */ + (eslt_Length)keyElements[1u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + } + } + else + { + retVal = retValKey; + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaDecrypt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_ErrorCode retValCv; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------ */ + /* # Handle operationmode UPDATE. */ + + /* # Update algorithm and save result. */ + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + /* # Copy Result to output PTR. */ + /* # If private exponent is not available use check if decryption with public exponent is used. */ + if(workspace->decryptionMode == CRYPTO_30_LIBCV_RSA_DECRYPT_MODE_PRIVATE) + { + retValCv = esl_decryptRSA_V15(&(workspace->wsRsa), + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + retValCv = esl_decryptPubRSA_V15(&(workspace->wsRsa), + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceRsaDecrypt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPkcs1Decrypt(Crypto_30_LibCv_GetRsaPkcs1DecryptIdxOfObjectInfo(objectId)); + + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceRsaDecrypt)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Start(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt_Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = E_OK; + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ENCRYPT_RSA == STD_ON) || (CRYPTO_30_LIBCV_DECRYPT_RSA == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsa_Finish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsa_Finish( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode == CRYPTO_OPERATIONMODE_FINISH) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } +} /* Crypto_30_LibCv_DispatchCipherRsa_Finish() */ +#endif /* (CRYPTO_30_LIBCV_ENCRYPT_RSA == STD_ON) || (CRYPTO_30_LIBCV_DECRYPT_RSA == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start( + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_OAEP_ENC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initEncryptRSASHA1_OAEP(workspace, + /* Modulus */ + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + /* Public Exponent */ + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initEncryptRSASHA256_OAEP(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + if (retValCv != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update( + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint32 labelLength = 0; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) labelPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType labelIndex; + boolean process = FALSE; + + /* # Update algorithm and save result. */ + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Check if label is available. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_LABEL, &labelIndex, &labelLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRetVal == E_OK) + { + labelPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(labelIndex); + process = TRUE; + } + else if (localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + process = TRUE; + } + else + { + retVal = localRetVal; + } + + if (process == TRUE) + { + + /* # Execute algorithm calculation. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_encryptRSASHA1_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_encryptRSASHA256_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha1Encrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha1Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepSha1Encrypt(Crypto_30_LibCv_GetRsaOaepSha1EncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAOAEPenc)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* #40 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepSha1Encrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha256Encrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha256Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSAOAEPenc, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepSha256Encrypt(Crypto_30_LibCv_GetRsaOaepSha256EncryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAOAEPenc)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* #40 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepEncrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepSha256Encrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start( + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_OAEP_DEC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm according to secondaryFamily. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initDecryptRSASHA1_OAEP(workspace, + /* Modulus */ + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + /* Private Exponent */ + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initDecryptRSASHA256_OAEP(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + if (retValCv != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update( + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint32 labelLength = 0; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) labelPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType labelIndex; + boolean process = FALSE; + + /* # Update algorithm and save result. */ + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Check if label is available. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_LABEL, &labelIndex, &labelLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRetVal == E_OK) + { + labelPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(labelIndex); + process = TRUE; + } + else if (localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + process = TRUE; + } + else + { + retVal = localRetVal; + } + + if (process == TRUE) + { + /* # Execute algorithm calculation. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_decryptRSASHA1_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS_AND_NULL_PTR */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_decryptRSASHA256_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS_AND_NULL_PTR */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepSha1Decrypt(Crypto_30_LibCv_GetRsaOaepSha1DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAOAEPdec)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSAOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepSha256Decrypt(Crypto_30_LibCv_GetRsaOaepSha256DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAOAEPdec)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepDecrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start( + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[5]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_CRT_OAEP_DEC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_PRIME_P); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PRIME_Q); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 2u, CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 3u, CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 4u, CRYPTO_KE_CUSTOM_RSA_INVERSE_QI); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 5u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initDecryptRSACRTSHA1_OAEP( + workspace, + /* Prime p */ + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + /* Prime q */ + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex), + /* Exponent dP */ + (eslt_Length)keyElements[2].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[2].keyElementIndex), + /* Exponent dQ */ + (eslt_Length)keyElements[3].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[3].keyElementIndex), + /* Inverse qInv */ + (eslt_Length)keyElements[4].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[4].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initDecryptRSACRTSHA256_OAEP( + workspace, + /* Prime p */ + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + /* Prime q */ + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex), + /* Exponent dP */ + (eslt_Length)keyElements[2].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[2].keyElementIndex), + /* Exponent dQ */ + (eslt_Length)keyElements[3].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[3].keyElementIndex), + /* Inverse qInv */ + (eslt_Length)keyElements[4].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[4].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + if (retValCv != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update( + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_AlgorithmSecondaryFamilyType secondaryFamily) +{ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint32 labelLength = 0; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) labelPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType labelIndex; + boolean process = FALSE; + + /* # Update algorithm and save result. */ + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Check if label is available. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_LABEL, &labelIndex, &labelLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRetVal == E_OK) + { + labelPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(labelIndex); + process = TRUE; + } + else if (localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + process = TRUE; + } + else + { + retVal = localRetVal; + } + + if (process == TRUE) + { + /* # Execute algorithm calculation. */ + switch (secondaryFamily) + { +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_decryptRSACRTSHA1_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS_AND_NULL_PTR */ + break; + } +# endif +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_decryptRSACRTSHA256_OAEP_Label(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) labelPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS_AND_NULL_PTR */ + break; + } +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) || (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepCrtSha1Decrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepCrtSha1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepCrtSha1Decrypt(Crypto_30_LibCv_GetRsaOaepCrtSha1DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSACRTOAEPdec)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepCrtSha1Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepCrtSha256Decrypt() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepCrtSha256Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + P2VAR(eslt_WorkSpaceRSACRTOAEPdec, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + workspace = Crypto_30_LibCv_GetWorkspaceOfRsaOaepCrtSha256Decrypt(Crypto_30_LibCv_GetRsaOaepCrtSha256DecryptIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSACRTOAEPdec)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Start(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchCipherRsaOaepCrtDecrypt_Update(workspace, job, secAlgoFam); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + Crypto_30_LibCv_DispatchCipherRsa_Finish(job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + retVal = E_OK; + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaOaepCrtSha256Decrypt() */ +#endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Cipher.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.c new file mode 100644 index 0000000..9d346d6 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.c @@ -0,0 +1,1474 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Curve.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal implementation file for curve parameters + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_CURVE_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "Crypto_30_LibCv_Curve.h" + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/**************************************************************************** + * + * This file contains: CURVE PARAMETER and additional informations + * generated by ECC_CreateGFPCurveInfos_ASN1 + * + * data objects: + * esl_EccDomain, esl_EccDomainExt, esl_EccSpeedUpExt + * + ***************************************************************************/ + +/* Empty curve vector START *********************************************************************************************/ +/* This vector is used to initialize pointers which shall point to the EC domain, the EC domain extension and + * the EC SpeedUp extension. If one of the regular curve parameters were used for this purpose, the corresponding + * arrays will always be used and therefore never be removed by the linker. + * Since this array does not start with the ASN1 sequence tag '0x30', the parser of the underlying crypto + * library will recognize these domains as invalid. + * Also, the length value (the second byte) is set to zero. + * Together, these two bytes form a valid ASN1 structure of tag and length 0 (and thus no content bytes). */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveEmptyDomain[2] = { 0u, 0u }; +/* Empty curve vector END ***********************************************************************************************/ + +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +/* SEC_p160r1 START *************************************************************************************************/ +/* The curve params in shorthand notation: + * Name: "SECGp160r1", + * p: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF", + * a: "0XFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC", + * b: "0X1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45", + * Gx: "0X4A96B5688EF573284664698968C38BB913CBFC82", + * Gy: "0X23A628553168947D59DCC912042351377AC5FB32", + * n: "0X100000000000000000001F4C8F927AED3CA752257", + * h: "0x1", + */ +#if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1Domain[155] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x98u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x20u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x15u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x14u, 0x1cu, 0x97u, 0xbeu, 0xfcu, 0x54u, 0xbdu, 0x7au, 0x8bu, 0x65u, 0xacu, 0xf8u, 0x9fu, 0x81u, 0xd4u, 0xd4u, 0xadu, 0xc5u, 0x65u, 0xfau, 0x45u, + /* G (basepoint of the curve) */ + 0x04u, 0x29u, 0x04u, 0x4au, 0x96u, 0xb5u, 0x68u, 0x8eu, 0xf5u, 0x73u, 0x28u, 0x46u, 0x64u, 0x69u, 0x89u, 0x68u, 0xc3u, 0x8bu, 0xb9u, 0x13u, 0xcbu, 0xfcu, 0x82u, 0x23u, 0xa6u, 0x28u, 0x55u, 0x31u, 0x68u, 0x94u, 0x7du, 0x59u, 0xdcu, 0xc9u, 0x12u, 0x04u, 0x23u, 0x51u, 0x37u, 0x7au, 0xc5u, 0xfbu, 0x32u, + /* n (order of G) */ + 0x02u, 0x15u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0xf4u, 0xc8u, 0xf9u, 0x27u, 0xaeu, 0xd3u, 0xcau, 0x75u, 0x22u, 0x57u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[147] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x90u, + /* SEQUENCE */ + 0x30u, 0x72u, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x14u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x40u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x14u, 0x46u, 0xf6u, 0x7cu, 0x42u, 0x07u, 0x93u, 0xf6u, 0xdbu, 0x26u, 0x97u, 0x62u, 0xf6u, 0x6bu, 0xadu, 0xc1u, 0x8fu, 0x53u, 0xb1u, 0xd9u, 0xc3u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x29u, 0x04u, 0x92u, 0x11u, 0x6eu, 0xfcu, 0xb2u, 0x27u, 0xa7u, 0xecu, 0xfau, 0xc6u, 0x2fu, 0x66u, 0x05u, 0x4fu, 0x37u, 0x54u, 0x39u, 0x17u, 0x57u, 0x36u, 0xbcu, 0x5au, 0x72u, 0x93u, 0xdeu, 0x56u, 0xf9u, 0x06u, 0x5bu, 0xeeu, 0x71u, 0xadu, 0xcau, 0x6fu, 0xd8u, 0xe5u, 0x8cu, 0x99u, 0x0fu, 0x5cu, + /* SEQUENCE */ + 0x30u, 0x1au, + /* n_RR (R^2 in order field) */ + 0x04u, 0x15u, 0x00u, 0xabu, 0x09u, 0x43u, 0x6au, 0xb2u, 0x04u, 0xa0u, 0xe6u, 0x26u, 0x84u, 0xc9u, 0x2cu, 0x7bu, 0xaau, 0xd1u, 0xb0u, 0xf3u, 0x93u, 0xb2u, 0x49u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x01u, 0x99u, +}; + +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1SpeedUpExt[355] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x5fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x58u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xa1u, 0x29u, 0x00u, 0x19u, 0x67u, 0x48u, 0xc7u, 0x48u, 0x89u, 0x82u, 0x8du, 0x41u, 0xdcu, 0x95u, 0xd7u, 0xd2u, 0x6au, 0x71u, 0x32u, 0x7fu, 0x94u, 0x98u, 0x6du, 0x17u, 0xeau, 0x30u, 0xd4u, 0xa8u, 0x54u, 0xf6u, 0x5du, 0x38u, 0x1cu, 0xecu, 0xdcu, 0xfau, 0x76u, 0x3au, 0x4bu, 0x0du, + /* (2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x25u, 0xfcu, 0x2fu, 0x27u, 0xf5u, 0x1cu, 0x2au, 0xadu, 0xa3u, 0xceu, 0x1fu, 0x41u, 0xefu, 0x06u, 0x99u, 0xd7u, 0x69u, 0x03u, 0xeeu, 0xd9u, 0x79u, 0x51u, 0xdeu, 0xfcu, 0x19u, 0xaeu, 0xe1u, 0xd9u, 0xc9u, 0xf0u, 0x18u, 0xc4u, 0x02u, 0x2eu, 0xbbu, 0x4eu, 0x0eu, 0x9eu, 0xaeu, 0x84u, + /* (2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xe7u, 0xbfu, 0x07u, 0x2du, 0xb4u, 0x5du, 0x88u, 0x4au, 0x29u, 0x69u, 0x97u, 0x77u, 0xb1u, 0xceu, 0xbau, 0xe2u, 0xb8u, 0x76u, 0xaeu, 0x32u, 0x22u, 0x34u, 0x45u, 0x0au, 0x8au, 0x69u, 0x30u, 0xcbu, 0xcfu, 0xa6u, 0x7cu, 0xe6u, 0x50u, 0xb3u, 0x3cu, 0xadu, 0x43u, 0x1du, 0xb1u, 0x4fu, + /* (2^108 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x35u, 0x63u, 0x29u, 0xc6u, 0xa6u, 0xe7u, 0xb3u, 0x6eu, 0x51u, 0xefu, 0xe3u, 0x5du, 0xe5u, 0x2bu, 0x0du, 0x03u, 0x0bu, 0x1bu, 0x53u, 0x67u, 0x13u, 0xe0u, 0xbau, 0x88u, 0x37u, 0xffu, 0xc0u, 0x5du, 0x06u, 0xfeu, 0x3du, 0x1du, 0xa4u, 0x83u, 0x9au, 0x6au, 0x04u, 0xa3u, 0xe6u, 0x85u, + /* (2^108 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xd4u, 0xd8u, 0x7cu, 0x90u, 0xc7u, 0x2bu, 0x0eu, 0x2eu, 0x56u, 0x73u, 0xc8u, 0x69u, 0x67u, 0xa2u, 0x28u, 0x2bu, 0x20u, 0x3fu, 0x96u, 0x30u, 0x8eu, 0xa8u, 0x06u, 0xb8u, 0xc8u, 0xecu, 0xbau, 0x42u, 0xa1u, 0xacu, 0x51u, 0x03u, 0xf0u, 0x59u, 0xc2u, 0xcfu, 0xddu, 0xdfu, 0xdeu, 0x40u, + /* (2^108 + 2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8eu, 0x62u, 0x41u, 0x4bu, 0x47u, 0x53u, 0x93u, 0xbbu, 0x20u, 0x70u, 0x01u, 0x8du, 0x63u, 0xedu, 0x63u, 0x7fu, 0x40u, 0xd1u, 0xecu, 0xf6u, 0x34u, 0x85u, 0xb9u, 0x62u, 0xfdu, 0x6au, 0x93u, 0x29u, 0x29u, 0xfeu, 0x95u, 0x42u, 0x85u, 0x1bu, 0x65u, 0xd9u, 0x42u, 0x0au, 0xc0u, 0x41u, + /* (2^108 + 2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8au, 0x73u, 0xfeu, 0x9fu, 0x5cu, 0x23u, 0xdcu, 0xf4u, 0x52u, 0x78u, 0x77u, 0x72u, 0x81u, 0xa7u, 0x55u, 0xdbu, 0xbfu, 0x77u, 0xc3u, 0x17u, 0x5cu, 0x80u, 0xf5u, 0x5du, 0x1cu, 0xbeu, 0xb3u, 0x42u, 0x3au, 0x1fu, 0x42u, 0xc4u, 0x96u, 0xd5u, 0xdbu, 0xc3u, 0x03u, 0x7du, 0x17u, 0x43u, + /* correction point D = - ((2^54 - 1) * G) in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x19u, 0x86u, 0x73u, 0x2eu, 0x8eu, 0x3eu, 0x13u, 0x39u, 0x81u, 0x01u, 0x3bu, 0xbcu, 0xd7u, 0x52u, 0x20u, 0x46u, 0x64u, 0xb8u, 0xa9u, 0xb3u, 0x96u, 0x28u, 0x5eu, 0xf2u, 0x3au, 0xa0u, 0xd2u, 0xebu, 0xe2u, 0x17u, 0x6fu, 0xcbu, 0xabu, 0x60u, 0xc1u, 0xdbu, 0xe0u, 0x59u, 0xe5u, 0x5cu, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1Domain[155] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x98u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x20u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x15u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x14u, 0x1cu, 0x97u, 0xbeu, 0xfcu, 0x54u, 0xbdu, 0x7au, 0x8bu, 0x65u, 0xacu, 0xf8u, 0x9fu, 0x81u, 0xd4u, 0xd4u, 0xadu, 0xc5u, 0x65u, 0xfau, 0x45u, + /* G (basepoint of the curve) */ + 0x04u, 0x29u, 0x04u, 0x4au, 0x96u, 0xb5u, 0x68u, 0x8eu, 0xf5u, 0x73u, 0x28u, 0x46u, 0x64u, 0x69u, 0x89u, 0x68u, 0xc3u, 0x8bu, 0xb9u, 0x13u, 0xcbu, 0xfcu, 0x82u, 0x23u, 0xa6u, 0x28u, 0x55u, 0x31u, 0x68u, 0x94u, 0x7du, 0x59u, 0xdcu, 0xc9u, 0x12u, 0x04u, 0x23u, 0x51u, 0x37u, 0x7au, 0xc5u, 0xfbu, 0x32u, + /* n (order of G) */ + 0x02u, 0x15u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0xf4u, 0xc8u, 0xf9u, 0x27u, 0xaeu, 0xd3u, 0xcau, 0x75u, 0x22u, 0x57u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[149] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x92u, + /* SEQUENCE */ + 0x30u, 0x73u, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x14u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x40u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x02u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x14u, 0x46u, 0xf6u, 0x7cu, 0x42u, 0x07u, 0x93u, 0xf6u, 0xdbu, 0x26u, 0x97u, 0x62u, 0xf6u, 0x6bu, 0xadu, 0xc1u, 0x8fu, 0x53u, 0xb1u, 0xd9u, 0xc3u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x29u, 0x04u, 0x92u, 0x11u, 0x6eu, 0xfcu, 0xb2u, 0x27u, 0xa7u, 0xecu, 0xfau, 0xc6u, 0x2fu, 0x66u, 0x05u, 0x4fu, 0x37u, 0x54u, 0x39u, 0x17u, 0x57u, 0x36u, 0xbcu, 0x5au, 0x72u, 0x93u, 0xdeu, 0x56u, 0xf9u, 0x06u, 0x5bu, 0xeeu, 0x71u, 0xadu, 0xcau, 0x6fu, 0xd8u, 0xe5u, 0x8cu, 0x99u, 0x0fu, 0x5cu, + /* SEQUENCE */ + 0x30u, 0x1bu, + /* n_RR (R^2 in order field) */ + 0x04u, 0x15u, 0x00u, 0x43u, 0x6au, 0xb2u, 0x04u, 0xa0u, 0xe6u, 0x26u, 0x83u, 0x7au, 0x98u, 0xa2u, 0x2cu, 0x8du, 0x84u, 0x55u, 0xe5u, 0x56u, 0x3au, 0xadu, 0xf1u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x02u, 0x16u, 0x99u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1SpeedUpExt[355] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x5fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x58u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xa1u, 0x29u, 0x00u, 0x19u, 0x67u, 0x48u, 0xc7u, 0x48u, 0x89u, 0x82u, 0x8du, 0x41u, 0xdcu, 0x95u, 0xd7u, 0xd2u, 0x6au, 0x71u, 0x32u, 0x7fu, 0x94u, 0x98u, 0x6du, 0x17u, 0xeau, 0x30u, 0xd4u, 0xa8u, 0x54u, 0xf6u, 0x5du, 0x38u, 0x1cu, 0xecu, 0xdcu, 0xfau, 0x76u, 0x3au, 0x4bu, 0x0du, + /* (2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x25u, 0xfcu, 0x2fu, 0x27u, 0xf5u, 0x1cu, 0x2au, 0xadu, 0xa3u, 0xceu, 0x1fu, 0x41u, 0xefu, 0x06u, 0x99u, 0xd7u, 0x69u, 0x03u, 0xeeu, 0xd9u, 0x79u, 0x51u, 0xdeu, 0xfcu, 0x19u, 0xaeu, 0xe1u, 0xd9u, 0xc9u, 0xf0u, 0x18u, 0xc4u, 0x02u, 0x2eu, 0xbbu, 0x4eu, 0x0eu, 0x9eu, 0xaeu, 0x84u, + /* (2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xe7u, 0xbfu, 0x07u, 0x2du, 0xb4u, 0x5du, 0x88u, 0x4au, 0x29u, 0x69u, 0x97u, 0x77u, 0xb1u, 0xceu, 0xbau, 0xe2u, 0xb8u, 0x76u, 0xaeu, 0x32u, 0x22u, 0x34u, 0x45u, 0x0au, 0x8au, 0x69u, 0x30u, 0xcbu, 0xcfu, 0xa6u, 0x7cu, 0xe6u, 0x50u, 0xb3u, 0x3cu, 0xadu, 0x43u, 0x1du, 0xb1u, 0x4fu, + /* (2^108 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x35u, 0x63u, 0x29u, 0xc6u, 0xa6u, 0xe7u, 0xb3u, 0x6eu, 0x51u, 0xefu, 0xe3u, 0x5du, 0xe5u, 0x2bu, 0x0du, 0x03u, 0x0bu, 0x1bu, 0x53u, 0x67u, 0x13u, 0xe0u, 0xbau, 0x88u, 0x37u, 0xffu, 0xc0u, 0x5du, 0x06u, 0xfeu, 0x3du, 0x1du, 0xa4u, 0x83u, 0x9au, 0x6au, 0x04u, 0xa3u, 0xe6u, 0x85u, + /* (2^108 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xd4u, 0xd8u, 0x7cu, 0x90u, 0xc7u, 0x2bu, 0x0eu, 0x2eu, 0x56u, 0x73u, 0xc8u, 0x69u, 0x67u, 0xa2u, 0x28u, 0x2bu, 0x20u, 0x3fu, 0x96u, 0x30u, 0x8eu, 0xa8u, 0x06u, 0xb8u, 0xc8u, 0xecu, 0xbau, 0x42u, 0xa1u, 0xacu, 0x51u, 0x03u, 0xf0u, 0x59u, 0xc2u, 0xcfu, 0xddu, 0xdfu, 0xdeu, 0x40u, + /* (2^108 + 2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8eu, 0x62u, 0x41u, 0x4bu, 0x47u, 0x53u, 0x93u, 0xbbu, 0x20u, 0x70u, 0x01u, 0x8du, 0x63u, 0xedu, 0x63u, 0x7fu, 0x40u, 0xd1u, 0xecu, 0xf6u, 0x34u, 0x85u, 0xb9u, 0x62u, 0xfdu, 0x6au, 0x93u, 0x29u, 0x29u, 0xfeu, 0x95u, 0x42u, 0x85u, 0x1bu, 0x65u, 0xd9u, 0x42u, 0x0au, 0xc0u, 0x41u, + /* (2^108 + 2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8au, 0x73u, 0xfeu, 0x9fu, 0x5cu, 0x23u, 0xdcu, 0xf4u, 0x52u, 0x78u, 0x77u, 0x72u, 0x81u, 0xa7u, 0x55u, 0xdbu, 0xbfu, 0x77u, 0xc3u, 0x17u, 0x5cu, 0x80u, 0xf5u, 0x5du, 0x1cu, 0xbeu, 0xb3u, 0x42u, 0x3au, 0x1fu, 0x42u, 0xc4u, 0x96u, 0xd5u, 0xdbu, 0xc3u, 0x03u, 0x7du, 0x17u, 0x43u, + /* correction point D = - ((2^54 - 1) * G) in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x19u, 0x86u, 0x73u, 0x2eu, 0x8eu, 0x3eu, 0x13u, 0x39u, 0x81u, 0x01u, 0x3bu, 0xbcu, 0xd7u, 0x52u, 0x20u, 0x46u, 0x64u, 0xb8u, 0xa9u, 0xb3u, 0x96u, 0x28u, 0x5eu, 0xf2u, 0x3au, 0xa0u, 0xd2u, 0xebu, 0xe2u, 0x17u, 0x6fu, 0xcbu, 0xabu, 0x60u, 0xc1u, 0xdbu, 0xe0u, 0x59u, 0xe5u, 0x5cu, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1Domain[155] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x98u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x20u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x15u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x7fu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x14u, 0x1cu, 0x97u, 0xbeu, 0xfcu, 0x54u, 0xbdu, 0x7au, 0x8bu, 0x65u, 0xacu, 0xf8u, 0x9fu, 0x81u, 0xd4u, 0xd4u, 0xadu, 0xc5u, 0x65u, 0xfau, 0x45u, + /* G (basepoint of the curve) */ + 0x04u, 0x29u, 0x04u, 0x4au, 0x96u, 0xb5u, 0x68u, 0x8eu, 0xf5u, 0x73u, 0x28u, 0x46u, 0x64u, 0x69u, 0x89u, 0x68u, 0xc3u, 0x8bu, 0xb9u, 0x13u, 0xcbu, 0xfcu, 0x82u, 0x23u, 0xa6u, 0x28u, 0x55u, 0x31u, 0x68u, 0x94u, 0x7du, 0x59u, 0xdcu, 0xc9u, 0x12u, 0x04u, 0x23u, 0x51u, 0x37u, 0x7au, 0xc5u, 0xfbu, 0x32u, + /* n (order of G) */ + 0x02u, 0x15u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0xf4u, 0xc8u, 0xf9u, 0x27u, 0xaeu, 0xd3u, 0xcau, 0x75u, 0x22u, 0x57u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[153] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0x96u, + /* SEQUENCE */ + 0x30u, 0x75u, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x14u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x40u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x04u, 0x80u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x14u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x14u, 0x46u, 0xf6u, 0x7cu, 0x42u, 0x07u, 0x93u, 0xf6u, 0xdbu, 0x26u, 0x97u, 0x62u, 0xf6u, 0x6bu, 0xadu, 0xc1u, 0x8fu, 0x53u, 0xb1u, 0xd9u, 0xc3u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x29u, 0x04u, 0x92u, 0x11u, 0x6eu, 0xfcu, 0xb2u, 0x27u, 0xa7u, 0xecu, 0xfau, 0xc6u, 0x2fu, 0x66u, 0x05u, 0x4fu, 0x37u, 0x54u, 0x39u, 0x17u, 0x57u, 0x36u, 0xbcu, 0x5au, 0x72u, 0x93u, 0xdeu, 0x56u, 0xf9u, 0x06u, 0x5bu, 0xeeu, 0x71u, 0xadu, 0xcau, 0x6fu, 0xd8u, 0xe5u, 0x8cu, 0x99u, 0x0fu, 0x5cu, + /* SEQUENCE */ + 0x30u, 0x1du, + /* n_RR (R^2 in order field) */ + 0x04u, 0x15u, 0x00u, 0xa0u, 0xe6u, 0x26u, 0x83u, 0x7au, 0x98u, 0x1eu, 0x4bu, 0x3cu, 0xdcu, 0x38u, 0x54u, 0x08u, 0x5eu, 0x33u, 0x5fu, 0x67u, 0x44u, 0xf8u, 0xa4u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x04u, 0x30u, 0x6du, 0x16u, 0x99u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1SpeedUpExt[355] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x5fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x58u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xa1u, 0x29u, 0x00u, 0x19u, 0x67u, 0x48u, 0xc7u, 0x48u, 0x89u, 0x82u, 0x8du, 0x41u, 0xdcu, 0x95u, 0xd7u, 0xd2u, 0x6au, 0x71u, 0x32u, 0x7fu, 0x94u, 0x98u, 0x6du, 0x17u, 0xeau, 0x30u, 0xd4u, 0xa8u, 0x54u, 0xf6u, 0x5du, 0x38u, 0x1cu, 0xecu, 0xdcu, 0xfau, 0x76u, 0x3au, 0x4bu, 0x0du, + /* (2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x25u, 0xfcu, 0x2fu, 0x27u, 0xf5u, 0x1cu, 0x2au, 0xadu, 0xa3u, 0xceu, 0x1fu, 0x41u, 0xefu, 0x06u, 0x99u, 0xd7u, 0x69u, 0x03u, 0xeeu, 0xd9u, 0x79u, 0x51u, 0xdeu, 0xfcu, 0x19u, 0xaeu, 0xe1u, 0xd9u, 0xc9u, 0xf0u, 0x18u, 0xc4u, 0x02u, 0x2eu, 0xbbu, 0x4eu, 0x0eu, 0x9eu, 0xaeu, 0x84u, + /* (2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xe7u, 0xbfu, 0x07u, 0x2du, 0xb4u, 0x5du, 0x88u, 0x4au, 0x29u, 0x69u, 0x97u, 0x77u, 0xb1u, 0xceu, 0xbau, 0xe2u, 0xb8u, 0x76u, 0xaeu, 0x32u, 0x22u, 0x34u, 0x45u, 0x0au, 0x8au, 0x69u, 0x30u, 0xcbu, 0xcfu, 0xa6u, 0x7cu, 0xe6u, 0x50u, 0xb3u, 0x3cu, 0xadu, 0x43u, 0x1du, 0xb1u, 0x4fu, + /* (2^108 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x35u, 0x63u, 0x29u, 0xc6u, 0xa6u, 0xe7u, 0xb3u, 0x6eu, 0x51u, 0xefu, 0xe3u, 0x5du, 0xe5u, 0x2bu, 0x0du, 0x03u, 0x0bu, 0x1bu, 0x53u, 0x67u, 0x13u, 0xe0u, 0xbau, 0x88u, 0x37u, 0xffu, 0xc0u, 0x5du, 0x06u, 0xfeu, 0x3du, 0x1du, 0xa4u, 0x83u, 0x9au, 0x6au, 0x04u, 0xa3u, 0xe6u, 0x85u, + /* (2^108 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0xd4u, 0xd8u, 0x7cu, 0x90u, 0xc7u, 0x2bu, 0x0eu, 0x2eu, 0x56u, 0x73u, 0xc8u, 0x69u, 0x67u, 0xa2u, 0x28u, 0x2bu, 0x20u, 0x3fu, 0x96u, 0x30u, 0x8eu, 0xa8u, 0x06u, 0xb8u, 0xc8u, 0xecu, 0xbau, 0x42u, 0xa1u, 0xacu, 0x51u, 0x03u, 0xf0u, 0x59u, 0xc2u, 0xcfu, 0xddu, 0xdfu, 0xdeu, 0x40u, + /* (2^108 + 2^54 + 1) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8eu, 0x62u, 0x41u, 0x4bu, 0x47u, 0x53u, 0x93u, 0xbbu, 0x20u, 0x70u, 0x01u, 0x8du, 0x63u, 0xedu, 0x63u, 0x7fu, 0x40u, 0xd1u, 0xecu, 0xf6u, 0x34u, 0x85u, 0xb9u, 0x62u, 0xfdu, 0x6au, 0x93u, 0x29u, 0x29u, 0xfeu, 0x95u, 0x42u, 0x85u, 0x1bu, 0x65u, 0xd9u, 0x42u, 0x0au, 0xc0u, 0x41u, + /* (2^108 + 2^54 + 2) * G in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x8au, 0x73u, 0xfeu, 0x9fu, 0x5cu, 0x23u, 0xdcu, 0xf4u, 0x52u, 0x78u, 0x77u, 0x72u, 0x81u, 0xa7u, 0x55u, 0xdbu, 0xbfu, 0x77u, 0xc3u, 0x17u, 0x5cu, 0x80u, 0xf5u, 0x5du, 0x1cu, 0xbeu, 0xb3u, 0x42u, 0x3au, 0x1fu, 0x42u, 0xc4u, 0x96u, 0xd5u, 0xdbu, 0xc3u, 0x03u, 0x7du, 0x17u, 0x43u, + /* correction point D = - ((2^54 - 1) * G) in Montgomery representation */ + 0x04u, 0x29u, 0x04u, 0x19u, 0x86u, 0x73u, 0x2eu, 0x8eu, 0x3eu, 0x13u, 0x39u, 0x81u, 0x01u, 0x3bu, 0xbcu, 0xd7u, 0x52u, 0x20u, 0x46u, 0x64u, 0xb8u, 0xa9u, 0xb3u, 0x96u, 0x28u, 0x5eu, 0xf2u, 0x3au, 0xa0u, 0xd2u, 0xebu, 0xe2u, 0x17u, 0x6fu, 0xcbu, 0xabu, 0x60u, 0xc1u, 0xdbu, 0xe0u, 0x59u, 0xe5u, 0x5cu, +}; +#else /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +# error "Value of CRYPTO_30_LIBCV_BYTES_PER_DIGIT is not supported" +#endif /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +/* SEC_p160r1 END ****************************************************************************************************/ + +/* NIST_SEC_p224r1 START *********************************************************************************************/ +/* NISTp224r1 = SECp224r1 */ +/* The curve params in shorthand notation: + * Name: SECGp224r1 + * p: 0xffffffffffffffffffffffffffffffff000000000000000000000001 + * a: 0xfffffffffffffffffffffffffffffffefffffffffffffffffffffffe + * b: 0xb4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4 + * Gx: 0xb70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21 + * Gy: 0xbd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34 + * n: 0xffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d + * h: 0x1 + */ + +#if (actBN_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1Domain[203] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc8u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x28u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x1cu, 0xb4u, 0x05u, 0x0au, 0x85u, 0x0cu, 0x04u, 0xb3u, 0xabu, 0xf5u, 0x41u, 0x32u, 0x56u, 0x50u, 0x44u, 0xb0u, 0xb7u, 0xd7u, 0xbfu, 0xd8u, 0xbau, 0x27u, 0x0bu, 0x39u, 0x43u, 0x23u, 0x55u, 0xffu, 0xb4u, + /* G (basepoint of the curve) */ + 0x04u, 0x39u, 0x04u, 0xb7u, 0x0eu, 0x0cu, 0xbdu, 0x6bu, 0xb4u, 0xbfu, 0x7fu, 0x32u, 0x13u, 0x90u, 0xb9u, 0x4au, 0x03u, 0xc1u, 0xd3u, 0x56u, 0xc2u, 0x11u, 0x22u, 0x34u, 0x32u, 0x80u, 0xd6u, 0x11u, 0x5cu, 0x1du, 0x21u, 0xbdu, 0x37u, 0x63u, 0x88u, 0xb5u, 0xf7u, 0x23u, 0xfbu, 0x4cu, 0x22u, 0xdfu, 0xe6u, 0xcdu, 0x43u, 0x75u, 0xa0u, 0x5au, 0x07u, 0x47u, 0x64u, 0x44u, 0xd5u, 0x81u, 0x99u, 0x85u, 0x00u, 0x7eu, 0x34u, + /* n (order of G) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x16u, 0xa2u, 0xe0u, 0xb8u, 0xf0u, 0x3eu, 0x13u, 0xddu, 0x29u, 0x45u, 0x5cu, 0x5cu, 0x2au, 0x3du, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[195] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc0u, + /* SEQUENCE */ + 0x30u, 0x81u, 0x9au, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x1cu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x01u, 0xffu, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x04u, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x1cu, 0x9cu, 0x3fu, 0xa6u, 0x33u, 0x7fu, 0xc0u, 0x2fu, 0x93u, 0x3du, 0xceu, 0xbau, 0x98u, 0xc8u, 0x52u, 0x81u, 0x50u, 0x74u, 0x3bu, 0x1cu, 0xc0u, 0xccu, 0xf0u, 0x13u, 0x10u, 0xe7u, 0x68u, 0xcdu, 0xf7u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x39u, 0x04u, 0x92u, 0xf5u, 0xb5u, 0x16u, 0xa2u, 0x1bu, 0x5eu, 0x60u, 0x6du, 0xd3u, 0xafu, 0x9bu, 0xf9u, 0x6bu, 0xecu, 0x04u, 0xf2u, 0x2fu, 0xe2u, 0x20u, 0x60u, 0x18u, 0xbfu, 0xaau, 0xbcu, 0x90u, 0x52u, 0x27u, 0x10u, 0x0cu, 0x12u, 0x18u, 0x61u, 0x47u, 0x86u, 0xf1u, 0xaeu, 0xa9u, 0xc5u, 0xaeu, 0x03u, 0xdfu, 0xe8u, 0x78u, 0xe8u, 0xc1u, 0x55u, 0x13u, 0x05u, 0x33u, 0x5au, 0x6bu, 0x2eu, 0xdcu, 0xa1u, 0xe6u, + /* SEQUENCE */ + 0x30u, 0x21u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x1cu, 0xd4u, 0xbau, 0xa4u, 0xcfu, 0x18u, 0x22u, 0xbcu, 0x47u, 0xb1u, 0xe9u, 0x79u, 0x61u, 0x6au, 0xd0u, 0x9du, 0x91u, 0x97u, 0xa5u, 0x45u, 0x52u, 0x6bu, 0xdau, 0xaeu, 0x6cu, 0x3au, 0xd0u, 0x12u, 0x89u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x01u, 0xebu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt[483] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xdfu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xd8u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x18u, 0xddu, 0x00u, 0xacu, 0xcau, 0xfbu, 0x50u, 0xf5u, 0x10u, 0xc9u, 0x11u, 0xf7u, 0x2au, 0x0fu, 0x16u, 0x89u, 0xbeu, 0x27u, 0xf7u, 0xa3u, 0x56u, 0x50u, 0xdfu, 0x9bu, 0x4cu, 0xa9u, 0xa1u, 0xedu, 0x6au, 0x5du, 0xb1u, 0xa2u, 0x5cu, 0xabu, 0xb8u, 0x80u, 0x0cu, 0x84u, 0xceu, 0xd0u, 0x76u, 0xccu, 0x10u, 0x19u, 0xe7u, 0x2eu, 0x60u, 0x0fu, 0xc9u, 0x0au, 0xe1u, 0x86u, 0x02u, 0xaau, 0xc7u, 0x9cu, + /* (2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x7du, 0xdfu, 0xbau, 0xa5u, 0x30u, 0x42u, 0x21u, 0xfcu, 0x33u, 0x50u, 0xe8u, 0x78u, 0x22u, 0x92u, 0xffu, 0x62u, 0x7eu, 0xc1u, 0x30u, 0x50u, 0x71u, 0x1fu, 0xceu, 0x8du, 0xf0u, 0x6du, 0x61u, 0x1du, 0x68u, 0x65u, 0xb8u, 0xd4u, 0x02u, 0x1du, 0x49u, 0x5du, 0xbau, 0x4du, 0xe4u, 0x4du, 0x41u, 0x02u, 0xe4u, 0xe3u, 0x09u, 0xb2u, 0xabu, 0x6fu, 0x4du, 0x42u, 0xadu, 0xaau, 0xc5u, 0xecu, 0x6du, 0x9cu, + /* (2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x84u, 0xb4u, 0x25u, 0xe8u, 0x77u, 0xd5u, 0x72u, 0x90u, 0xd6u, 0x97u, 0x56u, 0xdeu, 0xd1u, 0x42u, 0x49u, 0x43u, 0x57u, 0xd7u, 0xbbu, 0x8bu, 0x2cu, 0xe1u, 0xb4u, 0x90u, 0xabu, 0xf3u, 0x8cu, 0x1fu, 0x1au, 0x97u, 0x11u, 0xdeu, 0xfdu, 0xe3u, 0x23u, 0xabu, 0xa9u, 0x21u, 0x64u, 0x5au, 0x3bu, 0xa7u, 0x2fu, 0x33u, 0x0au, 0x7eu, 0x07u, 0x76u, 0x16u, 0x44u, 0xffu, 0xe5u, 0x7eu, 0x92u, 0xd0u, 0x9du, + /* (2^150 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x9du, 0x5cu, 0x98u, 0xa9u, 0x42u, 0xcfu, 0xb8u, 0x3cu, 0x41u, 0x6cu, 0x64u, 0x5au, 0xc0u, 0x63u, 0x2du, 0x43u, 0xd3u, 0xb7u, 0xc7u, 0x33u, 0xc6u, 0xe7u, 0x1du, 0x41u, 0x00u, 0x67u, 0xbfu, 0x54u, 0x1eu, 0xebu, 0x3fu, 0x8cu, 0xb7u, 0x1fu, 0xd5u, 0xddu, 0xc3u, 0xf3u, 0x48u, 0xa1u, 0x7eu, 0x81u, 0x8fu, 0xe0u, 0x8du, 0x72u, 0x23u, 0xb3u, 0xdfu, 0xddu, 0x55u, 0xf2u, 0x24u, 0xccu, 0x79u, 0xe3u, + /* (2^150 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xf5u, 0xb8u, 0xcau, 0x58u, 0x85u, 0xa6u, 0xa6u, 0xebu, 0xd9u, 0x28u, 0x9cu, 0x74u, 0xfau, 0x2au, 0x53u, 0x1fu, 0xd7u, 0x9au, 0x88u, 0x5eu, 0x15u, 0xd9u, 0x6eu, 0xc3u, 0x8fu, 0x63u, 0x9cu, 0xf3u, 0xfbu, 0x20u, 0x0cu, 0xe2u, 0x4cu, 0x5cu, 0xe6u, 0xa1u, 0xd9u, 0xfau, 0xd8u, 0xe5u, 0x63u, 0x1fu, 0xa0u, 0x04u, 0x0bu, 0x0fu, 0xd1u, 0xeeu, 0xdfu, 0xffu, 0xb5u, 0x17u, 0x96u, 0x7au, 0xfdu, 0xfcu, + /* (2^150 + 2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x34u, 0x7bu, 0xbcu, 0x79u, 0x1cu, 0xf6u, 0x1bu, 0xdfu, 0x7fu, 0x96u, 0xb5u, 0x5fu, 0x7eu, 0xabu, 0x4au, 0x0au, 0xa0u, 0x98u, 0xbau, 0xfbu, 0xdfu, 0x89u, 0x19u, 0x33u, 0xf5u, 0x45u, 0xe4u, 0xddu, 0xe0u, 0x57u, 0xe1u, 0xcau, 0xecu, 0x54u, 0x6eu, 0xd2u, 0x2du, 0x74u, 0xc2u, 0x3eu, 0x1fu, 0x2au, 0x61u, 0x4fu, 0x38u, 0x6du, 0x8cu, 0x37u, 0x19u, 0x39u, 0xa2u, 0x3eu, 0x12u, 0x38u, 0x73u, 0x43u, + /* (2^150 + 2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x99u, 0x12u, 0x11u, 0xc0u, 0xf8u, 0x74u, 0xb0u, 0x93u, 0xb7u, 0xa8u, 0xe3u, 0xceu, 0x9du, 0x60u, 0xb0u, 0xedu, 0xd9u, 0xbcu, 0x5eu, 0x28u, 0xdcu, 0xb0u, 0xb0u, 0xb8u, 0x0cu, 0xe9u, 0xeeu, 0xd8u, 0xb6u, 0xd0u, 0x53u, 0x98u, 0x1au, 0x4du, 0x50u, 0x75u, 0xe7u, 0xf0u, 0x7du, 0x12u, 0x44u, 0x79u, 0x53u, 0x26u, 0x81u, 0x52u, 0x5au, 0x94u, 0x9au, 0x00u, 0xd6u, 0xd4u, 0x53u, 0x89u, 0x2bu, 0xbdu, + /* correction point D = - ((2^75 - 1) * G) in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xafu, 0x18u, 0x1au, 0xe7u, 0x7cu, 0xc3u, 0xe9u, 0x18u, 0x71u, 0x5bu, 0x80u, 0x6eu, 0x41u, 0x32u, 0x20u, 0x05u, 0xd7u, 0xfau, 0x89u, 0x1du, 0xbcu, 0xc7u, 0xa3u, 0x56u, 0x67u, 0x32u, 0xb0u, 0xdfu, 0x24u, 0x9au, 0x58u, 0xfeu, 0x10u, 0xa2u, 0x0du, 0x6bu, 0x7fu, 0xa9u, 0xc4u, 0xd7u, 0xbau, 0x4cu, 0x3eu, 0x36u, 0x66u, 0x22u, 0xfau, 0x0du, 0xedu, 0xf1u, 0x46u, 0x69u, 0xd5u, 0xc2u, 0x44u, 0xedu, +}; + +#elif (actBN_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1Domain[203] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc8u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x28u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x1cu, 0xb4u, 0x05u, 0x0au, 0x85u, 0x0cu, 0x04u, 0xb3u, 0xabu, 0xf5u, 0x41u, 0x32u, 0x56u, 0x50u, 0x44u, 0xb0u, 0xb7u, 0xd7u, 0xbfu, 0xd8u, 0xbau, 0x27u, 0x0bu, 0x39u, 0x43u, 0x23u, 0x55u, 0xffu, 0xb4u, + /* G (basepoint of the curve) */ + 0x04u, 0x39u, 0x04u, 0xb7u, 0x0eu, 0x0cu, 0xbdu, 0x6bu, 0xb4u, 0xbfu, 0x7fu, 0x32u, 0x13u, 0x90u, 0xb9u, 0x4au, 0x03u, 0xc1u, 0xd3u, 0x56u, 0xc2u, 0x11u, 0x22u, 0x34u, 0x32u, 0x80u, 0xd6u, 0x11u, 0x5cu, 0x1du, 0x21u, 0xbdu, 0x37u, 0x63u, 0x88u, 0xb5u, 0xf7u, 0x23u, 0xfbu, 0x4cu, 0x22u, 0xdfu, 0xe6u, 0xcdu, 0x43u, 0x75u, 0xa0u, 0x5au, 0x07u, 0x47u, 0x64u, 0x44u, 0xd5u, 0x81u, 0x99u, 0x85u, 0x00u, 0x7eu, 0x34u, + /* n (order of G) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x16u, 0xa2u, 0xe0u, 0xb8u, 0xf0u, 0x3eu, 0x13u, 0xddu, 0x29u, 0x45u, 0x5cu, 0x5cu, 0x2au, 0x3du, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[197] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc2u, + /* SEQUENCE */ + 0x30u, 0x81u, 0x9bu, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x1cu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x02u, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x04u, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x1cu, 0x9cu, 0x3fu, 0xa6u, 0x33u, 0x7fu, 0xc0u, 0x2fu, 0x93u, 0x3du, 0xceu, 0xbau, 0x98u, 0xc8u, 0x52u, 0x81u, 0x50u, 0x74u, 0x3bu, 0x1cu, 0xc0u, 0xccu, 0xf0u, 0x13u, 0x10u, 0xe7u, 0x68u, 0xcdu, 0xf7u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x39u, 0x04u, 0x92u, 0xf5u, 0xb5u, 0x16u, 0xa2u, 0x1bu, 0x5eu, 0x60u, 0x6du, 0xd3u, 0xafu, 0x9bu, 0xf9u, 0x6bu, 0xecu, 0x04u, 0xf2u, 0x2fu, 0xe2u, 0x20u, 0x60u, 0x18u, 0xbfu, 0xaau, 0xbcu, 0x90u, 0x52u, 0x27u, 0x10u, 0x0cu, 0x12u, 0x18u, 0x61u, 0x47u, 0x86u, 0xf1u, 0xaeu, 0xa9u, 0xc5u, 0xaeu, 0x03u, 0xdfu, 0xe8u, 0x78u, 0xe8u, 0xc1u, 0x55u, 0x13u, 0x05u, 0x33u, 0x5au, 0x6bu, 0x2eu, 0xdcu, 0xa1u, 0xe6u, + /* SEQUENCE */ + 0x30u, 0x22u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x1cu, 0xd4u, 0xbau, 0xa4u, 0xcfu, 0x18u, 0x22u, 0xbcu, 0x47u, 0xb1u, 0xe9u, 0x79u, 0x61u, 0x6au, 0xd0u, 0x9du, 0x91u, 0x97u, 0xa5u, 0x45u, 0x52u, 0x6bu, 0xdau, 0xaeu, 0x6cu, 0x3au, 0xd0u, 0x12u, 0x89u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x02u, 0xc2u, 0xebu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt[483] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xdfu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xd8u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x18u, 0xddu, 0x00u, 0xacu, 0xcau, 0xfbu, 0x50u, 0xf5u, 0x10u, 0xc9u, 0x11u, 0xf7u, 0x2au, 0x0fu, 0x16u, 0x89u, 0xbeu, 0x27u, 0xf7u, 0xa3u, 0x56u, 0x50u, 0xdfu, 0x9bu, 0x4cu, 0xa9u, 0xa1u, 0xedu, 0x6au, 0x5du, 0xb1u, 0xa2u, 0x5cu, 0xabu, 0xb8u, 0x80u, 0x0cu, 0x84u, 0xceu, 0xd0u, 0x76u, 0xccu, 0x10u, 0x19u, 0xe7u, 0x2eu, 0x60u, 0x0fu, 0xc9u, 0x0au, 0xe1u, 0x86u, 0x02u, 0xaau, 0xc7u, 0x9cu, + /* (2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x7du, 0xdfu, 0xbau, 0xa5u, 0x30u, 0x42u, 0x21u, 0xfcu, 0x33u, 0x50u, 0xe8u, 0x78u, 0x22u, 0x92u, 0xffu, 0x62u, 0x7eu, 0xc1u, 0x30u, 0x50u, 0x71u, 0x1fu, 0xceu, 0x8du, 0xf0u, 0x6du, 0x61u, 0x1du, 0x68u, 0x65u, 0xb8u, 0xd4u, 0x02u, 0x1du, 0x49u, 0x5du, 0xbau, 0x4du, 0xe4u, 0x4du, 0x41u, 0x02u, 0xe4u, 0xe3u, 0x09u, 0xb2u, 0xabu, 0x6fu, 0x4du, 0x42u, 0xadu, 0xaau, 0xc5u, 0xecu, 0x6du, 0x9cu, + /* (2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x84u, 0xb4u, 0x25u, 0xe8u, 0x77u, 0xd5u, 0x72u, 0x90u, 0xd6u, 0x97u, 0x56u, 0xdeu, 0xd1u, 0x42u, 0x49u, 0x43u, 0x57u, 0xd7u, 0xbbu, 0x8bu, 0x2cu, 0xe1u, 0xb4u, 0x90u, 0xabu, 0xf3u, 0x8cu, 0x1fu, 0x1au, 0x97u, 0x11u, 0xdeu, 0xfdu, 0xe3u, 0x23u, 0xabu, 0xa9u, 0x21u, 0x64u, 0x5au, 0x3bu, 0xa7u, 0x2fu, 0x33u, 0x0au, 0x7eu, 0x07u, 0x76u, 0x16u, 0x44u, 0xffu, 0xe5u, 0x7eu, 0x92u, 0xd0u, 0x9du, + /* (2^150 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x9du, 0x5cu, 0x98u, 0xa9u, 0x42u, 0xcfu, 0xb8u, 0x3cu, 0x41u, 0x6cu, 0x64u, 0x5au, 0xc0u, 0x63u, 0x2du, 0x43u, 0xd3u, 0xb7u, 0xc7u, 0x33u, 0xc6u, 0xe7u, 0x1du, 0x41u, 0x00u, 0x67u, 0xbfu, 0x54u, 0x1eu, 0xebu, 0x3fu, 0x8cu, 0xb7u, 0x1fu, 0xd5u, 0xddu, 0xc3u, 0xf3u, 0x48u, 0xa1u, 0x7eu, 0x81u, 0x8fu, 0xe0u, 0x8du, 0x72u, 0x23u, 0xb3u, 0xdfu, 0xddu, 0x55u, 0xf2u, 0x24u, 0xccu, 0x79u, 0xe3u, + /* (2^150 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xf5u, 0xb8u, 0xcau, 0x58u, 0x85u, 0xa6u, 0xa6u, 0xebu, 0xd9u, 0x28u, 0x9cu, 0x74u, 0xfau, 0x2au, 0x53u, 0x1fu, 0xd7u, 0x9au, 0x88u, 0x5eu, 0x15u, 0xd9u, 0x6eu, 0xc3u, 0x8fu, 0x63u, 0x9cu, 0xf3u, 0xfbu, 0x20u, 0x0cu, 0xe2u, 0x4cu, 0x5cu, 0xe6u, 0xa1u, 0xd9u, 0xfau, 0xd8u, 0xe5u, 0x63u, 0x1fu, 0xa0u, 0x04u, 0x0bu, 0x0fu, 0xd1u, 0xeeu, 0xdfu, 0xffu, 0xb5u, 0x17u, 0x96u, 0x7au, 0xfdu, 0xfcu, + /* (2^150 + 2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x34u, 0x7bu, 0xbcu, 0x79u, 0x1cu, 0xf6u, 0x1bu, 0xdfu, 0x7fu, 0x96u, 0xb5u, 0x5fu, 0x7eu, 0xabu, 0x4au, 0x0au, 0xa0u, 0x98u, 0xbau, 0xfbu, 0xdfu, 0x89u, 0x19u, 0x33u, 0xf5u, 0x45u, 0xe4u, 0xddu, 0xe0u, 0x57u, 0xe1u, 0xcau, 0xecu, 0x54u, 0x6eu, 0xd2u, 0x2du, 0x74u, 0xc2u, 0x3eu, 0x1fu, 0x2au, 0x61u, 0x4fu, 0x38u, 0x6du, 0x8cu, 0x37u, 0x19u, 0x39u, 0xa2u, 0x3eu, 0x12u, 0x38u, 0x73u, 0x43u, + /* (2^150 + 2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x99u, 0x12u, 0x11u, 0xc0u, 0xf8u, 0x74u, 0xb0u, 0x93u, 0xb7u, 0xa8u, 0xe3u, 0xceu, 0x9du, 0x60u, 0xb0u, 0xedu, 0xd9u, 0xbcu, 0x5eu, 0x28u, 0xdcu, 0xb0u, 0xb0u, 0xb8u, 0x0cu, 0xe9u, 0xeeu, 0xd8u, 0xb6u, 0xd0u, 0x53u, 0x98u, 0x1au, 0x4du, 0x50u, 0x75u, 0xe7u, 0xf0u, 0x7du, 0x12u, 0x44u, 0x79u, 0x53u, 0x26u, 0x81u, 0x52u, 0x5au, 0x94u, 0x9au, 0x00u, 0xd6u, 0xd4u, 0x53u, 0x89u, 0x2bu, 0xbdu, + /* correction point D = - ((2^75 - 1) * G) in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xafu, 0x18u, 0x1au, 0xe7u, 0x7cu, 0xc3u, 0xe9u, 0x18u, 0x71u, 0x5bu, 0x80u, 0x6eu, 0x41u, 0x32u, 0x20u, 0x05u, 0xd7u, 0xfau, 0x89u, 0x1du, 0xbcu, 0xc7u, 0xa3u, 0x56u, 0x67u, 0x32u, 0xb0u, 0xdfu, 0x24u, 0x9au, 0x58u, 0xfeu, 0x10u, 0xa2u, 0x0du, 0x6bu, 0x7fu, 0xa9u, 0xc4u, 0xd7u, 0xbau, 0x4cu, 0x3eu, 0x36u, 0x66u, 0x22u, 0xfau, 0x0du, 0xedu, 0xf1u, 0x46u, 0x69u, 0xd5u, 0xc2u, 0x44u, 0xedu, +}; + +#elif (actBN_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1Domain[203] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc8u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x28u, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x1cu, 0xb4u, 0x05u, 0x0au, 0x85u, 0x0cu, 0x04u, 0xb3u, 0xabu, 0xf5u, 0x41u, 0x32u, 0x56u, 0x50u, 0x44u, 0xb0u, 0xb7u, 0xd7u, 0xbfu, 0xd8u, 0xbau, 0x27u, 0x0bu, 0x39u, 0x43u, 0x23u, 0x55u, 0xffu, 0xb4u, + /* G (basepoint of the curve) */ + 0x04u, 0x39u, 0x04u, 0xb7u, 0x0eu, 0x0cu, 0xbdu, 0x6bu, 0xb4u, 0xbfu, 0x7fu, 0x32u, 0x13u, 0x90u, 0xb9u, 0x4au, 0x03u, 0xc1u, 0xd3u, 0x56u, 0xc2u, 0x11u, 0x22u, 0x34u, 0x32u, 0x80u, 0xd6u, 0x11u, 0x5cu, 0x1du, 0x21u, 0xbdu, 0x37u, 0x63u, 0x88u, 0xb5u, 0xf7u, 0x23u, 0xfbu, 0x4cu, 0x22u, 0xdfu, 0xe6u, 0xcdu, 0x43u, 0x75u, 0xa0u, 0x5au, 0x07u, 0x47u, 0x64u, 0x44u, 0xd5u, 0x81u, 0x99u, 0x85u, 0x00u, 0x7eu, 0x34u, + /* n (order of G) */ + 0x02u, 0x1du, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0x16u, 0xa2u, 0xe0u, 0xb8u, 0xf0u, 0x3eu, 0x13u, 0xddu, 0x29u, 0x45u, 0x5cu, 0x5cu, 0x2au, 0x3du, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[201] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xc6u, + /* SEQUENCE */ + 0x30u, 0x81u, 0x9du, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x1cu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x04u, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x1cu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x04u, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x1cu, 0x9cu, 0x3fu, 0xa6u, 0x33u, 0x7fu, 0xc0u, 0x2fu, 0x93u, 0x3du, 0xceu, 0xbau, 0x98u, 0xc8u, 0x52u, 0x81u, 0x50u, 0x74u, 0x3bu, 0x1cu, 0xc0u, 0xccu, 0xf0u, 0x13u, 0x10u, 0xe7u, 0x68u, 0xcdu, 0xf7u, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x39u, 0x04u, 0x92u, 0xf5u, 0xb5u, 0x16u, 0xa2u, 0x1bu, 0x5eu, 0x60u, 0x6du, 0xd3u, 0xafu, 0x9bu, 0xf9u, 0x6bu, 0xecu, 0x04u, 0xf2u, 0x2fu, 0xe2u, 0x20u, 0x60u, 0x18u, 0xbfu, 0xaau, 0xbcu, 0x90u, 0x52u, 0x27u, 0x10u, 0x0cu, 0x12u, 0x18u, 0x61u, 0x47u, 0x86u, 0xf1u, 0xaeu, 0xa9u, 0xc5u, 0xaeu, 0x03u, 0xdfu, 0xe8u, 0x78u, 0xe8u, 0xc1u, 0x55u, 0x13u, 0x05u, 0x33u, 0x5au, 0x6bu, 0x2eu, 0xdcu, 0xa1u, 0xe6u, + /* SEQUENCE */ + 0x30u, 0x24u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x1cu, 0xd4u, 0xbau, 0xa4u, 0xcfu, 0x18u, 0x22u, 0xbcu, 0x47u, 0xb1u, 0xe9u, 0x79u, 0x61u, 0x6au, 0xd0u, 0x9du, 0x91u, 0x97u, 0xa5u, 0x45u, 0x52u, 0x6bu, 0xdau, 0xaeu, 0x6cu, 0x3au, 0xd0u, 0x12u, 0x89u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x04u, 0x6au, 0x1fu, 0xc2u, 0xebu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt[483] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xdfu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0xd8u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x18u, 0xddu, 0x00u, 0xacu, 0xcau, 0xfbu, 0x50u, 0xf5u, 0x10u, 0xc9u, 0x11u, 0xf7u, 0x2au, 0x0fu, 0x16u, 0x89u, 0xbeu, 0x27u, 0xf7u, 0xa3u, 0x56u, 0x50u, 0xdfu, 0x9bu, 0x4cu, 0xa9u, 0xa1u, 0xedu, 0x6au, 0x5du, 0xb1u, 0xa2u, 0x5cu, 0xabu, 0xb8u, 0x80u, 0x0cu, 0x84u, 0xceu, 0xd0u, 0x76u, 0xccu, 0x10u, 0x19u, 0xe7u, 0x2eu, 0x60u, 0x0fu, 0xc9u, 0x0au, 0xe1u, 0x86u, 0x02u, 0xaau, 0xc7u, 0x9cu, + /* (2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x7du, 0xdfu, 0xbau, 0xa5u, 0x30u, 0x42u, 0x21u, 0xfcu, 0x33u, 0x50u, 0xe8u, 0x78u, 0x22u, 0x92u, 0xffu, 0x62u, 0x7eu, 0xc1u, 0x30u, 0x50u, 0x71u, 0x1fu, 0xceu, 0x8du, 0xf0u, 0x6du, 0x61u, 0x1du, 0x68u, 0x65u, 0xb8u, 0xd4u, 0x02u, 0x1du, 0x49u, 0x5du, 0xbau, 0x4du, 0xe4u, 0x4du, 0x41u, 0x02u, 0xe4u, 0xe3u, 0x09u, 0xb2u, 0xabu, 0x6fu, 0x4du, 0x42u, 0xadu, 0xaau, 0xc5u, 0xecu, 0x6du, 0x9cu, + /* (2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x84u, 0xb4u, 0x25u, 0xe8u, 0x77u, 0xd5u, 0x72u, 0x90u, 0xd6u, 0x97u, 0x56u, 0xdeu, 0xd1u, 0x42u, 0x49u, 0x43u, 0x57u, 0xd7u, 0xbbu, 0x8bu, 0x2cu, 0xe1u, 0xb4u, 0x90u, 0xabu, 0xf3u, 0x8cu, 0x1fu, 0x1au, 0x97u, 0x11u, 0xdeu, 0xfdu, 0xe3u, 0x23u, 0xabu, 0xa9u, 0x21u, 0x64u, 0x5au, 0x3bu, 0xa7u, 0x2fu, 0x33u, 0x0au, 0x7eu, 0x07u, 0x76u, 0x16u, 0x44u, 0xffu, 0xe5u, 0x7eu, 0x92u, 0xd0u, 0x9du, + /* (2^150 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x9du, 0x5cu, 0x98u, 0xa9u, 0x42u, 0xcfu, 0xb8u, 0x3cu, 0x41u, 0x6cu, 0x64u, 0x5au, 0xc0u, 0x63u, 0x2du, 0x43u, 0xd3u, 0xb7u, 0xc7u, 0x33u, 0xc6u, 0xe7u, 0x1du, 0x41u, 0x00u, 0x67u, 0xbfu, 0x54u, 0x1eu, 0xebu, 0x3fu, 0x8cu, 0xb7u, 0x1fu, 0xd5u, 0xddu, 0xc3u, 0xf3u, 0x48u, 0xa1u, 0x7eu, 0x81u, 0x8fu, 0xe0u, 0x8du, 0x72u, 0x23u, 0xb3u, 0xdfu, 0xddu, 0x55u, 0xf2u, 0x24u, 0xccu, 0x79u, 0xe3u, + /* (2^150 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xf5u, 0xb8u, 0xcau, 0x58u, 0x85u, 0xa6u, 0xa6u, 0xebu, 0xd9u, 0x28u, 0x9cu, 0x74u, 0xfau, 0x2au, 0x53u, 0x1fu, 0xd7u, 0x9au, 0x88u, 0x5eu, 0x15u, 0xd9u, 0x6eu, 0xc3u, 0x8fu, 0x63u, 0x9cu, 0xf3u, 0xfbu, 0x20u, 0x0cu, 0xe2u, 0x4cu, 0x5cu, 0xe6u, 0xa1u, 0xd9u, 0xfau, 0xd8u, 0xe5u, 0x63u, 0x1fu, 0xa0u, 0x04u, 0x0bu, 0x0fu, 0xd1u, 0xeeu, 0xdfu, 0xffu, 0xb5u, 0x17u, 0x96u, 0x7au, 0xfdu, 0xfcu, + /* (2^150 + 2^75 + 1) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x34u, 0x7bu, 0xbcu, 0x79u, 0x1cu, 0xf6u, 0x1bu, 0xdfu, 0x7fu, 0x96u, 0xb5u, 0x5fu, 0x7eu, 0xabu, 0x4au, 0x0au, 0xa0u, 0x98u, 0xbau, 0xfbu, 0xdfu, 0x89u, 0x19u, 0x33u, 0xf5u, 0x45u, 0xe4u, 0xddu, 0xe0u, 0x57u, 0xe1u, 0xcau, 0xecu, 0x54u, 0x6eu, 0xd2u, 0x2du, 0x74u, 0xc2u, 0x3eu, 0x1fu, 0x2au, 0x61u, 0x4fu, 0x38u, 0x6du, 0x8cu, 0x37u, 0x19u, 0x39u, 0xa2u, 0x3eu, 0x12u, 0x38u, 0x73u, 0x43u, + /* (2^150 + 2^75 + 2) * G in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0x99u, 0x12u, 0x11u, 0xc0u, 0xf8u, 0x74u, 0xb0u, 0x93u, 0xb7u, 0xa8u, 0xe3u, 0xceu, 0x9du, 0x60u, 0xb0u, 0xedu, 0xd9u, 0xbcu, 0x5eu, 0x28u, 0xdcu, 0xb0u, 0xb0u, 0xb8u, 0x0cu, 0xe9u, 0xeeu, 0xd8u, 0xb6u, 0xd0u, 0x53u, 0x98u, 0x1au, 0x4du, 0x50u, 0x75u, 0xe7u, 0xf0u, 0x7du, 0x12u, 0x44u, 0x79u, 0x53u, 0x26u, 0x81u, 0x52u, 0x5au, 0x94u, 0x9au, 0x00u, 0xd6u, 0xd4u, 0x53u, 0x89u, 0x2bu, 0xbdu, + /* correction point D = - ((2^75 - 1) * G) in Montgomery representation */ + 0x04u, 0x39u, 0x04u, 0xafu, 0x18u, 0x1au, 0xe7u, 0x7cu, 0xc3u, 0xe9u, 0x18u, 0x71u, 0x5bu, 0x80u, 0x6eu, 0x41u, 0x32u, 0x20u, 0x05u, 0xd7u, 0xfau, 0x89u, 0x1du, 0xbcu, 0xc7u, 0xa3u, 0x56u, 0x67u, 0x32u, 0xb0u, 0xdfu, 0x24u, 0x9au, 0x58u, 0xfeu, 0x10u, 0xa2u, 0x0du, 0x6bu, 0x7fu, 0xa9u, 0xc4u, 0xd7u, 0xbau, 0x4cu, 0x3eu, 0x36u, 0x66u, 0x22u, 0xfau, 0x0du, 0xedu, 0xf1u, 0x46u, 0x69u, 0xd5u, 0xc2u, 0x44u, 0xedu, +}; +#else /* actBN_BYTES_PER_DIGIT */ +# error "Value of actBN_BYTES_PER_DIGIT is not supported" +#endif /* actBN_BYTES_PER_DIGIT */ +/* NIST_SEC_p224r1 END *********************************************************************************************/ + +/* NIST_ANSI_SEC_p256r1 START *********************************************************************************************/ +/* NISTp256r1 = ANSIp256r1 = SECp256r1 */ +/* The curve params in shorthand notation: + * Name: "NISTp256r1", + * p: "0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", + * a: "0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", + * b: "0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B", + * Gx: "0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296", + * Gy: "0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", + * n: "0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", + * h: "0x1", + */ + +#if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain[227] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xe0u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x20u, 0x5au, 0xc6u, 0x35u, 0xd8u, 0xaau, 0x3au, 0x93u, 0xe7u, 0xb3u, 0xebu, 0xbdu, 0x55u, 0x76u, 0x98u, 0x86u, 0xbcu, 0x65u, 0x1du, 0x06u, 0xb0u, 0xccu, 0x53u, 0xb0u, 0xf6u, 0x3bu, 0xceu, 0x3cu, 0x3eu, 0x27u, 0xd2u, 0x60u, 0x4bu, + /* G (basepoint of the curve) */ + 0x04u, 0x41u, 0x04u, 0x6bu, 0x17u, 0xd1u, 0xf2u, 0xe1u, 0x2cu, 0x42u, 0x47u, 0xf8u, 0xbcu, 0xe6u, 0xe5u, 0x63u, 0xa4u, 0x40u, 0xf2u, 0x77u, 0x03u, 0x7du, 0x81u, 0x2du, 0xebu, 0x33u, 0xa0u, 0xf4u, 0xa1u, 0x39u, 0x45u, 0xd8u, 0x98u, 0xc2u, 0x96u, 0x4fu, 0xe3u, 0x42u, 0xe2u, 0xfeu, 0x1au, 0x7fu, 0x9bu, 0x8eu, 0xe7u, 0xebu, 0x4au, 0x7cu, 0x0fu, 0x9eu, 0x16u, 0x2bu, 0xceu, 0x33u, 0x57u, 0x6bu, 0x31u, 0x5eu, 0xceu, 0xcbu, 0xb6u, 0x40u, 0x68u, 0x37u, 0xbfu, 0x51u, 0xf5u, + /* n (order of G) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xbcu, 0xe6u, 0xfau, 0xadu, 0xa7u, 0x17u, 0x9eu, 0x84u, 0xf3u, 0xb9u, 0xcau, 0xc2u, 0xfcu, 0x63u, 0x25u, 0x51u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[219] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xd8u, + /* SEQUENCE */ + 0x30u, 0x81u, 0xaeu, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x20u, 0x00u, 0x00u, 0x00u, 0x04u, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x04u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x20u, 0xdcu, 0x30u, 0x06u, 0x1du, 0x04u, 0x87u, 0x48u, 0x34u, 0xe5u, 0xa2u, 0x20u, 0xabu, 0xf7u, 0x21u, 0x2eu, 0xd6u, 0xacu, 0xf0u, 0x05u, 0xcdu, 0x78u, 0x84u, 0x30u, 0x90u, 0xd8u, 0x9cu, 0xdfu, 0x62u, 0x29u, 0xc4u, 0xbdu, 0xdfu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x41u, 0x04u, 0x18u, 0x90u, 0x5fu, 0x76u, 0xa5u, 0x37u, 0x55u, 0xc6u, 0x79u, 0xfbu, 0x73u, 0x2bu, 0x77u, 0x62u, 0x25u, 0x10u, 0x75u, 0xbau, 0x95u, 0xfcu, 0x5fu, 0xedu, 0xb6u, 0x01u, 0x79u, 0xe7u, 0x30u, 0xd4u, 0x18u, 0xa9u, 0x14u, 0x3cu, 0x85u, 0x71u, 0xffu, 0x18u, 0x25u, 0x88u, 0x5du, 0x85u, 0xd2u, 0xe8u, 0x86u, 0x88u, 0xddu, 0x21u, 0xf3u, 0x25u, 0x8bu, 0x4au, 0xb8u, 0xe4u, 0xbau, 0x19u, 0xe4u, 0x5cu, 0xddu, 0xf2u, 0x53u, 0x57u, 0xceu, 0x95u, 0x56u, 0x0au, + /* SEQUENCE */ + 0x30u, 0x25u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x20u, 0x66u, 0xe1u, 0x2du, 0x94u, 0xf3u, 0xd9u, 0x56u, 0x20u, 0x28u, 0x45u, 0xb2u, 0x39u, 0x2bu, 0x6bu, 0xecu, 0x59u, 0x46u, 0x99u, 0x79u, 0x9cu, 0x49u, 0xbdu, 0x6fu, 0xa6u, 0x83u, 0x24u, 0x4cu, 0x95u, 0xbeu, 0x79u, 0xeeu, 0xa2u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x01u, 0x4fu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt[547] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xf6u, 0xbbu, 0x32u, 0xe4u, 0x3du, 0xcfu, 0x3au, 0x3bu, 0x73u, 0x22u, 0x05u, 0x03u, 0x8du, 0x14u, 0x90u, 0xd9u, 0xaau, 0x6au, 0xe3u, 0xc1u, 0xa4u, 0x33u, 0x82u, 0x7du, 0x85u, 0x00u, 0x46u, 0xd4u, 0x10u, 0xddu, 0xd6u, 0x4du, 0x78u, 0xc5u, 0x77u, 0x51u, 0x0au, 0x5bu, 0x8au, 0x3bu, 0x19u, 0xa8u, 0xfbu, 0x0eu, 0x92u, 0x04u, 0x2du, 0xbeu, 0x15u, 0x2cu, 0xd7u, 0xcbu, 0xebu, 0x23u, 0x6fu, 0xf8u, 0x2fu, 0x36u, 0x48u, 0xd3u, 0x61u, 0xbeu, 0xe1u, 0xa5u, + /* (2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xdau, 0x59u, 0xadu, 0x0du, 0xc7u, 0x0du, 0xedu, 0xbcu, 0x33u, 0x6bu, 0xccu, 0x89u, 0x6fu, 0x1fu, 0xcau, 0x13u, 0x1fu, 0x08u, 0x80u, 0xb0u, 0xe1u, 0xf4u, 0xe3u, 0x02u, 0x46u, 0x15u, 0xd9u, 0x12u, 0xc1u, 0xd8u, 0x5fu, 0x12u, 0x2au, 0xefu, 0xd9u, 0x5au, 0xddu, 0xc8u, 0x4fu, 0x79u, 0xa3u, 0xb1u, 0xc2u, 0xf2u, 0x60u, 0x32u, 0x1bu, 0xbbu, 0xbau, 0xedu, 0x81u, 0xcdu, 0xf4u, 0x99u, 0x0cu, 0xfdu, 0x38u, 0x97u, 0xefu, 0xaeu, 0xb0u, 0xf6u, 0x2eu, 0xceu, + /* (2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x15u, 0xfdu, 0x84u, 0x55u, 0x0fu, 0x1cu, 0x86u, 0x84u, 0x57u, 0x5fu, 0xccu, 0x49u, 0x01u, 0x57u, 0xf2u, 0xadu, 0x6cu, 0x12u, 0xfau, 0xa9u, 0xfau, 0xf7u, 0x90u, 0xe8u, 0x63u, 0x36u, 0xffu, 0x57u, 0xbau, 0xf5u, 0x98u, 0x07u, 0x70u, 0xaau, 0x92u, 0xc6u, 0xdau, 0x2bu, 0x23u, 0x7cu, 0xd0u, 0xb6u, 0x16u, 0xcau, 0x6fu, 0x5eu, 0x49u, 0x06u, 0xd4u, 0x73u, 0xffu, 0x4eu, 0x67u, 0x6cu, 0x6cu, 0x11u, 0x94u, 0x4fu, 0x97u, 0x01u, 0xe2u, 0x2cu, 0xd1u, 0x70u, + /* (2^172 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x73u, 0xa6u, 0x37u, 0x95u, 0x2fu, 0x83u, 0x7fu, 0x32u, 0x36u, 0x06u, 0x82u, 0xc0u, 0xe4u, 0x0eu, 0x81u, 0x25u, 0xecu, 0xfdu, 0xb3u, 0xa2u, 0x98u, 0x9au, 0x01u, 0x82u, 0x21u, 0xe0u, 0x7fu, 0x9au, 0xbcu, 0x0au, 0x70u, 0xc0u, 0xb7u, 0x1eu, 0xf4u, 0xefu, 0x34u, 0xe2u, 0x2au, 0xb1u, 0xf9u, 0x35u, 0x21u, 0x23u, 0xafu, 0x3du, 0x5du, 0x7eu, 0xefu, 0xb9u, 0x7fu, 0xecu, 0xebu, 0xf4u, 0xc7u, 0xa5u, 0xf4u, 0xebu, 0x8cu, 0xefu, 0x9cu, 0x0du, 0x32u, 0x6bu, + /* (2^172 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x04u, 0x51u, 0x20u, 0x9du, 0x10u, 0x44u, 0xf3u, 0xfeu, 0x9bu, 0x45u, 0x74u, 0xb0u, 0x53u, 0x96u, 0x9bu, 0xccu, 0x6fu, 0xb2u, 0x38u, 0xc2u, 0xd5u, 0xe1u, 0xe9u, 0x0eu, 0x60u, 0x2du, 0x9bu, 0x54u, 0x9du, 0x20u, 0xb7u, 0x33u, 0x8bu, 0x61u, 0x9bu, 0xe0u, 0x6cu, 0xb0u, 0xf9u, 0x64u, 0x96u, 0xa4u, 0x69u, 0xf4u, 0x99u, 0xe2u, 0x5fu, 0xfeu, 0x52u, 0x2cu, 0xb3u, 0x5cu, 0x96u, 0x7bu, 0x2bu, 0x08u, 0x7eu, 0x95u, 0x17u, 0xbbu, 0x66u, 0xddu, 0x6bu, 0xcfu, + /* (2^172 + 2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x19u, 0x29u, 0xcfu, 0x60u, 0x6du, 0x8eu, 0x17u, 0x6fu, 0x2eu, 0xd8u, 0x08u, 0x5au, 0x69u, 0x55u, 0xc2u, 0x90u, 0x00u, 0x0fu, 0xc8u, 0xd4u, 0x84u, 0x1bu, 0xe9u, 0xedu, 0x8fu, 0x2eu, 0xacu, 0xfeu, 0x49u, 0x38u, 0x89u, 0x95u, 0x68u, 0xfeu, 0x61u, 0x07u, 0x8fu, 0x61u, 0x83u, 0x2bu, 0x13u, 0xa8u, 0x1bu, 0x95u, 0xb2u, 0x6cu, 0x6eu, 0x05u, 0x58u, 0xd7u, 0x67u, 0xadu, 0x6cu, 0xb6u, 0x26u, 0xcdu, 0x2eu, 0xfdu, 0x26u, 0xa5u, 0xfdu, 0x1au, 0x09u, 0xdbu, + /* (2^172 + 2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xa2u, 0x13u, 0xc8u, 0x07u, 0xfdu, 0x95u, 0x8bu, 0xe4u, 0xbcu, 0x98u, 0x2cu, 0x36u, 0xe9u, 0x4du, 0xd3u, 0xc1u, 0xaeu, 0x8bu, 0x32u, 0x58u, 0x92u, 0x91u, 0x14u, 0xc8u, 0xe4u, 0x5au, 0x10u, 0xbdu, 0xc1u, 0xe0u, 0x67u, 0x8bu, 0xeau, 0x8du, 0x82u, 0x90u, 0xbau, 0xabu, 0x01u, 0x1bu, 0x40u, 0xdfu, 0x78u, 0xe0u, 0x60u, 0xf5u, 0xa0u, 0x6bu, 0x9eu, 0x99u, 0xe5u, 0x43u, 0x5eu, 0xdeu, 0x80u, 0xaeu, 0xc2u, 0x68u, 0x3du, 0xffu, 0xdau, 0xa2u, 0xccu, 0xa7u, + /* correction point D = - ((2^86 - 1) * G) in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x7au, 0x22u, 0xebu, 0xe8u, 0x23u, 0x5bu, 0xdeu, 0x3bu, 0x6du, 0xfeu, 0x83u, 0xfdu, 0x1bu, 0x62u, 0xe3u, 0xcdu, 0x01u, 0x94u, 0x9au, 0x18u, 0xbau, 0x87u, 0x5fu, 0x3cu, 0x0au, 0x36u, 0xc1u, 0xc7u, 0xbfu, 0x34u, 0x15u, 0x09u, 0x23u, 0xc3u, 0xa9u, 0xc1u, 0x49u, 0x0du, 0x76u, 0xe8u, 0x0au, 0x8eu, 0x84u, 0x2au, 0x66u, 0xa6u, 0x30u, 0x19u, 0x0fu, 0x48u, 0x18u, 0xb6u, 0x72u, 0xcau, 0xfbu, 0x8au, 0x69u, 0x7du, 0x55u, 0xe5u, 0x85u, 0x60u, 0x37u, 0x65u, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain[227] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xe0u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x20u, 0x5au, 0xc6u, 0x35u, 0xd8u, 0xaau, 0x3au, 0x93u, 0xe7u, 0xb3u, 0xebu, 0xbdu, 0x55u, 0x76u, 0x98u, 0x86u, 0xbcu, 0x65u, 0x1du, 0x06u, 0xb0u, 0xccu, 0x53u, 0xb0u, 0xf6u, 0x3bu, 0xceu, 0x3cu, 0x3eu, 0x27u, 0xd2u, 0x60u, 0x4bu, + /* G (basepoint of the curve) */ + 0x04u, 0x41u, 0x04u, 0x6bu, 0x17u, 0xd1u, 0xf2u, 0xe1u, 0x2cu, 0x42u, 0x47u, 0xf8u, 0xbcu, 0xe6u, 0xe5u, 0x63u, 0xa4u, 0x40u, 0xf2u, 0x77u, 0x03u, 0x7du, 0x81u, 0x2du, 0xebu, 0x33u, 0xa0u, 0xf4u, 0xa1u, 0x39u, 0x45u, 0xd8u, 0x98u, 0xc2u, 0x96u, 0x4fu, 0xe3u, 0x42u, 0xe2u, 0xfeu, 0x1au, 0x7fu, 0x9bu, 0x8eu, 0xe7u, 0xebu, 0x4au, 0x7cu, 0x0fu, 0x9eu, 0x16u, 0x2bu, 0xceu, 0x33u, 0x57u, 0x6bu, 0x31u, 0x5eu, 0xceu, 0xcbu, 0xb6u, 0x40u, 0x68u, 0x37u, 0xbfu, 0x51u, 0xf5u, + /* n (order of G) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xbcu, 0xe6u, 0xfau, 0xadu, 0xa7u, 0x17u, 0x9eu, 0x84u, 0xf3u, 0xb9u, 0xcau, 0xc2u, 0xfcu, 0x63u, 0x25u, 0x51u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[221] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xdau, + /* SEQUENCE */ + 0x30u, 0x81u, 0xafu, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x20u, 0x00u, 0x00u, 0x00u, 0x04u, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x02u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x04u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x20u, 0xdcu, 0x30u, 0x06u, 0x1du, 0x04u, 0x87u, 0x48u, 0x34u, 0xe5u, 0xa2u, 0x20u, 0xabu, 0xf7u, 0x21u, 0x2eu, 0xd6u, 0xacu, 0xf0u, 0x05u, 0xcdu, 0x78u, 0x84u, 0x30u, 0x90u, 0xd8u, 0x9cu, 0xdfu, 0x62u, 0x29u, 0xc4u, 0xbdu, 0xdfu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x41u, 0x04u, 0x18u, 0x90u, 0x5fu, 0x76u, 0xa5u, 0x37u, 0x55u, 0xc6u, 0x79u, 0xfbu, 0x73u, 0x2bu, 0x77u, 0x62u, 0x25u, 0x10u, 0x75u, 0xbau, 0x95u, 0xfcu, 0x5fu, 0xedu, 0xb6u, 0x01u, 0x79u, 0xe7u, 0x30u, 0xd4u, 0x18u, 0xa9u, 0x14u, 0x3cu, 0x85u, 0x71u, 0xffu, 0x18u, 0x25u, 0x88u, 0x5du, 0x85u, 0xd2u, 0xe8u, 0x86u, 0x88u, 0xddu, 0x21u, 0xf3u, 0x25u, 0x8bu, 0x4au, 0xb8u, 0xe4u, 0xbau, 0x19u, 0xe4u, 0x5cu, 0xddu, 0xf2u, 0x53u, 0x57u, 0xceu, 0x95u, 0x56u, 0x0au, + /* SEQUENCE */ + 0x30u, 0x26u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x20u, 0x66u, 0xe1u, 0x2du, 0x94u, 0xf3u, 0xd9u, 0x56u, 0x20u, 0x28u, 0x45u, 0xb2u, 0x39u, 0x2bu, 0x6bu, 0xecu, 0x59u, 0x46u, 0x99u, 0x79u, 0x9cu, 0x49u, 0xbdu, 0x6fu, 0xa6u, 0x83u, 0x24u, 0x4cu, 0x95u, 0xbeu, 0x79u, 0xeeu, 0xa2u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x02u, 0xbcu, 0x4fu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt[547] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xf6u, 0xbbu, 0x32u, 0xe4u, 0x3du, 0xcfu, 0x3au, 0x3bu, 0x73u, 0x22u, 0x05u, 0x03u, 0x8du, 0x14u, 0x90u, 0xd9u, 0xaau, 0x6au, 0xe3u, 0xc1u, 0xa4u, 0x33u, 0x82u, 0x7du, 0x85u, 0x00u, 0x46u, 0xd4u, 0x10u, 0xddu, 0xd6u, 0x4du, 0x78u, 0xc5u, 0x77u, 0x51u, 0x0au, 0x5bu, 0x8au, 0x3bu, 0x19u, 0xa8u, 0xfbu, 0x0eu, 0x92u, 0x04u, 0x2du, 0xbeu, 0x15u, 0x2cu, 0xd7u, 0xcbu, 0xebu, 0x23u, 0x6fu, 0xf8u, 0x2fu, 0x36u, 0x48u, 0xd3u, 0x61u, 0xbeu, 0xe1u, 0xa5u, + /* (2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xdau, 0x59u, 0xadu, 0x0du, 0xc7u, 0x0du, 0xedu, 0xbcu, 0x33u, 0x6bu, 0xccu, 0x89u, 0x6fu, 0x1fu, 0xcau, 0x13u, 0x1fu, 0x08u, 0x80u, 0xb0u, 0xe1u, 0xf4u, 0xe3u, 0x02u, 0x46u, 0x15u, 0xd9u, 0x12u, 0xc1u, 0xd8u, 0x5fu, 0x12u, 0x2au, 0xefu, 0xd9u, 0x5au, 0xddu, 0xc8u, 0x4fu, 0x79u, 0xa3u, 0xb1u, 0xc2u, 0xf2u, 0x60u, 0x32u, 0x1bu, 0xbbu, 0xbau, 0xedu, 0x81u, 0xcdu, 0xf4u, 0x99u, 0x0cu, 0xfdu, 0x38u, 0x97u, 0xefu, 0xaeu, 0xb0u, 0xf6u, 0x2eu, 0xceu, + /* (2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x15u, 0xfdu, 0x84u, 0x55u, 0x0fu, 0x1cu, 0x86u, 0x84u, 0x57u, 0x5fu, 0xccu, 0x49u, 0x01u, 0x57u, 0xf2u, 0xadu, 0x6cu, 0x12u, 0xfau, 0xa9u, 0xfau, 0xf7u, 0x90u, 0xe8u, 0x63u, 0x36u, 0xffu, 0x57u, 0xbau, 0xf5u, 0x98u, 0x07u, 0x70u, 0xaau, 0x92u, 0xc6u, 0xdau, 0x2bu, 0x23u, 0x7cu, 0xd0u, 0xb6u, 0x16u, 0xcau, 0x6fu, 0x5eu, 0x49u, 0x06u, 0xd4u, 0x73u, 0xffu, 0x4eu, 0x67u, 0x6cu, 0x6cu, 0x11u, 0x94u, 0x4fu, 0x97u, 0x01u, 0xe2u, 0x2cu, 0xd1u, 0x70u, + /* (2^172 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x73u, 0xa6u, 0x37u, 0x95u, 0x2fu, 0x83u, 0x7fu, 0x32u, 0x36u, 0x06u, 0x82u, 0xc0u, 0xe4u, 0x0eu, 0x81u, 0x25u, 0xecu, 0xfdu, 0xb3u, 0xa2u, 0x98u, 0x9au, 0x01u, 0x82u, 0x21u, 0xe0u, 0x7fu, 0x9au, 0xbcu, 0x0au, 0x70u, 0xc0u, 0xb7u, 0x1eu, 0xf4u, 0xefu, 0x34u, 0xe2u, 0x2au, 0xb1u, 0xf9u, 0x35u, 0x21u, 0x23u, 0xafu, 0x3du, 0x5du, 0x7eu, 0xefu, 0xb9u, 0x7fu, 0xecu, 0xebu, 0xf4u, 0xc7u, 0xa5u, 0xf4u, 0xebu, 0x8cu, 0xefu, 0x9cu, 0x0du, 0x32u, 0x6bu, + /* (2^172 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x04u, 0x51u, 0x20u, 0x9du, 0x10u, 0x44u, 0xf3u, 0xfeu, 0x9bu, 0x45u, 0x74u, 0xb0u, 0x53u, 0x96u, 0x9bu, 0xccu, 0x6fu, 0xb2u, 0x38u, 0xc2u, 0xd5u, 0xe1u, 0xe9u, 0x0eu, 0x60u, 0x2du, 0x9bu, 0x54u, 0x9du, 0x20u, 0xb7u, 0x33u, 0x8bu, 0x61u, 0x9bu, 0xe0u, 0x6cu, 0xb0u, 0xf9u, 0x64u, 0x96u, 0xa4u, 0x69u, 0xf4u, 0x99u, 0xe2u, 0x5fu, 0xfeu, 0x52u, 0x2cu, 0xb3u, 0x5cu, 0x96u, 0x7bu, 0x2bu, 0x08u, 0x7eu, 0x95u, 0x17u, 0xbbu, 0x66u, 0xddu, 0x6bu, 0xcfu, + /* (2^172 + 2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x19u, 0x29u, 0xcfu, 0x60u, 0x6du, 0x8eu, 0x17u, 0x6fu, 0x2eu, 0xd8u, 0x08u, 0x5au, 0x69u, 0x55u, 0xc2u, 0x90u, 0x00u, 0x0fu, 0xc8u, 0xd4u, 0x84u, 0x1bu, 0xe9u, 0xedu, 0x8fu, 0x2eu, 0xacu, 0xfeu, 0x49u, 0x38u, 0x89u, 0x95u, 0x68u, 0xfeu, 0x61u, 0x07u, 0x8fu, 0x61u, 0x83u, 0x2bu, 0x13u, 0xa8u, 0x1bu, 0x95u, 0xb2u, 0x6cu, 0x6eu, 0x05u, 0x58u, 0xd7u, 0x67u, 0xadu, 0x6cu, 0xb6u, 0x26u, 0xcdu, 0x2eu, 0xfdu, 0x26u, 0xa5u, 0xfdu, 0x1au, 0x09u, 0xdbu, + /* (2^172 + 2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xa2u, 0x13u, 0xc8u, 0x07u, 0xfdu, 0x95u, 0x8bu, 0xe4u, 0xbcu, 0x98u, 0x2cu, 0x36u, 0xe9u, 0x4du, 0xd3u, 0xc1u, 0xaeu, 0x8bu, 0x32u, 0x58u, 0x92u, 0x91u, 0x14u, 0xc8u, 0xe4u, 0x5au, 0x10u, 0xbdu, 0xc1u, 0xe0u, 0x67u, 0x8bu, 0xeau, 0x8du, 0x82u, 0x90u, 0xbau, 0xabu, 0x01u, 0x1bu, 0x40u, 0xdfu, 0x78u, 0xe0u, 0x60u, 0xf5u, 0xa0u, 0x6bu, 0x9eu, 0x99u, 0xe5u, 0x43u, 0x5eu, 0xdeu, 0x80u, 0xaeu, 0xc2u, 0x68u, 0x3du, 0xffu, 0xdau, 0xa2u, 0xccu, 0xa7u, + /* correction point D = - ((2^86 - 1) * G) in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x7au, 0x22u, 0xebu, 0xe8u, 0x23u, 0x5bu, 0xdeu, 0x3bu, 0x6du, 0xfeu, 0x83u, 0xfdu, 0x1bu, 0x62u, 0xe3u, 0xcdu, 0x01u, 0x94u, 0x9au, 0x18u, 0xbau, 0x87u, 0x5fu, 0x3cu, 0x0au, 0x36u, 0xc1u, 0xc7u, 0xbfu, 0x34u, 0x15u, 0x09u, 0x23u, 0xc3u, 0xa9u, 0xc1u, 0x49u, 0x0du, 0x76u, 0xe8u, 0x0au, 0x8eu, 0x84u, 0x2au, 0x66u, 0xa6u, 0x30u, 0x19u, 0x0fu, 0x48u, 0x18u, 0xb6u, 0x72u, 0xcau, 0xfbu, 0x8au, 0x69u, 0x7du, 0x55u, 0xe5u, 0x85u, 0x60u, 0x37u, 0x65u, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain[227] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xe0u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x2cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x20u, 0x5au, 0xc6u, 0x35u, 0xd8u, 0xaau, 0x3au, 0x93u, 0xe7u, 0xb3u, 0xebu, 0xbdu, 0x55u, 0x76u, 0x98u, 0x86u, 0xbcu, 0x65u, 0x1du, 0x06u, 0xb0u, 0xccu, 0x53u, 0xb0u, 0xf6u, 0x3bu, 0xceu, 0x3cu, 0x3eu, 0x27u, 0xd2u, 0x60u, 0x4bu, + /* G (basepoint of the curve) */ + 0x04u, 0x41u, 0x04u, 0x6bu, 0x17u, 0xd1u, 0xf2u, 0xe1u, 0x2cu, 0x42u, 0x47u, 0xf8u, 0xbcu, 0xe6u, 0xe5u, 0x63u, 0xa4u, 0x40u, 0xf2u, 0x77u, 0x03u, 0x7du, 0x81u, 0x2du, 0xebu, 0x33u, 0xa0u, 0xf4u, 0xa1u, 0x39u, 0x45u, 0xd8u, 0x98u, 0xc2u, 0x96u, 0x4fu, 0xe3u, 0x42u, 0xe2u, 0xfeu, 0x1au, 0x7fu, 0x9bu, 0x8eu, 0xe7u, 0xebu, 0x4au, 0x7cu, 0x0fu, 0x9eu, 0x16u, 0x2bu, 0xceu, 0x33u, 0x57u, 0x6bu, 0x31u, 0x5eu, 0xceu, 0xcbu, 0xb6u, 0x40u, 0x68u, 0x37u, 0xbfu, 0x51u, 0xf5u, + /* n (order of G) */ + 0x02u, 0x21u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xbcu, 0xe6u, 0xfau, 0xadu, 0xa7u, 0x17u, 0x9eu, 0x84u, 0xf3u, 0xb9u, 0xcau, 0xc2u, 0xfcu, 0x63u, 0x25u, 0x51u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[225] = { + /* SEQUENCE */ + 0x30u, 0x81u, 0xdeu, + /* SEQUENCE */ + 0x30u, 0x81u, 0xb1u, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x20u, 0x00u, 0x00u, 0x00u, 0x04u, 0xffu, 0xffu, 0xffu, 0xfdu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x04u, 0x00u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x44u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x20u, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x04u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x20u, 0xdcu, 0x30u, 0x06u, 0x1du, 0x04u, 0x87u, 0x48u, 0x34u, 0xe5u, 0xa2u, 0x20u, 0xabu, 0xf7u, 0x21u, 0x2eu, 0xd6u, 0xacu, 0xf0u, 0x05u, 0xcdu, 0x78u, 0x84u, 0x30u, 0x90u, 0xd8u, 0x9cu, 0xdfu, 0x62u, 0x29u, 0xc4u, 0xbdu, 0xdfu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x41u, 0x04u, 0x18u, 0x90u, 0x5fu, 0x76u, 0xa5u, 0x37u, 0x55u, 0xc6u, 0x79u, 0xfbu, 0x73u, 0x2bu, 0x77u, 0x62u, 0x25u, 0x10u, 0x75u, 0xbau, 0x95u, 0xfcu, 0x5fu, 0xedu, 0xb6u, 0x01u, 0x79u, 0xe7u, 0x30u, 0xd4u, 0x18u, 0xa9u, 0x14u, 0x3cu, 0x85u, 0x71u, 0xffu, 0x18u, 0x25u, 0x88u, 0x5du, 0x85u, 0xd2u, 0xe8u, 0x86u, 0x88u, 0xddu, 0x21u, 0xf3u, 0x25u, 0x8bu, 0x4au, 0xb8u, 0xe4u, 0xbau, 0x19u, 0xe4u, 0x5cu, 0xddu, 0xf2u, 0x53u, 0x57u, 0xceu, 0x95u, 0x56u, 0x0au, + /* SEQUENCE */ + 0x30u, 0x28u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x20u, 0x66u, 0xe1u, 0x2du, 0x94u, 0xf3u, 0xd9u, 0x56u, 0x20u, 0x28u, 0x45u, 0xb2u, 0x39u, 0x2bu, 0x6bu, 0xecu, 0x59u, 0x46u, 0x99u, 0x79u, 0x9cu, 0x49u, 0xbdu, 0x6fu, 0xa6u, 0x83u, 0x24u, 0x4cu, 0x95u, 0xbeu, 0x79u, 0xeeu, 0xa2u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x04u, 0xeeu, 0x00u, 0xbcu, 0x4fu, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt[547] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x02u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xf6u, 0xbbu, 0x32u, 0xe4u, 0x3du, 0xcfu, 0x3au, 0x3bu, 0x73u, 0x22u, 0x05u, 0x03u, 0x8du, 0x14u, 0x90u, 0xd9u, 0xaau, 0x6au, 0xe3u, 0xc1u, 0xa4u, 0x33u, 0x82u, 0x7du, 0x85u, 0x00u, 0x46u, 0xd4u, 0x10u, 0xddu, 0xd6u, 0x4du, 0x78u, 0xc5u, 0x77u, 0x51u, 0x0au, 0x5bu, 0x8au, 0x3bu, 0x19u, 0xa8u, 0xfbu, 0x0eu, 0x92u, 0x04u, 0x2du, 0xbeu, 0x15u, 0x2cu, 0xd7u, 0xcbu, 0xebu, 0x23u, 0x6fu, 0xf8u, 0x2fu, 0x36u, 0x48u, 0xd3u, 0x61u, 0xbeu, 0xe1u, 0xa5u, + /* (2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xdau, 0x59u, 0xadu, 0x0du, 0xc7u, 0x0du, 0xedu, 0xbcu, 0x33u, 0x6bu, 0xccu, 0x89u, 0x6fu, 0x1fu, 0xcau, 0x13u, 0x1fu, 0x08u, 0x80u, 0xb0u, 0xe1u, 0xf4u, 0xe3u, 0x02u, 0x46u, 0x15u, 0xd9u, 0x12u, 0xc1u, 0xd8u, 0x5fu, 0x12u, 0x2au, 0xefu, 0xd9u, 0x5au, 0xddu, 0xc8u, 0x4fu, 0x79u, 0xa3u, 0xb1u, 0xc2u, 0xf2u, 0x60u, 0x32u, 0x1bu, 0xbbu, 0xbau, 0xedu, 0x81u, 0xcdu, 0xf4u, 0x99u, 0x0cu, 0xfdu, 0x38u, 0x97u, 0xefu, 0xaeu, 0xb0u, 0xf6u, 0x2eu, 0xceu, + /* (2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x15u, 0xfdu, 0x84u, 0x55u, 0x0fu, 0x1cu, 0x86u, 0x84u, 0x57u, 0x5fu, 0xccu, 0x49u, 0x01u, 0x57u, 0xf2u, 0xadu, 0x6cu, 0x12u, 0xfau, 0xa9u, 0xfau, 0xf7u, 0x90u, 0xe8u, 0x63u, 0x36u, 0xffu, 0x57u, 0xbau, 0xf5u, 0x98u, 0x07u, 0x70u, 0xaau, 0x92u, 0xc6u, 0xdau, 0x2bu, 0x23u, 0x7cu, 0xd0u, 0xb6u, 0x16u, 0xcau, 0x6fu, 0x5eu, 0x49u, 0x06u, 0xd4u, 0x73u, 0xffu, 0x4eu, 0x67u, 0x6cu, 0x6cu, 0x11u, 0x94u, 0x4fu, 0x97u, 0x01u, 0xe2u, 0x2cu, 0xd1u, 0x70u, + /* (2^172 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x73u, 0xa6u, 0x37u, 0x95u, 0x2fu, 0x83u, 0x7fu, 0x32u, 0x36u, 0x06u, 0x82u, 0xc0u, 0xe4u, 0x0eu, 0x81u, 0x25u, 0xecu, 0xfdu, 0xb3u, 0xa2u, 0x98u, 0x9au, 0x01u, 0x82u, 0x21u, 0xe0u, 0x7fu, 0x9au, 0xbcu, 0x0au, 0x70u, 0xc0u, 0xb7u, 0x1eu, 0xf4u, 0xefu, 0x34u, 0xe2u, 0x2au, 0xb1u, 0xf9u, 0x35u, 0x21u, 0x23u, 0xafu, 0x3du, 0x5du, 0x7eu, 0xefu, 0xb9u, 0x7fu, 0xecu, 0xebu, 0xf4u, 0xc7u, 0xa5u, 0xf4u, 0xebu, 0x8cu, 0xefu, 0x9cu, 0x0du, 0x32u, 0x6bu, + /* (2^172 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x04u, 0x51u, 0x20u, 0x9du, 0x10u, 0x44u, 0xf3u, 0xfeu, 0x9bu, 0x45u, 0x74u, 0xb0u, 0x53u, 0x96u, 0x9bu, 0xccu, 0x6fu, 0xb2u, 0x38u, 0xc2u, 0xd5u, 0xe1u, 0xe9u, 0x0eu, 0x60u, 0x2du, 0x9bu, 0x54u, 0x9du, 0x20u, 0xb7u, 0x33u, 0x8bu, 0x61u, 0x9bu, 0xe0u, 0x6cu, 0xb0u, 0xf9u, 0x64u, 0x96u, 0xa4u, 0x69u, 0xf4u, 0x99u, 0xe2u, 0x5fu, 0xfeu, 0x52u, 0x2cu, 0xb3u, 0x5cu, 0x96u, 0x7bu, 0x2bu, 0x08u, 0x7eu, 0x95u, 0x17u, 0xbbu, 0x66u, 0xddu, 0x6bu, 0xcfu, + /* (2^172 + 2^86 + 1) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x19u, 0x29u, 0xcfu, 0x60u, 0x6du, 0x8eu, 0x17u, 0x6fu, 0x2eu, 0xd8u, 0x08u, 0x5au, 0x69u, 0x55u, 0xc2u, 0x90u, 0x00u, 0x0fu, 0xc8u, 0xd4u, 0x84u, 0x1bu, 0xe9u, 0xedu, 0x8fu, 0x2eu, 0xacu, 0xfeu, 0x49u, 0x38u, 0x89u, 0x95u, 0x68u, 0xfeu, 0x61u, 0x07u, 0x8fu, 0x61u, 0x83u, 0x2bu, 0x13u, 0xa8u, 0x1bu, 0x95u, 0xb2u, 0x6cu, 0x6eu, 0x05u, 0x58u, 0xd7u, 0x67u, 0xadu, 0x6cu, 0xb6u, 0x26u, 0xcdu, 0x2eu, 0xfdu, 0x26u, 0xa5u, 0xfdu, 0x1au, 0x09u, 0xdbu, + /* (2^172 + 2^86 + 2) * G in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0xa2u, 0x13u, 0xc8u, 0x07u, 0xfdu, 0x95u, 0x8bu, 0xe4u, 0xbcu, 0x98u, 0x2cu, 0x36u, 0xe9u, 0x4du, 0xd3u, 0xc1u, 0xaeu, 0x8bu, 0x32u, 0x58u, 0x92u, 0x91u, 0x14u, 0xc8u, 0xe4u, 0x5au, 0x10u, 0xbdu, 0xc1u, 0xe0u, 0x67u, 0x8bu, 0xeau, 0x8du, 0x82u, 0x90u, 0xbau, 0xabu, 0x01u, 0x1bu, 0x40u, 0xdfu, 0x78u, 0xe0u, 0x60u, 0xf5u, 0xa0u, 0x6bu, 0x9eu, 0x99u, 0xe5u, 0x43u, 0x5eu, 0xdeu, 0x80u, 0xaeu, 0xc2u, 0x68u, 0x3du, 0xffu, 0xdau, 0xa2u, 0xccu, 0xa7u, + /* correction point D = - ((2^86 - 1) * G) in Montgomery representation */ + 0x04u, 0x41u, 0x04u, 0x7au, 0x22u, 0xebu, 0xe8u, 0x23u, 0x5bu, 0xdeu, 0x3bu, 0x6du, 0xfeu, 0x83u, 0xfdu, 0x1bu, 0x62u, 0xe3u, 0xcdu, 0x01u, 0x94u, 0x9au, 0x18u, 0xbau, 0x87u, 0x5fu, 0x3cu, 0x0au, 0x36u, 0xc1u, 0xc7u, 0xbfu, 0x34u, 0x15u, 0x09u, 0x23u, 0xc3u, 0xa9u, 0xc1u, 0x49u, 0x0du, 0x76u, 0xe8u, 0x0au, 0x8eu, 0x84u, 0x2au, 0x66u, 0xa6u, 0x30u, 0x19u, 0x0fu, 0x48u, 0x18u, 0xb6u, 0x72u, 0xcau, 0xfbu, 0x8au, 0x69u, 0x7du, 0x55u, 0xe5u, 0x85u, 0x60u, 0x37u, 0x65u, +}; +#else /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +# error "Value of CRYPTO_30_LIBCV_BYTES_PER_DIGIT is not supported" +#endif /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +/* NIST_ANSI_SEC_p256r1 END *********************************************************************************************/ + +/* NIST_SEC_p384r1 START *********************************************************************************************/ +/* NISTp384r1 = SECp384r1 */ +/* The curve params in shorthand notation: + * Name: NISTp384r1 + * p: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff + * a: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc + * b: 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef + * Gx: 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7 + * Gy: 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f + * n: 0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 + * h: 0x1 + */ + +#if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1Domain[324] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x40u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x30u, 0xb3u, 0x31u, 0x2fu, 0xa7u, 0xe2u, 0x3eu, 0xe7u, 0xe4u, 0x98u, 0x8eu, 0x05u, 0x6bu, 0xe3u, 0xf8u, 0x2du, 0x19u, 0x18u, 0x1du, 0x9cu, 0x6eu, 0xfeu, 0x81u, 0x41u, 0x12u, 0x03u, 0x14u, 0x08u, 0x8fu, 0x50u, 0x13u, 0x87u, 0x5au, 0xc6u, 0x56u, 0x39u, 0x8du, 0x8au, 0x2eu, 0xd1u, 0x9du, 0x2au, 0x85u, 0xc8u, 0xedu, 0xd3u, 0xecu, 0x2au, 0xefu, + /* G (basepoint of the curve) */ + 0x04u, 0x61u, 0x04u, 0xaau, 0x87u, 0xcau, 0x22u, 0xbeu, 0x8bu, 0x05u, 0x37u, 0x8eu, 0xb1u, 0xc7u, 0x1eu, 0xf3u, 0x20u, 0xadu, 0x74u, 0x6eu, 0x1du, 0x3bu, 0x62u, 0x8bu, 0xa7u, 0x9bu, 0x98u, 0x59u, 0xf7u, 0x41u, 0xe0u, 0x82u, 0x54u, 0x2au, 0x38u, 0x55u, 0x02u, 0xf2u, 0x5du, 0xbfu, 0x55u, 0x29u, 0x6cu, 0x3au, 0x54u, 0x5eu, 0x38u, 0x72u, 0x76u, 0x0au, 0xb7u, 0x36u, 0x17u, 0xdeu, 0x4au, 0x96u, 0x26u, 0x2cu, 0x6fu, 0x5du, 0x9eu, 0x98u, 0xbfu, 0x92u, 0x92u, 0xdcu, 0x29u, 0xf8u, 0xf4u, 0x1du, 0xbdu, 0x28u, 0x9au, 0x14u, 0x7cu, 0xe9u, 0xdau, 0x31u, 0x13u, 0xb5u, 0xf0u, 0xb8u, 0xc0u, 0x0au, 0x60u, 0xb1u, 0xceu, 0x1du, 0x7eu, 0x81u, 0x9du, 0x7au, 0x43u, 0x1du, 0x7cu, 0x90u, 0xeau, 0x0eu, 0x5fu, + /* n (order of G) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xc7u, 0x63u, 0x4du, 0x81u, 0xf4u, 0x37u, 0x2du, 0xdfu, 0x58u, 0x1au, 0x0du, 0xb2u, 0x48u, 0xb0u, 0xa7u, 0x7au, 0xecu, 0xecu, 0x19u, 0x6au, 0xccu, 0xc5u, 0x29u, 0x73u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[316] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x38u, + /* SEQUENCE */ + 0x30u, 0x81u, 0xfeu, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x30u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x30u, 0xcdu, 0x08u, 0x11u, 0x4bu, 0x60u, 0x4fu, 0xbfu, 0xf9u, 0xb6u, 0x2bu, 0x21u, 0xf4u, 0x1fu, 0x02u, 0x20u, 0x94u, 0xe3u, 0x37u, 0x4bu, 0xeeu, 0x94u, 0x93u, 0x8au, 0xe2u, 0x77u, 0xf2u, 0x20u, 0x9bu, 0x19u, 0x20u, 0x02u, 0x2eu, 0xf7u, 0x29u, 0xadu, 0xd8u, 0x7au, 0x4cu, 0x32u, 0xecu, 0x08u, 0x11u, 0x88u, 0x71u, 0x9du, 0x41u, 0x2du, 0xccu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x61u, 0x04u, 0x4du, 0x3au, 0xadu, 0xc2u, 0x29u, 0x9eu, 0x15u, 0x13u, 0x81u, 0x2fu, 0xf7u, 0x23u, 0x61u, 0x4eu, 0xdeu, 0x2bu, 0x64u, 0x54u, 0x86u, 0x84u, 0x59u, 0xa3u, 0x0eu, 0xffu, 0x87u, 0x9cu, 0x3au, 0xfcu, 0x54u, 0x1bu, 0x4du, 0x6eu, 0x20u, 0xe3u, 0x78u, 0xe2u, 0xa0u, 0xd6u, 0xceu, 0x38u, 0x3du, 0xd0u, 0x75u, 0x66u, 0x49u, 0xc0u, 0xb5u, 0x28u, 0x2bu, 0x78u, 0xabu, 0xc2u, 0x5au, 0x15u, 0xc5u, 0xe9u, 0xddu, 0x80u, 0x02u, 0x26u, 0x39u, 0x69u, 0xa8u, 0x40u, 0xc6u, 0xc3u, 0x52u, 0x19u, 0x68u, 0xf4u, 0xffu, 0xd9u, 0x8bu, 0xadu, 0xe7u, 0x56u, 0x2eu, 0x83u, 0xb0u, 0x50u, 0xa1u, 0xbfu, 0xa8u, 0xbfu, 0x7bu, 0xb4u, 0xa9u, 0xacu, 0x23u, 0x04u, 0x3du, 0xadu, 0x4bu, 0x03u, 0xa4u, 0xfeu, + /* SEQUENCE */ + 0x30u, 0x35u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x30u, 0x0cu, 0x84u, 0xeeu, 0x01u, 0x2bu, 0x39u, 0xbfu, 0x21u, 0x3fu, 0xb0u, 0x5bu, 0x7au, 0x28u, 0x26u, 0x68u, 0x95u, 0xd4u, 0x0du, 0x49u, 0x17u, 0x4au, 0xabu, 0x1cu, 0xc5u, 0xbcu, 0x3eu, 0x48u, 0x3au, 0xfcu, 0xb8u, 0x29u, 0x47u, 0xffu, 0x3du, 0x81u, 0xe5u, 0xdfu, 0x1au, 0xa4u, 0x19u, 0x2du, 0x31u, 0x9bu, 0x24u, 0x19u, 0xb4u, 0x09u, 0xa9u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x01u, 0x45u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt[803] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xdbu, 0x93u, 0xb7u, 0x76u, 0x42u, 0x74u, 0x60u, 0xc3u, 0x9cu, 0x90u, 0xa4u, 0xfdu, 0x2du, 0xe4u, 0xb5u, 0x06u, 0xdau, 0x82u, 0x14u, 0x95u, 0xf0u, 0x68u, 0x7fu, 0x50u, 0x35u, 0x04u, 0xe6u, 0xf0u, 0xffu, 0x9du, 0x48u, 0xa1u, 0x8eu, 0x6cu, 0x8fu, 0x2eu, 0x02u, 0x2bu, 0x53u, 0xf0u, 0xc8u, 0x22u, 0x9eu, 0x55u, 0x78u, 0x3du, 0xdeu, 0x91u, 0xe3u, 0x49u, 0x47u, 0xf7u, 0x12u, 0x3du, 0xf0u, 0xc2u, 0x07u, 0x0du, 0x43u, 0x09u, 0x00u, 0xb0u, 0xe6u, 0x84u, 0x09u, 0xf1u, 0xfeu, 0x41u, 0x51u, 0x72u, 0xbau, 0xd9u, 0x15u, 0xe4u, 0xf1u, 0x8bu, 0xdcu, 0x58u, 0x82u, 0x58u, 0xe8u, 0xe8u, 0xe4u, 0xa8u, 0xc2u, 0xaau, 0xccu, 0xd8u, 0x42u, 0xeau, 0x84u, 0x63u, 0x31u, 0x40u, 0xbfu, 0xdau, + /* (2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xebu, 0x65u, 0x7bu, 0x10u, 0xfdu, 0x71u, 0x1bu, 0xa4u, 0x63u, 0x7eu, 0x33u, 0x02u, 0x42u, 0xedu, 0x76u, 0x26u, 0x39u, 0x24u, 0xe5u, 0x0au, 0x74u, 0x20u, 0x40u, 0x8fu, 0xa1u, 0xe4u, 0x4bu, 0x14u, 0xdcu, 0x26u, 0x1eu, 0xc2u, 0xfeu, 0x4au, 0x36u, 0xe7u, 0xffu, 0x13u, 0x31u, 0x4eu, 0x39u, 0x4fu, 0xb8u, 0x4du, 0xe8u, 0x6eu, 0x3fu, 0x64u, 0xa9u, 0x6fu, 0xd3u, 0xb7u, 0x46u, 0x94u, 0xe1u, 0x5au, 0x5bu, 0xe4u, 0x63u, 0xa5u, 0xbeu, 0x56u, 0xf7u, 0x74u, 0x33u, 0x86u, 0xf1u, 0xc6u, 0x88u, 0x6fu, 0xb3u, 0xdbu, 0xe7u, 0x46u, 0x58u, 0x19u, 0xb0u, 0x56u, 0xd8u, 0x72u, 0x30u, 0xe0u, 0x43u, 0x26u, 0x7fu, 0x1fu, 0x42u, 0xc7u, 0xc1u, 0x6du, 0x01u, 0xc5u, 0x34u, 0x09u, 0x49u, 0xbbu, + /* (2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xcbu, 0x0eu, 0xc2u, 0x40u, 0x54u, 0x40u, 0x30u, 0x0eu, 0x87u, 0xa3u, 0x41u, 0xffu, 0x26u, 0x25u, 0xc6u, 0x45u, 0x16u, 0x92u, 0x6bu, 0x63u, 0x5bu, 0xd7u, 0xe9u, 0x20u, 0x67u, 0x78u, 0xc2u, 0xf9u, 0xa0u, 0x18u, 0x43u, 0x09u, 0x53u, 0xceu, 0x5eu, 0x7eu, 0x08u, 0x3cu, 0xd6u, 0x22u, 0x0au, 0x1fu, 0x01u, 0x6du, 0xa7u, 0xa2u, 0x98u, 0x2cu, 0x74u, 0x1au, 0xc8u, 0x5fu, 0x44u, 0x17u, 0x10u, 0x90u, 0x89u, 0x5du, 0x29u, 0xaeu, 0x22u, 0x31u, 0x0au, 0x17u, 0xa0u, 0xe4u, 0xe8u, 0xc6u, 0x2du, 0x55u, 0xd9u, 0x3au, 0xc8u, 0xf3u, 0x60u, 0x28u, 0x4fu, 0x9bu, 0x94u, 0x35u, 0xdeu, 0xcbu, 0x19u, 0xb5u, 0x88u, 0x64u, 0x57u, 0xe4u, 0x58u, 0x68u, 0x21u, 0xd5u, 0xfau, 0x6du, 0xe7u, 0x19u, + /* (2^256 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x27u, 0x1fu, 0x07u, 0x17u, 0x8fu, 0xcbu, 0x87u, 0xf1u, 0x05u, 0xbeu, 0x51u, 0xb7u, 0xbfu, 0x50u, 0x01u, 0x59u, 0xdeu, 0x1du, 0x76u, 0x17u, 0x79u, 0xfdu, 0x9cu, 0x91u, 0xadu, 0xfdu, 0x85u, 0xb0u, 0x3eu, 0xeeu, 0x3du, 0x12u, 0x05u, 0x29u, 0x17u, 0xc3u, 0x19u, 0x0eu, 0xb1u, 0x98u, 0x56u, 0x21u, 0x11u, 0x90u, 0xa3u, 0x53u, 0xe8u, 0x89u, 0x8fu, 0x8eu, 0x6eu, 0x28u, 0x9eu, 0x96u, 0xb1u, 0x5du, 0xb0u, 0xd7u, 0xa7u, 0x36u, 0x56u, 0x49u, 0x97u, 0x6eu, 0x0au, 0x22u, 0xcbu, 0xe1u, 0x06u, 0x3bu, 0x1du, 0x7fu, 0xb2u, 0x56u, 0x47u, 0x92u, 0x8fu, 0x5fu, 0xb8u, 0xc0u, 0xb1u, 0xb7u, 0x24u, 0x6eu, 0xdau, 0x12u, 0xdau, 0x8du, 0x02u, 0x67u, 0x3eu, 0x27u, 0x3au, 0x75u, 0xacu, 0x71u, + /* (2^256 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xf2u, 0x4du, 0xd6u, 0xbbu, 0xbfu, 0x42u, 0x7fu, 0x21u, 0xcdu, 0xfdu, 0xfau, 0xb5u, 0xdau, 0xc6u, 0xf6u, 0x43u, 0x3au, 0x95u, 0x5eu, 0xe9u, 0xb5u, 0x18u, 0x78u, 0x08u, 0x07u, 0xa0u, 0xf7u, 0xceu, 0xb2u, 0xa8u, 0x0du, 0xc3u, 0x29u, 0x61u, 0xf5u, 0x2bu, 0x7au, 0x4fu, 0xd5u, 0xe5u, 0x10u, 0xd5u, 0x62u, 0xf2u, 0xa6u, 0x9bu, 0xcbu, 0x2cu, 0x29u, 0x1cu, 0x6au, 0xd9u, 0x08u, 0x25u, 0x5eu, 0xb5u, 0x29u, 0x1eu, 0x34u, 0x6du, 0x78u, 0xc7u, 0x45u, 0x39u, 0x1du, 0x45u, 0x2au, 0x53u, 0xb7u, 0x99u, 0xdeu, 0x3fu, 0x43u, 0x48u, 0x17u, 0xd4u, 0x2bu, 0x0du, 0x78u, 0x68u, 0x45u, 0xe1u, 0xf8u, 0x6eu, 0x60u, 0x3au, 0x03u, 0x33u, 0x56u, 0xcau, 0xe7u, 0x8cu, 0xadu, 0x54u, 0x83u, 0x5bu, + /* (2^256 + 2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xd8u, 0x86u, 0x59u, 0x88u, 0x6eu, 0xe9u, 0xa9u, 0x30u, 0x8bu, 0x73u, 0x9au, 0xd5u, 0x7cu, 0x92u, 0x77u, 0xcfu, 0xeau, 0x79u, 0xa5u, 0xf5u, 0xadu, 0x3eu, 0xd3u, 0x4fu, 0x9du, 0x18u, 0x12u, 0x68u, 0x0eu, 0x0du, 0x07u, 0xfeu, 0xb3u, 0x65u, 0x74u, 0xa8u, 0xdcu, 0xa4u, 0x20u, 0xbau, 0x25u, 0x53u, 0x9du, 0xe9u, 0x8eu, 0xceu, 0x21u, 0x8du, 0x89u, 0x76u, 0xb7u, 0x03u, 0x05u, 0xf5u, 0x11u, 0x22u, 0x3eu, 0x1au, 0x96u, 0xb1u, 0x40u, 0xc7u, 0x3au, 0x2du, 0x67u, 0xf8u, 0x64u, 0x1eu, 0x21u, 0x04u, 0x5fu, 0x63u, 0xd3u, 0x12u, 0x8fu, 0x12u, 0x97u, 0xeeu, 0x31u, 0x5eu, 0xe0u, 0x13u, 0x8cu, 0x65u, 0x08u, 0xf3u, 0x52u, 0x4fu, 0xafu, 0x07u, 0xbfu, 0xb6u, 0x21u, 0x59u, 0x1au, 0x3eu, + /* (2^256 + 2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x0du, 0xe7u, 0x0du, 0x3bu, 0x66u, 0xb9u, 0x3au, 0x52u, 0x65u, 0x4cu, 0xdau, 0xdfu, 0x52u, 0xf1u, 0x6bu, 0x74u, 0x88u, 0x86u, 0x03u, 0x4cu, 0x4cu, 0xbeu, 0x5eu, 0x85u, 0x8cu, 0x1du, 0x85u, 0x06u, 0x11u, 0x6cu, 0x4du, 0x0cu, 0xa8u, 0x73u, 0xecu, 0xbfu, 0x64u, 0x10u, 0xc9u, 0xe3u, 0x6cu, 0x2du, 0x76u, 0x2eu, 0xedu, 0xc2u, 0xe9u, 0xfcu, 0xddu, 0x97u, 0x4eu, 0x2bu, 0x20u, 0x21u, 0x36u, 0x30u, 0x0bu, 0xb0u, 0x73u, 0x97u, 0x58u, 0x9bu, 0x48u, 0x03u, 0x47u, 0x00u, 0xb8u, 0x65u, 0xcfu, 0x33u, 0x89u, 0x9fu, 0x1du, 0x05u, 0xa1u, 0xf5u, 0x0fu, 0x57u, 0x8fu, 0x57u, 0xb8u, 0x3cu, 0x56u, 0x9fu, 0x87u, 0x3fu, 0xafu, 0x2au, 0xa1u, 0xdeu, 0x0eu, 0x75u, 0x03u, 0x7au, 0x58u, 0xabu, + /* correction point D = - ((2^128 - 1) * G) in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xbbu, 0x3fu, 0x5au, 0x84u, 0x87u, 0xf9u, 0x1au, 0x36u, 0x48u, 0x28u, 0x20u, 0xd6u, 0x7fu, 0x73u, 0x36u, 0xd6u, 0xc4u, 0xeau, 0x85u, 0x36u, 0xe6u, 0x51u, 0xcau, 0xb5u, 0xc6u, 0x06u, 0xd7u, 0x47u, 0x6du, 0x24u, 0x4du, 0xa9u, 0x32u, 0x12u, 0xa5u, 0x0cu, 0x71u, 0x17u, 0x13u, 0xf4u, 0x79u, 0xc0u, 0x00u, 0xdau, 0x6fu, 0xc6u, 0xb7u, 0xeeu, 0xc7u, 0xe7u, 0x30u, 0x8cu, 0x0bu, 0x91u, 0xb3u, 0x09u, 0x6au, 0x2cu, 0x2bu, 0x3au, 0xd4u, 0xf6u, 0x83u, 0xe1u, 0x87u, 0xe5u, 0x0fu, 0x70u, 0xd1u, 0xceu, 0x0fu, 0xbfu, 0xa6u, 0x5au, 0x46u, 0x6eu, 0xb8u, 0xb0u, 0x82u, 0x52u, 0x00u, 0x33u, 0x7fu, 0xcbu, 0x6au, 0xdau, 0xc8u, 0x40u, 0xeau, 0x24u, 0x6cu, 0xfdu, 0xbdu, 0x58u, 0xc5u, 0x4cu, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1Domain[324] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x40u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x30u, 0xb3u, 0x31u, 0x2fu, 0xa7u, 0xe2u, 0x3eu, 0xe7u, 0xe4u, 0x98u, 0x8eu, 0x05u, 0x6bu, 0xe3u, 0xf8u, 0x2du, 0x19u, 0x18u, 0x1du, 0x9cu, 0x6eu, 0xfeu, 0x81u, 0x41u, 0x12u, 0x03u, 0x14u, 0x08u, 0x8fu, 0x50u, 0x13u, 0x87u, 0x5au, 0xc6u, 0x56u, 0x39u, 0x8du, 0x8au, 0x2eu, 0xd1u, 0x9du, 0x2au, 0x85u, 0xc8u, 0xedu, 0xd3u, 0xecu, 0x2au, 0xefu, + /* G (basepoint of the curve) */ + 0x04u, 0x61u, 0x04u, 0xaau, 0x87u, 0xcau, 0x22u, 0xbeu, 0x8bu, 0x05u, 0x37u, 0x8eu, 0xb1u, 0xc7u, 0x1eu, 0xf3u, 0x20u, 0xadu, 0x74u, 0x6eu, 0x1du, 0x3bu, 0x62u, 0x8bu, 0xa7u, 0x9bu, 0x98u, 0x59u, 0xf7u, 0x41u, 0xe0u, 0x82u, 0x54u, 0x2au, 0x38u, 0x55u, 0x02u, 0xf2u, 0x5du, 0xbfu, 0x55u, 0x29u, 0x6cu, 0x3au, 0x54u, 0x5eu, 0x38u, 0x72u, 0x76u, 0x0au, 0xb7u, 0x36u, 0x17u, 0xdeu, 0x4au, 0x96u, 0x26u, 0x2cu, 0x6fu, 0x5du, 0x9eu, 0x98u, 0xbfu, 0x92u, 0x92u, 0xdcu, 0x29u, 0xf8u, 0xf4u, 0x1du, 0xbdu, 0x28u, 0x9au, 0x14u, 0x7cu, 0xe9u, 0xdau, 0x31u, 0x13u, 0xb5u, 0xf0u, 0xb8u, 0xc0u, 0x0au, 0x60u, 0xb1u, 0xceu, 0x1du, 0x7eu, 0x81u, 0x9du, 0x7au, 0x43u, 0x1du, 0x7cu, 0x90u, 0xeau, 0x0eu, 0x5fu, + /* n (order of G) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xc7u, 0x63u, 0x4du, 0x81u, 0xf4u, 0x37u, 0x2du, 0xdfu, 0x58u, 0x1au, 0x0du, 0xb2u, 0x48u, 0xb0u, 0xa7u, 0x7au, 0xecu, 0xecu, 0x19u, 0x6au, 0xccu, 0xc5u, 0x29u, 0x73u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[318] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x3au, + /* SEQUENCE */ + 0x30u, 0x81u, 0xffu, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x30u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x02u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x30u, 0xcdu, 0x08u, 0x11u, 0x4bu, 0x60u, 0x4fu, 0xbfu, 0xf9u, 0xb6u, 0x2bu, 0x21u, 0xf4u, 0x1fu, 0x02u, 0x20u, 0x94u, 0xe3u, 0x37u, 0x4bu, 0xeeu, 0x94u, 0x93u, 0x8au, 0xe2u, 0x77u, 0xf2u, 0x20u, 0x9bu, 0x19u, 0x20u, 0x02u, 0x2eu, 0xf7u, 0x29u, 0xadu, 0xd8u, 0x7au, 0x4cu, 0x32u, 0xecu, 0x08u, 0x11u, 0x88u, 0x71u, 0x9du, 0x41u, 0x2du, 0xccu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x61u, 0x04u, 0x4du, 0x3au, 0xadu, 0xc2u, 0x29u, 0x9eu, 0x15u, 0x13u, 0x81u, 0x2fu, 0xf7u, 0x23u, 0x61u, 0x4eu, 0xdeu, 0x2bu, 0x64u, 0x54u, 0x86u, 0x84u, 0x59u, 0xa3u, 0x0eu, 0xffu, 0x87u, 0x9cu, 0x3au, 0xfcu, 0x54u, 0x1bu, 0x4du, 0x6eu, 0x20u, 0xe3u, 0x78u, 0xe2u, 0xa0u, 0xd6u, 0xceu, 0x38u, 0x3du, 0xd0u, 0x75u, 0x66u, 0x49u, 0xc0u, 0xb5u, 0x28u, 0x2bu, 0x78u, 0xabu, 0xc2u, 0x5au, 0x15u, 0xc5u, 0xe9u, 0xddu, 0x80u, 0x02u, 0x26u, 0x39u, 0x69u, 0xa8u, 0x40u, 0xc6u, 0xc3u, 0x52u, 0x19u, 0x68u, 0xf4u, 0xffu, 0xd9u, 0x8bu, 0xadu, 0xe7u, 0x56u, 0x2eu, 0x83u, 0xb0u, 0x50u, 0xa1u, 0xbfu, 0xa8u, 0xbfu, 0x7bu, 0xb4u, 0xa9u, 0xacu, 0x23u, 0x04u, 0x3du, 0xadu, 0x4bu, 0x03u, 0xa4u, 0xfeu, + /* SEQUENCE */ + 0x30u, 0x36u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x30u, 0x0cu, 0x84u, 0xeeu, 0x01u, 0x2bu, 0x39u, 0xbfu, 0x21u, 0x3fu, 0xb0u, 0x5bu, 0x7au, 0x28u, 0x26u, 0x68u, 0x95u, 0xd4u, 0x0du, 0x49u, 0x17u, 0x4au, 0xabu, 0x1cu, 0xc5u, 0xbcu, 0x3eu, 0x48u, 0x3au, 0xfcu, 0xb8u, 0x29u, 0x47u, 0xffu, 0x3du, 0x81u, 0xe5u, 0xdfu, 0x1au, 0xa4u, 0x19u, 0x2du, 0x31u, 0x9bu, 0x24u, 0x19u, 0xb4u, 0x09u, 0xa9u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x02u, 0xdcu, 0x45u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt[803] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xdbu, 0x93u, 0xb7u, 0x76u, 0x42u, 0x74u, 0x60u, 0xc3u, 0x9cu, 0x90u, 0xa4u, 0xfdu, 0x2du, 0xe4u, 0xb5u, 0x06u, 0xdau, 0x82u, 0x14u, 0x95u, 0xf0u, 0x68u, 0x7fu, 0x50u, 0x35u, 0x04u, 0xe6u, 0xf0u, 0xffu, 0x9du, 0x48u, 0xa1u, 0x8eu, 0x6cu, 0x8fu, 0x2eu, 0x02u, 0x2bu, 0x53u, 0xf0u, 0xc8u, 0x22u, 0x9eu, 0x55u, 0x78u, 0x3du, 0xdeu, 0x91u, 0xe3u, 0x49u, 0x47u, 0xf7u, 0x12u, 0x3du, 0xf0u, 0xc2u, 0x07u, 0x0du, 0x43u, 0x09u, 0x00u, 0xb0u, 0xe6u, 0x84u, 0x09u, 0xf1u, 0xfeu, 0x41u, 0x51u, 0x72u, 0xbau, 0xd9u, 0x15u, 0xe4u, 0xf1u, 0x8bu, 0xdcu, 0x58u, 0x82u, 0x58u, 0xe8u, 0xe8u, 0xe4u, 0xa8u, 0xc2u, 0xaau, 0xccu, 0xd8u, 0x42u, 0xeau, 0x84u, 0x63u, 0x31u, 0x40u, 0xbfu, 0xdau, + /* (2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xebu, 0x65u, 0x7bu, 0x10u, 0xfdu, 0x71u, 0x1bu, 0xa4u, 0x63u, 0x7eu, 0x33u, 0x02u, 0x42u, 0xedu, 0x76u, 0x26u, 0x39u, 0x24u, 0xe5u, 0x0au, 0x74u, 0x20u, 0x40u, 0x8fu, 0xa1u, 0xe4u, 0x4bu, 0x14u, 0xdcu, 0x26u, 0x1eu, 0xc2u, 0xfeu, 0x4au, 0x36u, 0xe7u, 0xffu, 0x13u, 0x31u, 0x4eu, 0x39u, 0x4fu, 0xb8u, 0x4du, 0xe8u, 0x6eu, 0x3fu, 0x64u, 0xa9u, 0x6fu, 0xd3u, 0xb7u, 0x46u, 0x94u, 0xe1u, 0x5au, 0x5bu, 0xe4u, 0x63u, 0xa5u, 0xbeu, 0x56u, 0xf7u, 0x74u, 0x33u, 0x86u, 0xf1u, 0xc6u, 0x88u, 0x6fu, 0xb3u, 0xdbu, 0xe7u, 0x46u, 0x58u, 0x19u, 0xb0u, 0x56u, 0xd8u, 0x72u, 0x30u, 0xe0u, 0x43u, 0x26u, 0x7fu, 0x1fu, 0x42u, 0xc7u, 0xc1u, 0x6du, 0x01u, 0xc5u, 0x34u, 0x09u, 0x49u, 0xbbu, + /* (2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xcbu, 0x0eu, 0xc2u, 0x40u, 0x54u, 0x40u, 0x30u, 0x0eu, 0x87u, 0xa3u, 0x41u, 0xffu, 0x26u, 0x25u, 0xc6u, 0x45u, 0x16u, 0x92u, 0x6bu, 0x63u, 0x5bu, 0xd7u, 0xe9u, 0x20u, 0x67u, 0x78u, 0xc2u, 0xf9u, 0xa0u, 0x18u, 0x43u, 0x09u, 0x53u, 0xceu, 0x5eu, 0x7eu, 0x08u, 0x3cu, 0xd6u, 0x22u, 0x0au, 0x1fu, 0x01u, 0x6du, 0xa7u, 0xa2u, 0x98u, 0x2cu, 0x74u, 0x1au, 0xc8u, 0x5fu, 0x44u, 0x17u, 0x10u, 0x90u, 0x89u, 0x5du, 0x29u, 0xaeu, 0x22u, 0x31u, 0x0au, 0x17u, 0xa0u, 0xe4u, 0xe8u, 0xc6u, 0x2du, 0x55u, 0xd9u, 0x3au, 0xc8u, 0xf3u, 0x60u, 0x28u, 0x4fu, 0x9bu, 0x94u, 0x35u, 0xdeu, 0xcbu, 0x19u, 0xb5u, 0x88u, 0x64u, 0x57u, 0xe4u, 0x58u, 0x68u, 0x21u, 0xd5u, 0xfau, 0x6du, 0xe7u, 0x19u, + /* (2^256 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x27u, 0x1fu, 0x07u, 0x17u, 0x8fu, 0xcbu, 0x87u, 0xf1u, 0x05u, 0xbeu, 0x51u, 0xb7u, 0xbfu, 0x50u, 0x01u, 0x59u, 0xdeu, 0x1du, 0x76u, 0x17u, 0x79u, 0xfdu, 0x9cu, 0x91u, 0xadu, 0xfdu, 0x85u, 0xb0u, 0x3eu, 0xeeu, 0x3du, 0x12u, 0x05u, 0x29u, 0x17u, 0xc3u, 0x19u, 0x0eu, 0xb1u, 0x98u, 0x56u, 0x21u, 0x11u, 0x90u, 0xa3u, 0x53u, 0xe8u, 0x89u, 0x8fu, 0x8eu, 0x6eu, 0x28u, 0x9eu, 0x96u, 0xb1u, 0x5du, 0xb0u, 0xd7u, 0xa7u, 0x36u, 0x56u, 0x49u, 0x97u, 0x6eu, 0x0au, 0x22u, 0xcbu, 0xe1u, 0x06u, 0x3bu, 0x1du, 0x7fu, 0xb2u, 0x56u, 0x47u, 0x92u, 0x8fu, 0x5fu, 0xb8u, 0xc0u, 0xb1u, 0xb7u, 0x24u, 0x6eu, 0xdau, 0x12u, 0xdau, 0x8du, 0x02u, 0x67u, 0x3eu, 0x27u, 0x3au, 0x75u, 0xacu, 0x71u, + /* (2^256 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xf2u, 0x4du, 0xd6u, 0xbbu, 0xbfu, 0x42u, 0x7fu, 0x21u, 0xcdu, 0xfdu, 0xfau, 0xb5u, 0xdau, 0xc6u, 0xf6u, 0x43u, 0x3au, 0x95u, 0x5eu, 0xe9u, 0xb5u, 0x18u, 0x78u, 0x08u, 0x07u, 0xa0u, 0xf7u, 0xceu, 0xb2u, 0xa8u, 0x0du, 0xc3u, 0x29u, 0x61u, 0xf5u, 0x2bu, 0x7au, 0x4fu, 0xd5u, 0xe5u, 0x10u, 0xd5u, 0x62u, 0xf2u, 0xa6u, 0x9bu, 0xcbu, 0x2cu, 0x29u, 0x1cu, 0x6au, 0xd9u, 0x08u, 0x25u, 0x5eu, 0xb5u, 0x29u, 0x1eu, 0x34u, 0x6du, 0x78u, 0xc7u, 0x45u, 0x39u, 0x1du, 0x45u, 0x2au, 0x53u, 0xb7u, 0x99u, 0xdeu, 0x3fu, 0x43u, 0x48u, 0x17u, 0xd4u, 0x2bu, 0x0du, 0x78u, 0x68u, 0x45u, 0xe1u, 0xf8u, 0x6eu, 0x60u, 0x3au, 0x03u, 0x33u, 0x56u, 0xcau, 0xe7u, 0x8cu, 0xadu, 0x54u, 0x83u, 0x5bu, + /* (2^256 + 2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xd8u, 0x86u, 0x59u, 0x88u, 0x6eu, 0xe9u, 0xa9u, 0x30u, 0x8bu, 0x73u, 0x9au, 0xd5u, 0x7cu, 0x92u, 0x77u, 0xcfu, 0xeau, 0x79u, 0xa5u, 0xf5u, 0xadu, 0x3eu, 0xd3u, 0x4fu, 0x9du, 0x18u, 0x12u, 0x68u, 0x0eu, 0x0du, 0x07u, 0xfeu, 0xb3u, 0x65u, 0x74u, 0xa8u, 0xdcu, 0xa4u, 0x20u, 0xbau, 0x25u, 0x53u, 0x9du, 0xe9u, 0x8eu, 0xceu, 0x21u, 0x8du, 0x89u, 0x76u, 0xb7u, 0x03u, 0x05u, 0xf5u, 0x11u, 0x22u, 0x3eu, 0x1au, 0x96u, 0xb1u, 0x40u, 0xc7u, 0x3au, 0x2du, 0x67u, 0xf8u, 0x64u, 0x1eu, 0x21u, 0x04u, 0x5fu, 0x63u, 0xd3u, 0x12u, 0x8fu, 0x12u, 0x97u, 0xeeu, 0x31u, 0x5eu, 0xe0u, 0x13u, 0x8cu, 0x65u, 0x08u, 0xf3u, 0x52u, 0x4fu, 0xafu, 0x07u, 0xbfu, 0xb6u, 0x21u, 0x59u, 0x1au, 0x3eu, + /* (2^256 + 2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x0du, 0xe7u, 0x0du, 0x3bu, 0x66u, 0xb9u, 0x3au, 0x52u, 0x65u, 0x4cu, 0xdau, 0xdfu, 0x52u, 0xf1u, 0x6bu, 0x74u, 0x88u, 0x86u, 0x03u, 0x4cu, 0x4cu, 0xbeu, 0x5eu, 0x85u, 0x8cu, 0x1du, 0x85u, 0x06u, 0x11u, 0x6cu, 0x4du, 0x0cu, 0xa8u, 0x73u, 0xecu, 0xbfu, 0x64u, 0x10u, 0xc9u, 0xe3u, 0x6cu, 0x2du, 0x76u, 0x2eu, 0xedu, 0xc2u, 0xe9u, 0xfcu, 0xddu, 0x97u, 0x4eu, 0x2bu, 0x20u, 0x21u, 0x36u, 0x30u, 0x0bu, 0xb0u, 0x73u, 0x97u, 0x58u, 0x9bu, 0x48u, 0x03u, 0x47u, 0x00u, 0xb8u, 0x65u, 0xcfu, 0x33u, 0x89u, 0x9fu, 0x1du, 0x05u, 0xa1u, 0xf5u, 0x0fu, 0x57u, 0x8fu, 0x57u, 0xb8u, 0x3cu, 0x56u, 0x9fu, 0x87u, 0x3fu, 0xafu, 0x2au, 0xa1u, 0xdeu, 0x0eu, 0x75u, 0x03u, 0x7au, 0x58u, 0xabu, + /* correction point D = - ((2^128 - 1) * G) in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xbbu, 0x3fu, 0x5au, 0x84u, 0x87u, 0xf9u, 0x1au, 0x36u, 0x48u, 0x28u, 0x20u, 0xd6u, 0x7fu, 0x73u, 0x36u, 0xd6u, 0xc4u, 0xeau, 0x85u, 0x36u, 0xe6u, 0x51u, 0xcau, 0xb5u, 0xc6u, 0x06u, 0xd7u, 0x47u, 0x6du, 0x24u, 0x4du, 0xa9u, 0x32u, 0x12u, 0xa5u, 0x0cu, 0x71u, 0x17u, 0x13u, 0xf4u, 0x79u, 0xc0u, 0x00u, 0xdau, 0x6fu, 0xc6u, 0xb7u, 0xeeu, 0xc7u, 0xe7u, 0x30u, 0x8cu, 0x0bu, 0x91u, 0xb3u, 0x09u, 0x6au, 0x2cu, 0x2bu, 0x3au, 0xd4u, 0xf6u, 0x83u, 0xe1u, 0x87u, 0xe5u, 0x0fu, 0x70u, 0xd1u, 0xceu, 0x0fu, 0xbfu, 0xa6u, 0x5au, 0x46u, 0x6eu, 0xb8u, 0xb0u, 0x82u, 0x52u, 0x00u, 0x33u, 0x7fu, 0xcbu, 0x6au, 0xdau, 0xc8u, 0x40u, 0xeau, 0x24u, 0x6cu, 0xfdu, 0xbdu, 0x58u, 0xc5u, 0x4cu, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1Domain[324] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x40u, + /* version */ + 0x02u, 0x01u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x3cu, + /* prime OID */ + 0x06u, 0x07u, 0x2au, 0x86u, 0x48u, 0xceu, 0x3du, 0x01u, 0x01u, + /* p (field prime) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a (coefficient a of the curve equation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u, 0x30u, 0xb3u, 0x31u, 0x2fu, 0xa7u, 0xe2u, 0x3eu, 0xe7u, 0xe4u, 0x98u, 0x8eu, 0x05u, 0x6bu, 0xe3u, 0xf8u, 0x2du, 0x19u, 0x18u, 0x1du, 0x9cu, 0x6eu, 0xfeu, 0x81u, 0x41u, 0x12u, 0x03u, 0x14u, 0x08u, 0x8fu, 0x50u, 0x13u, 0x87u, 0x5au, 0xc6u, 0x56u, 0x39u, 0x8du, 0x8au, 0x2eu, 0xd1u, 0x9du, 0x2au, 0x85u, 0xc8u, 0xedu, 0xd3u, 0xecu, 0x2au, 0xefu, + /* G (basepoint of the curve) */ + 0x04u, 0x61u, 0x04u, 0xaau, 0x87u, 0xcau, 0x22u, 0xbeu, 0x8bu, 0x05u, 0x37u, 0x8eu, 0xb1u, 0xc7u, 0x1eu, 0xf3u, 0x20u, 0xadu, 0x74u, 0x6eu, 0x1du, 0x3bu, 0x62u, 0x8bu, 0xa7u, 0x9bu, 0x98u, 0x59u, 0xf7u, 0x41u, 0xe0u, 0x82u, 0x54u, 0x2au, 0x38u, 0x55u, 0x02u, 0xf2u, 0x5du, 0xbfu, 0x55u, 0x29u, 0x6cu, 0x3au, 0x54u, 0x5eu, 0x38u, 0x72u, 0x76u, 0x0au, 0xb7u, 0x36u, 0x17u, 0xdeu, 0x4au, 0x96u, 0x26u, 0x2cu, 0x6fu, 0x5du, 0x9eu, 0x98u, 0xbfu, 0x92u, 0x92u, 0xdcu, 0x29u, 0xf8u, 0xf4u, 0x1du, 0xbdu, 0x28u, 0x9au, 0x14u, 0x7cu, 0xe9u, 0xdau, 0x31u, 0x13u, 0xb5u, 0xf0u, 0xb8u, 0xc0u, 0x0au, 0x60u, 0xb1u, 0xceu, 0x1du, 0x7eu, 0x81u, 0x9du, 0x7au, 0x43u, 0x1du, 0x7cu, 0x90u, 0xeau, 0x0eu, 0x5fu, + /* n (order of G) */ + 0x02u, 0x31u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xc7u, 0x63u, 0x4du, 0x81u, 0xf4u, 0x37u, 0x2du, 0xdfu, 0x58u, 0x1au, 0x0du, 0xb2u, 0x48u, 0xb0u, 0xa7u, 0x7au, 0xecu, 0xecu, 0x19u, 0x6au, 0xccu, 0xc5u, 0x29u, 0x73u, + /* h (cofactor) */ + 0x02u, 0x01u, 0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[323] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x3fu, + /* SEQUENCE */ + 0x30u, 0x82u, 0x01u, 0x01u, + /* p_RR (R^2 in prime field) */ + 0x04u, 0x30u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x01u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x02u, 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xfeu, 0x00u, 0x00u, 0x00u, 0x01u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u, 0x04u, 0x00u, 0x00u, 0x00u, 0x01u, + /* SEQUENCE */ + 0x30u, 0x64u, + /* a_R (a in Montgomery representation) */ + 0x04u, 0x30u, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xfbu, 0xffu, 0xffu, 0xffu, 0xfcu, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x03u, 0xffu, 0xffu, 0xffu, 0xfcu, + /* b_R (b in Montgomery representation) */ + 0x04u, 0x30u, 0xcdu, 0x08u, 0x11u, 0x4bu, 0x60u, 0x4fu, 0xbfu, 0xf9u, 0xb6u, 0x2bu, 0x21u, 0xf4u, 0x1fu, 0x02u, 0x20u, 0x94u, 0xe3u, 0x37u, 0x4bu, 0xeeu, 0x94u, 0x93u, 0x8au, 0xe2u, 0x77u, 0xf2u, 0x20u, 0x9bu, 0x19u, 0x20u, 0x02u, 0x2eu, 0xf7u, 0x29u, 0xadu, 0xd8u, 0x7au, 0x4cu, 0x32u, 0xecu, 0x08u, 0x11u, 0x88u, 0x71u, 0x9du, 0x41u, 0x2du, 0xccu, + /* G_R (G in Montgomery representation) */ + 0x04u, 0x61u, 0x04u, 0x4du, 0x3au, 0xadu, 0xc2u, 0x29u, 0x9eu, 0x15u, 0x13u, 0x81u, 0x2fu, 0xf7u, 0x23u, 0x61u, 0x4eu, 0xdeu, 0x2bu, 0x64u, 0x54u, 0x86u, 0x84u, 0x59u, 0xa3u, 0x0eu, 0xffu, 0x87u, 0x9cu, 0x3au, 0xfcu, 0x54u, 0x1bu, 0x4du, 0x6eu, 0x20u, 0xe3u, 0x78u, 0xe2u, 0xa0u, 0xd6u, 0xceu, 0x38u, 0x3du, 0xd0u, 0x75u, 0x66u, 0x49u, 0xc0u, 0xb5u, 0x28u, 0x2bu, 0x78u, 0xabu, 0xc2u, 0x5au, 0x15u, 0xc5u, 0xe9u, 0xddu, 0x80u, 0x02u, 0x26u, 0x39u, 0x69u, 0xa8u, 0x40u, 0xc6u, 0xc3u, 0x52u, 0x19u, 0x68u, 0xf4u, 0xffu, 0xd9u, 0x8bu, 0xadu, 0xe7u, 0x56u, 0x2eu, 0x83u, 0xb0u, 0x50u, 0xa1u, 0xbfu, 0xa8u, 0xbfu, 0x7bu, 0xb4u, 0xa9u, 0xacu, 0x23u, 0x04u, 0x3du, 0xadu, 0x4bu, 0x03u, 0xa4u, 0xfeu, + /* SEQUENCE */ + 0x30u, 0x38u, + /* n_RR (R^2 in order field) */ + 0x04u, 0x30u, 0x0cu, 0x84u, 0xeeu, 0x01u, 0x2bu, 0x39u, 0xbfu, 0x21u, 0x3fu, 0xb0u, 0x5bu, 0x7au, 0x28u, 0x26u, 0x68u, 0x95u, 0xd4u, 0x0du, 0x49u, 0x17u, 0x4au, 0xabu, 0x1cu, 0xc5u, 0xbcu, 0x3eu, 0x48u, 0x3au, 0xfcu, 0xb8u, 0x29u, 0x47u, 0xffu, 0x3du, 0x81u, 0xe5u, 0xdfu, 0x1au, 0xa4u, 0x19u, 0x2du, 0x31u, 0x9bu, 0x24u, 0x19u, 0xb4u, 0x09u, 0xa9u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u, 0x04u, 0xe8u, 0x8fu, 0xdcu, 0x45u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt[803] = { + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x1fu, + /* groups parameter */ + 0x04u, 0x01u, 0x03u, + /* SEQUENCE */ + 0x30u, 0x82u, 0x03u, 0x18u, + /* 2 * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xdbu, 0x93u, 0xb7u, 0x76u, 0x42u, 0x74u, 0x60u, 0xc3u, 0x9cu, 0x90u, 0xa4u, 0xfdu, 0x2du, 0xe4u, 0xb5u, 0x06u, 0xdau, 0x82u, 0x14u, 0x95u, 0xf0u, 0x68u, 0x7fu, 0x50u, 0x35u, 0x04u, 0xe6u, 0xf0u, 0xffu, 0x9du, 0x48u, 0xa1u, 0x8eu, 0x6cu, 0x8fu, 0x2eu, 0x02u, 0x2bu, 0x53u, 0xf0u, 0xc8u, 0x22u, 0x9eu, 0x55u, 0x78u, 0x3du, 0xdeu, 0x91u, 0xe3u, 0x49u, 0x47u, 0xf7u, 0x12u, 0x3du, 0xf0u, 0xc2u, 0x07u, 0x0du, 0x43u, 0x09u, 0x00u, 0xb0u, 0xe6u, 0x84u, 0x09u, 0xf1u, 0xfeu, 0x41u, 0x51u, 0x72u, 0xbau, 0xd9u, 0x15u, 0xe4u, 0xf1u, 0x8bu, 0xdcu, 0x58u, 0x82u, 0x58u, 0xe8u, 0xe8u, 0xe4u, 0xa8u, 0xc2u, 0xaau, 0xccu, 0xd8u, 0x42u, 0xeau, 0x84u, 0x63u, 0x31u, 0x40u, 0xbfu, 0xdau, + /* (2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xebu, 0x65u, 0x7bu, 0x10u, 0xfdu, 0x71u, 0x1bu, 0xa4u, 0x63u, 0x7eu, 0x33u, 0x02u, 0x42u, 0xedu, 0x76u, 0x26u, 0x39u, 0x24u, 0xe5u, 0x0au, 0x74u, 0x20u, 0x40u, 0x8fu, 0xa1u, 0xe4u, 0x4bu, 0x14u, 0xdcu, 0x26u, 0x1eu, 0xc2u, 0xfeu, 0x4au, 0x36u, 0xe7u, 0xffu, 0x13u, 0x31u, 0x4eu, 0x39u, 0x4fu, 0xb8u, 0x4du, 0xe8u, 0x6eu, 0x3fu, 0x64u, 0xa9u, 0x6fu, 0xd3u, 0xb7u, 0x46u, 0x94u, 0xe1u, 0x5au, 0x5bu, 0xe4u, 0x63u, 0xa5u, 0xbeu, 0x56u, 0xf7u, 0x74u, 0x33u, 0x86u, 0xf1u, 0xc6u, 0x88u, 0x6fu, 0xb3u, 0xdbu, 0xe7u, 0x46u, 0x58u, 0x19u, 0xb0u, 0x56u, 0xd8u, 0x72u, 0x30u, 0xe0u, 0x43u, 0x26u, 0x7fu, 0x1fu, 0x42u, 0xc7u, 0xc1u, 0x6du, 0x01u, 0xc5u, 0x34u, 0x09u, 0x49u, 0xbbu, + /* (2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xcbu, 0x0eu, 0xc2u, 0x40u, 0x54u, 0x40u, 0x30u, 0x0eu, 0x87u, 0xa3u, 0x41u, 0xffu, 0x26u, 0x25u, 0xc6u, 0x45u, 0x16u, 0x92u, 0x6bu, 0x63u, 0x5bu, 0xd7u, 0xe9u, 0x20u, 0x67u, 0x78u, 0xc2u, 0xf9u, 0xa0u, 0x18u, 0x43u, 0x09u, 0x53u, 0xceu, 0x5eu, 0x7eu, 0x08u, 0x3cu, 0xd6u, 0x22u, 0x0au, 0x1fu, 0x01u, 0x6du, 0xa7u, 0xa2u, 0x98u, 0x2cu, 0x74u, 0x1au, 0xc8u, 0x5fu, 0x44u, 0x17u, 0x10u, 0x90u, 0x89u, 0x5du, 0x29u, 0xaeu, 0x22u, 0x31u, 0x0au, 0x17u, 0xa0u, 0xe4u, 0xe8u, 0xc6u, 0x2du, 0x55u, 0xd9u, 0x3au, 0xc8u, 0xf3u, 0x60u, 0x28u, 0x4fu, 0x9bu, 0x94u, 0x35u, 0xdeu, 0xcbu, 0x19u, 0xb5u, 0x88u, 0x64u, 0x57u, 0xe4u, 0x58u, 0x68u, 0x21u, 0xd5u, 0xfau, 0x6du, 0xe7u, 0x19u, + /* (2^256 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x27u, 0x1fu, 0x07u, 0x17u, 0x8fu, 0xcbu, 0x87u, 0xf1u, 0x05u, 0xbeu, 0x51u, 0xb7u, 0xbfu, 0x50u, 0x01u, 0x59u, 0xdeu, 0x1du, 0x76u, 0x17u, 0x79u, 0xfdu, 0x9cu, 0x91u, 0xadu, 0xfdu, 0x85u, 0xb0u, 0x3eu, 0xeeu, 0x3du, 0x12u, 0x05u, 0x29u, 0x17u, 0xc3u, 0x19u, 0x0eu, 0xb1u, 0x98u, 0x56u, 0x21u, 0x11u, 0x90u, 0xa3u, 0x53u, 0xe8u, 0x89u, 0x8fu, 0x8eu, 0x6eu, 0x28u, 0x9eu, 0x96u, 0xb1u, 0x5du, 0xb0u, 0xd7u, 0xa7u, 0x36u, 0x56u, 0x49u, 0x97u, 0x6eu, 0x0au, 0x22u, 0xcbu, 0xe1u, 0x06u, 0x3bu, 0x1du, 0x7fu, 0xb2u, 0x56u, 0x47u, 0x92u, 0x8fu, 0x5fu, 0xb8u, 0xc0u, 0xb1u, 0xb7u, 0x24u, 0x6eu, 0xdau, 0x12u, 0xdau, 0x8du, 0x02u, 0x67u, 0x3eu, 0x27u, 0x3au, 0x75u, 0xacu, 0x71u, + /* (2^256 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xf2u, 0x4du, 0xd6u, 0xbbu, 0xbfu, 0x42u, 0x7fu, 0x21u, 0xcdu, 0xfdu, 0xfau, 0xb5u, 0xdau, 0xc6u, 0xf6u, 0x43u, 0x3au, 0x95u, 0x5eu, 0xe9u, 0xb5u, 0x18u, 0x78u, 0x08u, 0x07u, 0xa0u, 0xf7u, 0xceu, 0xb2u, 0xa8u, 0x0du, 0xc3u, 0x29u, 0x61u, 0xf5u, 0x2bu, 0x7au, 0x4fu, 0xd5u, 0xe5u, 0x10u, 0xd5u, 0x62u, 0xf2u, 0xa6u, 0x9bu, 0xcbu, 0x2cu, 0x29u, 0x1cu, 0x6au, 0xd9u, 0x08u, 0x25u, 0x5eu, 0xb5u, 0x29u, 0x1eu, 0x34u, 0x6du, 0x78u, 0xc7u, 0x45u, 0x39u, 0x1du, 0x45u, 0x2au, 0x53u, 0xb7u, 0x99u, 0xdeu, 0x3fu, 0x43u, 0x48u, 0x17u, 0xd4u, 0x2bu, 0x0du, 0x78u, 0x68u, 0x45u, 0xe1u, 0xf8u, 0x6eu, 0x60u, 0x3au, 0x03u, 0x33u, 0x56u, 0xcau, 0xe7u, 0x8cu, 0xadu, 0x54u, 0x83u, 0x5bu, + /* (2^256 + 2^128 + 1) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xd8u, 0x86u, 0x59u, 0x88u, 0x6eu, 0xe9u, 0xa9u, 0x30u, 0x8bu, 0x73u, 0x9au, 0xd5u, 0x7cu, 0x92u, 0x77u, 0xcfu, 0xeau, 0x79u, 0xa5u, 0xf5u, 0xadu, 0x3eu, 0xd3u, 0x4fu, 0x9du, 0x18u, 0x12u, 0x68u, 0x0eu, 0x0du, 0x07u, 0xfeu, 0xb3u, 0x65u, 0x74u, 0xa8u, 0xdcu, 0xa4u, 0x20u, 0xbau, 0x25u, 0x53u, 0x9du, 0xe9u, 0x8eu, 0xceu, 0x21u, 0x8du, 0x89u, 0x76u, 0xb7u, 0x03u, 0x05u, 0xf5u, 0x11u, 0x22u, 0x3eu, 0x1au, 0x96u, 0xb1u, 0x40u, 0xc7u, 0x3au, 0x2du, 0x67u, 0xf8u, 0x64u, 0x1eu, 0x21u, 0x04u, 0x5fu, 0x63u, 0xd3u, 0x12u, 0x8fu, 0x12u, 0x97u, 0xeeu, 0x31u, 0x5eu, 0xe0u, 0x13u, 0x8cu, 0x65u, 0x08u, 0xf3u, 0x52u, 0x4fu, 0xafu, 0x07u, 0xbfu, 0xb6u, 0x21u, 0x59u, 0x1au, 0x3eu, + /* (2^256 + 2^128 + 2) * G in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0x0du, 0xe7u, 0x0du, 0x3bu, 0x66u, 0xb9u, 0x3au, 0x52u, 0x65u, 0x4cu, 0xdau, 0xdfu, 0x52u, 0xf1u, 0x6bu, 0x74u, 0x88u, 0x86u, 0x03u, 0x4cu, 0x4cu, 0xbeu, 0x5eu, 0x85u, 0x8cu, 0x1du, 0x85u, 0x06u, 0x11u, 0x6cu, 0x4du, 0x0cu, 0xa8u, 0x73u, 0xecu, 0xbfu, 0x64u, 0x10u, 0xc9u, 0xe3u, 0x6cu, 0x2du, 0x76u, 0x2eu, 0xedu, 0xc2u, 0xe9u, 0xfcu, 0xddu, 0x97u, 0x4eu, 0x2bu, 0x20u, 0x21u, 0x36u, 0x30u, 0x0bu, 0xb0u, 0x73u, 0x97u, 0x58u, 0x9bu, 0x48u, 0x03u, 0x47u, 0x00u, 0xb8u, 0x65u, 0xcfu, 0x33u, 0x89u, 0x9fu, 0x1du, 0x05u, 0xa1u, 0xf5u, 0x0fu, 0x57u, 0x8fu, 0x57u, 0xb8u, 0x3cu, 0x56u, 0x9fu, 0x87u, 0x3fu, 0xafu, 0x2au, 0xa1u, 0xdeu, 0x0eu, 0x75u, 0x03u, 0x7au, 0x58u, 0xabu, + /* correction point D = - ((2^128 - 1) * G) in Montgomery representation */ + 0x04u, 0x61u, 0x04u, 0xbbu, 0x3fu, 0x5au, 0x84u, 0x87u, 0xf9u, 0x1au, 0x36u, 0x48u, 0x28u, 0x20u, 0xd6u, 0x7fu, 0x73u, 0x36u, 0xd6u, 0xc4u, 0xeau, 0x85u, 0x36u, 0xe6u, 0x51u, 0xcau, 0xb5u, 0xc6u, 0x06u, 0xd7u, 0x47u, 0x6du, 0x24u, 0x4du, 0xa9u, 0x32u, 0x12u, 0xa5u, 0x0cu, 0x71u, 0x17u, 0x13u, 0xf4u, 0x79u, 0xc0u, 0x00u, 0xdau, 0x6fu, 0xc6u, 0xb7u, 0xeeu, 0xc7u, 0xe7u, 0x30u, 0x8cu, 0x0bu, 0x91u, 0xb3u, 0x09u, 0x6au, 0x2cu, 0x2bu, 0x3au, 0xd4u, 0xf6u, 0x83u, 0xe1u, 0x87u, 0xe5u, 0x0fu, 0x70u, 0xd1u, 0xceu, 0x0fu, 0xbfu, 0xa6u, 0x5au, 0x46u, 0x6eu, 0xb8u, 0xb0u, 0x82u, 0x52u, 0x00u, 0x33u, 0x7fu, 0xcbu, 0x6au, 0xdau, 0xc8u, 0x40u, 0xeau, 0x24u, 0x6cu, 0xfdu, 0xbdu, 0x58u, 0xc5u, 0x4cu, +}; +#else /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +# error "Value of CRYPTO_30_LIBCV_BYTES_PER_DIGIT is not supported" +#endif /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +/* NIST_SEC_p384r1 END *********************************************************************************************/ + +/* NIST_SEC_p521r1 START *********************************************************************************************/ +/* NISTp521r1 = SECp521r1 */ +/* The curve params in shorthand notation: + * Name: secp521r1 + * p: 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + * a: 0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + * b: 0x51953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00 + * Gx: 0xc6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66 + * Gy: 0x11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650 + * n: 0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409 + * h: 0x1 + */ + +#if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1Domain[432] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xacu, + /* version */ + 0x02u,0x01u,0x01u, + /* SEQUENCE */ + 0x30u,0x4du, + /* prime OID */ + 0x06u,0x07u,0x2au,0x86u,0x48u,0xceu,0x3du,0x01u,0x01u, + /* p (field prime) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a (coefficient a of the curve equation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u,0x42u,0x00u,0x51u,0x95u,0x3eu,0xb9u,0x61u,0x8eu,0x1cu,0x9au,0x1fu,0x92u,0x9au,0x21u,0xa0u,0xb6u,0x85u,0x40u,0xeeu,0xa2u,0xdau,0x72u,0x5bu,0x99u,0xb3u,0x15u,0xf3u,0xb8u,0xb4u,0x89u,0x91u,0x8eu,0xf1u,0x09u,0xe1u,0x56u,0x19u,0x39u,0x51u,0xecu,0x7eu,0x93u,0x7bu,0x16u,0x52u,0xc0u,0xbdu,0x3bu,0xb1u,0xbfu,0x07u,0x35u,0x73u,0xdfu,0x88u,0x3du,0x2cu,0x34u,0xf1u,0xefu,0x45u,0x1fu,0xd4u,0x6bu,0x50u,0x3fu,0x00u, + /* G (basepoint of the curve) */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xc6u,0x85u,0x8eu,0x06u,0xb7u,0x04u,0x04u,0xe9u,0xcdu,0x9eu,0x3eu,0xcbu,0x66u,0x23u,0x95u,0xb4u,0x42u,0x9cu,0x64u,0x81u,0x39u,0x05u,0x3fu,0xb5u,0x21u,0xf8u,0x28u,0xafu,0x60u,0x6bu,0x4du,0x3du,0xbau,0xa1u,0x4bu,0x5eu,0x77u,0xefu,0xe7u,0x59u,0x28u,0xfeu,0x1du,0xc1u,0x27u,0xa2u,0xffu,0xa8u,0xdeu,0x33u,0x48u,0xb3u,0xc1u,0x85u,0x6au,0x42u,0x9bu,0xf9u,0x7eu,0x7eu,0x31u,0xc2u,0xe5u,0xbdu,0x66u,0x01u,0x18u,0x39u,0x29u,0x6au,0x78u,0x9au,0x3bu,0xc0u,0x04u,0x5cu,0x8au,0x5fu,0xb4u,0x2cu,0x7du,0x1bu,0xd9u,0x98u,0xf5u,0x44u,0x49u,0x57u,0x9bu,0x44u,0x68u,0x17u,0xafu,0xbdu,0x17u,0x27u,0x3eu,0x66u,0x2cu,0x97u,0xeeu,0x72u,0x99u,0x5eu,0xf4u,0x26u,0x40u,0xc5u,0x50u,0xb9u,0x01u,0x3fu,0xadu,0x07u,0x61u,0x35u,0x3cu,0x70u,0x86u,0xa2u,0x72u,0xc2u,0x40u,0x88u,0xbeu,0x94u,0x76u,0x9fu,0xd1u,0x66u,0x50u, + /* n (order of G) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfau,0x51u,0x86u,0x87u,0x83u,0xbfu,0x2fu,0x96u,0x6bu,0x7fu,0xccu,0x01u,0x48u,0xf7u,0x09u,0xa5u,0xd0u,0x3bu,0xb5u,0xc9u,0xb8u,0x89u,0x9cu,0x47u,0xaeu,0xbbu,0x6fu,0xb7u,0x1eu,0x91u,0x38u,0x64u,0x09u, + /* h (cofactor) */ + 0x02u,0x01u,0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[427] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xa7u, + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0x5au, + /* p_RR (R^2 in prime field) */ + 0x04u,0x42u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x40u,0x00u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u,0x01u,0x01u, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a_R (a in Montgomery representation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfeu,0x7fu, + /* b_R (b in Montgomery representation) */ + 0x04u,0x42u,0x00u,0xcau,0x9fu,0x5cu,0xb0u,0xc7u,0x0eu,0x4du,0x0fu,0xc9u,0x4du,0x10u,0xd0u,0x5bu,0x42u,0xa0u,0x77u,0x51u,0x6du,0x39u,0x2du,0xccu,0xd9u,0x8au,0xf9u,0xdcu,0x5au,0x44u,0xc8u,0xc7u,0x78u,0x84u,0xf0u,0xabu,0x0cu,0x9cu,0xa8u,0xf6u,0x3fu,0x49u,0xbdu,0x8bu,0x29u,0x60u,0x5eu,0x9du,0xd8u,0xdfu,0x83u,0x9au,0xb9u,0xefu,0xc4u,0x1eu,0x96u,0x1au,0x78u,0xf7u,0xa2u,0x8fu,0xeau,0x35u,0xa8u,0x1fu,0x80u,0x14u, + /* G_R (G in Montgomery representation) */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x42u,0xc7u,0x03u,0x5bu,0x82u,0x02u,0x74u,0xe6u,0xcfu,0x1fu,0x65u,0xb3u,0x11u,0xcau,0xdau,0x21u,0x4eu,0x32u,0x40u,0x9cu,0x82u,0x9fu,0xdau,0x90u,0xfcu,0x14u,0x57u,0xb0u,0x35u,0xa6u,0x9eu,0xddu,0x50u,0xa5u,0xafu,0x3bu,0xf7u,0xf3u,0xacu,0x94u,0x7fu,0x0eu,0xe0u,0x93u,0xd1u,0x7fu,0xd4u,0x6fu,0x19u,0xa4u,0x59u,0xe0u,0xc2u,0xb5u,0x21u,0x4du,0xfcu,0xbfu,0x3fu,0x18u,0xe1u,0x72u,0xdeu,0xb3u,0x31u,0x00u,0x1cu,0x94u,0xb5u,0x3cu,0x4du,0x1du,0xe0u,0x02u,0x2eu,0x45u,0x2fu,0xdau,0x16u,0x3eu,0x8du,0xecu,0xccu,0x7au,0xa2u,0x24u,0xabu,0xcdu,0xa2u,0x34u,0x0bu,0xd7u,0xdeu,0x8bu,0x93u,0x9fu,0x33u,0x16u,0x4bu,0xf7u,0x39u,0x4cu,0xafu,0x7au,0x13u,0x20u,0x62u,0xa8u,0x5cu,0x80u,0x9fu,0xd6u,0x83u,0xb0u,0x9au,0x9eu,0x38u,0x43u,0x51u,0x39u,0x61u,0x20u,0x44u,0x5fu,0x4au,0x3bu,0x4fu,0xe8u,0xb3u,0x28u,0x46u, + /* SEQUENCE */ + 0x30u,0x47u, + /* n_RR (R^2 in order field) */ + 0x04u,0x42u,0x01u,0xeau,0x03u,0x91u,0xa3u,0x9au,0x5bu,0x5au,0x3au,0xfeu,0x8cu,0x44u,0x38u,0x3du,0x2du,0x8eu,0x03u,0xd1u,0x49u,0x2du,0x0du,0x45u,0x5bu,0xccu,0x6du,0x61u,0xa8u,0xe5u,0x67u,0xbcu,0xcfu,0xf3u,0xd1u,0x3du,0x47u,0x71u,0x0au,0x7fu,0x95u,0xe3u,0x35u,0x83u,0x8eu,0x57u,0xadu,0xa6u,0xe9u,0x91u,0x17u,0x1eu,0x2eu,0xf2u,0x1du,0x46u,0x42u,0xa2u,0x3fu,0xb7u,0x35u,0x1cu,0x54u,0x08u,0x56u,0xc0u,0xfbu,0xb8u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u,0x01u,0xc7u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt[1099] = { + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x47u, + /* groups parameter */ + 0x04u,0x01u,0x03u, + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x40u, + /* 2 * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x9eu,0x10u,0xc8u,0x12u,0x13u,0xbfu,0x3fu,0x34u,0x17u,0xe5u,0x94u,0x40u,0xa4u,0x61u,0x41u,0x3au,0x3au,0x01u,0x93u,0xcdu,0x8eu,0x66u,0x03u,0x1au,0x96u,0x37u,0x2au,0x82u,0xebu,0xb4u,0xdfu,0x4bu,0xd9u,0xd9u,0x02u,0x6du,0x37u,0x7au,0xaau,0x83u,0xd5u,0x08u,0x25u,0x1du,0x1au,0xe2u,0xd7u,0xa0u,0xe7u,0x97u,0xd1u,0xb2u,0x6bu,0x07u,0xecu,0xb3u,0xfau,0x1fu,0x1cu,0x99u,0xddu,0x36u,0xbcu,0x1eu,0x90u,0x00u,0x5du,0xc6u,0x63u,0xfcu,0x36u,0xd9u,0x33u,0x80u,0x53u,0xf9u,0xf6u,0x77u,0x77u,0x69u,0xf8u,0x5au,0xe3u,0x5au,0x88u,0x3eu,0x26u,0xd4u,0xbbu,0xa0u,0x55u,0x90u,0xd1u,0x4cu,0x83u,0x62u,0x16u,0xddu,0xd9u,0xf1u,0xbbu,0xefu,0x4fu,0x92u,0x8fu,0xb5u,0xc9u,0xc9u,0xbfu,0xd4u,0xcdu,0x19u,0x24u,0x7au,0x75u,0x7eu,0x5fu,0x4au,0xf6u,0xe0u,0x7au,0x7bu,0x8du,0xf1u,0xabu,0x6bu,0x30u,0xfau,0x0du,0x81u,0x3du, + /* (2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xe1u,0x51u,0x77u,0xdeu,0x42u,0x44u,0xaau,0x8eu,0xe7u,0x2cu,0xafu,0x4fu,0x9au,0x9bu,0x7fu,0x03u,0xd4u,0x89u,0x83u,0xe0u,0x29u,0xe1u,0x71u,0x95u,0x01u,0x11u,0xd0u,0x8cu,0xf0u,0x9eu,0x3du,0x8eu,0x89u,0xdcu,0x58u,0x7cu,0xbdu,0xbfu,0xb5u,0x83u,0x46u,0x90u,0x12u,0x37u,0x72u,0x61u,0x14u,0xe2u,0x5du,0x61u,0x01u,0xf7u,0x70u,0x19u,0x66u,0x03u,0x9bu,0x00u,0x2du,0x1bu,0xe3u,0xdcu,0x24u,0x50u,0x06u,0x01u,0x65u,0x10u,0x55u,0xa3u,0x7au,0x73u,0xf2u,0x90u,0xb4u,0x97u,0xb8u,0x96u,0x39u,0xecu,0x68u,0x80u,0x9cu,0x84u,0x3cu,0xa1u,0xf5u,0x24u,0xf1u,0x19u,0x88u,0x88u,0xbcu,0x65u,0x89u,0xa2u,0x47u,0xbcu,0x46u,0xbbu,0x90u,0x68u,0xfbu,0x9cu,0x8cu,0x39u,0xa4u,0x7au,0x03u,0x24u,0x05u,0x68u,0x26u,0xf0u,0x6du,0x0eu,0x2fu,0x9eu,0x40u,0xefu,0x93u,0x3bu,0x76u,0x91u,0x73u,0xdau,0x33u,0x84u,0x0du,0x7eu,0x96u, + /* (2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x36u,0x4fu,0xacu,0x85u,0x6du,0x00u,0xf2u,0x4eu,0x2fu,0x9du,0x89u,0x81u,0x04u,0x7fu,0x3eu,0x03u,0xa3u,0xcau,0x57u,0xb3u,0x54u,0x4fu,0x02u,0x99u,0x0fu,0x4du,0x2fu,0xf9u,0x33u,0xcbu,0x96u,0x58u,0x23u,0x27u,0x9bu,0xcbu,0xbcu,0xd9u,0x6cu,0x80u,0xcdu,0x03u,0x7au,0xd9u,0x19u,0x12u,0x6bu,0x32u,0xe2u,0xb7u,0x4bu,0x24u,0x91u,0x5bu,0x79u,0x51u,0x1eu,0x81u,0x09u,0xffu,0x6au,0x5eu,0x75u,0x85u,0x85u,0x01u,0x11u,0xc7u,0x8cu,0xd0u,0x72u,0x64u,0xbdu,0xbeu,0x73u,0x43u,0x7fu,0xe5u,0xc1u,0x20u,0x3eu,0x74u,0xfdu,0xa7u,0xe8u,0x16u,0x3bu,0xdau,0x93u,0xd5u,0x7cu,0xdeu,0x89u,0x23u,0xecu,0x09u,0xeau,0x5fu,0x93u,0x90u,0x79u,0x30u,0xd9u,0x54u,0x1cu,0x1au,0x37u,0x24u,0x98u,0x8cu,0xceu,0x93u,0xa2u,0x9eu,0x59u,0x84u,0x8au,0xb0u,0x1eu,0x24u,0xa6u,0x36u,0x82u,0x6du,0xfbu,0x8cu,0xfdu,0xb6u,0x74u,0xf7u,0xacu, + /* (2^348 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x8cu,0x2cu,0xfeu,0x90u,0x6fu,0x1cu,0x23u,0x3eu,0xb0u,0x76u,0xa1u,0xf7u,0x67u,0x7au,0x2bu,0xcau,0xf2u,0xa9u,0x17u,0xd7u,0xf9u,0xfbu,0x6cu,0x75u,0x42u,0xd9u,0x25u,0xe2u,0x3au,0x47u,0x4bu,0xd6u,0x9eu,0x7cu,0xd7u,0xa6u,0xf1u,0x60u,0xbcu,0x3au,0x70u,0x39u,0x54u,0xc0u,0x56u,0x3bu,0x54u,0x46u,0x87u,0x3eu,0xc2u,0xacu,0xddu,0xdeu,0x0bu,0xacu,0x33u,0x5eu,0xcdu,0x06u,0xe6u,0xb4u,0xc3u,0x4bu,0xf5u,0x00u,0xc8u,0xf0u,0x5bu,0xa3u,0x73u,0x91u,0xf1u,0x3cu,0x04u,0xfdu,0xb9u,0x06u,0x58u,0xfbu,0xaeu,0x48u,0x0eu,0xdfu,0x52u,0xedu,0x74u,0x05u,0x6du,0x5au,0x23u,0x44u,0x3fu,0x3au,0x46u,0x0cu,0xd3u,0xbau,0x05u,0x1cu,0x5cu,0xa9u,0xcdu,0x13u,0x11u,0x41u,0x96u,0x58u,0x5au,0xb8u,0x77u,0x44u,0xfcu,0x7au,0x9bu,0x98u,0xdeu,0x63u,0xffu,0x72u,0x2au,0x76u,0xf3u,0x16u,0x3bu,0x5cu,0xacu,0x74u,0x0cu,0x0eu,0x71u, + /* (2^348 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xecu,0x3fu,0x0au,0x19u,0xefu,0xbau,0xafu,0xccu,0x4bu,0xffu,0x94u,0x65u,0xc1u,0xecu,0x0fu,0xd3u,0xc4u,0xd2u,0x67u,0x22u,0xc6u,0xebu,0x0bu,0x8bu,0xa9u,0xc2u,0xd7u,0x7du,0x80u,0x23u,0xc4u,0x64u,0xe6u,0x9bu,0x15u,0xd9u,0x81u,0xbfu,0x6au,0x56u,0x90u,0xacu,0xe1u,0x97u,0x65u,0x81u,0xc6u,0xdau,0x53u,0x36u,0xa1u,0x3fu,0xa7u,0x4du,0x01u,0x90u,0x55u,0xabu,0x41u,0xcfu,0x26u,0xceu,0x39u,0xa8u,0x46u,0x01u,0xa4u,0xddu,0xdeu,0xe9u,0xb2u,0x92u,0x9eu,0x4cu,0x3au,0xfbu,0x96u,0x26u,0x73u,0x18u,0xf9u,0x04u,0xb5u,0x5au,0x4au,0xe0u,0x60u,0x58u,0xb7u,0xb0u,0x0cu,0x13u,0xfdu,0xe5u,0x80u,0x3fu,0xf9u,0x2bu,0x8eu,0x8bu,0x7eu,0xa1u,0x10u,0x43u,0xb2u,0x6cu,0xd9u,0xccu,0xe1u,0x02u,0x07u,0x04u,0xe1u,0xbfu,0x30u,0x42u,0x04u,0xc9u,0x37u,0xa8u,0xd9u,0xd0u,0x09u,0xe4u,0x8cu,0x82u,0x6du,0x1du,0xa3u,0xebu,0x46u, + /* (2^348 + 2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0x67u,0x9bu,0xa9u,0xddu,0x43u,0x03u,0xe7u,0xb4u,0x83u,0xc5u,0xd0u,0xbfu,0x7du,0x9eu,0xa6u,0x48u,0xe9u,0xd6u,0x8fu,0xabu,0xc3u,0xf7u,0x17u,0x61u,0x10u,0x10u,0x55u,0xcau,0x2du,0x38u,0xd5u,0xb4u,0x82u,0xffu,0xbcu,0x66u,0xbeu,0x23u,0x37u,0x84u,0x03u,0xdcu,0x85u,0x6cu,0xd5u,0xfeu,0x76u,0xc1u,0xf0u,0xf2u,0xc4u,0xf9u,0xe5u,0x54u,0x90u,0x7bu,0xaau,0xd2u,0xf4u,0x7au,0x32u,0x0du,0xbfu,0x04u,0x4eu,0x01u,0xb1u,0x9fu,0xfau,0x6fu,0xc9u,0x20u,0xbcu,0x36u,0x89u,0x33u,0x5bu,0x5cu,0xedu,0x2cu,0xc2u,0x1fu,0xabu,0x89u,0x1eu,0xccu,0xdeu,0xa4u,0x73u,0x38u,0xe9u,0xaau,0xa7u,0xd1u,0x7fu,0xc6u,0x95u,0xc1u,0xcbu,0x94u,0x4bu,0x6du,0x8fu,0x8bu,0x4bu,0x43u,0xa6u,0x4cu,0xa2u,0xb2u,0x17u,0xbbu,0xd4u,0x2eu,0xe9u,0x05u,0x9eu,0x84u,0x42u,0x2au,0x64u,0xbcu,0xdau,0xf1u,0xc8u,0xf1u,0x5cu,0xd9u,0x13u,0x00u,0x47u, + /* (2^348 + 2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x3bu,0x98u,0x9bu,0x87u,0x4du,0x06u,0x72u,0x8du,0x7au,0x77u,0x20u,0xa9u,0xd6u,0xf1u,0xf8u,0xbcu,0x3au,0x39u,0x6fu,0x04u,0x4fu,0xeau,0x08u,0x93u,0xbdu,0x35u,0x1bu,0xffu,0xccu,0xd7u,0x5eu,0xdeu,0x0du,0x6au,0xfau,0xe5u,0x34u,0x97u,0x4bu,0x61u,0x8au,0x5eu,0x2cu,0x93u,0xf8u,0x6cu,0xc8u,0x47u,0xe5u,0x1bu,0x51u,0xbau,0x32u,0x35u,0xe0u,0x22u,0x69u,0x2au,0xc5u,0xf6u,0xdcu,0x31u,0x1eu,0xe0u,0x3du,0x01u,0xefu,0xfbu,0x64u,0x11u,0x06u,0x31u,0x02u,0xb2u,0xe4u,0xb7u,0x21u,0xb7u,0x1au,0xc5u,0x63u,0xc7u,0x63u,0xb3u,0x2cu,0x08u,0x13u,0xdbu,0x35u,0x78u,0x45u,0x6cu,0xddu,0x7du,0xaau,0x9cu,0x0cu,0x45u,0x37u,0xfeu,0x2eu,0xf8u,0x73u,0x35u,0xdau,0x6du,0x3bu,0x6au,0x39u,0x48u,0x4fu,0xbbu,0xceu,0xdau,0xbau,0x6bu,0xb0u,0x6bu,0xccu,0xeau,0xdau,0xc2u,0x5fu,0x27u,0x0eu,0xedu,0x90u,0x57u,0x32u,0x5eu,0x2bu, + /* correction point D = - ((2^174 - 1) * G) in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0x3au,0x67u,0xe5u,0xe1u,0x41u,0xb5u,0x93u,0xf6u,0xc7u,0x9cu,0x37u,0x00u,0x20u,0x7du,0x83u,0xcbu,0x87u,0x5fu,0x2au,0x22u,0xdfu,0x95u,0x81u,0x8cu,0x5eu,0xa0u,0x2du,0x84u,0x05u,0xa4u,0xb3u,0x3au,0x69u,0x06u,0x98u,0xfdu,0xc0u,0x3eu,0xadu,0x83u,0x83u,0x40u,0x79u,0xadu,0x6eu,0xe1u,0x3bu,0x59u,0x60u,0xb4u,0x65u,0xb5u,0x96u,0x5bu,0xd5u,0x4eu,0x79u,0xf0u,0xf7u,0xb6u,0x57u,0x92u,0x99u,0x39u,0xd9u,0x00u,0x79u,0x0du,0x13u,0x65u,0x21u,0xb9u,0x51u,0x80u,0xeau,0xd6u,0x4bu,0xe9u,0x83u,0xc1u,0x3au,0x91u,0x3du,0x85u,0x8cu,0xf5u,0x0cu,0x74u,0x4cu,0x47u,0xe0u,0xc7u,0x32u,0x98u,0xd8u,0x5au,0xa2u,0x8eu,0xceu,0xbau,0xedu,0x8eu,0x3eu,0x9cu,0x05u,0xb2u,0x30u,0x35u,0x91u,0x13u,0xc2u,0x4cu,0xe3u,0x56u,0xebu,0x9cu,0xc0u,0x07u,0x2cu,0x68u,0x5cu,0x6fu,0xfau,0xb3u,0xd3u,0x55u,0xe3u,0x32u,0x37u,0xdfu,0x15u, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1Domain[432] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xacu, + /* version */ + 0x02u,0x01u,0x01u, + /* SEQUENCE */ + 0x30u,0x4du, + /* prime OID */ + 0x06u,0x07u,0x2au,0x86u,0x48u,0xceu,0x3du,0x01u,0x01u, + /* p (field prime) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a (coefficient a of the curve equation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u,0x42u,0x00u,0x51u,0x95u,0x3eu,0xb9u,0x61u,0x8eu,0x1cu,0x9au,0x1fu,0x92u,0x9au,0x21u,0xa0u,0xb6u,0x85u,0x40u,0xeeu,0xa2u,0xdau,0x72u,0x5bu,0x99u,0xb3u,0x15u,0xf3u,0xb8u,0xb4u,0x89u,0x91u,0x8eu,0xf1u,0x09u,0xe1u,0x56u,0x19u,0x39u,0x51u,0xecu,0x7eu,0x93u,0x7bu,0x16u,0x52u,0xc0u,0xbdu,0x3bu,0xb1u,0xbfu,0x07u,0x35u,0x73u,0xdfu,0x88u,0x3du,0x2cu,0x34u,0xf1u,0xefu,0x45u,0x1fu,0xd4u,0x6bu,0x50u,0x3fu,0x00u, + /* G (basepoint of the curve) */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xc6u,0x85u,0x8eu,0x06u,0xb7u,0x04u,0x04u,0xe9u,0xcdu,0x9eu,0x3eu,0xcbu,0x66u,0x23u,0x95u,0xb4u,0x42u,0x9cu,0x64u,0x81u,0x39u,0x05u,0x3fu,0xb5u,0x21u,0xf8u,0x28u,0xafu,0x60u,0x6bu,0x4du,0x3du,0xbau,0xa1u,0x4bu,0x5eu,0x77u,0xefu,0xe7u,0x59u,0x28u,0xfeu,0x1du,0xc1u,0x27u,0xa2u,0xffu,0xa8u,0xdeu,0x33u,0x48u,0xb3u,0xc1u,0x85u,0x6au,0x42u,0x9bu,0xf9u,0x7eu,0x7eu,0x31u,0xc2u,0xe5u,0xbdu,0x66u,0x01u,0x18u,0x39u,0x29u,0x6au,0x78u,0x9au,0x3bu,0xc0u,0x04u,0x5cu,0x8au,0x5fu,0xb4u,0x2cu,0x7du,0x1bu,0xd9u,0x98u,0xf5u,0x44u,0x49u,0x57u,0x9bu,0x44u,0x68u,0x17u,0xafu,0xbdu,0x17u,0x27u,0x3eu,0x66u,0x2cu,0x97u,0xeeu,0x72u,0x99u,0x5eu,0xf4u,0x26u,0x40u,0xc5u,0x50u,0xb9u,0x01u,0x3fu,0xadu,0x07u,0x61u,0x35u,0x3cu,0x70u,0x86u,0xa2u,0x72u,0xc2u,0x40u,0x88u,0xbeu,0x94u,0x76u,0x9fu,0xd1u,0x66u,0x50u, + /* n (order of G) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfau,0x51u,0x86u,0x87u,0x83u,0xbfu,0x2fu,0x96u,0x6bu,0x7fu,0xccu,0x01u,0x48u,0xf7u,0x09u,0xa5u,0xd0u,0x3bu,0xb5u,0xc9u,0xb8u,0x89u,0x9cu,0x47u,0xaeu,0xbbu,0x6fu,0xb7u,0x1eu,0x91u,0x38u,0x64u,0x09u, + /* h (cofactor) */ + 0x02u,0x01u,0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[429] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xa9u, + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0x5bu, + /* p_RR (R^2 in prime field) */ + 0x04u,0x42u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x40u,0x00u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u,0x02u,0x00u,0x01u, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a_R (a in Montgomery representation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfeu,0x7fu, + /* b_R (b in Montgomery representation) */ + 0x04u,0x42u,0x00u,0xcau,0x9fu,0x5cu,0xb0u,0xc7u,0x0eu,0x4du,0x0fu,0xc9u,0x4du,0x10u,0xd0u,0x5bu,0x42u,0xa0u,0x77u,0x51u,0x6du,0x39u,0x2du,0xccu,0xd9u,0x8au,0xf9u,0xdcu,0x5au,0x44u,0xc8u,0xc7u,0x78u,0x84u,0xf0u,0xabu,0x0cu,0x9cu,0xa8u,0xf6u,0x3fu,0x49u,0xbdu,0x8bu,0x29u,0x60u,0x5eu,0x9du,0xd8u,0xdfu,0x83u,0x9au,0xb9u,0xefu,0xc4u,0x1eu,0x96u,0x1au,0x78u,0xf7u,0xa2u,0x8fu,0xeau,0x35u,0xa8u,0x1fu,0x80u,0x14u, + /* G_R (G in Montgomery representation) */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x42u,0xc7u,0x03u,0x5bu,0x82u,0x02u,0x74u,0xe6u,0xcfu,0x1fu,0x65u,0xb3u,0x11u,0xcau,0xdau,0x21u,0x4eu,0x32u,0x40u,0x9cu,0x82u,0x9fu,0xdau,0x90u,0xfcu,0x14u,0x57u,0xb0u,0x35u,0xa6u,0x9eu,0xddu,0x50u,0xa5u,0xafu,0x3bu,0xf7u,0xf3u,0xacu,0x94u,0x7fu,0x0eu,0xe0u,0x93u,0xd1u,0x7fu,0xd4u,0x6fu,0x19u,0xa4u,0x59u,0xe0u,0xc2u,0xb5u,0x21u,0x4du,0xfcu,0xbfu,0x3fu,0x18u,0xe1u,0x72u,0xdeu,0xb3u,0x31u,0x00u,0x1cu,0x94u,0xb5u,0x3cu,0x4du,0x1du,0xe0u,0x02u,0x2eu,0x45u,0x2fu,0xdau,0x16u,0x3eu,0x8du,0xecu,0xccu,0x7au,0xa2u,0x24u,0xabu,0xcdu,0xa2u,0x34u,0x0bu,0xd7u,0xdeu,0x8bu,0x93u,0x9fu,0x33u,0x16u,0x4bu,0xf7u,0x39u,0x4cu,0xafu,0x7au,0x13u,0x20u,0x62u,0xa8u,0x5cu,0x80u,0x9fu,0xd6u,0x83u,0xb0u,0x9au,0x9eu,0x38u,0x43u,0x51u,0x39u,0x61u,0x20u,0x44u,0x5fu,0x4au,0x3bu,0x4fu,0xe8u,0xb3u,0x28u,0x46u, + /* SEQUENCE */ + 0x30u,0x48u, + /* n_RR (R^2 in order field) */ + 0x04u,0x42u,0x01u,0xeau,0x03u,0x91u,0xa3u,0x9au,0x5bu,0x5au,0x3au,0xfeu,0x8cu,0x44u,0x38u,0x3du,0x2du,0x8eu,0x03u,0xd1u,0x49u,0x2du,0x0du,0x45u,0x5bu,0xccu,0x6du,0x61u,0xa8u,0xe5u,0x67u,0xbcu,0xcfu,0xf3u,0xd1u,0x3du,0x47u,0x71u,0x0au,0x7fu,0x95u,0xe3u,0x35u,0x83u,0x8eu,0x57u,0xadu,0xa6u,0xe9u,0x91u,0x17u,0x1eu,0x2eu,0xf2u,0x1du,0x46u,0x42u,0xa2u,0x3fu,0xb7u,0x35u,0x1cu,0x54u,0x08u,0x56u,0xc0u,0xfbu,0xb8u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u,0x02u,0x95u,0xc7u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt[1099] = { + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x47u, + /* groups parameter */ + 0x04u,0x01u,0x03u, + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x40u, + /* 2 * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x9eu,0x10u,0xc8u,0x12u,0x13u,0xbfu,0x3fu,0x34u,0x17u,0xe5u,0x94u,0x40u,0xa4u,0x61u,0x41u,0x3au,0x3au,0x01u,0x93u,0xcdu,0x8eu,0x66u,0x03u,0x1au,0x96u,0x37u,0x2au,0x82u,0xebu,0xb4u,0xdfu,0x4bu,0xd9u,0xd9u,0x02u,0x6du,0x37u,0x7au,0xaau,0x83u,0xd5u,0x08u,0x25u,0x1du,0x1au,0xe2u,0xd7u,0xa0u,0xe7u,0x97u,0xd1u,0xb2u,0x6bu,0x07u,0xecu,0xb3u,0xfau,0x1fu,0x1cu,0x99u,0xddu,0x36u,0xbcu,0x1eu,0x90u,0x00u,0x5du,0xc6u,0x63u,0xfcu,0x36u,0xd9u,0x33u,0x80u,0x53u,0xf9u,0xf6u,0x77u,0x77u,0x69u,0xf8u,0x5au,0xe3u,0x5au,0x88u,0x3eu,0x26u,0xd4u,0xbbu,0xa0u,0x55u,0x90u,0xd1u,0x4cu,0x83u,0x62u,0x16u,0xddu,0xd9u,0xf1u,0xbbu,0xefu,0x4fu,0x92u,0x8fu,0xb5u,0xc9u,0xc9u,0xbfu,0xd4u,0xcdu,0x19u,0x24u,0x7au,0x75u,0x7eu,0x5fu,0x4au,0xf6u,0xe0u,0x7au,0x7bu,0x8du,0xf1u,0xabu,0x6bu,0x30u,0xfau,0x0du,0x81u,0x3du, + /* (2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xe1u,0x51u,0x77u,0xdeu,0x42u,0x44u,0xaau,0x8eu,0xe7u,0x2cu,0xafu,0x4fu,0x9au,0x9bu,0x7fu,0x03u,0xd4u,0x89u,0x83u,0xe0u,0x29u,0xe1u,0x71u,0x95u,0x01u,0x11u,0xd0u,0x8cu,0xf0u,0x9eu,0x3du,0x8eu,0x89u,0xdcu,0x58u,0x7cu,0xbdu,0xbfu,0xb5u,0x83u,0x46u,0x90u,0x12u,0x37u,0x72u,0x61u,0x14u,0xe2u,0x5du,0x61u,0x01u,0xf7u,0x70u,0x19u,0x66u,0x03u,0x9bu,0x00u,0x2du,0x1bu,0xe3u,0xdcu,0x24u,0x50u,0x06u,0x01u,0x65u,0x10u,0x55u,0xa3u,0x7au,0x73u,0xf2u,0x90u,0xb4u,0x97u,0xb8u,0x96u,0x39u,0xecu,0x68u,0x80u,0x9cu,0x84u,0x3cu,0xa1u,0xf5u,0x24u,0xf1u,0x19u,0x88u,0x88u,0xbcu,0x65u,0x89u,0xa2u,0x47u,0xbcu,0x46u,0xbbu,0x90u,0x68u,0xfbu,0x9cu,0x8cu,0x39u,0xa4u,0x7au,0x03u,0x24u,0x05u,0x68u,0x26u,0xf0u,0x6du,0x0eu,0x2fu,0x9eu,0x40u,0xefu,0x93u,0x3bu,0x76u,0x91u,0x73u,0xdau,0x33u,0x84u,0x0du,0x7eu,0x96u, + /* (2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x36u,0x4fu,0xacu,0x85u,0x6du,0x00u,0xf2u,0x4eu,0x2fu,0x9du,0x89u,0x81u,0x04u,0x7fu,0x3eu,0x03u,0xa3u,0xcau,0x57u,0xb3u,0x54u,0x4fu,0x02u,0x99u,0x0fu,0x4du,0x2fu,0xf9u,0x33u,0xcbu,0x96u,0x58u,0x23u,0x27u,0x9bu,0xcbu,0xbcu,0xd9u,0x6cu,0x80u,0xcdu,0x03u,0x7au,0xd9u,0x19u,0x12u,0x6bu,0x32u,0xe2u,0xb7u,0x4bu,0x24u,0x91u,0x5bu,0x79u,0x51u,0x1eu,0x81u,0x09u,0xffu,0x6au,0x5eu,0x75u,0x85u,0x85u,0x01u,0x11u,0xc7u,0x8cu,0xd0u,0x72u,0x64u,0xbdu,0xbeu,0x73u,0x43u,0x7fu,0xe5u,0xc1u,0x20u,0x3eu,0x74u,0xfdu,0xa7u,0xe8u,0x16u,0x3bu,0xdau,0x93u,0xd5u,0x7cu,0xdeu,0x89u,0x23u,0xecu,0x09u,0xeau,0x5fu,0x93u,0x90u,0x79u,0x30u,0xd9u,0x54u,0x1cu,0x1au,0x37u,0x24u,0x98u,0x8cu,0xceu,0x93u,0xa2u,0x9eu,0x59u,0x84u,0x8au,0xb0u,0x1eu,0x24u,0xa6u,0x36u,0x82u,0x6du,0xfbu,0x8cu,0xfdu,0xb6u,0x74u,0xf7u,0xacu, + /* (2^348 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x8cu,0x2cu,0xfeu,0x90u,0x6fu,0x1cu,0x23u,0x3eu,0xb0u,0x76u,0xa1u,0xf7u,0x67u,0x7au,0x2bu,0xcau,0xf2u,0xa9u,0x17u,0xd7u,0xf9u,0xfbu,0x6cu,0x75u,0x42u,0xd9u,0x25u,0xe2u,0x3au,0x47u,0x4bu,0xd6u,0x9eu,0x7cu,0xd7u,0xa6u,0xf1u,0x60u,0xbcu,0x3au,0x70u,0x39u,0x54u,0xc0u,0x56u,0x3bu,0x54u,0x46u,0x87u,0x3eu,0xc2u,0xacu,0xddu,0xdeu,0x0bu,0xacu,0x33u,0x5eu,0xcdu,0x06u,0xe6u,0xb4u,0xc3u,0x4bu,0xf5u,0x00u,0xc8u,0xf0u,0x5bu,0xa3u,0x73u,0x91u,0xf1u,0x3cu,0x04u,0xfdu,0xb9u,0x06u,0x58u,0xfbu,0xaeu,0x48u,0x0eu,0xdfu,0x52u,0xedu,0x74u,0x05u,0x6du,0x5au,0x23u,0x44u,0x3fu,0x3au,0x46u,0x0cu,0xd3u,0xbau,0x05u,0x1cu,0x5cu,0xa9u,0xcdu,0x13u,0x11u,0x41u,0x96u,0x58u,0x5au,0xb8u,0x77u,0x44u,0xfcu,0x7au,0x9bu,0x98u,0xdeu,0x63u,0xffu,0x72u,0x2au,0x76u,0xf3u,0x16u,0x3bu,0x5cu,0xacu,0x74u,0x0cu,0x0eu,0x71u, + /* (2^348 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xecu,0x3fu,0x0au,0x19u,0xefu,0xbau,0xafu,0xccu,0x4bu,0xffu,0x94u,0x65u,0xc1u,0xecu,0x0fu,0xd3u,0xc4u,0xd2u,0x67u,0x22u,0xc6u,0xebu,0x0bu,0x8bu,0xa9u,0xc2u,0xd7u,0x7du,0x80u,0x23u,0xc4u,0x64u,0xe6u,0x9bu,0x15u,0xd9u,0x81u,0xbfu,0x6au,0x56u,0x90u,0xacu,0xe1u,0x97u,0x65u,0x81u,0xc6u,0xdau,0x53u,0x36u,0xa1u,0x3fu,0xa7u,0x4du,0x01u,0x90u,0x55u,0xabu,0x41u,0xcfu,0x26u,0xceu,0x39u,0xa8u,0x46u,0x01u,0xa4u,0xddu,0xdeu,0xe9u,0xb2u,0x92u,0x9eu,0x4cu,0x3au,0xfbu,0x96u,0x26u,0x73u,0x18u,0xf9u,0x04u,0xb5u,0x5au,0x4au,0xe0u,0x60u,0x58u,0xb7u,0xb0u,0x0cu,0x13u,0xfdu,0xe5u,0x80u,0x3fu,0xf9u,0x2bu,0x8eu,0x8bu,0x7eu,0xa1u,0x10u,0x43u,0xb2u,0x6cu,0xd9u,0xccu,0xe1u,0x02u,0x07u,0x04u,0xe1u,0xbfu,0x30u,0x42u,0x04u,0xc9u,0x37u,0xa8u,0xd9u,0xd0u,0x09u,0xe4u,0x8cu,0x82u,0x6du,0x1du,0xa3u,0xebu,0x46u, + /* (2^348 + 2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0x67u,0x9bu,0xa9u,0xddu,0x43u,0x03u,0xe7u,0xb4u,0x83u,0xc5u,0xd0u,0xbfu,0x7du,0x9eu,0xa6u,0x48u,0xe9u,0xd6u,0x8fu,0xabu,0xc3u,0xf7u,0x17u,0x61u,0x10u,0x10u,0x55u,0xcau,0x2du,0x38u,0xd5u,0xb4u,0x82u,0xffu,0xbcu,0x66u,0xbeu,0x23u,0x37u,0x84u,0x03u,0xdcu,0x85u,0x6cu,0xd5u,0xfeu,0x76u,0xc1u,0xf0u,0xf2u,0xc4u,0xf9u,0xe5u,0x54u,0x90u,0x7bu,0xaau,0xd2u,0xf4u,0x7au,0x32u,0x0du,0xbfu,0x04u,0x4eu,0x01u,0xb1u,0x9fu,0xfau,0x6fu,0xc9u,0x20u,0xbcu,0x36u,0x89u,0x33u,0x5bu,0x5cu,0xedu,0x2cu,0xc2u,0x1fu,0xabu,0x89u,0x1eu,0xccu,0xdeu,0xa4u,0x73u,0x38u,0xe9u,0xaau,0xa7u,0xd1u,0x7fu,0xc6u,0x95u,0xc1u,0xcbu,0x94u,0x4bu,0x6du,0x8fu,0x8bu,0x4bu,0x43u,0xa6u,0x4cu,0xa2u,0xb2u,0x17u,0xbbu,0xd4u,0x2eu,0xe9u,0x05u,0x9eu,0x84u,0x42u,0x2au,0x64u,0xbcu,0xdau,0xf1u,0xc8u,0xf1u,0x5cu,0xd9u,0x13u,0x00u,0x47u, + /* (2^348 + 2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x3bu,0x98u,0x9bu,0x87u,0x4du,0x06u,0x72u,0x8du,0x7au,0x77u,0x20u,0xa9u,0xd6u,0xf1u,0xf8u,0xbcu,0x3au,0x39u,0x6fu,0x04u,0x4fu,0xeau,0x08u,0x93u,0xbdu,0x35u,0x1bu,0xffu,0xccu,0xd7u,0x5eu,0xdeu,0x0du,0x6au,0xfau,0xe5u,0x34u,0x97u,0x4bu,0x61u,0x8au,0x5eu,0x2cu,0x93u,0xf8u,0x6cu,0xc8u,0x47u,0xe5u,0x1bu,0x51u,0xbau,0x32u,0x35u,0xe0u,0x22u,0x69u,0x2au,0xc5u,0xf6u,0xdcu,0x31u,0x1eu,0xe0u,0x3du,0x01u,0xefu,0xfbu,0x64u,0x11u,0x06u,0x31u,0x02u,0xb2u,0xe4u,0xb7u,0x21u,0xb7u,0x1au,0xc5u,0x63u,0xc7u,0x63u,0xb3u,0x2cu,0x08u,0x13u,0xdbu,0x35u,0x78u,0x45u,0x6cu,0xddu,0x7du,0xaau,0x9cu,0x0cu,0x45u,0x37u,0xfeu,0x2eu,0xf8u,0x73u,0x35u,0xdau,0x6du,0x3bu,0x6au,0x39u,0x48u,0x4fu,0xbbu,0xceu,0xdau,0xbau,0x6bu,0xb0u,0x6bu,0xccu,0xeau,0xdau,0xc2u,0x5fu,0x27u,0x0eu,0xedu,0x90u,0x57u,0x32u,0x5eu,0x2bu, + /* correction point D = - ((2^174 - 1) * G) in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0x3au,0x67u,0xe5u,0xe1u,0x41u,0xb5u,0x93u,0xf6u,0xc7u,0x9cu,0x37u,0x00u,0x20u,0x7du,0x83u,0xcbu,0x87u,0x5fu,0x2au,0x22u,0xdfu,0x95u,0x81u,0x8cu,0x5eu,0xa0u,0x2du,0x84u,0x05u,0xa4u,0xb3u,0x3au,0x69u,0x06u,0x98u,0xfdu,0xc0u,0x3eu,0xadu,0x83u,0x83u,0x40u,0x79u,0xadu,0x6eu,0xe1u,0x3bu,0x59u,0x60u,0xb4u,0x65u,0xb5u,0x96u,0x5bu,0xd5u,0x4eu,0x79u,0xf0u,0xf7u,0xb6u,0x57u,0x92u,0x99u,0x39u,0xd9u,0x00u,0x79u,0x0du,0x13u,0x65u,0x21u,0xb9u,0x51u,0x80u,0xeau,0xd6u,0x4bu,0xe9u,0x83u,0xc1u,0x3au,0x91u,0x3du,0x85u,0x8cu,0xf5u,0x0cu,0x74u,0x4cu,0x47u,0xe0u,0xc7u,0x32u,0x98u,0xd8u,0x5au,0xa2u,0x8eu,0xceu,0xbau,0xedu,0x8eu,0x3eu,0x9cu,0x05u,0xb2u,0x30u,0x35u,0x91u,0x13u,0xc2u,0x4cu,0xe3u,0x56u,0xebu,0x9cu,0xc0u,0x07u,0x2cu,0x68u,0x5cu,0x6fu,0xfau,0xb3u,0xd3u,0x55u,0xe3u,0x32u,0x37u,0xdfu,0x15u, +}; + +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1Domain[432] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xacu, + /* version */ + 0x02u,0x01u,0x01u, + /* SEQUENCE */ + 0x30u,0x4du, + /* prime OID */ + 0x06u,0x07u,0x2au,0x86u,0x48u,0xceu,0x3du,0x01u,0x01u, + /* p (field prime) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a (coefficient a of the curve equation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfcu, + /* b (coefficient b of the curve equation) */ + 0x04u,0x42u,0x00u,0x51u,0x95u,0x3eu,0xb9u,0x61u,0x8eu,0x1cu,0x9au,0x1fu,0x92u,0x9au,0x21u,0xa0u,0xb6u,0x85u,0x40u,0xeeu,0xa2u,0xdau,0x72u,0x5bu,0x99u,0xb3u,0x15u,0xf3u,0xb8u,0xb4u,0x89u,0x91u,0x8eu,0xf1u,0x09u,0xe1u,0x56u,0x19u,0x39u,0x51u,0xecu,0x7eu,0x93u,0x7bu,0x16u,0x52u,0xc0u,0xbdu,0x3bu,0xb1u,0xbfu,0x07u,0x35u,0x73u,0xdfu,0x88u,0x3du,0x2cu,0x34u,0xf1u,0xefu,0x45u,0x1fu,0xd4u,0x6bu,0x50u,0x3fu,0x00u, + /* G (basepoint of the curve) */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xc6u,0x85u,0x8eu,0x06u,0xb7u,0x04u,0x04u,0xe9u,0xcdu,0x9eu,0x3eu,0xcbu,0x66u,0x23u,0x95u,0xb4u,0x42u,0x9cu,0x64u,0x81u,0x39u,0x05u,0x3fu,0xb5u,0x21u,0xf8u,0x28u,0xafu,0x60u,0x6bu,0x4du,0x3du,0xbau,0xa1u,0x4bu,0x5eu,0x77u,0xefu,0xe7u,0x59u,0x28u,0xfeu,0x1du,0xc1u,0x27u,0xa2u,0xffu,0xa8u,0xdeu,0x33u,0x48u,0xb3u,0xc1u,0x85u,0x6au,0x42u,0x9bu,0xf9u,0x7eu,0x7eu,0x31u,0xc2u,0xe5u,0xbdu,0x66u,0x01u,0x18u,0x39u,0x29u,0x6au,0x78u,0x9au,0x3bu,0xc0u,0x04u,0x5cu,0x8au,0x5fu,0xb4u,0x2cu,0x7du,0x1bu,0xd9u,0x98u,0xf5u,0x44u,0x49u,0x57u,0x9bu,0x44u,0x68u,0x17u,0xafu,0xbdu,0x17u,0x27u,0x3eu,0x66u,0x2cu,0x97u,0xeeu,0x72u,0x99u,0x5eu,0xf4u,0x26u,0x40u,0xc5u,0x50u,0xb9u,0x01u,0x3fu,0xadu,0x07u,0x61u,0x35u,0x3cu,0x70u,0x86u,0xa2u,0x72u,0xc2u,0x40u,0x88u,0xbeu,0x94u,0x76u,0x9fu,0xd1u,0x66u,0x50u, + /* n (order of G) */ + 0x02u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfau,0x51u,0x86u,0x87u,0x83u,0xbfu,0x2fu,0x96u,0x6bu,0x7fu,0xccu,0x01u,0x48u,0xf7u,0x09u,0xa5u,0xd0u,0x3bu,0xb5u,0xc9u,0xb8u,0x89u,0x9cu,0x47u,0xaeu,0xbbu,0x6fu,0xb7u,0x1eu,0x91u,0x38u,0x64u,0x09u, + /* h (cofactor) */ + 0x02u,0x01u,0x01u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[433] = { + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0xadu, + /* SEQUENCE */ + 0x30u,0x82u,0x01u,0x5du, + /* p_RR (R^2 in prime field) */ + 0x04u,0x42u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x40u,0x00u,0x00u,0x00u,0x00u,0x00u, + /* p_bar (low digit of -(p^-1)) */ + 0x04u,0x04u,0x00u,0x00u,0x00u,0x01u, + /* SEQUENCE */ + 0x30u,0x81u,0x88u, + /* a_R (a in Montgomery representation) */ + 0x04u,0x42u,0x01u,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xffu,0xfeu,0x7fu,0xffu,0xffu, + /* b_R (b in Montgomery representation) */ + 0x04u,0x42u,0x01u,0x5cu,0xb0u,0xc7u,0x0eu,0x4du,0x0fu,0xc9u,0x4du,0x10u,0xd0u,0x5bu,0x42u,0xa0u,0x77u,0x51u,0x6du,0x39u,0x2du,0xccu,0xd9u,0x8au,0xf9u,0xdcu,0x5au,0x44u,0xc8u,0xc7u,0x78u,0x84u,0xf0u,0xabu,0x0cu,0x9cu,0xa8u,0xf6u,0x3fu,0x49u,0xbdu,0x8bu,0x29u,0x60u,0x5eu,0x9du,0xd8u,0xdfu,0x83u,0x9au,0xb9u,0xefu,0xc4u,0x1eu,0x96u,0x1au,0x78u,0xf7u,0xa2u,0x8fu,0xeau,0x35u,0xa8u,0x1fu,0x80u,0x14u,0x65u,0x4fu, + /* G_R (G in Montgomery representation) */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x03u,0x5bu,0x82u,0x02u,0x74u,0xe6u,0xcfu,0x1fu,0x65u,0xb3u,0x11u,0xcau,0xdau,0x21u,0x4eu,0x32u,0x40u,0x9cu,0x82u,0x9fu,0xdau,0x90u,0xfcu,0x14u,0x57u,0xb0u,0x35u,0xa6u,0x9eu,0xddu,0x50u,0xa5u,0xafu,0x3bu,0xf7u,0xf3u,0xacu,0x94u,0x7fu,0x0eu,0xe0u,0x93u,0xd1u,0x7fu,0xd4u,0x6fu,0x19u,0xa4u,0x59u,0xe0u,0xc2u,0xb5u,0x21u,0x4du,0xfcu,0xbfu,0x3fu,0x18u,0xe1u,0x72u,0xdeu,0xb3u,0x31u,0xa1u,0x63u,0x00u,0xb5u,0x3cu,0x4du,0x1du,0xe0u,0x02u,0x2eu,0x45u,0x2fu,0xdau,0x16u,0x3eu,0x8du,0xecu,0xccu,0x7au,0xa2u,0x24u,0xabu,0xcdu,0xa2u,0x34u,0x0bu,0xd7u,0xdeu,0x8bu,0x93u,0x9fu,0x33u,0x16u,0x4bu,0xf7u,0x39u,0x4cu,0xafu,0x7au,0x13u,0x20u,0x62u,0xa8u,0x5cu,0x80u,0x9fu,0xd6u,0x83u,0xb0u,0x9au,0x9eu,0x38u,0x43u,0x51u,0x39u,0x61u,0x20u,0x44u,0x5fu,0x4au,0x3bu,0x4fu,0xe8u,0xb3u,0x28u,0x46u,0x0eu,0x4au, + /* SEQUENCE */ + 0x30u,0x4au, + /* n_RR (R^2 in order field) */ + 0x04u,0x42u,0x01u,0x9au,0x5bu,0x5au,0x3au,0xfeu,0x8cu,0x44u,0x38u,0x3du,0x2du,0x8eu,0x03u,0xd1u,0x49u,0x2du,0x0du,0x45u,0x5bu,0xccu,0x6du,0x61u,0xa8u,0xe5u,0x67u,0xbcu,0xcfu,0xf3u,0xd1u,0x42u,0xb7u,0x75u,0x6eu,0x3au,0x4fu,0xb3u,0x5bu,0x72u,0xd3u,0x40u,0x27u,0x05u,0x5du,0x4du,0xd6u,0xd3u,0x07u,0x91u,0xd9u,0xdcu,0x18u,0x35u,0x4au,0x56u,0x43u,0x74u,0xa6u,0x42u,0x11u,0x63u,0x11u,0x5au,0x61u,0xc6u,0x4cu,0xa7u, + /* n_bar (low digit of -(n^-1)) */ + 0x04u,0x04u,0x79u,0xa9u,0x95u,0xc7u, +}; +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt[1099] = { + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x47u, + /* groups parameter */ + 0x04u,0x01u,0x03u, + /* SEQUENCE */ + 0x30u,0x82u,0x04u,0x40u, + /* 2 * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xc8u,0x12u,0x13u,0xbfu,0x3fu,0x34u,0x17u,0xe5u,0x94u,0x40u,0xa4u,0x61u,0x41u,0x3au,0x3au,0x01u,0x93u,0xcdu,0x8eu,0x66u,0x03u,0x1au,0x96u,0x37u,0x2au,0x82u,0xebu,0xb4u,0xdfu,0x4bu,0xd9u,0xd9u,0x02u,0x6du,0x37u,0x7au,0xaau,0x83u,0xd5u,0x08u,0x25u,0x1du,0x1au,0xe2u,0xd7u,0xa0u,0xe7u,0x97u,0xd1u,0xb2u,0x6bu,0x07u,0xecu,0xb3u,0xfau,0x1fu,0x1cu,0x99u,0xddu,0x36u,0xbcu,0x1eu,0x90u,0xcfu,0x08u,0x00u,0x63u,0xfcu,0x36u,0xd9u,0x33u,0x80u,0x53u,0xf9u,0xf6u,0x77u,0x77u,0x69u,0xf8u,0x5au,0xe3u,0x5au,0x88u,0x3eu,0x26u,0xd4u,0xbbu,0xa0u,0x55u,0x90u,0xd1u,0x4cu,0x83u,0x62u,0x16u,0xddu,0xd9u,0xf1u,0xbbu,0xefu,0x4fu,0x92u,0x8fu,0xb5u,0xc9u,0xc9u,0xbfu,0xd4u,0xcdu,0x19u,0x24u,0x7au,0x75u,0x7eu,0x5fu,0x4au,0xf6u,0xe0u,0x7au,0x7bu,0x8du,0xf1u,0xabu,0x6bu,0x30u,0xfau,0x0du,0x81u,0x3du,0x2eu,0xe3u, + /* (2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x77u,0xdeu,0x42u,0x44u,0xaau,0x8eu,0xe7u,0x2cu,0xafu,0x4fu,0x9au,0x9bu,0x7fu,0x03u,0xd4u,0x89u,0x83u,0xe0u,0x29u,0xe1u,0x71u,0x95u,0x01u,0x11u,0xd0u,0x8cu,0xf0u,0x9eu,0x3du,0x8eu,0x89u,0xdcu,0x58u,0x7cu,0xbdu,0xbfu,0xb5u,0x83u,0x46u,0x90u,0x12u,0x37u,0x72u,0x61u,0x14u,0xe2u,0x5du,0x61u,0x01u,0xf7u,0x70u,0x19u,0x66u,0x03u,0x9bu,0x00u,0x2du,0x1bu,0xe3u,0xdcu,0x24u,0x50u,0x06u,0x70u,0xa8u,0x00u,0x55u,0xa3u,0x7au,0x73u,0xf2u,0x90u,0xb4u,0x97u,0xb8u,0x96u,0x39u,0xecu,0x68u,0x80u,0x9cu,0x84u,0x3cu,0xa1u,0xf5u,0x24u,0xf1u,0x19u,0x88u,0x88u,0xbcu,0x65u,0x89u,0xa2u,0x47u,0xbcu,0x46u,0xbbu,0x90u,0x68u,0xfbu,0x9cu,0x8cu,0x39u,0xa4u,0x7au,0x03u,0x24u,0x05u,0x68u,0x26u,0xf0u,0x6du,0x0eu,0x2fu,0x9eu,0x40u,0xefu,0x93u,0x3bu,0x76u,0x91u,0x73u,0xdau,0x33u,0x84u,0x0du,0x7eu,0x96u,0xb2u,0x88u, + /* (2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0xacu,0x85u,0x6du,0x00u,0xf2u,0x4eu,0x2fu,0x9du,0x89u,0x81u,0x04u,0x7fu,0x3eu,0x03u,0xa3u,0xcau,0x57u,0xb3u,0x54u,0x4fu,0x02u,0x99u,0x0fu,0x4du,0x2fu,0xf9u,0x33u,0xcbu,0x96u,0x58u,0x23u,0x27u,0x9bu,0xcbu,0xbcu,0xd9u,0x6cu,0x80u,0xcdu,0x03u,0x7au,0xd9u,0x19u,0x12u,0x6bu,0x32u,0xe2u,0xb7u,0x4bu,0x24u,0x91u,0x5bu,0x79u,0x51u,0x1eu,0x81u,0x09u,0xffu,0x6au,0x5eu,0x75u,0x85u,0x85u,0x9bu,0x27u,0x01u,0x8cu,0xd0u,0x72u,0x64u,0xbdu,0xbeu,0x73u,0x43u,0x7fu,0xe5u,0xc1u,0x20u,0x3eu,0x74u,0xfdu,0xa7u,0xe8u,0x16u,0x3bu,0xdau,0x93u,0xd5u,0x7cu,0xdeu,0x89u,0x23u,0xecu,0x09u,0xeau,0x5fu,0x93u,0x90u,0x79u,0x30u,0xd9u,0x54u,0x1cu,0x1au,0x37u,0x24u,0x98u,0x8cu,0xceu,0x93u,0xa2u,0x9eu,0x59u,0x84u,0x8au,0xb0u,0x1eu,0x24u,0xa6u,0x36u,0x82u,0x6du,0xfbu,0x8cu,0xfdu,0xb6u,0x74u,0xf7u,0xacu,0x88u,0xe3u, + /* (2^348 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0xfeu,0x90u,0x6fu,0x1cu,0x23u,0x3eu,0xb0u,0x76u,0xa1u,0xf7u,0x67u,0x7au,0x2bu,0xcau,0xf2u,0xa9u,0x17u,0xd7u,0xf9u,0xfbu,0x6cu,0x75u,0x42u,0xd9u,0x25u,0xe2u,0x3au,0x47u,0x4bu,0xd6u,0x9eu,0x7cu,0xd7u,0xa6u,0xf1u,0x60u,0xbcu,0x3au,0x70u,0x39u,0x54u,0xc0u,0x56u,0x3bu,0x54u,0x46u,0x87u,0x3eu,0xc2u,0xacu,0xddu,0xdeu,0x0bu,0xacu,0x33u,0x5eu,0xcdu,0x06u,0xe6u,0xb4u,0xc3u,0x4bu,0xf5u,0xc6u,0x16u,0x00u,0x5bu,0xa3u,0x73u,0x91u,0xf1u,0x3cu,0x04u,0xfdu,0xb9u,0x06u,0x58u,0xfbu,0xaeu,0x48u,0x0eu,0xdfu,0x52u,0xedu,0x74u,0x05u,0x6du,0x5au,0x23u,0x44u,0x3fu,0x3au,0x46u,0x0cu,0xd3u,0xbau,0x05u,0x1cu,0x5cu,0xa9u,0xcdu,0x13u,0x11u,0x41u,0x96u,0x58u,0x5au,0xb8u,0x77u,0x44u,0xfcu,0x7au,0x9bu,0x98u,0xdeu,0x63u,0xffu,0x72u,0x2au,0x76u,0xf3u,0x16u,0x3bu,0x5cu,0xacu,0x74u,0x0cu,0x0eu,0x71u,0x64u,0x78u, + /* (2^348 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0x0au,0x19u,0xefu,0xbau,0xafu,0xccu,0x4bu,0xffu,0x94u,0x65u,0xc1u,0xecu,0x0fu,0xd3u,0xc4u,0xd2u,0x67u,0x22u,0xc6u,0xebu,0x0bu,0x8bu,0xa9u,0xc2u,0xd7u,0x7du,0x80u,0x23u,0xc4u,0x64u,0xe6u,0x9bu,0x15u,0xd9u,0x81u,0xbfu,0x6au,0x56u,0x90u,0xacu,0xe1u,0x97u,0x65u,0x81u,0xc6u,0xdau,0x53u,0x36u,0xa1u,0x3fu,0xa7u,0x4du,0x01u,0x90u,0x55u,0xabu,0x41u,0xcfu,0x26u,0xceu,0x39u,0xa8u,0x46u,0x76u,0x1fu,0x01u,0xdeu,0xe9u,0xb2u,0x92u,0x9eu,0x4cu,0x3au,0xfbu,0x96u,0x26u,0x73u,0x18u,0xf9u,0x04u,0xb5u,0x5au,0x4au,0xe0u,0x60u,0x58u,0xb7u,0xb0u,0x0cu,0x13u,0xfdu,0xe5u,0x80u,0x3fu,0xf9u,0x2bu,0x8eu,0x8bu,0x7eu,0xa1u,0x10u,0x43u,0xb2u,0x6cu,0xd9u,0xccu,0xe1u,0x02u,0x07u,0x04u,0xe1u,0xbfu,0x30u,0x42u,0x04u,0xc9u,0x37u,0xa8u,0xd9u,0xd0u,0x09u,0xe4u,0x8cu,0x82u,0x6du,0x1du,0xa3u,0xebu,0x46u,0xd2u,0x6eu, + /* (2^348 + 2^174 + 1) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0xa9u,0xddu,0x43u,0x03u,0xe7u,0xb4u,0x83u,0xc5u,0xd0u,0xbfu,0x7du,0x9eu,0xa6u,0x48u,0xe9u,0xd6u,0x8fu,0xabu,0xc3u,0xf7u,0x17u,0x61u,0x10u,0x10u,0x55u,0xcau,0x2du,0x38u,0xd5u,0xb4u,0x82u,0xffu,0xbcu,0x66u,0xbeu,0x23u,0x37u,0x84u,0x03u,0xdcu,0x85u,0x6cu,0xd5u,0xfeu,0x76u,0xc1u,0xf0u,0xf2u,0xc4u,0xf9u,0xe5u,0x54u,0x90u,0x7bu,0xaau,0xd2u,0xf4u,0x7au,0x32u,0x0du,0xbfu,0x04u,0x4eu,0x33u,0xcdu,0x01u,0xfau,0x6fu,0xc9u,0x20u,0xbcu,0x36u,0x89u,0x33u,0x5bu,0x5cu,0xedu,0x2cu,0xc2u,0x1fu,0xabu,0x89u,0x1eu,0xccu,0xdeu,0xa4u,0x73u,0x38u,0xe9u,0xaau,0xa7u,0xd1u,0x7fu,0xc6u,0x95u,0xc1u,0xcbu,0x94u,0x4bu,0x6du,0x8fu,0x8bu,0x4bu,0x43u,0xa6u,0x4cu,0xa2u,0xb2u,0x17u,0xbbu,0xd4u,0x2eu,0xe9u,0x05u,0x9eu,0x84u,0x42u,0x2au,0x64u,0xbcu,0xdau,0xf1u,0xc8u,0xf1u,0x5cu,0xd9u,0x13u,0x00u,0x47u,0xd8u,0xcfu, + /* (2^348 + 2^174 + 2) * G in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x00u,0x9bu,0x87u,0x4du,0x06u,0x72u,0x8du,0x7au,0x77u,0x20u,0xa9u,0xd6u,0xf1u,0xf8u,0xbcu,0x3au,0x39u,0x6fu,0x04u,0x4fu,0xeau,0x08u,0x93u,0xbdu,0x35u,0x1bu,0xffu,0xccu,0xd7u,0x5eu,0xdeu,0x0du,0x6au,0xfau,0xe5u,0x34u,0x97u,0x4bu,0x61u,0x8au,0x5eu,0x2cu,0x93u,0xf8u,0x6cu,0xc8u,0x47u,0xe5u,0x1bu,0x51u,0xbau,0x32u,0x35u,0xe0u,0x22u,0x69u,0x2au,0xc5u,0xf6u,0xdcu,0x31u,0x1eu,0xe0u,0x3du,0x9du,0xccu,0x01u,0x64u,0x11u,0x06u,0x31u,0x02u,0xb2u,0xe4u,0xb7u,0x21u,0xb7u,0x1au,0xc5u,0x63u,0xc7u,0x63u,0xb3u,0x2cu,0x08u,0x13u,0xdbu,0x35u,0x78u,0x45u,0x6cu,0xddu,0x7du,0xaau,0x9cu,0x0cu,0x45u,0x37u,0xfeu,0x2eu,0xf8u,0x73u,0x35u,0xdau,0x6du,0x3bu,0x6au,0x39u,0x48u,0x4fu,0xbbu,0xceu,0xdau,0xbau,0x6bu,0xb0u,0x6bu,0xccu,0xeau,0xdau,0xc2u,0x5fu,0x27u,0x0eu,0xedu,0x90u,0x57u,0x32u,0x5eu,0x2bu,0xf7u,0xfdu, + /* correction point D = - ((2^174 - 1) * G) in Montgomery representation */ + 0x04u,0x81u,0x85u,0x04u,0x01u,0xe5u,0xe1u,0x41u,0xb5u,0x93u,0xf6u,0xc7u,0x9cu,0x37u,0x00u,0x20u,0x7du,0x83u,0xcbu,0x87u,0x5fu,0x2au,0x22u,0xdfu,0x95u,0x81u,0x8cu,0x5eu,0xa0u,0x2du,0x84u,0x05u,0xa4u,0xb3u,0x3au,0x69u,0x06u,0x98u,0xfdu,0xc0u,0x3eu,0xadu,0x83u,0x83u,0x40u,0x79u,0xadu,0x6eu,0xe1u,0x3bu,0x59u,0x60u,0xb4u,0x65u,0xb5u,0x96u,0x5bu,0xd5u,0x4eu,0x79u,0xf0u,0xf7u,0xb6u,0x57u,0x92u,0x99u,0x39u,0xd9u,0x1du,0x33u,0x01u,0x13u,0x65u,0x21u,0xb9u,0x51u,0x80u,0xeau,0xd6u,0x4bu,0xe9u,0x83u,0xc1u,0x3au,0x91u,0x3du,0x85u,0x8cu,0xf5u,0x0cu,0x74u,0x4cu,0x47u,0xe0u,0xc7u,0x32u,0x98u,0xd8u,0x5au,0xa2u,0x8eu,0xceu,0xbau,0xedu,0x8eu,0x3eu,0x9cu,0x05u,0xb2u,0x30u,0x35u,0x91u,0x13u,0xc2u,0x4cu,0xe3u,0x56u,0xebu,0x9cu,0xc0u,0x07u,0x2cu,0x68u,0x5cu,0x6fu,0xfau,0xb3u,0xd3u,0x55u,0xe3u,0x32u,0x37u,0xdfu,0x15u,0x3cu,0x86u, +}; +#else /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +# error "Value of CRYPTO_30_LIBCV_BYTES_PER_DIGIT is not supported" +#endif /* CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +/* NIST_SEC_p521r1 END *********************************************************************************************/ + +/* Edwards448 START **************************************************************************************************/ +/* group order: + * q = 2^446 - 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d + * = 181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779 + * = 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7CCA23E9C44EDB49AED63690216CC2728DC58F552378C292AB5844F3 + * (446 bit long) + */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveEdwards448GroupOrder[56] = +{ + 0xabu, 0x58u, 0x44u, 0xf3u, 0x23u, 0x78u, 0xc2u, 0x92u, 0x8du, 0xc5u, 0x8fu, 0x55u, 0x21u, 0x6cu, 0xc2u, 0x72u, + 0xaeu, 0xd6u, 0x36u, 0x90u, 0xc4u, 0x4eu, 0xdbu, 0x49u, 0x7cu, 0xcau, 0x23u, 0xe9u, 0xffu, 0xffu, 0xffu, 0xffu, + 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, + 0xffu, 0xffu, 0xffu, 0xffu, 0x3fu, 0xffu, 0xffu, 0xffu +}; +/* Edwards448 END ****************************************************************************************************/ + +/* Sm2p256v1 START *********************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * The curve params in shorthand notation: + * Name: Sm2p256v1 + * p: 0xfffffffe ffffffff ffffffff ffffffff ffffffff 00000000 ffffffff ffffffff + * a: 0xfffffffe ffffffff ffffffff ffffffff ffffffff 00000000 ffffffff fffffffc + * b: 0x28e9fa9e 9d9f5e34 4d5a9e4b cf6509a7 f39789f5 15ab8f92 ddbcbd41 4d940e93 + * Gx: 0x32c4ae2c 1f198119 5f990446 6a39c994 8fe30bbf f2660be1 715a4589 334c74c7 + * Gy: 0xbc3736a2 f4f6779c 59bdcee3 6b692153 d0a9877c c62a4740 02df32e5 2139f0a0 + * n: 0xfffffffe ffffffff ffffffff ffffffff 7203df6b 21c6052b 53bbf409 39d54123 + * h: 0x01 + */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1Domain[227] = +{ + /* SEQUENCE */ + 0x30,0x81,0xe0, + /* version */ + 0x02,0x01,0x01, + /* SEQUENCE */ + 0x30,0x2c, + /* prime OID */ + 0x06,0x07,0x2a,0x86,0x48,0xce,0x3d,0x01,0x01, + /* p (field prime) */ + 0x02,0x21,0x00,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, + /* SEQUENCE */ + 0x30,0x44, + /* a (coefficient a of the curve equation) */ + 0x04,0x20,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc, + /* b (coefficient b of the curve equation) */ + 0x04,0x20,0x28,0xe9,0xfa,0x9e,0x9d,0x9f,0x5e,0x34,0x4d,0x5a,0x9e,0x4b,0xcf,0x65,0x09,0xa7,0xf3,0x97,0x89,0xf5,0x15,0xab,0x8f,0x92,0xdd,0xbc,0xbd,0x41,0x4d,0x94,0x0e,0x93, + /* G (basepoint of the curve) */ + 0x04,0x41,0x04,0x32,0xc4,0xae,0x2c,0x1f,0x19,0x81,0x19,0x5f,0x99,0x04,0x46,0x6a,0x39,0xc9,0x94,0x8f,0xe3,0x0b,0xbf,0xf2,0x66,0x0b,0xe1,0x71,0x5a,0x45,0x89,0x33,0x4c,0x74,0xc7,0xbc,0x37,0x36,0xa2,0xf4,0xf6,0x77,0x9c,0x59,0xbd,0xce,0xe3,0x6b,0x69,0x21,0x53,0xd0,0xa9,0x87,0x7c,0xc6,0x2a,0x47,0x40,0x02,0xdf,0x32,0xe5,0x21,0x39,0xf0,0xa0, + /* n (order of G) */ + 0x02,0x21,0x00,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x72,0x03,0xdf,0x6b,0x21,0xc6,0x05,0x2b,0x53,0xbb,0xf4,0x09,0x39,0xd5,0x41,0x23, + /* h (cofactor) */ + 0x02,0x01,0x01 +}; +#if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[219] = +{ + /* SEQUENCE */ + 0x30,0x81,0xd8, + /* SEQUENCE */ + 0x30,0x81,0xae, + /* p_RR (R^2 in prime field) */ + 0x04,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03, + /* p_bar (low digit of -(p^-1)) */ + 0x04,0x01,0x01, + /* SEQUENCE */ + 0x30,0x44, + /* a_R (a in Montgomery representation) */ + 0x04,0x20,0xff,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc, + /* b_R (b in Montgomery representation) */ + 0x04,0x20,0x24,0x0f,0xe1,0x88,0xba,0x20,0xe2,0xc8,0x52,0x79,0x81,0x50,0x5e,0xa5,0x1c,0x3c,0x71,0xcf,0x37,0x9a,0xe9,0xb5,0x37,0xab,0x90,0xd2,0x30,0x63,0x2b,0xc0,0xdd,0x42, + /* G_R (G in Montgomery representation) */ + 0x04,0x41,0x04,0x91,0x16,0x7a,0x5e,0xe1,0xc1,0x3b,0x05,0xd6,0xa1,0xed,0x99,0xac,0x24,0xc3,0xc3,0x3e,0x79,0x81,0xed,0xdc,0xa6,0xc0,0x50,0x61,0x32,0x89,0x90,0xf4,0x18,0x02,0x9e,0x63,0xcd,0x65,0xd4,0x81,0xd7,0x35,0xbd,0x8d,0x4c,0xfb,0x06,0x6e,0x2a,0x48,0xf8,0xc1,0xf5,0xe5,0x78,0x8d,0x32,0x95,0xfa,0xc1,0x35,0x4e,0x59,0x3c,0x2d,0x0d,0xdd, + /* SEQUENCE */ + 0x30,0x25, + /* n_RR (R^2 in order field) */ + 0x04,0x20,0x1e,0xb5,0xe4,0x12,0xa2,0x2b,0x3d,0x3b,0x62,0x0f,0xc8,0x4c,0x3a,0xff,0xe0,0xd4,0x34,0x64,0x50,0x4a,0xde,0x6f,0xa2,0xfa,0x90,0x11,0x92,0xaf,0x7c,0x11,0x4f,0x20, + /* n_bar (low digit of -(n^-1)) */ + 0x04,0x01,0x75 +}; +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[221] = +{ + /* SEQUENCE */ + 0x30,0x81,0xda, + /* SEQUENCE */ + 0x30,0x81,0xaf, + /* p_RR (R^2 in prime field) */ + 0x04,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03, + /* p_bar (low digit of -(p^-1)) */ + 0x04,0x02,0x00,0x01, + /* SEQUENCE */ + 0x30,0x44, + /* a_R (a in Montgomery representation) */ + 0x04,0x20,0xff,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc, + /* b_R (b in Montgomery representation) */ + 0x04,0x20,0x24,0x0f,0xe1,0x88,0xba,0x20,0xe2,0xc8,0x52,0x79,0x81,0x50,0x5e,0xa5,0x1c,0x3c,0x71,0xcf,0x37,0x9a,0xe9,0xb5,0x37,0xab,0x90,0xd2,0x30,0x63,0x2b,0xc0,0xdd,0x42, + /* G_R (G in Montgomery representation) */ + 0x04,0x41,0x04,0x91,0x16,0x7a,0x5e,0xe1,0xc1,0x3b,0x05,0xd6,0xa1,0xed,0x99,0xac,0x24,0xc3,0xc3,0x3e,0x79,0x81,0xed,0xdc,0xa6,0xc0,0x50,0x61,0x32,0x89,0x90,0xf4,0x18,0x02,0x9e,0x63,0xcd,0x65,0xd4,0x81,0xd7,0x35,0xbd,0x8d,0x4c,0xfb,0x06,0x6e,0x2a,0x48,0xf8,0xc1,0xf5,0xe5,0x78,0x8d,0x32,0x95,0xfa,0xc1,0x35,0x4e,0x59,0x3c,0x2d,0x0d,0xdd, + /* SEQUENCE */ + 0x30,0x26, + /* n_RR (R^2 in order field) */ + 0x04,0x20,0x1e,0xb5,0xe4,0x12,0xa2,0x2b,0x3d,0x3b,0x62,0x0f,0xc8,0x4c,0x3a,0xff,0xe0,0xd4,0x34,0x64,0x50,0x4a,0xde,0x6f,0xa2,0xfa,0x90,0x11,0x92,0xaf,0x7c,0x11,0x4f,0x20, + /* n_bar (low digit of -(n^-1)) */ + 0x04,0x02,0x09,0x75 +}; +#elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[225] = +{ + /* SEQUENCE */ + 0x30,0x81,0xde, + /* SEQUENCE */ + 0x30,0x81,0xb1, + /* p_RR (R^2 in prime field) */ + 0x04,0x20,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03, + /* p_bar (low digit of -(p^-1)) */ + 0x04,0x04,0x00,0x00,0x00,0x01, + /* SEQUENCE */ + 0x30,0x44, + /* a_R (a in Montgomery representation) */ + 0x04,0x20,0xff,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,0x00,0x00,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc, + /* b_R (b in Montgomery representation) */ + 0x04,0x20,0x24,0x0f,0xe1,0x88,0xba,0x20,0xe2,0xc8,0x52,0x79,0x81,0x50,0x5e,0xa5,0x1c,0x3c,0x71,0xcf,0x37,0x9a,0xe9,0xb5,0x37,0xab,0x90,0xd2,0x30,0x63,0x2b,0xc0,0xdd,0x42, + /* G_R (G in Montgomery representation) */ + 0x04,0x41,0x04,0x91,0x16,0x7a,0x5e,0xe1,0xc1,0x3b,0x05,0xd6,0xa1,0xed,0x99,0xac,0x24,0xc3,0xc3,0x3e,0x79,0x81,0xed,0xdc,0xa6,0xc0,0x50,0x61,0x32,0x89,0x90,0xf4,0x18,0x02,0x9e,0x63,0xcd,0x65,0xd4,0x81,0xd7,0x35,0xbd,0x8d,0x4c,0xfb,0x06,0x6e,0x2a,0x48,0xf8,0xc1,0xf5,0xe5,0x78,0x8d,0x32,0x95,0xfa,0xc1,0x35,0x4e,0x59,0x3c,0x2d,0x0d,0xdd, + /* SEQUENCE */ + 0x30,0x28, + /* n_RR (R^2 in order field) */ + 0x04,0x20,0x1e,0xb5,0xe4,0x12,0xa2,0x2b,0x3d,0x3b,0x62,0x0f,0xc8,0x4c,0x3a,0xff,0xe0,0xd4,0x34,0x64,0x50,0x4a,0xde,0x6f,0xa2,0xfa,0x90,0x11,0x92,0xaf,0x7c,0x11,0x4f,0x20, + /* n_bar (low digit of -(n^-1)) */ + 0x04,0x04,0x72,0x35,0x09,0x75 +}; +#endif +CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1SpeedUpExt[547] = +{ + /* SEQUENCE */ + 0x30,0x82,0x02,0x1f, + /* groups parameter */ + 0x04,0x01,0x03, + /* SEQUENCE */ + 0x30,0x82,0x02,0x18, + /* 2 * G in Montgomery representation */ + 0x04,0x41,0x04,0x0d,0x7e,0x9c,0x18,0xca,0xa5,0x73,0x6a,0x53,0x49,0xd9,0x4b,0x57,0x88,0xcd,0x24,0x83,0xbd,0xc9,0xba,0x2d,0x8f,0xa9,0x38,0x0a,0xf0,0x37,0xbf,0xbc,0x3b,0xe4,0x6a,0x94,0x7e,0x74,0x65,0x6c,0x21,0xbd,0xf5,0xc7,0xb1,0x45,0x16,0x9b,0x71,0x57,0xac,0xcc,0xbd,0x8d,0x37,0xc4,0xa8,0xe8,0x2b,0x6a,0x7e,0x1a,0x1d,0x69,0xdb,0x9a,0xc1, + /* (2^86 + 1) * G in Montgomery representation */ + 0x04,0x41,0x04,0x49,0xe7,0x25,0x75,0xfe,0xdd,0x2b,0x2d,0x61,0xb1,0xb3,0x8f,0x2e,0x2b,0xd6,0xd3,0x05,0x57,0x69,0xcc,0x7a,0x57,0xcc,0x35,0xaf,0x6e,0xa6,0xe4,0xc6,0xda,0xe1,0x87,0xe2,0x25,0x8e,0xfb,0x47,0x02,0xd9,0xff,0x47,0xd1,0xd3,0xfd,0xd5,0x7e,0x25,0x2a,0x59,0x37,0x2d,0xa0,0x68,0x98,0x9c,0x52,0xf1,0x3f,0xbc,0x50,0x1d,0xd3,0xfa,0x13, + /* (2^86 + 2) * G in Montgomery representation */ + 0x04,0x41,0x04,0x7d,0xd4,0x32,0x93,0x82,0xbd,0x00,0x16,0xfa,0x7c,0x06,0x88,0x02,0x50,0x75,0xac,0x4c,0xde,0xfd,0xe9,0x44,0xe4,0xa8,0xc8,0x95,0x64,0xb5,0xe3,0xc9,0x41,0xf8,0xe2,0x8c,0xe2,0x6e,0x6b,0x4b,0x91,0xf8,0x55,0x31,0x8e,0xf1,0x67,0x0d,0xe9,0x7e,0xed,0x75,0x7d,0x29,0x1c,0xc6,0xd6,0x45,0x45,0x3c,0xf5,0x87,0x1c,0xb9,0x6d,0x1f,0x98, + /* (2^172 + 1) * G in Montgomery representation */ + 0x04,0x41,0x04,0x88,0xf1,0xea,0x0c,0x12,0x62,0x22,0xb5,0x7c,0xf8,0x3e,0x30,0xd5,0x18,0x05,0x00,0x8e,0xc4,0x0a,0x13,0xea,0x25,0x4a,0xa9,0x9f,0x8c,0x30,0xf6,0x66,0xdc,0x3e,0xd1,0x1e,0x18,0x8a,0x57,0x72,0x69,0x66,0xbe,0x70,0x60,0x9d,0x57,0xbd,0x89,0xb6,0xc3,0x5e,0x69,0xe6,0x3c,0x95,0xcf,0xf0,0xdb,0x09,0x62,0x25,0x60,0x35,0x8d,0x62,0x19, + /* (2^172 + 2) * G in Montgomery representation */ + 0x04,0x41,0x04,0x6b,0x79,0x8e,0x7a,0xfb,0x07,0x18,0x3a,0x02,0xe7,0x85,0x3c,0xb8,0x43,0xa2,0xde,0x8b,0x94,0x62,0xd2,0x37,0x06,0x02,0x09,0x2c,0x8e,0x1c,0x4f,0x26,0x0a,0xb6,0xcd,0xb0,0xcc,0x80,0xbb,0x44,0xe0,0xb1,0x81,0x07,0x33,0x41,0x69,0xdf,0xdc,0xd4,0xf3,0x05,0x48,0xbe,0xdb,0xe7,0xe1,0xe1,0x1a,0xa7,0x2c,0xb0,0x08,0x4f,0xfa,0x08,0xb4, + /* (2^172 + 2^86 + 1) * G in Montgomery representation */ + 0x04,0x41,0x04,0x88,0x17,0xcf,0xe0,0xe9,0x62,0xbf,0xbe,0xd0,0x4d,0xfb,0x7d,0x57,0x81,0xc4,0x33,0x52,0x52,0x11,0x3d,0x89,0x1b,0xf9,0x31,0x95,0xfe,0xb1,0x4a,0x94,0x4c,0xcd,0x35,0x53,0x6c,0x1b,0xba,0xc5,0xe5,0xd7,0xa5,0xe6,0x06,0x87,0x93,0x00,0x8d,0x03,0x2e,0x74,0x35,0xa2,0x61,0x3c,0x00,0x41,0xa4,0x7d,0x7e,0xca,0x9a,0x39,0x25,0xff,0x3b, + /* (2^172 + 2^86 + 2) * G in Montgomery representation */ + 0x04,0x41,0x04,0xf9,0x75,0x83,0xc1,0xf4,0x5e,0xb3,0xb3,0x79,0x3a,0x76,0x32,0x76,0xe9,0xc9,0xd3,0x11,0x5c,0x11,0x6c,0x74,0xfb,0xcf,0xec,0x5c,0x72,0x4e,0x0d,0x09,0x90,0xc1,0xc1,0x49,0x91,0x7f,0x46,0xce,0x88,0xba,0xcf,0x7f,0xf4,0xbd,0x21,0x2c,0x65,0x39,0x5a,0x09,0xa5,0x16,0x7d,0x6e,0x75,0xdb,0x9f,0x93,0xad,0xb6,0xec,0xc9,0x82,0x70,0x0e, + /* correction point D = - ((2^86 - 1) * G) in Montgomery representation */ + 0x04,0x41,0x04,0xff,0x69,0xbf,0x41,0x4f,0x65,0xad,0x33,0x87,0xb1,0xb3,0xb5,0x40,0xab,0xc8,0x7d,0x38,0x1e,0x9e,0xac,0x2b,0x20,0x2e,0x5f,0x10,0xe6,0x9c,0x66,0xa1,0xa0,0xa6,0x05,0x3d,0x72,0xac,0x40,0xc3,0x24,0x44,0xb4,0xc8,0xbb,0xaf,0x30,0xe2,0x8b,0xf9,0xac,0x7f,0x6d,0x46,0xb4,0x28,0x0c,0x84,0x2c,0x35,0xa1,0x7f,0x09,0xde,0x5a,0x88,0x80 +}; +/* Sm2p256v1 END *********************************************************************************************/ + +#define CRYPTO_30_LIBCV_STOP_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Curve.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.h new file mode 100644 index 0000000..c0474a0 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Curve.h @@ -0,0 +1,151 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Curve.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for curve parameter prototypes + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_CURVE_H) +# define CRYPTO_30_LIBCV_CURVE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Crypto_30_LibCv_Services.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CONST_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Empty curve vector START *********************************************************************************************/ +/* This vector is used to initialize pointers which shall point to the EC domain, the EC domain extension and + * the EC SpeedUp extension. If one of the regular curve parameters were used for this purpose, the corresponding + * arrays will always be used and therefore never be removed by the linker. + * Since this array does not start with the ASN1 sequence tag '0x30', the parser of the underlying crypto + * library will recognize these domains as invalid. */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveEmptyDomain[2]; +/* Empty curve vector END ***********************************************************************************************/ + +/* SEC_p160r1 START *****************************************************************************************************/ +/* SECp160r1 */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1Domain[155]; +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[147]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[149]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1DomainExt[153]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSecP160R1SpeedUpExt[355]; +/* SEC_p160r1 END *********************************************************************************************/ + +/* NIST_SEC_p224r1 START *********************************************************************************************/ +/* NISTp224r1 = SECp224r1 */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1Domain[203]; +# if (actBN_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[195]; +# elif (actBN_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[197]; +# elif (actBN_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt[201]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt[483]; +/* NIST_SEC_p224r1 END *********************************************************************************************/ + +/* NIST_ANSI_SEC_p256r1 START *********************************************************************************************/ +/* NISTp256r1 = ANSIp256r1 = SECp256r1 */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain[227]; +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[219]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[221]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt[225]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt[547]; +/* NIST_ANSI_SEC_p256r1 END *********************************************************************************************/ + +/* NIST_SEC_p384r1 START *********************************************************************************************/ +/* NISTp384r1 = SECp384r1 */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1Domain[324]; +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[316]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[318]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt[323]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt[803]; +/* NIST_SEC_p384r1 END *********************************************************************************************/ + +/* NIST_SEC_p521r1 START *********************************************************************************************/ +/* NISTp521r1 = SECp521r1 */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1Domain[432]; +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[427]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[429]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt[433]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt[1099]; +/* NIST_SEC_p521r1 END *********************************************************************************************/ + +/* Edwards448 START **************************************************************************************************/ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveEdwards448GroupOrder[56]; +/* Edwards448 END ****************************************************************************************************/ + +/* Sm2p256v1 START *********************************************************************************************/ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1Domain[227]; +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 1) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[219]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 2) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[221]; +# elif (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1DomainExt[225]; +# endif +extern CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_EccCurveSm2P256v1SpeedUpExt[547]; +/* Sm2p256v1 END *********************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CONST_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#endif /* CRYPTO_30_LIBCV_CURVE_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Curve.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Custom.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Custom.h new file mode 100644 index 0000000..6b66a07 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Custom.h @@ -0,0 +1,626 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Custom.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for custom algorithms + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_CUSTOM_H +# define CRYPTO_30_LIBCV_CUSTOM_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Crypto_30_LibCv_Custom_Generated.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* ----- Additional Key Element defines ---------------------------------------------- */ + +/* AES MAC */ +# ifndef CRYPTO_KE_CUSTOM_MAC_AES_ROUNDKEY /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_MAC_AES_ROUNDKEY (129u) +# endif + +/* Key Derive */ +# ifndef CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL (130u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (131u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_ADDITIONAL_INFO /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_ADDITIONAL_INFO (131u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT (3061u) +# endif + +/* RSA */ +# ifndef CRYPTO_KE_CUSTOM_RSA_MODULUS /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_MODULUS (160u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT (161u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT (162u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_SALT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_SALT (163u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH (164u) +# endif + +/* TLS */ +# ifndef CRYPTO_KE_CUSTOM_TLS_CLIENT_HELLO_RANDOM /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_CLIENT_HELLO_RANDOM (3000u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_TLS_SERVER_HELLO_RANDOM /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_SERVER_HELLO_RANDOM (3001u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_TLS_HMAC_KEY_SIZE /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_HMAC_KEY_SIZE (3002u) +# endif + +/* Key Exchange */ +# ifndef CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY (3003u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY_2 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY_2 (3004u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYEXCHANGE_INTERMEDIATE /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_INTERMEDIATE (3005u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYEXCHANGE_NUM_ECU /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_NUM_ECU (3006u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_KEYEXCHANGE_ECU_ID /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_ECU_ID (3007u) +# endif + +/* Smart Charge Communication */ +# ifndef CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY (3013u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY (3014u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD (3060u) +# endif + +/* Random Number Generation */ +# ifndef CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING (3015u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT (3016u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RANDOM_NONCE /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_NONCE (3017u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER (3018u) +# endif + +/* SHE Key Update */ +# ifndef CRYPTO_KE_CUSTOM_SHE_COUNTER /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_COUNTER (3019u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SHE_UID /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_UID (3021u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION (3056u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION (3057u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD (3059u) +# endif + +/* RSA CRT */ +# ifndef CRYPTO_KE_CUSTOM_RSA_PRIME_P /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIME_P (3051u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_PRIME_Q /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIME_Q (3052u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP (3053u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ (3054u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_RSA_INVERSE_QI /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_INVERSE_QI (3055u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_LABEL /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_LABEL (3058u) +# endif + +/* Spake2+ */ +# ifndef CRYPTO_KE_CUSTOM_W0 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_W0 (3084u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_W1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_W1 (3085u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_L /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_L (3086u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_VERIFICATION /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VERIFICATION (3087u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_VERIFICATION_RESULT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VERIFICATION_RESULT (3088u) +# endif + +/* EdDsa */ +# ifndef CRYPTO_KE_CUSTOM_EDDSA_CONTEXT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_EDDSA_CONTEXT (3061u) +# endif + +/* SlhDsa */ +# ifndef CRYPTO_KE_CUSTOM_SLHDSA_CONTEXT /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SLHDSA_CONTEXT (3062u) +# endif + +/* Sm2 Signature */ +# ifndef CRYPTO_KE_CUSTOM_SM2_ID /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SM2_ID (3092u) +# endif + +# ifndef CRYPTO_KE_CUSTOM_SM2_GENERATE_PUBLIC_KEY /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SM2_GENERATE_PUBLIC_KEY (3093u) +# endif + +/* ----- Custom Algorithm Mode Defines ---------------------------------------------- */ +/* ECC curve p224r1 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_P224R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P224R1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_P224r1) +# endif + +/* ECC curve p256r1 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_P256R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P256R1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_P256r1) +# endif + +/* RSA CRT */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT) +# endif + +# ifndef CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_RSAES_OAEP_CRT) +# endif + +/* Use Derivation function e.g. for NIST DRBG AES128 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_USE_DF /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_USE_DF (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_UseDF) +# endif + +/* ECC curve p384r1 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_P384R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P384R1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_P384r1) +# endif + +/* ECC curve p160r1 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_P160R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P160R1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_P160r1) +# endif + +/* ECC curve p521r1 */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_P521R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P521R1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_P521r1) +# endif + +/* Aead Aes Ccm */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_CCM /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_CCM (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_CCM) +# endif + +/* EdDsaEd448 Pure */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_ED448_PURE /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_ED448_PURE (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_EdDsaEd448Pure) +# endif + +/* EdDsaEd448 Prehash */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_ED448_PH /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_ED448_PH (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_EdDsaEd448Ph) +# endif + +/* EdDsaEd25519 Pure */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_ED25519_PURE /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_ED25519_PURE (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_EdDsaEd25519Pure) +# endif + +/* EdDsaEd25519 Context */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_ED25519_CTX /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_ED25519_CTX (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_EdDsaEd25519Ctx) +# endif + +/* EdDsaEd25519 Prehash */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_ED25519_PH /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_ED25519_PH (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_EdDsaEd25519Ph) +# endif + +/* SlhDsa Sha2-128s */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_SHA2_128S /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_SHA2_128S (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_SHA2_128S) +# endif + +# ifndef CRYPTO_ALGOMODE_CUSTOM_SHA2_128S_DETERMINISTIC /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_SHA2_128S_DETERMINISTIC (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_SHA2_128S_Deterministic) +# endif + +/* SM2 Sm2p256v1 curve */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_SM2P256V1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_SM2P256V1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_Sm2P256v1) +# endif + +/* Modes */ +# ifndef CRYPTO_ALGOMODE_CUSTOM_MODE_1 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_MODE_1 (CryptoConf_CryptoPrimitiveAlgorithmModeCustom_Crypto_30_LibCv_Mode1) +# endif + +/* ----- Custom Algorithm Family Defines ---------------------------------------------- */ +/* Ecc-ANSI conform */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ECCANSI /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ECCANSI (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_ECCANSI) +# endif + +/* Ecc-SEC conform */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ECCSEC /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ECCSEC (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_ECCSEC) +# endif + +/* NIST 800-90A DRBG conform */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_DRBG /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_DRBG (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_DRBG) +# endif + +/* FIPS 186.2 conform */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_FIPS186 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_FIPS186 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_FIPS186) +# endif + +/* Padding PKCS7 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_PaddingPKCS7) +# endif + +/* Key exchange X25519 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_X25519 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_X25519 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_X25519) +# endif + +/* Key exchange X448 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_X448 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_X448 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_X448) +# endif + +/* Key Derive ISO15118 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ISO15118 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ISO15118 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_ISO15118) +# endif + +/* Key Derive ISO15118-20 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ISO15118_20 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ISO15118_20 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_ISO15118_20) +# endif + +/* Poly 1305 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_POLY_1305 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_POLY_1305 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_POLY1305) +# endif + +/* Spake2+ */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_SPAKE2PLUS) +# endif + +/* HKDF */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_HKDF /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_HKDF (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_HKDF) +# endif + +/* Cmd get ID */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_CMD_GET_ID /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_CMD_GET_ID (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_CmdGetId) +# endif + +/* Cipher Suites */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_CipherSuite8) +# endif + +/* Hash MD5 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_MD5 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_MD5 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_MD5) +# endif + +/* Burmester Desmedt */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_BD /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_BD (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_BD) +# endif + +/* Ed448 */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ED448 /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ED448 (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_ED448) +# endif + +/* IsPublicKeyOnCurve */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ISPUBLICKEYONCURVE /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ISPUBLICKEYONCURVE (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_IsPublicKeyOnCurve) +# endif + +/* HKDF Expand */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_HKDF_EXPAND /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_HKDF_EXPAND (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_HKDF_Expand) +# endif + +/* IsSecretKeyOnCurve */ +# ifndef CRYPTO_ALGOFAM_CUSTOM_ISPRIVATEKEYONCURVE /* COV_CRYPTO_30_LIBCV_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ISPRIVATEKEYONCURVE (CryptoConf_CryptoPrimitiveAlgorithmFamilyCustom_Crypto_30_LibCv_IsPrivateKeyOnCurve) +# endif + +/* ----- Custom Key Exchange Algorithm Defines ---------------------------------------------- */ +/* Exchange algorithm x25519 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519 (0u) +# endif + +/* Exchange algorithm ANSI p256r1 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1 (1u) +# endif + +/* Exchange algorithm SEC p256r1 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1 (2u) +# endif + +/* Exchange algorithm Nist p224r1 for burmester desmedt */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_NISTP224R1_BD /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_NISTP224R1_BD (3u) +# endif + +/* Exchange algorithm SEC p384r1 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1 (4u) +# endif + +/* Exchange algorithm Spake2+ Cipher Suite 8 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8 (5u) +# endif +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8_1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8_1 (6u) +# endif + +/* Exchange algorithm SEC p521r1 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP521R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP521R1 (7u) +# endif + +/* Exchange algorithm x448 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_X448 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_X448 (8u) +# endif + +/* Exchange algorithm p256r1 for burmester desmedt */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_BD /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_BD (9u) +# endif + +/* Exchange algorithm NIST/SEC p224r1 */ +# ifndef CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1 (10u) +# endif + +/* ----- Custom Key Generate Algorithm Defines ---------------------------------------------- */ +/* Key Generate Symmetric Generic */ +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_SYMMETRIC /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_SYMMETRIC (0u) +# endif +/* Key Generate algorithm P256R1 */ +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_P256R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_P256R1 (1u) +# endif +/* Key Generate algorithm P384R1 */ +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_P384R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_P384R1 (2u) +# endif +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519 (3u) +# endif +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_P521R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_P521R1 (4u) +# endif +# ifndef CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1 (5u) +# endif + +/* ----- Custom Key Derivation Algorithm Defines ---------------------------------------------- */ +/* KDF_NIST_800-108 'KDF in Counter Mode' with SHA-256 as PRF */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 (1u) +# endif + +/* NIST.FIPS.186-4 'Key Pair Generation Using Extra Random Bits' with 'KDF in Counter Mode' as RBG */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB (2u) +# endif + +/* NIST.SP.800-56A Single-Step KDF with Option 1: H(x) = hash(x) */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256 (3u) +# endif + +/* ISO 15118 install and update certificate. */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING (4u) +# endif + +/* KDF X9.63 SHA 1 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA1 (5u) +# endif + +/* KDF X9.63 SHA 256 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256 (6u) +# endif + +/* KDF X9.63 SHA 512 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512 (7u) +# endif + +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_108_CTR_CMAC_AES /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_108_CTR_CMAC_AES (8u) +# endif + +/* PBKDF2 HMAC SHA 1 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1 (9u) +# endif + +/* PBKDF2 HMAC SHA 256 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256 (10u) +# endif + +/* HKDF HMAC SHA 256 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256 (11u) +# endif + +/* KDF Spake2+ P256R1 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1 (12u) +# endif + +/* HKDF HMAC Option 1 SHA2-256 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256 (13u) +# endif + +/* HKDF HMAC SHA2-384 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384 (14u) +# endif + +/* HKDF HMAC Option 1 SHA2-512 */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512 (15u) +# endif + +/* ISO 15118-20 install certificate. */ +# ifndef CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING (16u) +# endif + +/* HKDF Expand HMAC SHA2-256 */ +# ifndef CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256 (17u) +# endif + +/* HKDF Expand HMAC SHA2-384 */ +# ifndef CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384 (18u) +# endif + +/* ----- Custom Random Seed Algorithm Defines ---------------------------------------------- */ +/* Random Seed according to FIPS 186-2 SHA1 */ +# ifndef CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1 (0u) +# endif + +/* Random Seed according to NIST 800-90A CTR_DRBG with AES-128 */ +# ifndef CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128 (1u) +# endif + +/* Random Seed according to NIST 800-90A CTR_DRBG with AES-128 and DF */ +# ifndef CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128_DF /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128_DF (2u) +# endif + +/* Random Seed according to NIST 800-90A HASH_DRBG */ +# ifndef CRYPTO_30_LIBCV_RNG_NIST_800_90A_HASH_DRBG_SHA_512 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_HASH_DRBG_SHA_512 (3u) +# endif + +/* Random Seed according to NIST 800-90A CTR_DRBG with AES-256 */ +# ifndef CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256 /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256 (4u) +# endif + +/* Random Seed according to NIST 800-90A CTR_DRBG with AES-256 and DF */ +# ifndef CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256_DF /* COV_CRYPTO_30_LIBCV_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256_DF (5u) +# endif + +#endif /* CRYPTO_30_LIBCV_CUSTOM_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Custom.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Decrypt.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Decrypt.h new file mode 100644 index 0000000..1f43d63 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Decrypt.h @@ -0,0 +1,243 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Decrypt.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for CIPHER Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_DECRYPT_H) +# define CRYPTO_30_LIBCV_DECRYPT_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesDecrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the CipherAesDecrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137765, CREQ-317644, CREQ-158941 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesDecrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESDECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm4Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the SM4-Decrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key size is not correct. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Sm4Decrypt + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm4Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SM4DECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaPkcs1Decrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137764, CREQ-190479 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPKCS1DECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Decrypt Sha1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168409 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1DECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Decrypt Sha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168409 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha256Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA256DECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepCrtSha1Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Crt Decrypt Sha1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168872 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepCrtSha1Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA1DECRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepCrtSha256Decrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Crt Decrypt Sha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168872 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepCrtSha256Decrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPCRTSHA256DECRYPT == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_DECRYPT_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Decrypt.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Encrypt.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Encrypt.h new file mode 100644 index 0000000..f6bc64d --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Encrypt.h @@ -0,0 +1,190 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Encrypt.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for CIPHER Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_ENCRYPT_H) +# define CRYPTO_30_LIBCV_ENCRYPT_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_AesEncrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the AesEncrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137759, CREQ-317643, CREQ-158942 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_AesEncrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_AESENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm4Encrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the SM4-Encrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key size is not correct. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Sm4Encrypt + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm4Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SM4ENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Encrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaPkcs1Encrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137760 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPKCS1ENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha1Encrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Encrypt Sha1 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168408 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha1Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA1ENCRYPT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaOaepSha256Encrypt() + *********************************************************************************************************************/ +/*! \brief Dispatches the RsaOaep Encrypt Sha256 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-168408 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaOaepSha256Encrypt( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAOAEPSHA256ENCRYPT == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_ENCRYPT_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Encrypt.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.c new file mode 100644 index 0000000..f2fd6e6 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.c @@ -0,0 +1,235 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Hash.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for HASH Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_HASH_SOURCE +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_Hash.h" + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_VSECPRIM_HASH_ALGO_INVALID (0xFFu) + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ +#if ((CRYPTO_30_LIBCV_HASH == STD_ON) || (((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) && (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON))) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeStart( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + Crypto_AlgorithmFamilyType hashAlgoFam) +{ + eslt_ErrorCode retValCv; + Std_ReturnType retVal = E_NOT_OK; + vSecPrimType_HashAlgorithm esLibHashAlgoIdentifier = CRYPTO_30_LIBCV_VSECPRIM_HASH_ALGO_INVALID; + + /* Get hash algorithm identifier for vSecPrim */ +# if (CRYPTO_30_LIBCV_HASH_CUSTOM_MD5 == STD_ON) + if (hashAlgoFam == CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_MD5) + { + esLibHashAlgoIdentifier = VSECPRIM_DIGEST_MD5; + } + else +# endif /* (CRYPTO_30_LIBCV_HASH_CUSTOM_MD5 == STD_ON) */ + if (hashAlgoFam < Crypto_30_LibCv_GetSizeOfFamilyToHashMapping()) + { + esLibHashAlgoIdentifier = Crypto_30_LibCv_GetFamilyToHashMapping(hashAlgoFam); + } + else + { + /* esLibHashAlgoIdentifier already set */ + } + + /* Initialize algorithm. */ + retValCv = esl_initWorkSpaceHeader(&(workSpace->header), VSECPRIM_SIZEOF_WS_HASH, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retValCv = vSecPrim_initHash(workSpace, esLibHashAlgoIdentifier, VSECPRIM_OUTPUT_TRUNCATION_ALLOWED); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Hash_ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeUpdate( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + uint32 inputLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inputPtr) +{ + eslt_ErrorCode retValCv; + Std_ReturnType retVal = E_NOT_OK; + + /* # Process input data. */ + retValCv = vSecPrim_updateHash(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))inputPtr); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Hash_ModeUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeFinish( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputPtr) +{ + eslt_ErrorCode retValCv; + Std_ReturnType retVal = E_NOT_OK; + eslt_Length outputLength = (eslt_Length)(*outputLengthPtr); + + /* # Write results in output buffers. Output size adaption is done in vSecPrim. */ + retValCv = vSecPrim_finalizeHash(workSpace, &outputLength, outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + *outputLengthPtr = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Hash_ModeFinish() */ +#endif /* ((CRYPTO_30_LIBCV_HASH == STD_ON) || (((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) && (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON))) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if (CRYPTO_30_LIBCV_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpaceHash = Crypto_30_LibCv_GetWorkspaceOfHash(Crypto_30_LibCv_GetHashIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeStart(workSpaceHash, job->jobPrimitiveInfo->primitiveInfo->algorithm.family); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeUpdate(workSpaceHash, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + break; + } + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeFinish(workSpaceHash, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Hash() */ +#endif /* (CRYPTO_30_LIBCV_HASH == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Hash.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.h new file mode 100644 index 0000000..e132226 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Hash.h @@ -0,0 +1,151 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Hash.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for HASH Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_HASH_H) +# define CRYPTO_30_LIBCV_HASH_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash() + *********************************************************************************************************************/ +/*! \brief Dispatches the Hash job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * It will evaluate the correct hash based on the given job. + * Based on the jobs operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139111, CREQ-139110, CREQ-178100, CREQ-139109, CREQ-321212, CREQ-257656, CREQ-321213, + * CREQ-247953, CREQ-266807, CREQ-321214, CREQ-321215, CREQ-321216, CREQ-Crypto-Sm3Hash, + * CREQ-Crypto-SHA2-512-224, CREQ-Crypto-SHA2-512-256, CREQ-Crypto-SHA2-224 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HASH == STD_ON) */ + +# if ((CRYPTO_30_LIBCV_HASH == STD_ON) || (((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) && (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON))) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles hash operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the vSecPrim workspace. + * \param[in] hashAlgoFam Algorithm family of the hash. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeStart( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + Crypto_AlgorithmFamilyType hashAlgoFam); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles hash operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the vSecPrim workspace. + * \param[in] inputLength Length of the input data in bytes. + * \param[in] inputPtr Pointer to the input data which should be hashed. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeUpdate( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + uint32 inputLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inputPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Hash_ModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles hash operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the hash value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the vSecPrim workspace. + * \param[in,out] outputLengthPtr Pointer to the output length of the hash. + * If the output length is smaller than the hash output, + * the hash output will be truncated accordingly. + * \param[out] outputPtr Pointer to the output buffer of the hash. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre outputLengthPtr and outputPtr has to be valid. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Hash_ModeFinish( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputPtr); +# endif /* ((CRYPTO_30_LIBCV_HASH == STD_ON) || (((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) && (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON))) */ +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_HASH_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Hash.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_InternalApi.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_InternalApi.h new file mode 100644 index 0000000..cab03fe --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_InternalApi.h @@ -0,0 +1,402 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_InternalApi.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal API Functions. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_INTERNALAPI_H) +# define CRYPTO_30_LIBCV_INTERNALAPI_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Services.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +typedef struct +{ + boolean isKeyValid; /* 1 key is valid, 0 key is invalid */ + boolean isSheKey; /* 1 key is an she key, 0 key is not a she key */ + boolean write_protection; /* 0 rewriting and erasing enabled, 1 rewriting and erasing disabled */ + /* The following flags are only relevant for SHE keys */ + boolean boot_protection; /* 0 key usage is not limited according to result of secure boot, 1 usage is limited */ + boolean debugger_protection; /* 0 use of a debug interface does not impose a limitation on key usage, 1 key can not be used if debugger is attached */ + boolean key_usage; /* 0 key can be used for AES ECB+CBC encrypt/decrypt, 1 key can be used for CMAC generate/verify */ + boolean disable_wildcard; /* 0 key update by wildcard UID is enabled, 1 key update by wildcard is disabled */ + boolean cmac_usage; /* 0 key can be used to execute CMAC generate, 1 key can not be used to execute CMAC generate but only for CMAC verify */ +} Crypto_30_LibCv_KeyFlagType; + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementGetStorageIndex() + *********************************************************************************************************************/ +/*! \brief The key element storage index can be provided for all read access rights values. + * \details This interface shall be used to get a key element of the key identified by the + * cryptoKeyId and store the key element in the memory location pointed to by the result pointer. + * The key element will be searched and checked vor validity. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be provided. + * \param[in] keyElementId Holds the Id of the key element which shall be provided. + * \param[in,out] resultIndexPtr Holds the pointer to the storage index which shall be provided. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \param[in] serviceType SHE service Type. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * lengthCheck has to be a valid parameter. + * serviceType has to be a valid parameter. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementGetStorageIndex( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_GetKeyFlags() + *********************************************************************************************************************/ +/*! \brief Retrieving information about key flags + * \details The function checks the key for validity and its key extensions and sets the output buffer. + * \param[in] cryptoKeyId Holds the identifier of the key + * \param[in] keyElementId Holds the identifier of the key element + * \param[out] keyFlagsPtr Contains the pointer to the data where the key flag data shall be stored + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre The crypto key has to be locked for read access. + * keyFlagsPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_GetKeyFlags( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_KeyFlagType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyFlagsPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyReadLockGetNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Try to get key read lock. + * \details This access is not protected by a exclusive area. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key read access success. + * E_NOT_OK Lock key read access failed. + * \pre The caller must ensure that this call is protected by a exclusive area which prohibits + * multiple calls to LibCv Api's. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyReadLockGetNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyReadLockReleaseNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Release key read lock. + * \details This access is not protected by a exclusive area. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Release key read access success. + * E_NOT_OK Request failed, the key is not available. + * \pre The caller must ensure that this call is protected by a exclusive area which prohibits + * multiple calls to LibCv Api's. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyReadLockReleaseNotProtected( + uint32 cryptoKeyId); + +# if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_GetKeyListRedirection() + **********************************************************************************************************************/ +/*! \brief Create list of keys for redirection. + * \details A key is only referenced once in the list with the highest access. + * \param[in] job Pointer to the job which shall checked. + * \param[in,out] keyList Pointer to the keyList. + * \pre job has to be a valid job object. + * keyList has to be a valid keyList object with at least 6 elements if redirection is used, otherwise 1. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_GetKeyListRedirection( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_RedirectPreRedirKeys() + **********************************************************************************************************************/ +/*! \brief Pre redirect keys and in- and out-buffer. + * \details Set the in- and out-buffer to the redirected keys. + * \param[in,out] redirectBuffer Pointer to the redirection buffer. + * \param[in,out] job Pointer to the configuration of the job. + * \return E_OK Request success. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_EMPTY Request failed, key is empty. + * \pre Lock has to be reserved for the job object. + * redirectBuffer has to be a valid pointer. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_RedirectPreRedirKeys( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_RedirectPostRestoreBuffer() + **********************************************************************************************************************/ +/*! \brief Post redirect keys and in- and out-buffer. + * \details Save result and restore in- and out-buffer. + * \param[in,out] redirectBuffer Pointer to the redirection buffer. + * \param[in,out] job Pointer to the configuration of the job. + * \param[in] result Current update result + * \return E_OK Request successful. + * E_NOT_OK Redirect Keys are not available. + * \pre Lock has to be reserved for the job object. + * redirectBuffer has to be a valid pointer. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_RedirectPostRestoreBuffer( + P2VAR(Crypto_30_LibCv_Redirect_Type, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) redirectBuffer, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Std_ReturnType result); +# endif /* (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListAddKey() + **********************************************************************************************************************/ +/*! \brief Add Key to key list. + * \details Add key to keyList if the key is not in keyList. If the Key is in KeyList update keyAccess. + * \param[in,out] keyList Pointer to the keyList. + * \param[in] cryptoKeyId KeyId of the key which shall be add. + * \param[in] keyAccess Key access right of the key which shall be add. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListAddKey( + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, + uint32 cryptoKeyId, + uint8 keyAccess); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPreLockKeys() + **********************************************************************************************************************/ +/*! \brief Lock keys in key list. + * \details Lock keys in key list according to their read/write access. + * This access is not protected by a exclusive area. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is already locked or not available. + * \pre keyList has to be a valid keyList object. + * The caller must ensure that this call is protected by a exclusive area which prohibits + * multiple calls to LibCv Api's. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPreLockKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPostFreeKeys() + **********************************************************************************************************************/ +/*! \brief Free keys in key list. + * \details Free keys in key list according to their read/write access. + * This access is not protected by a exclusive area. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is not available. + * \pre keyList has to be a valid keyList object. + * The caller must ensure that this call is protected by a exclusive area which prohibits + * multiple calls to LibCv Api's. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPostFreeKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPreLockKeysProtected() + **********************************************************************************************************************/ +/*! \brief Lock keys in key list. + * \details Lock keys in key list according to their read/write access. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is already locked or not available. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPreLockKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyListPostFreeKeysProtected() + **********************************************************************************************************************/ +/*! \brief Free keys in key list. + * \details Free keys in key list according to their read/write access. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is not available. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyListPostFreeKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementSearch() + *********************************************************************************************************************/ +/*! \brief Searches the key elementIndex. + * \details Searches the key elementIndex of the given keyElementId in the given cryptoKeyId. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[out] elementIndex Holds the pointer to the found key element index. + * \return E_OK Request successful. + * E_NOT_OK Request failed, key or key element not found. + * \pre elementIndex has to be a valid element index Ptr. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementSearch( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndex); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyWriteLockGetNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Try to get key write lock. + * \details Try to get key write lock. Only one write lock can be allocated, if there is no read lock. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key write access success. + * E_NOT_OK Lock key write access failed. + * \pre The caller has to ensure that this call is protected by a exclusive area. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyWriteLockGetNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyWriteLockReleaseNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Release key write lock. + * \details Release key write lock. Only one write lock can be allocated. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Request success. + * E_NOT_OK Request failed as key is not available. + * \pre The caller has to ensure that this call is protected by a exclusive area. + * The caller has to ensure that the key is locked for write access. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyWriteLockReleaseNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementSetInternalStandard() + *********************************************************************************************************************/ +/*! \brief Copies data to key storage. + * \details Copies data of the keyPtr to the internal key storage identified by the elementIndex. + * If keyLength is zero the old value is deleted. + * \param[in] elementIndex Holds the identifier of the keyElement in the keyStorage. + * \param[in] keyPtr Holds the data which shall be copied to the key storage + * \param[in] keyLength Specifies the number of bytes which shall be copied. + * \return E_OK Request success. + * E_NOT_OK Request failed as elementIndex is not valid. + * \pre keyLength has to be smaller or equal in length to available key storage space. + * keyPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementSetInternalStandard( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_INTERNALAPI_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_InternalApi.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.c new file mode 100644 index 0000000..d5181a7 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.c @@ -0,0 +1,5359 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyDerive.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of Key Derive Services. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_KEYDERIVE_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_KeyDerive.h" +#include "Crypto_30_LibCv_KeyExchange.h" + +#include "Crypto_30_LibCv_Custom.h" +#include "Crypto_30_LibCv_Curve.h" + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) +# include "actBigNum.h" +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +typedef struct +{ + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) sourceKey; + uint32 sourceKeyLength; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) label; + uint32 labelLength; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) context; + uint32 contextLength; + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetKey; + uint32 targetKeyLength; + Crypto_30_LibCv_SizeOfKeyElementsType targetKEIdx; +} Crypto_30_LibCv_Nist800108_KDF_InputOutput; + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + + /* KDF */ +#define CRYPTO_30_LIBCV_KEY_DERIVE_SIZEOF_ALGORITHM (1u) + +/* KDF ISO15118 */ +#define CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV (16u) +#define CRYPTO_30_LIBCV_ISO15118_PRIV_KEY_START (CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV) +#define CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV_AND_PRIV_KEY (48u) +#define CRYPTO_30_LIBCV_ISO15118_SIZEOF_OTHER_INFO (3u) + +/* KDF ISO15118-20 */ +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV (12u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_TAG (16u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_OTHER_INFO (3u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY (32u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_P521 (94u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_P521 (CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521 (66u) +#define CRYPTO_30_LIBCV_ISO15118_20_IV_START_P521 (0u) +#define CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_P521 (CRYPTO_30_LIBCV_ISO15118_20_IV_START_P521 + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV) +#define CRYPTO_30_LIBCV_ISO15118_20_TAG_START_P521 (CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_P521 + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_X448 (84u) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448 (ESL_SIZEOF_X448_SHARED_SECRET) +#define CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448 (ESL_SIZEOF_X448_PRIVATE_KEY) +#define CRYPTO_30_LIBCV_ISO15118_20_IV_START_X448 (0u) +#define CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_X448 (CRYPTO_30_LIBCV_ISO15118_20_IV_START_X448 + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV) +#define CRYPTO_30_LIBCV_ISO15118_20_TAG_START_X448 (CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_X448 + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448) + +/* KDF NIST 800-56A */ +#define CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE (4u) +#define CRYPTO_30_LIBCV_NIST80056A_OTHER_INFO_MAXSIZE (5u) + +/* NIST 800-108 NIST/FIPS 186.4 */ +#define CRYPTO_30_LIBCV_SIZEOF_KDF_PRF_INPUT_BUFFER (256u + 12u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_PARENT_KEY (256u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY (256u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8 (256u + 8u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_SYMMETRIC (6u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC (38u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_PRIME (32u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_CONTEXT (4u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_TARGET_KEY_LENGTH (2u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_LABEL_LENGTH (4u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_ALGORITHM_LENGTH (1u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_PRIME_ASYM_EXTEND (8u) + +/* General */ +#define CRYPTO_30_LIBCV_SIZEOF_KDF_ITERATIONSLENGTH (CRYPTO_30_LIBCV_SIZEOF_UINT32) +#define CRYPTO_30_LIBCV_SIZEOF_HKDF_ITERATIONSLENGTH (1u) + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED STD_ON +#else +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED STD_OFF +#endif + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED STD_ON +#else +# define CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED STD_OFF +#endif + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON)) + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams() + *********************************************************************************************************************/ +/*! \brief Check KDF input parameters + * \details Gets and checks input parameters of the KDF according to NIST 800-108 NIST/FIPS 186-4. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] deriveAlgorithm The algorithm from the Algorithm key element + * \param[out] prfInputBuffer Input for the PRF + * \param[out] prfInputBufferLength Written Length of the PRF intput + * \param[out] saltBuffer The salt from the Salt key element (needs to be defined in the calling function because primeMinus1PtrPtr points into that buffer) + * \param[out] targetKeyLength Length of the target key + * \param[out] parentKeyLength Length of the parent key + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY The required key is busy. + * \pre All pointers need to be valid. + * Length of the buffer provided by deriveAlgorithm has to be 1 Byte. + * Length of the buffer provided by prfInputBuffer has to be CRYPTO_30_LIBCV_SIZEOF_KDF_PRF_INPUT_BUFFER Bytes. + * Length of the buffer provided by saltBuffer has to be CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC Bytes. + * cryptoKeyId and targetCryptoKeyId have to be a valid identifiers. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) parentKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt() + *********************************************************************************************************************/ +/*! \brief Gets and checks the salt input parameter of the KDF + * \details Gets and checks the salt input parameter of the KDF according to NIST 800-108 NIST/FIPS 186-4. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] deriveAlgorithm The algorithm from the Algorithm key element + * \param[out] prfInputBuffer Input for the PRF + * \param[out] prfInputBufferLength Written Length of the PRF intput + * \param[out] saltBuffer The salt from the Salt key element (needs to be defined in the calling function because primeMinus1PtrPtr points into that buffer) + * \param[out] targetKeyLength Length of the target key + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by deriveAlgorithm has to be 1 Byte. + * Length of the buffer provided by prfInputBuffer has to be CRYPTO_30_LIBCV_SIZEOF_KDF_PRF_INPUT_BUFFER Bytes. + * Length of the buffer provided by saltBuffer has to be CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC Bytes. + * cryptoKeyId and targetCryptoKeyId have to be a valid identifiers. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength() + *********************************************************************************************************************/ +/*! \brief Gets and checks the target key length from the salt input parameter of the KDF + * \details Gets and checks the target key length from the salt input parameter of the KDF according to + * NIST 800-108 NIST/FIPS 186-4. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] deriveAlgorithm The algorithm from the Algorithm key element + * \param[in] saltBuffer The salt from the Salt key element (needs to be defined in the calling function because primeMinus1PtrPtr points into that buffer) + * \param[out] targetKeyLength Length of the target key + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by deriveAlgorithm has to be 1 Byte. + * Length of the buffer provided by saltBuffer has to be CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC Bytes. + * targetCryptoKeyId has to be a valid identifier. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength( + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_CallPRF() + *********************************************************************************************************************/ +/*! \brief Calls the PRF function of the KDF + * \details Calls the PRF function of the KDF according to NIST 800-108 NIST/FIPS 186-4. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in,out] prfInputBuffer Input for the PRF + * \param[in] prfInputBufferLength Written Length of the PRF intput + * \param[out] targetKey Buffer for the target key + * \param[in] targetKeyLength Length of the target key + * \param[in] parentKeyLength Length of the parent key + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by targetKey has to be CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8 Bytes. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_CallPRF( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + uint32 prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) targetKey, + uint32 targetKeyLength, uint32 parentKeyLength); +#endif /* #if ((CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne() + *********************************************************************************************************************/ +/*! \brief Divides the given target key by the given prime-1 and adds one to the result + * \details Divides the given target key by the given prime-1 and adds one to the result according to NIST/FIPS 186-4. + * \param[out] targetKey Buffer for the target key + * \param[in] targetKeyLength Length of the target key + * \param[in] primeMinus1Ptr Pointer to the position of the prime minus-1 data within the salt + * \param[in] primeMinus1Length Length of the prime-1 + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by targetKey has to be CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8 Bytes. + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) targetKey, + uint32 targetKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) primeMinus1Ptr, + uint32 primeMinus1Length); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey() + *********************************************************************************************************************/ +/*! \brief Calculate one pass c1e1s KDF. + * \details Calculate the the one pass c1e1s corresponding to NIST 800 56A and load all required key elements. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey() + *********************************************************************************************************************/ +/*! \brief Calculate one pass c1e1s KDF. + * \details Calculate the the one pass c1e1s corresponding to NIST 800 56A and load all required key elements. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-145593 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash() + *********************************************************************************************************************/ +/*! \brief Calculate single step KDF. + * \details Calculate the single step kdf with HASH/Sha256 corresponding to NIST 800 56A. + * \param[in,out] workspace Hols the primitive workspace. + * \param[in] sharedSecretPtr Pointer to the shared secret. + * \param[in] sharedSecretLength Length of the shared secret. + * \param[in] otherInfoPtr Pointer to the other-information. + * \param[in] otherInfoLength Length of the other-information. + * \param[out] derivedKeyPtr Pointer to the derived key. + * \param[in,out] derivedKeyLengthPtr Pointer to the length of the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre sharedSecretPtr has to be a valid pointer with the length sharedSecretLength. + * otherInfoPtr has to be a valid pointer with the length otherInfoLength. + * derivedKeyPtr has to be a valid pointer with the length *derivedKeyLengthPtr. + * derivedKeyLengthPtr has to be a valid length pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + uint32 sharedSecretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) otherInfoPtr, + uint32 otherInfoLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) derivedKeyPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) derivedKeyLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S() + *********************************************************************************************************************/ +/*! \brief Calculate one pass c1e1s KDF. + * \details Calculate the the one pass c1e1s corresponding to NIST 800 56A. + * \param[in,out] workspace Hols the primitive workspace. + * \param[in] privateKeyPtr Pointer to the private key. + * \param[in] privateKeyLength Length of the private key. + * \param[in] partnerPubKeyPtr Pointer to the partner public key. + * \param[in] partnerPubKeyLength Length of the partner public key. + * \param[in] otherInfoPtr Pointer to the other-information. + * \param[in] otherInfoPtrLength Length of the other-information. + * \param[out] derivedKeyPtr Pointer to the derived key. + * \param[in,out] derivedKeyLengthPtr Pointer to the length of the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre privateKeyPtr has to be a valid pointer with the length privateKeyLength. + * partnerPubKeyPtr has to be a valid pointer with the length partnerPubKeyLength. + * otherInfoPtr has to be a valid pointer with the length otherInfoLength. + * derivedKeyPtr has to be a valid pointer with the length *derivedKeyLengthPtr. + * derivedKeyLengthPtr has to be a valid length pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) otherInfoPtr, + uint32 otherInfoPtrLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) derivedKeyPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) derivedKeyLengthPtr); +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey() + *********************************************************************************************************************/ +/*! \brief Check key according to ISO15118. + * \details Check if the key pair is valid according to ISO15118. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] privateKeyPtr Pointer to the private key. + * \param[in] privateKeyLength Length of the private key. + * \param[in] pubKeyPtr Pointer to the public key. + * \param[in] pubKeyLength Length of the public key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre privateKeyPtr has to be a valid pointer with the length privateKeyLength. + * pubKeyPtr has to be a valid pointer with the length pubKeyLength. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey( + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt() + *********************************************************************************************************************/ +/*! \brief Decrypt Aes128 data. + * \details Decrypt Aes128 data corresponding to ISO15118(extract private key). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] ivPtr Pointer to the initial vector. + * \param[in] keyPtr Pointer to the encryption key. + * \param[in] encryptedMessagePtr Pointer to the encrypted message. + * \param[in] encryptedMessageLength Length of the encrypted message. + * \param[out] plainMessagePtr Pointer to the plain message. + * \param[in,out] plainMessageLengthPtr Length of the plain message. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre encryptedMessagePtr has to be a valid pointer with the length encryptedMessageLength. + * plainMessagePtr has to be a valid pointer with the length plainMessageLengthPtr. + * plainMessageLengthPtr has to be a length valid pointer. + * ivPtr has to be a length valid pointer to a valid IV with the length CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV. + * keyPtr has to be a length valid pointer to a valid AES128 key with the length ESL_SIZEOF_AES128_KEY. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt( + P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) ivPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedMessagePtr, + uint32 encryptedMessageLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) plainMessagePtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) plainMessageLengthPtr); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA() + *********************************************************************************************************************/ +/*! \brief Check ECDSA key according to ISO15118-20. + * \details Check if the key pair is valid according to ISO15118-20. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] privateKeyPtr Valid pointer to the private key with the length privateKeyLength. + * \param[in] privateKeyLength Length of the private key. + * \param[in] pubKeyPtr Valid pointer to the public key with the length pubKeyLength. + * \param[in] pubKeyLength Length of the public key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA( + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448() + *********************************************************************************************************************/ +/*! \brief Check X448 key according to ISO15118-20. + * \details Check if the key pair is valid according to ISO15118-20. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] privateKeyPtr Valid pointer to the private key with the length privateKeyLength. + * \param[in] privateKeyLength Length of the private key. + * \param[in] pubKeyPtr Valid pointer to the public key with the length pubKeyLength. + * \param[in] pubKeyLength Length of the public key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448( + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt() + *********************************************************************************************************************/ +/*! \brief Decrypt AesGcm256 data. + * \details Decrypt AesGcm256 data corresponding to ISO15118-20(extract contract private key). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] ivPtr Valid pointer to the initial vector with the length CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV. + * \param[in] keyPtr Valid pointer to the AESGcm256 encryption key with the length CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY. + * \param[in] aadPtr Valid pointer to the AAD (PCID + SKI) with the length aadLength. + * \param[in] aadLength Length of the AAD. + * \param[in] tagPtr Valid pointer to the AESGcm256 tag with the length CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_TAG. + * \param[in] encryptedMessagePtr Valid pointer to the encrypted message with the length encryptedMessageLength. + * \param[in] encryptedMessageLength Length of the encrypted message. + * \param[out] plainMessagePtr Valid pointer to the plain message with the length plainMessageLengthPtr. + * \param[in,out] plainMessageLengthPtr Length of the plain message. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) ivPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) aadPtr, + uint32 aadLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) tagPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedMessagePtr, + uint32 encryptedMessageLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) plainMessagePtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) plainMessageLengthPtr); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SERVICE_KEY_DERIVE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Derive_UpdateKeyState() + **********************************************************************************************************************/ +/*! \brief Update Key State after key derive. + * \details - + * \param[in] objectId Holds the identifier of driver object. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] retVal Holds the retVal of the key derive. + * \pre cryptoKeyId has to be a valid identifier. + * objectId has to be a valid identifier. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Derive_UpdateKeyState( + uint32 objectId, + uint32 targetCryptoKeyId, + Std_ReturnType retVal); +#endif + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS() + *********************************************************************************************************************/ +/*! \brief Derive Key for NIST 800-108 NIST/FIPS 186.4 + * \details Dispatch and derive the key according to NIST 800-108 NIST/FIPS 186-4. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] deriveAlgorithm The algorithm from the Algorithm key element + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY The required key is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * targetCryptoKeyId has to be a valid crypto key. + * deriveAlgorithm has to be a valid (CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 + * or CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB). + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864() + *********************************************************************************************************************/ +/*! \brief Derive Key for NIST 800-108 NIST/FIPS 186.4 + * \details Dispatch and derive the key according to NIST 800-108 NIST/FIPS 186-4. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] deriveAlgorithm The algorithm from the Algorithm key element + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY The required key is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * targetCryptoKeyId has to be a valid crypto key. + * deriveAlgorithm has to be a valid (CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 + * or CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB). + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-132407, CREQ-145592 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm); +#endif /* CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED || CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_108_CTR_CMAC_AES_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput() + *********************************************************************************************************************/ +/*! \brief Get inputs and outputs used by NIST800-108 KDF. + * \details Get pointers and lengths of the key elements providing sourceKey, label, context and targetKey. + * Label and context are optional and may be NULL_PTR with length zero. All members of + * pInputOutputContainer are initialized by this function only if E_OK is returned. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \param[out] pInputOutputContainer Pointer to the container where this function writes the pointers and lengths + * of the key elements used as input and output. + * \return E_OK Request successful, all members of pInputOutputContainer were initialized. + * E_NOT_OK Request failed, some members of pInputOutputContainer may be uninitialized. + * CRYPTO_E_KEY_NOT_VALID Request failed, key is not valid. + * \pre cryptoKeyId has to be a valid crypto key. + * targetCryptoKeyId has to be a valid crypto key. + * pInputOutputContainer must be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput( + uint32 cryptoKeyId, + uint32 targetKeyId, + P2VAR(Crypto_30_LibCv_Nist800108_KDF_InputOutput, AUTOMATIC, AUTOMATIC) pInputOutputContainer); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES() + *********************************************************************************************************************/ +/*! \brief Derive Key using NIST 800-108 Counter mode with CMAC AES. + * \details Choose AES128 or AES256 based on sourceKey length (16 or 32 Byte) and derive key using ESLib. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in,out] pInputOutputContainer Pointer to container holding pointers and lengths of input and output. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_SIZE_MISMATCH SourceKey has not the correct length of 16 or 32 bytes. + * \pre Pointers must be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES( + P2VAR(eslt_WorkSpaceKDFnist800108, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_30_LibCv_Nist800108_KDF_InputOutput, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) pInputOutputContainer); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS() + *********************************************************************************************************************/ +/*! \brief Derive Key for NIST 800-108 using the ESLib for calculation. + * \details Get needed input and output, choose algorithm and derive the key. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace must be a valid pointer. + * cryptoKeyId has to be a valid crypto key. + * targetCryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS( + P2VAR(eslt_WorkSpaceKDFnist800108, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic() + *********************************************************************************************************************/ +/*! \brief Derive Key for NIST 800-108 using the ESLib for calculation. + * \details Provide workspace on stack and call Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS(). + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre cryptoKeyId has to be a valid crypto key. + * targetCryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_108_CTR_CMAC_AES_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118 key. + * \details Install and update the key according to ISO15118. Calculate the session key an decrypt the new private key. + * \param[in,out] workspace Holds the primitives workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118 key. + * \details Install and update the key according to ISO15118. Calculate the session key an decrypt the new private key. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_ISO15118CertificateInstallationAndUpdate + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118-20 key with curve SECP521R1. + * \details Calculates the session key and decrypt the contract private key according to ISO15118-20 using SECP521R1. + * \param[in,out] workspace Holds the primitives workspace. + * \param[in] privKeyPtr Pointer to the provision certificate private key. + * \param[in] privKeyLength Length of the provision certificate private key. + * \param[in] partnerPubKeyPtr Pointer to the partner public key. + * \param[in] partnerPubKeyLength Length of the partner public key. + * \param[in] encryptedDataKeyPtr Pointer to the data which holds the IV and the encrypted contract private key. + * \param[in] associatedDataPtr Pointer to the associated data of the encryptedDataKey. + * \param[in] associatedDataLength Length of the associated data. + * \param[out] contractCertPrivateKeyPtr Pointer to where the contract certificate private key should be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre privKeyPtr is a valid pointer to a key of length privKeyLength. + * partnerPubKeyPtr is a valid pointer to a key of length partnerPubKeyLength. + * encryptedDataKeyPtr is a valid pointer to a key of length CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_P521. + * associatedDataPtr is a valid pointer to associatedData of length associatedDataLength. + * contractCertPrivateKeyPtr is a valid pointer of length >= CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privKeyPtr, + uint32 privKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedDataKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) contractCertPrivateKeyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118-20 key with Curve448. + * \details Calculates the session key and decrypt the contract private key according to ISO15118-20 using X448. + * \param[in,out] workspace Holds the primitives workspace. + * \param[in] privKeyPtr Pointer to the provision certificate private key. + * \param[in] privKeyLength Length of the provision certificate private key. + * \param[in] partnerPubKeyPtr Pointer to the partner public key. + * \param[in] partnerPubKeyLength Length of the partner public key. + * \param[in] encryptedDataKeyPtr Pointer to the data which holds the IV and the encrypted contract private key. + * \param[in] associatedDataPtr Pointer to the associated data of the encryptedDataKey. + * \param[in] associatedDataLength Length of the associated data. + * \param[out] contractCertPrivateKeyPtr Pointer to where the contract certificate private key should be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre privKeyPtr is a valid pointer to a key of length privKeyLength. + * partnerPubKeyPtr is a valid pointer to a key of length partnerPubKeyLength. + * encryptedDataKeyPtr is a valid pointer to a key of length CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_X448. + * associatedDataPtr is a valid pointer to associatedData of length associatedDataLength. + * contractCertPrivateKeyPtr is a valid pointer of length >= CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privKeyPtr, + uint32 privKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedDataKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) contractCertPrivateKeyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118-20 key. + * \details Installs the key according to ISO15118-20. Calculates the session key an decrypt the contract private key. + * \param[in,out] workspace Holds the primitives workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20() + *********************************************************************************************************************/ +/*! \brief Derives a ISO15118-20 key. + * \details Installs the key according to ISO15118-20. Calculate the session key an decrypt the contract private key. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_ISO15118-20-CertificateInstallation + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1() + **********************************************************************************************************************/ +/*! \brief Derives a PBKDF2 HMAC SHA1 key. + * \details Derives a key according to PBKDF2 HMAC SHA1 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-248610 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1() + **********************************************************************************************************************/ +/*! \brief Derives a PBKDF2 HMAC SHA1 key. + * \details Derives a key according to PBKDF2 HMAC SHA1 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \param[in] iterations Holds the value to the iterations. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1( + P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint32 iterations); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) */ + +#if((CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS() + **********************************************************************************************************************/ +/*! \brief Derives a PBKDF2 HMAC SHA1 or PBKDF2 HMAC SHA256 key. + * \details Derives a key according to PBKDF2 HMAC SHA1 or PBKDF2 HMAC SHA256 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] algorithm Holds the identifier of the algorithm which is used for the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS( + P2VAR(eslt_WorkSpaceKDF2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 algorithm); +#endif /* ( CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON || CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256() + **********************************************************************************************************************/ +/*! \brief Derives a PBKDF2 HMAC SHA256 key. + * \details Derives a key according to PBKDF2 HMAC SHA256 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-248610 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256() + **********************************************************************************************************************/ +/*! \brief Derives a PBKDF2 HMAC SHA256 key. + * \details Derives a key according to PBKDF2 HMAC SHA256 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \param[in] iterations Holds the value of the iterations. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256( + P2VAR(eslt_WorkSpaceKDF2HMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint32 iterations); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF HMAC key. + * \details Derives a key according to HKDF HMAC with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashAlgorithmId Holds the identifier of the hash algorithm to use for HMAC. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF HMAC SHA256 key. + * \details Derives a key according to HKDF HMAC with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret), + * CRYPTO_KE_KEYDERIVATION_SALT(Seed) and CRYPTO_KE_KEYDERIVATION_ITERATIONS(Iteration). + * By passing a suitable workspace to Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashAlgorithmId Holds the identifier of the hash algorithm to use for HMAC. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-266053 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF HMAC SHA256 key. + * \details Derives a key according to HKDF HMAC SHA256. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] saltLength Holds the length of the salt. + * \param[in] saltPtr Holds the pointer to the salt with length of saltLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \param[in] iterations Holds the value of the iterations. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 saltLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint8 iterations); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF Hash Option 1 key. + * \details Derives a key according to HKDF option 1 with the specified CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret). + * The hash function is specified using the CRYPTO_KE_KEYDERIVATION_ALGORITHM(Algorithm). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashId Holds the identifier of the Hash. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-304740 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS( + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + eslt_HashAlgorithm hashId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF Hash Option 1 key. + * \details Derives a key according to HKDF Hash Option 1 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) + * and optionally CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional information). + * The hash function is specified using the CRYPTO_KE_KEYDERIVATION_ALGORITHM(Algorithm). + * By passing a suitable workspace to Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashId Holds the identifier of the hash. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + eslt_HashAlgorithm hashId); +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF Hash Option 1 key. + * \details Derives a key according to HKDF Hash Option 1. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \param[in] hashId Holds the value of the hash id. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1( + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + eslt_HashAlgorithm hashId); +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384() + **********************************************************************************************************************/ +/*! \brief Derives a HKDF HMAC SHA384 key. + * \details Derives a key according to HKDF HMAC SHA384. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] saltLength Holds the length of the salt. + * \param[in] saltPtr Holds the pointer to the salt with length of saltLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \param[in] iterations Holds the value of the iterations. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 saltLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint8 iterations); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC() + **********************************************************************************************************************/ +/*! \brief Expands a key according to the second step of HKDF HMAC. + * \details Expands a given key according to HKDF HMAC with a local workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashAlgorithmId Holds the identifier of the hash algorithm to use for HMAC. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-Crypto-HKDFExpand + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS() + **********************************************************************************************************************/ +/*! \brief Expands a key according to the second step of HKDF HMAC. + * \details Expands a given key according to HKDF HMAC with provided workspace. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in] hashAlgorithmId Holds the identifier of the hash algorithm to use for HMAC. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS() + **********************************************************************************************************************/ +/*! \brief Derives a Spake2+ key. + * \details Derives a key according to Spake2+ preamble phase with the given Secret [w0s|w1s], the function derives + * w0, w1 and l. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS( + P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Spake2Plus() + **********************************************************************************************************************/ +/*! \brief Derives a Spake2+ key. + * \details Derives a key according to Spake2+ preamble phase with the given Secret [w0s|w1s], the function derives + * w0, w1 and l. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Spake2Plus( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus() + **********************************************************************************************************************/ +/*! \brief Derives a Spake2+ key. + * \details Derives a key according to Spake2+ with the given Secret [w0s|w1s], the function derives + * w0, w1 and l. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] secretPtr Holds the pointer to the secret [w0s|w1s] with length of secretLength. + * \param[in] secretLength Holds the length of the secret. + * \param[in,out] w0Ptr Holds the pointer to the value w0 with length of w0Length. + * \param[in] w0Length Holds the length of the w0. + * \param[in,out] w1Ptr Holds the pointer to the value w1 with length of w1Length. + * \param[in] w1Length Holds the length of the w1. + * \param[in,out] lPtr Holds the pointer to the point l with length of lLength. + * \param[in] lLength Holds the length of the l. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus( + P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 secretLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) w1Ptr, + uint32 w1Length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) lPtr, + uint32 lLength); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-256. + * \details Derives a key according to KDF X9.63 Sha-256 with the given secret and + * optional seed. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc( + P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-256. + * \details Derives a key according to KDF X9.63 Sha-256 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) and + * optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + * By passing a suitable workspace to Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-191710 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-256. + * \details Derives a key according to KDF X9.63 Sha-256 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) and + * optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS( + P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-512. + * \details Derives a key according tp KDF X9.63 Sha-512 with the given secret and + * optional seed. + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] secretLength Holds the length of the secret. + * \param[in] secretPtr Holds the pointer to the secret with length of secretLength. + * \param[in] infoLength Holds the length of the info. + * \param[in] infoPtr Holds the pointer to the info with length of infoLength. + * \param[in] keyLength Holds the length of the key. + * \param[in,out] keyPtr Holds the pointer to the key with length of keyLength. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc( + P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-512. + * \details Derives a key according tp KDF X9.63 Sha-512 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) and + * optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + * By passing a suitable workspace to Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-191710 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS() + **********************************************************************************************************************/ +/*! \brief Derives a KDF X9.63 key with Sha-512. + * \details Derives a key according to KDF X9.63 Sha-512 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) and + * optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + * \param[in,out] workspace Holds the primitive workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS( + P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt() + **********************************************************************************************************************/ +/*! \brief Gets the secret and salt index and checks the target key. + * \details Gets the index for secret and salt and checks the target key for validity. + * \param[in,out] secretLength Holds the length of the secret. + * \param[in,out] secretIndex Holds the secret index. + * \param[in,out] saltLength Holds the length of the salt. + * \param[in,out] saltIndex Holds the salt index. + * \param[in,out] keyLength Holds the length of the key. + * \param[in,out] keyElementIndex Holds the key element index. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt( + P2VAR(uint32, AUTOMATIC, AUTOMATIC) secretLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) secretIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) saltLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) saltIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) keyLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) keyElementIndex, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON)) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength( + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength) +{ + Std_ReturnType retVal = E_OK; + + uint32 configuredTargetKeyLength = 0u; + + /* #1 Get configured target key length */ + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + if (Crypto_30_LibCv_Local_KeyElementSearch(targetCryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* Get Configured Target Key Length */ + configuredTargetKeyLength = Crypto_30_LibCv_GetKeyElementLength(elementIndex); + } + else + { + retVal = E_NOT_OK; /* PRQA S 2982 */ /* MD_MSR_RetVal */ + } + + /* #2 Compare the configured length against the target key length given in salt */ + /* The keyLength (k) in salt is given in bytes and Big Endian Format. This has to be converted to size in bits and little endian format later */ + (*targetKeyLength) = (((((uint32)(saltBuffer[4])) << 8) | ((uint32)(saltBuffer[5])))); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + /* Check valid target key length */ + if ((*targetKeyLength > CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY) || + ((*targetKeyLength) > configuredTargetKeyLength)) + { + retVal = E_NOT_OK; + } + +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) +# if (CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) + /* #3 For Asym keys check that length is supported by used prime numbers */ + if (deriveAlgorithm == CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB) +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(deriveAlgorithm); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + { + if ((*targetKeyLength) != CRYPTO_30_LIBCV_SIZEOF_KDF_PRIME) + { + retVal = E_NOT_OK; + } + + /* #4 For Asymmetric key derivation target key has to be extended by 8 bytes, because it is divided by prime-1 in the second step */ + (*targetKeyLength) += CRYPTO_30_LIBCV_SIZEOF_KDF_PRIME_ASYM_EXTEND; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(deriveAlgorithm); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength) +{ + Std_ReturnType retVal; + + Crypto_30_LibCv_SizeOfKeyStorageType saltIndex; + uint32 saltLength; + + /* #1 Load Salt / Context from the salt key element */ + /* 4 byte Context | 2 byte target Key Length in Big Endian (k) | 32 byte curve specific Prime-1 */ + /* For Asym keys the salt contains also the 32 byte prime-1 */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_SALT, &saltIndex, &saltLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* #2 Check expected salt length according to the algorithm */ + if (retVal == E_OK) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + if (deriveAlgorithm == CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256) +# endif + { + if (saltLength != CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_SYMMETRIC) + { + retVal = E_NOT_OK; + } + } +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + else +# endif +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + { + /* CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB */ + if (saltLength != CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC) + { + retVal = E_NOT_OK; + } + } +# endif + } + + /* #4 Copy the 4 byte Context into the PRF input buffer */ + if (retVal == E_OK) + { + Crypto_30_LibCv_CopyData(saltBuffer, Crypto_30_LibCv_GetAddrKeyStorage(saltIndex), saltLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + Crypto_30_LibCv_CopyData(&(prfInputBuffer[*prfInputBufferLength]), saltBuffer, CRYPTO_30_LIBCV_SIZEOF_KDF_CONTEXT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + (*prfInputBufferLength) += CRYPTO_30_LIBCV_SIZEOF_KDF_CONTEXT; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + retVal = Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt_TargetKeyLength(targetCryptoKeyId, deriveAlgorithm, saltBuffer, targetKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + return retVal; +} /* Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_HandleInputParams() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_HandleInputParams( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltBuffer, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) targetKeyLength, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) parentKeyLength) +{ + Std_ReturnType retVal; + Crypto_30_LibCv_SizeOfKeyStorageType passwordIndex = 0u; /* init with valid value */ + Crypto_30_LibCv_SizeOfKeyStorageType labelIndex = 0u; /* init with valid value */ + uint32 labelLength = CRYPTO_30_LIBCV_SIZEOF_KDF_LABEL_LENGTH; + + (*parentKeyLength) = CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_PARENT_KEY; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + /* #2 Get Parent Key from the password key element and write it to the PRF input buffer */ + + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &passwordIndex, parentKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + Crypto_30_LibCv_CopyData(prfInputBuffer, Crypto_30_LibCv_GetAddrKeyStorage(passwordIndex), *parentKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + (*prfInputBufferLength) += *parentKeyLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + /* #3 Get Label from the Label key element and write it to the PRF input buffer */ + /* Skip one byte for iteration counter */ + (*prfInputBufferLength)++; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL, &labelIndex, &labelLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + + if (retVal == E_OK) + { + Crypto_30_LibCv_CopyData(&(prfInputBuffer[*prfInputBufferLength]), Crypto_30_LibCv_GetAddrKeyStorage(labelIndex), labelLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + (*prfInputBufferLength) += labelLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + /* #4 Add constant byte 0x00 to the PRF input buffer */ + prfInputBuffer[*prfInputBufferLength] = 0x00u; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + (*prfInputBufferLength)++; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + + /* #5 Get and check the Salt element */ + retVal = Crypto_30_LibCv_Local_Kdf_HandleInputParams_Salt(cryptoKeyId, targetCryptoKeyId, deriveAlgorithm, prfInputBuffer, prfInputBufferLength, saltBuffer, targetKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + /* #6 Convert target key length to bits and little endian and copy it to the input buffer */ + if (retVal == E_OK) + { + /* Set k in bits and little endian (lo byte first) */ + prfInputBuffer[*prfInputBufferLength] = (uint8)((uint16)((*targetKeyLength << 3u)) & 0x00FFu); /* lo byte */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + prfInputBuffer[*prfInputBufferLength + 1u] = (uint8)((uint16)((*targetKeyLength) >> 5u) & 0x00FFu); /* hi byte */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ /* PRQA S 2985 */ /* MD_CRYPTO_30_LIBCV_2985 */ + (*prfInputBufferLength) += CRYPTO_30_LIBCV_SIZEOF_KDF_TARGET_KEY_LENGTH; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_Kdf_HandleInputParams() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_CallPRF() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060, 6080 7 */ /* MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_CallPRF( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) prfInputBuffer, + uint32 prfInputBufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) targetKey, + uint32 targetKeyLength, + uint32 parentKeyLength) +{ + Std_ReturnType retVal = E_OK; + uint32_least derivedLength; + uint8 i = 1u; + + /* #1 Iterate over the target key length */ + for (derivedLength = 0u; derivedLength < targetKeyLength; derivedLength += ESL_SIZEOF_SHA256_DIGEST) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND_WITH_CHECK */ + { + uint8 tempHashBuf[ESL_SIZEOF_SHA256_DIGEST] = { 0u }; + + /* #11 Set the iteration counter i in the PRF input buffer. Inserted after parent key */ + prfInputBuffer[parentKeyLength] = i; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + i++; + + /* #12 Call SHA-256 as PRF */ + retVal = E_NOT_OK; + /* CRYPTO_OPERATIONMODE_START: */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_SHA256, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + { + if (esl_initSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + { + /* CRYPTO_OPERATIONMODE_UPDATE: */ + if (esl_updateSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (eslt_Length)prfInputBufferLength, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))prfInputBuffer) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_PTR */ + { + /* CRYPTO_OPERATIONMODE_FINISH: */ + if (esl_finalizeSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))tempHashBuf) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + retVal = E_OK; + } + } + } + } + + /* #13 Copy the PRF result to the end of the target key buffer */ + if (retVal == E_OK) + { + if ((derivedLength + ESL_SIZEOF_SHA256_DIGEST) <= targetKeyLength) + { + Crypto_30_LibCv_CopyData(&(targetKey[derivedLength]), tempHashBuf, ESL_SIZEOF_SHA256_DIGEST); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + Crypto_30_LibCv_CopyData(&(targetKey[derivedLength]), tempHashBuf, (uint16)(targetKeyLength - derivedLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + } + else + { + break; + } + /* END Calculate Hash */ + } + return retVal; +} /* Crypto_30_LibCv_Local_Kdf_CallPRF() */ + +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) targetKey, + uint32 targetKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) primeMinus1Ptr, + uint32 primeMinus1Length) +{ + Std_ReturnType retVal = E_OK; + /* #1 Use the library function actBNReduce to divide big numbers */ + /* r = a mod b + ** + ** int actBNReduce(actBNDIGIT* a, + ** actBNLENGTH a_length, + ** actBNDIGIT* b, + ** actBNLENGTH b_length, + ** actBNDIGIT* r, + ** void (*watchdog) (void)); + ** + ** BigNum reduce (r = a mod b). + ** + ** input: (length in digits) + ** - a: first number (will be destroyed) a_length+1 + ** - b: second number (will be returned const b_length + ** but touched by the normalization) + ** - r: result buffer b_length+1 + ** + ** output: + ** - a: the normalized result a mod b b_length + ** - b: second number b_length + ** - r: the result a mod b b_length + ** - returns: -1 if exact b_length <= 1 (error) + ** 0 else (success) */ + +# if (CRYPTO_30_LIBCV_BYTES_PER_DIGIT == 4) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT_DEFINE */ + actBNDIGIT a[264u >> 2]; /* 256 + 8 */ + actBNLENGTH a_length = (actBNLENGTH)(targetKeyLength >> 2); /* PRQA S 4394 */ /* MD_CRYPTO_30_LIBCV_4394 */ + actBNDIGIT b[256u >> 2]; + actBNLENGTH b_length = (actBNLENGTH)(primeMinus1Length >> 2); /* PRQA S 4394 */ /* MD_CRYPTO_30_LIBCV_4394 */ + actBNDIGIT r[264u >> 2]; +# else +# error "Value of CRYPTO_30_LIBCV_BYTES_PER_DIGIT is not supported" +# endif + + uint8 one = 1u; + uint32 res; /* PRQA S 5013 */ /* MD_CRYPTO_30_LIBCV_5013 */ + + /* #11 Set the so far calculated target key as dividend */ + actBNSetOctetString(a, a_length, targetKey, (uint32)targetKeyLength); /* PRQA S 5013 */ /* MD_CRYPTO_30_LIBCV_5013 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + + /* #12 Set the prime-1 as divisor */ + actBNSetOctetString(b, b_length, primeMinus1Ptr, (uint32)primeMinus1Length); /* PRQA S 5013 */ /* MD_CRYPTO_30_LIBCV_5013 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + + /* #13 Call actBNReduce and store the value in targetKey */ + res = actBNReduce(a, a_length, b, b_length, r, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (res == (uint32)0) + { + /* #2 Add one and return the result */ + actBNSetOctetString(a, a_length, &one, (uint32)1); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)actBNAdd(r, a, r, a_length); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + actBNOctetString(targetKey, (uint32)targetKeyLength, r, a_length); /* PRQA S 5013 */ /* MD_CRYPTO_30_LIBCV_5013 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retVal = E_NOT_OK; + } + return retVal; +} /* Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne() */ +# endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + uint32 targetKeyLength; + + uint32 parentKeyLength; + uint32 prfInputBufferLength = 0u; +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + uint16 primeMinus1Length; + P2VAR(uint8, AUTOMATIC, AUTOMATIC) primeMinus1Ptr; /* PRQA S 3678 */ /* MD_CRYPTO_30_LIBCV_3678 */ +# endif + + /* Input buffer for the Pseudo Random Function. */ + /* Buffer size is 256 byte maximum parent key length + 12 byte (1 byte iteration | 4 byte Label | 1 byte 0x00 | 6 byte of salt (2 byte TypeID | 2 byte training Counter | 2 byte target Key Length in little endian (k))) */ + uint8 prfInputBuffer[CRYPTO_30_LIBCV_SIZEOF_KDF_PRF_INPUT_BUFFER]; + uint8 saltBuffer[CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_ASYMMETRIC]; + uint8 targetKey[CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8]; /* 256+8 for asym KDF */ + + /* ----- Implementation ------------------------------------------------- */ + Crypto_30_LibCv_ClearData(targetKey, CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #1 Handle input parameter */ + retVal = Crypto_30_LibCv_Local_Kdf_HandleInputParams(cryptoKeyId, targetCryptoKeyId, deriveAlgorithm, prfInputBuffer, &prfInputBufferLength, saltBuffer, &targetKeyLength, &parentKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #5 Call PRF */ + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Local_Kdf_CallPRF(workspace, prfInputBuffer, prfInputBufferLength, targetKey, targetKeyLength, parentKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + /* #10 Handle the results of the PRF according to the algorithm */ + if (retVal == E_OK) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + if (deriveAlgorithm == CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256) +# endif + { + /* #15 Symmetric Key Derive finished here. Copy calculated key to key element */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, targetKey, targetKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + else +# endif +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + { + /* CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB */ + /* #20 For Asymmetric Key Derive: */ + + /* #25 Set the prime minus-1 pointer to the start address of the value within the salt buffer and set the data length */ + primeMinus1Ptr = &(saltBuffer[CRYPTO_30_LIBCV_SIZEOF_KDF_SALT_SYMMETRIC]); + primeMinus1Length = CRYPTO_30_LIBCV_SIZEOF_KDF_PRIME; + + /* #30 Calculate private key for asymmetric keys only by dividing key by given prime-1 */ + retVal = Crypto_30_LibCv_Local_Kdf_AsymDivideByPrimeMinusOne(targetKey, targetKeyLength, primeMinus1Ptr, primeMinus1Length); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + /* Skip the first 8 additional bytes */ + /* #35 Asymmetric Key Derive finished. Copy calculated key to key element */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, &(targetKey[8]), targetKeyLength - 8u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } +# endif + } + Crypto_30_LibCv_ClearData(targetKey, CRYPTO_30_LIBCV_SIZEOF_KDF_MAX_TARGET_KEY_PLUS_8); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #40 If key was derived successfully, mark it as valid */ + if (retVal != E_OK) + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 deriveAlgorithm) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + eslt_WorkSpaceSHA256 workspace; + /* ----- Implementation ------------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS(&workspace, cryptoKeyId, targetCryptoKeyId, deriveAlgorithm); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864() */ +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_108_CTR_CMAC_AES_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput( + uint32 cryptoKeyId, + uint32 targetKeyId, + P2VAR(Crypto_30_LibCv_Nist800108_KDF_InputOutput, AUTOMATIC, AUTOMATIC) pInputOutputContainer) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType cryptoKeyIndex, labelIndex, contextIndex; + + /* # Source key */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, + &cryptoKeyIndex, &pInputOutputContainer->sourceKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + pInputOutputContainer->sourceKey = Crypto_30_LibCv_GetAddrKeyStorage(cryptoKeyIndex); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* # Label (optional) */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL, &labelIndex, &pInputOutputContainer->labelLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + pInputOutputContainer->label = Crypto_30_LibCv_GetAddrKeyStorage(labelIndex); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + pInputOutputContainer->label = NULL_PTR; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + pInputOutputContainer->labelLength = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else + { + /* remain on error code from KeyElementGetStorageIndexJobOptional */ + } + + if (retVal == E_OK) + { + /* # Context (optional) */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT, &contextIndex, &pInputOutputContainer->contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + pInputOutputContainer->context = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + pInputOutputContainer->context = NULL_PTR; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + pInputOutputContainer->contextLength = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else + { + /* remain on error code from KeyElementGetStorageIndexJobOptional */ + } + + if (retVal == E_OK) + { + /* Target key */ + retVal = Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, + &pInputOutputContainer->targetKEIdx, &pInputOutputContainer->targetKeyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + pInputOutputContainer->targetKey = Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(pInputOutputContainer->targetKEIdx)); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES( + P2VAR(eslt_WorkSpaceKDFnist800108, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_30_LibCv_Nist800108_KDF_InputOutput, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) pInputOutputContainer) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet = ESL_ERC_ERROR; + + /* Choose AES128 or AES256 depending on the size of the source key. */ + switch(pInputOutputContainer->sourceKeyLength) + { + case ESL_SIZEOF_AES128_KEY: + eslRet = esl_initKDFnist800108_CMAC_AES128(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->sourceKey, + (eslt_Length)pInputOutputContainer->sourceKeyLength, ESL_KDF800108_MODE_CRT_BE); + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_deriveKDFnist800108_CMAC_AES128(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->label, + (eslt_Length)pInputOutputContainer->labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->context, + (eslt_Length)pInputOutputContainer->contextLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->targetKey, + (eslt_Length)pInputOutputContainer->targetKeyLength); + } + break; + + case ESL_SIZEOF_AES256_KEY: + eslRet = esl_initKDFnist800108_CMAC_AES256(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->sourceKey, + (eslt_Length)pInputOutputContainer->sourceKeyLength, ESL_KDF800108_MODE_CRT_BE); + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_deriveKDFnist800108_CMAC_AES256(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->label, + (eslt_Length)pInputOutputContainer->labelLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->context, + (eslt_Length)pInputOutputContainer->contextLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))pInputOutputContainer->targetKey, + (eslt_Length)pInputOutputContainer->targetKeyLength); + } + break; + + default: + /* Key size not supported. */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + break; + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS( + P2VAR(eslt_WorkSpaceKDFnist800108, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* Will be initialized by Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput() */ + Crypto_30_LibCv_Nist800108_KDF_InputOutput InputOutputContainer; + + /* Get pointer and length of input and output. */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108_GetInputOutput(cryptoKeyId, targetKeyId, &InputOutputContainer); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + retVal = E_NOT_OK; + + /* Init workspace header. */ + if(esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workspace->header), ESL_MAXSIZEOF_WS_NIST800108KDF, CRYPTO_30_LIBCV_WATCHDOG_PTR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE_PARAMETER */ + == ESL_ERC_NO_ERROR) + { + /* Derive key according to NIST800-108 (only counter mode with CMAC AES is supported by now). */ + retVal = Crypto_30_LibCv_Calc_Nist800108_CTR_CMAC_AES(workspace, &InputOutputContainer); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Update key element. */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(InputOutputContainer.targetKEIdx); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetKeyId, InputOutputContainer.targetKEIdx, InputOutputContainer.targetKeyLength); + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_WorkSpaceKDFnist800108 workspace; + /* ----- Implementation ------------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_STACK_WORKSPACE */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_108_CTR_CMAC_AES_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060, 6080 8 */ /* MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash( + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + uint32 sharedSecretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) otherInfoPtr, + uint32 otherInfoLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) derivedKeyPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) derivedKeyLengthPtr) +{ + /* This check is not required while the sharedSecret size and hash digest size are equal but is required by IS15118 (marked with \fr) */ + /* \fr uint32 repeatSteps; */ + /* \fr uint32 counter; */ + uint32 derivedLength = 0u; + uint8 concatenateBuf[CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE + CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE + CRYPTO_30_LIBCV_NIST80056A_OTHER_INFO_MAXSIZE]; + Std_ReturnType retVal = E_NOT_OK; + /* #1 init workspace */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) & workspace->header, ESL_MAXSIZEOF_WS_SHA256, CRYPTO_30_LIBCV_WATCHDOG_PTR) != ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + { + /* retVal remains E_NOT_OK */ + } + /* #2 Check that sharedSecretLength does not exceed the maximum ECC key size */ + else if (sharedSecretLength > CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) + { + /* retVal remains E_NOT_OK */ + } + else + { + /* Single-step KDF Option 1 Hash */ + /* Implementation according to NIST SP 56A: Revision 2, May 2013 (5.8.1.1 The Single-Step KDF Specification) */ + + /* #5 (Spec-Step: 1) calculate repeat Steps. */ + /* repeat Steps = KeyLength(bit)/HashLength(bit) */ + /* This check is not required while the sharedSecret size and hash digest size are equal */ + /* \fr repeatSteps = Crypto_30_LibCv_Byte2Bit(sharedSecretLength) / Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_SHA256_DIGEST); */ + + /* #10 (Spec-Step: 2) check max repeat Steps. */ + /* This check is not required while the sharedSecret size and hash digest size are equal */ + /* \fr if ((repeatSteps * ESL_SIZEOF_SHA256_DIGEST) <= *derivedKeyLengthPtr) */ + { + + /* #12 add shared secret to string. */ + /* (counter || Z || OtherInfo) */ + Crypto_30_LibCv_CopyData(&concatenateBuf[CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE], sharedSecretPtr, sharedSecretLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + + /* #15 add otherInformation to string. */ + /* OtherInfo = (AlgorithmID || PartyUInfo(Transmitter) || PartyVInfo(Receiver)) */ + Crypto_30_LibCv_CopyData(&concatenateBuf[CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE + sharedSecretLength], otherInfoPtr, otherInfoLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + + /* #20 (Spec-Step: 4) check max input length hash */ + /* not required */ + + /* #25 (Spec-Step: 3) init Counter */ + /* create the concatenated shared secret (counter || Z || OtherInfo) */ + /* Initialize a 32-bit counter as 1 (big-endian) */ + /* #30 (Spec-Step: 5 + 5.2) process repeat steps + increment counter */ + /* This check is not required while the sharedSecret size and hash digest size are equal */ + /* \fr for (counter = 1u; counter <= repeatSteps; counter++) */ + { + /* retVal = E_NOT_OK; */ + + /* #35 copy counter to string. */ + /* \fr Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(concatenateBuf, counter); SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(concatenateBuf, (uint32)1u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #40 (Spec-Step: 5.1) Hash(counter || Z || OtherInfo) */ + if (esl_initSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE */ + { + if (esl_updateSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (eslt_Length)(CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE + sharedSecretLength + otherInfoLength), (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))concatenateBuf) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + { + if (esl_finalizeSHA256((P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&derivedKeyPtr[derivedLength]) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + { + derivedLength += ESL_SIZEOF_SHA256_DIGEST; + retVal = E_OK; + } + } + } + /* This check is not required while the sharedSecret size and hash digest size are equal */ + /* \fr if (retVal != E_OK) + { + break; + } */ + } + } + } + + /* #45 Set derived key length. */ + if (retVal == E_OK) + { + *derivedKeyLengthPtr = derivedLength; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + } + + /* #50 clear buffer */ + Crypto_30_LibCv_ClearData(concatenateBuf, CRYPTO_30_LIBCV_NIST80056A_COUNTER_SIZE + CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE + CRYPTO_30_LIBCV_NIST80056A_OTHER_INFO_MAXSIZE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 10 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) otherInfoPtr, + uint32 otherInfoPtrLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) derivedKeyPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) derivedKeyLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 sharedSecret[CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE * 2u]; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ----------------------------------------------- */ + if (Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws( + privateKeyPtr, privateKeyLength, + partnerPubKeyPtr, partnerPubKeyLength, + sharedSecret, CRYPTO_30_LIBCV_ECDHE_256_ID, + &workspace->wsEcP) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + /* #1 Single-step KDF Option 1 Hash */ + /* use only shared secret X for concatenation */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist80056A_SingleStepKdfHash( + &workspace->wsSHA256, + sharedSecret, CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + otherInfoPtr, otherInfoPtrLength, + derivedKeyPtr, derivedKeyLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + + /* #5 destroy all working copies. */ + Crypto_30_LibCv_ClearData(sharedSecret, CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE * 2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S() */ +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + + uint32 partnerPubKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE * 2u; + uint32 privKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE; + uint32 otherInfoLength = CRYPTO_30_LIBCV_NIST80056A_OTHER_INFO_MAXSIZE; + uint32 derivedKeyBufLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE; + + Crypto_30_LibCv_SizeOfKeyStorageType partnerPubKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType privKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType otherInfoIndex; + uint8 derivedKeyBuf[CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE]; + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet; + + /* ----- Implementation ----------------------------------------------- */ + Crypto_30_LibCv_ClearData(derivedKeyBuf, CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #1 read other info from key element. */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO, &otherInfoIndex, &otherInfoLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY, &partnerPubKeyIndex, &partnerPubKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &privKeyIndex, &privKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* #5 calculate NIST 800 56A */ + if (Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S(workspace, + Crypto_30_LibCv_GetAddrKeyStorage(privKeyIndex), privKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(partnerPubKeyIndex), partnerPubKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(otherInfoIndex), otherInfoLength, + derivedKeyBuf, &derivedKeyBufLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + if (Crypto_30_LibCv_Local_KeyElementSet(targetCryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, derivedKeyBuf, derivedKeyBufLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + retVal = E_OK; + } + } + } + + /* #10 destroy all working copies. */ + Crypto_30_LibCv_ClearData(derivedKeyBuf, derivedKeyBufLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retval; + Crypto_30_LibCv_WorkSpaceISO15118 workspace; /* PRQA S 0759 */ /* MD_MSR_Union */ + + /* ----- Implementation ----------------------------------------------- */ + retval = Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retval; +} /* Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey( + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 sharedSecret[CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE * 2u]; + Std_ReturnType retVal = E_NOT_OK; + + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CONST) basePointOrder = &Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain[192]; + + /* ----- Implementation ----------------------------------------------- */ + /* #1 check if the private key is smaller than the order of the curve base point */ + + if (Crypto_30_LibCv_Local_CompareData_IsSmaller(privateKeyPtr, basePointOrder, privateKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + + /* #5 verify key pair with esLib */ + if (Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws(privateKeyPtr, privateKeyLength, pubKeyPtr, pubKeyLength, sharedSecret, CRYPTO_30_LIBCV_ECDHE_256_ID, workspace) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + retVal = E_OK; + } + } + + /* #10 destroy all working copies. */ + Crypto_30_LibCv_ClearData(sharedSecret, CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE * 2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt( + P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) ivPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedMessagePtr, + uint32 encryptedMessageLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) plainMessagePtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) plainMessageLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + eslt_Length outputDataLen; + uint32 totalOutputDataLen = 0u; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* #0 initialize the AES workspaces */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_AES128, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + { + + /* #5 initialize the decryption */ + eslRet = esl_initDecryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE */ + ESL_BM_CBC, ESL_PM_OFF, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))ivPtr); + + if (eslRet == ESL_ERC_NO_ERROR) + { + outputDataLen = (eslt_Length)*plainMessageLengthPtr; + /* #10 decrypt the actual private key */ + eslRet = esl_decryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, + (eslt_Length)encryptedMessageLength, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))encryptedMessagePtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputDataLen, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))plainMessagePtr); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #15 save the decrypted length */ + totalOutputDataLen = outputDataLen; + /* reset the OutputDataLen */ + outputDataLen = (eslt_Length)(*plainMessageLengthPtr - totalOutputDataLen); + + /* #20 add padding to get least block */ + eslRet = esl_decryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)1u, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))encryptedMessagePtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputDataLen, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&plainMessagePtr[totalOutputDataLen]); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #25 update the decrypted length */ + totalOutputDataLen += outputDataLen; + } + } + } + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #30 provide the total output data len to the application */ + *plainMessageLengthPtr = totalOutputDataLen; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32 encryptedIvAndPrivKeyLength = CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV_AND_PRIV_KEY; + + uint32 privKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE; + uint32 partnerPubKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE * 2u; + + uint32 derivedKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE; + + uint32 newPrivateKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE; + uint32 newPubKeyLength = CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE * 2u; + + Crypto_30_LibCv_SizeOfKeyStorageType encryptedIvAndPrivKeyIndex; + + Crypto_30_LibCv_SizeOfKeyStorageType privKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType partnerPubKeyIndex; + + Crypto_30_LibCv_SizeOfKeyStorageType newPubKeyIndex; + + uint8 otherInfo[CRYPTO_30_LIBCV_ISO15118_SIZEOF_OTHER_INFO] = { 0u }; + uint8 derivedKey[CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE] = { 0u }; + + uint8 newPrivateKey[CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE] = { 0u }; + + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet; + /* ----- Implementation ----------------------------------------------- */ + /* #5 Get KeyElements for CertificateInstallation/Update (ISO 15118) */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY, &newPubKeyIndex, &newPubKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY, &encryptedIvAndPrivKeyIndex, &encryptedIvAndPrivKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY, &partnerPubKeyIndex, &partnerPubKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + /* load old partner public value and private key */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &privKeyIndex, &privKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if ((localRet == E_OK) && + (encryptedIvAndPrivKeyLength == CRYPTO_30_LIBCV_ISO15118_SIZEOF_IV_AND_PRIV_KEY)) + { + /* [V2G2-818] + * The algorithm ID shall be one character 0x01. The sender name ID U shall be one character "U" = 0x55 , the receiver name ID V shall be + * one character "V" = 0x56. A symmetric encryption key of exactly 128 bits shall be derived. */ + + /* #10 Set OtherInfo = (AlgorithmID || PartyUInfo(Transmitter) || PartyVInfo(Receiver)) */ + otherInfo[0] = 0x01u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[1] = 0x55u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[2] = 0x56u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + + /* #15 Execute Concatenation KDF */ + localRet = Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S(workspace, + Crypto_30_LibCv_GetAddrKeyStorage(privKeyIndex), privKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(partnerPubKeyIndex), partnerPubKeyLength, + otherInfo, CRYPTO_30_LIBCV_ISO15118_SIZEOF_OTHER_INFO, + derivedKey, &derivedKeyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRet == E_OK) + { + /* #20 decrypt new key */ + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_Aes128Decrypt(&workspace->wsAes, + Crypto_30_LibCv_GetAddrKeyStorage(encryptedIvAndPrivKeyIndex), + derivedKey, + Crypto_30_LibCv_GetAddrKeyStorage(encryptedIvAndPrivKeyIndex + CRYPTO_30_LIBCV_ISO15118_PRIV_KEY_START), + encryptedIvAndPrivKeyLength - CRYPTO_30_LIBCV_ISO15118_PRIV_KEY_START, + newPrivateKey, &newPrivateKeyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRet == E_OK) + { + /* #25 Verify new key pair */ + /* The best way the verify that the keys are valid is to generate and verify a signature. This need to be implemented by upper layer e.g. TLS */ + if (Crypto_30_LibCv_Local_KeyDerive_ISO15118_CheckKey(&workspace->wsEcP, + newPrivateKey, newPrivateKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(newPubKeyIndex), newPubKeyLength) + == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + /* #30 Store new key pair */ + if (Crypto_30_LibCv_Local_KeyElementSet(targetCryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &newPrivateKey[0], newPrivateKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + retVal = E_OK; + } + } + } + } + } + + /* #40 clear data */ + Crypto_30_LibCv_ClearData(derivedKey, derivedKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(newPrivateKey, newPrivateKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + Crypto_30_LibCv_WorkSpaceISO15118 workspace; /* PRQA S 0759 */ /* MD_MSR_Union */ + + /* ----- Implementation ----------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA( + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength) +{ + uint8 pubKeyTmp[CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC_XY] = {0u}; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CONST) basePointPtr = &Crypto_30_LibCv_EccCurveNistSecP521R1Domain[229]; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CONST) curveOrderPtr = &Crypto_30_LibCv_EccCurveNistSecP521R1Domain[363]; + Std_ReturnType retVal = E_OK; + + /* #1 Check if the private key is strictly smaller than the order of the curve base point */ + if (Crypto_30_LibCv_Local_CompareData_IsSmaller(privateKeyPtr, curveOrderPtr, privateKeyLength) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + { + retVal = E_NOT_OK; + } + /* #5 Multiplication of the base point with the private key shall generate a key matching the public key */ + else if (Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws(privateKeyPtr, privateKeyLength, basePointPtr, pubKeyLength, pubKeyTmp, CRYPTO_30_LIBCV_ECDHE_521_ID, workspace) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + retVal = E_NOT_OK; + } + else + { + uint8 currentByte = 0u; + + retVal = E_OK; + for (currentByte = 0u; currentByte < pubKeyLength; currentByte++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + if (pubKeyTmp[currentByte] != pubKeyPtr[currentByte]) + { + retVal = E_NOT_OK; + break; + } + } + } + + /* #10 destroy all working copies. */ + Crypto_30_LibCv_ClearData(pubKeyTmp, CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC_XY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448( + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) pubKeyPtr, + uint32 pubKeyLength) +{ + uint8 pubKeyTmp[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448] = {0u}; + uint32 pubKeyTmpLength = sizeof(pubKeyTmp); + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CONST) curveOrderPtr = Crypto_30_LibCv_EccCurveEdwards448GroupOrder; + Std_ReturnType retVal = E_OK; + + /* base point in Montgomery coordinates + * U = 5 (447 bit long) + */ + const uint8 basePointU[56] = + { + 0x05u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, + 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u + }; + + /* #1 Check if the private key is strictly smaller than the order of the curve base point */ + if (Crypto_30_LibCv_Local_CompareData_IsSmaller(privateKeyPtr, curveOrderPtr, privateKeyLength) != E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + { + retVal = E_NOT_OK; + } + /* #5 Multiplication of the base point with the private key shall generate a key matching the public key */ + else if (Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + privateKeyPtr, privateKeyLength, + basePointU, pubKeyLength, + pubKeyTmp, &pubKeyTmpLength, workspace) != E_OK) + { + retVal = E_NOT_OK; + } + else + { + uint8 currentByte = 0u; + + retVal = E_OK; + for (currentByte = 0u; currentByte < pubKeyLength; currentByte++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + if (pubKeyTmp[currentByte] != pubKeyPtr[currentByte]) + { + retVal = E_NOT_OK; + break; + } + } + } + + /* #10 destroy all working copies. */ + Crypto_30_LibCv_ClearData(pubKeyTmp, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060, 6080 10 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt( + P2VAR(eslt_WorkSpaceGCM, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) ivPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) aadPtr, + uint32 aadLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) tagPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedMessagePtr, + uint32 encryptedMessageLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) plainMessagePtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) plainMessageLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + *plainMessageLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_GCM, CRYPTO_30_LIBCV_WATCHDOG_PTR) != ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + { + retVal = E_NOT_OK; + } + /* #10 initialize the decryption */ + else if(esl_initDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))ivPtr, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV) != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + /* #20 process authentic data */ + else if(esl_updateAuthDataDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))aadPtr, + (eslt_Length)aadLength) != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + /* #30 decrypt the actual private key */ + else if(esl_updateCiphertextDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))encryptedMessagePtr, + (eslt_Length)encryptedMessageLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))plainMessagePtr, + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))plainMessageLengthPtr) != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + else if(esl_finalizeDecryptGCM(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&plainMessagePtr[*plainMessageLengthPtr], + (P2VAR(eslt_Size32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))plainMessageLengthPtr, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))tagPtr) != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + else + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privKeyPtr, + uint32 privKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedDataKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) contractCertPrivateKeyPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet = E_NOT_OK; + + /* #10 Calculate ECDHE Secret (Array needs to be twice the size because LibCv Function stores XY values) */ + uint8 sharedSecret[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_P521 * 2u] = {0u}; + + localRet = Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + privKeyPtr, privKeyLength, + partnerPubKeyPtr, partnerPubKeyLength, + sharedSecret, CRYPTO_30_LIBCV_ECDHE_521_ID, + &workspace->wsEcP); + + if (localRet == E_OK) + { + uint8 otherInfo[CRYPTO_30_LIBCV_ISO15118_SIZEOF_OTHER_INFO]; + uint8 derivedKey[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY]; + + /* #20 Set OtherInfo = (AlgorithmID || PartyUInfo(Transmitter) || PartyVInfo(Receiver)) */ + otherInfo[0] = 0x01u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[1] = 0x55u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[2] = 0x56u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + + /* #30 Execute Concatenation KDF */ + localRet = Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1(&workspace->wsHkdfSHA512, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_P521, sharedSecret, + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_OTHER_INFO, otherInfo, + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY, derivedKey, + ESL_HA_SHA2_512); + + if (localRet == E_OK) + { + uint8 contractCertPrivateKey[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521] = { 0 }; + uint32 contractCertPrivateKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521; + + /* #40 Decrypt new key */ + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt(&workspace->wsAesGcm, /* SBSW_CRYPTO_30_LIBCV_CALL_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_IV_START_P521], + derivedKey, + associatedDataPtr, associatedDataLength, + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_TAG_START_P521], + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_P521], + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521, + contractCertPrivateKey, &contractCertPrivateKeyLength); + + if (localRet == E_OK) + { + /* #50 Check decrypted key for correct format */ + if ((contractCertPrivateKey[0] & 0xFEu) != 0u) + { + retVal = E_NOT_OK; + } + else + { + /* #60 Copy decrypted key to buffer */ + Crypto_30_LibCv_CopyData(contractCertPrivateKeyPtr, contractCertPrivateKey, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + retVal = E_OK; + } + } + Crypto_30_LibCv_ClearData(contractCertPrivateKey, CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + Crypto_30_LibCv_ClearData(derivedKey, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + Crypto_30_LibCv_ClearData(sharedSecret, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_P521 * 2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privKeyPtr, + uint32 privKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) encryptedDataKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) contractCertPrivateKeyPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet = E_NOT_OK; + + /* #10 Calculate ECDHE Secret */ + uint8 sharedSecret[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448] = {0u}; + uint32 sharedSecretLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448; + + localRet = Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + privKeyPtr, privKeyLength, + partnerPubKeyPtr, partnerPubKeyLength, + sharedSecret, &sharedSecretLength, + &workspace->wsEdDH + ); + + if (localRet == E_OK) + { + uint8 otherInfo[CRYPTO_30_LIBCV_ISO15118_SIZEOF_OTHER_INFO]; + uint8 derivedKey[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY]; + + /* #20 Set OtherInfo = (AlgorithmID || PartyUInfo(Transmitter) || PartyVInfo(Receiver)) */ + otherInfo[0] = 0x01u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[1] = 0x55u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + otherInfo[2] = 0x56u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + + /* #30 Execute Concatenation KDF */ + localRet = Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1(&workspace->wsHkdfSHA512, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448, sharedSecret, + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_OTHER_INFO, otherInfo, + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY, derivedKey, + ESL_HA_SHA2_512); + + if (localRet == E_OK) + { + uint8 contractCertPrivateKey[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448] = { 0 }; + uint32 contractCertPrivateKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448; + + /* #40 Decrypt new key */ + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_AesGcm256Decrypt(&workspace->wsAesGcm, /* SBSW_CRYPTO_30_LIBCV_CALL_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_IV_START_X448], + derivedKey, + associatedDataPtr, associatedDataLength, + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_TAG_START_X448], + &encryptedDataKeyPtr[CRYPTO_30_LIBCV_ISO15118_20_PRIV_KEY_START_X448], + CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448, + contractCertPrivateKey, &contractCertPrivateKeyLength); + + if (localRet == E_OK) + { + /* #60 Copy decrypted key to buffer */ + Crypto_30_LibCv_CopyData(contractCertPrivateKeyPtr, contractCertPrivateKey, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + retVal = E_OK; + } + Crypto_30_LibCv_ClearData(contractCertPrivateKey, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + Crypto_30_LibCv_ClearData(derivedKey, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_DERIVED_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + Crypto_30_LibCv_ClearData(sharedSecret, CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_SHARED_SECRET_X448); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS( + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + uint8 contractCertPrivateKey[CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521] = { 0 }; + uint32 contractCertPrivateKeyLength = 0u; + uint32 encryptedIvAndPrivKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_P521; + uint32 aadLength = 0u; + uint32 privKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521; + uint32 partnerPubKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC_XY; + uint32 contrPubKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC_XY; + + Crypto_30_LibCv_SizeOfKeyStorageType encryptedDataKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType aadKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType privKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType partnerPubKeyIndex; + Crypto_30_LibCv_SizeOfKeyStorageType contrPubKeyIndex; + + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet; + + /* #10 Get KeyElements for CertificateInstallation (ISO 15118-20) */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY, &contrPubKeyIndex, &contrPubKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY, &encryptedDataKeyIndex, &encryptedIvAndPrivKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD, &aadKeyIndex, &aadLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(targetCryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY, &partnerPubKeyIndex, &partnerPubKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + /* load own private key */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &privKeyIndex, &privKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* #20 Derive contract private key for curve */ + if ((localRet == E_OK) && + (encryptedIvAndPrivKeyLength == CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_P521)) + { + /* Use curve SEC-P521R1 */ + contractCertPrivateKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_P521; + + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleSECP521(workspace, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_KEYSTORE_BUFFER */ + Crypto_30_LibCv_GetAddrKeyStorage(privKeyIndex), privKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(partnerPubKeyIndex), partnerPubKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(encryptedDataKeyIndex), + Crypto_30_LibCv_GetAddrKeyStorage(aadKeyIndex), aadLength, + contractCertPrivateKey); + + if (localRet == E_OK) + { + /* #30 Verify new key */ + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_ECDSA(&workspace->wsEcP, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_KEYSTORE_BUFFER */ + contractCertPrivateKey, + contractCertPrivateKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(contrPubKeyIndex), + contrPubKeyLength); + } + } + else if ((localRet == E_OK) && + (encryptedIvAndPrivKeyLength == CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_IV_PRIV_KEY_TAG_X448)) + { + /* Use curve Curve448 */ + contractCertPrivateKeyLength = CRYPTO_30_LIBCV_ISO15118_20_SIZEOF_PRIV_KEY_X448; + + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_HandleX448(workspace, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_KEYSTORE_BUFFER */ + Crypto_30_LibCv_GetAddrKeyStorage(privKeyIndex), privKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(partnerPubKeyIndex), partnerPubKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(encryptedDataKeyIndex), + Crypto_30_LibCv_GetAddrKeyStorage(aadKeyIndex), aadLength, + contractCertPrivateKey); + + if (localRet == E_OK) + { + /* #30 Verify new key */ + localRet = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_CheckKey_X448(&workspace->wsEdDH, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_KEYSTORE_BUFFER */ + contractCertPrivateKey, + contractCertPrivateKeyLength, + Crypto_30_LibCv_GetAddrKeyStorage(contrPubKeyIndex), + contrPubKeyLength); + } + } + else + { + localRet = E_NOT_OK; + } + + if (localRet == E_OK) + { + /* #40 Store new key */ + if (Crypto_30_LibCv_Local_KeyElementSet(targetCryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &contractCertPrivateKey[0], contractCertPrivateKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + retVal = E_OK; + } + } + + /* #50 clear data */ + Crypto_30_LibCv_ClearData(contractCertPrivateKey, CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_ISO15118_20() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_ISO15118_20( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + Crypto_30_LibCv_WorkSpaceISO15118_20 workspace; /* PRQA S 0759 */ /* MD_MSR_Union */ + + /* ----- Implementation ----------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_ISO15118_20() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc( + P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_KDFX963SHA256, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initKDFX963SHA256((P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyKDFX963SHA256((P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceKDFX963SHA256 workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal= Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_256() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS( + P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet; + + uint32 secretLength, saltLength, keyLength; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex, saltIndex; + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex; + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltPtr = NULL_PTR; /* PRQA S 3678 */ /* MD_CRYPTO_30_LIBCV_3678 */ + + /* ----- Implementation ----------------------------------------------- */ + /* get key elements for algorithm: CRYPTO_KE_KEYDERIVATION_PASSWORD and optional CRYPTO_KE_KEYDERIVATION_SALT */ + /* get target key element index, length and check access */ + localRet = Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt( + &secretLength, + &secretIndex, + &saltLength, + &saltIndex, + &keyLength, + &keyElementIndex, + cryptoKeyId, + targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + if (saltLength > 0u) + { + saltPtr = Crypto_30_LibCv_GetAddrKeyStorage(saltIndex); + } + + /* derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_Calc( + workspace, + secretLength, + Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, + saltPtr, + keyLength, + Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(keyElementIndex)); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* update key element */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(keyElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, keyElementIndex, keyLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc( + P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_KDFX963SHA512, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initKDFX963SHA512((P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyKDFX963SHA512((P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceKDFX963SHA512 workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal= Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_512() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS( + P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet; + + uint32 secretLength, saltLength, keyLength; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex, saltIndex; + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex; + P2VAR(uint8, AUTOMATIC, AUTOMATIC) saltPtr = NULL_PTR; /* PRQA S 3678 */ /* MD_CRYPTO_30_LIBCV_3678 */ + + /* ----- Implementation ----------------------------------------------- */ + /* get key elements for algorithm: CRYPTO_KE_KEYDERIVATION_PASSWORD and optional CRYPTO_KE_KEYDERIVATION_SALT */ + /* get target key element index, length and check access */ + localRet = Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt( + &secretLength, + &secretIndex, + &saltLength, + &saltIndex, + &keyLength, + &keyElementIndex, + cryptoKeyId, + targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + if (saltLength > 0u) + { + saltPtr = Crypto_30_LibCv_GetAddrKeyStorage(saltIndex); + } + + /* derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_Calc( + workspace, + secretLength, + Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, + saltPtr, + keyLength, + Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(keyElementIndex)); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* update key element */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(keyElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, keyElementIndex, keyLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt( + P2VAR(uint32, AUTOMATIC, AUTOMATIC) secretLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) secretIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) saltLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) saltIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) keyLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) keyElementIndex, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType localRet; + + /* ----- Implementation ----------------------------------------------- */ + /* Get secret */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, secretIndex, secretLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* Get optional salt */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_SALT, saltIndex, saltLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* Set length since input in not required. */ + *saltLength = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* continue processing */ + localRet = E_OK; + } + else + { + /* retVal is already set */ + } + + if (localRet == E_OK) + { + /* get target key element index, length and check access */ + localRet = Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, keyElementIndex, keyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + } + return localRet; +} /* Crypto_30_LibCv_Local_KeyDerive_KDF_963_Get_Secret_And_Salt() */ +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_SERVICE_KEY_DERIVE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Derive_UpdateKeyState() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Derive_UpdateKeyState( + uint32 objectId, + uint32 targetCryptoKeyId, + Std_ReturnType retVal) +{ + /* ----- Local Variables ---------------------------------------------- */ + /* ----- Implementation ----------------------------------------------- */ + + /* If key was derived successfully, mark it as valid */ + if (retVal == E_OK) + { + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, Crypto_30_LibCv_Internal_KeySetValid(targetCryptoKeyId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } +} /* Crypto_30_LibCv_Local_Derive_UpdateKeyState() */ +#endif /* (CRYPTO_30_LIBCV_SERVICE_KEY_DERIVE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock) +{ + uint32 deriveAlgorithmLength = CRYPTO_30_LIBCV_KEY_DERIVE_SIZEOF_ALGORITHM; + Crypto_30_LibCv_SizeOfKeyStorageType deriveAlgorithmIndex; + + Std_ReturnType retVal; + + /* #1 Get Algorithm from the algorithm key element */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_ALGORITHM, &deriveAlgorithmIndex, &deriveAlgorithmLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* #5 Dispatch key derivation according the given algorithm */ + switch (Crypto_30_LibCv_GetKeyStorage(deriveAlgorithmIndex)) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_SYM_NIST_800_108_CNT_MODE_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_ASYM_NIST_FIPS_186_4_ERB_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB: + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING: + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING: + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_256(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_X963_SHA512_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512: + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_512(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1: + retVal = Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1(cryptoKeyId, targetCryptoKeyId, ESL_HA_SHA2_256); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1: + retVal = Crypto_30_LibCv_Local_KeyDerive_Spake2Plus(cryptoKeyId, targetCryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1(cryptoKeyId, targetCryptoKeyId, ESL_HA_SHA2_512); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384: + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC(cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384); + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_108_CTR_CMAC_AES_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_108_CTR_CMAC_AES: + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic(cryptoKeyId, targetCryptoKeyId); + break; +# endif + + default: + retVal = E_NOT_OK; + break; + } + } + else + { + retVal = E_NOT_OK; + } + + /* #10 If key was derived successfully, mark it as valid */ + if (retVal == E_OK) + { + *writeBlock = Crypto_30_LibCv_Internal_KeySetValid(targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + else + { + /* #11 Map error codes according to AUTOSAR */ + retVal = E_NOT_OK; + *writeBlock = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive() */ +#endif /* (CRYPTO_30_LIBCV_SUPPORT_KEY_DERIVE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1( + P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint32 iterations) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_KDF2HMACSHA1, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initKDF2HMACSHA1((P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (eslt_Length)iterations); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyKDF2HMACSHA1((P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceKDF2HMACSHA1 workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal= Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS(&workspace, cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA1() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON) */ + +#if((CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON) || (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS( + P2VAR(eslt_WorkSpaceKDF2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 algorithm) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet; + uint32 iterationLength = CRYPTO_30_LIBCV_SIZEOF_KDF_ITERATIONSLENGTH; + uint32 secretLength, saltLength, keyLength; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex, saltIndex, iterationIndex; + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex; + uint32 iterations; + + /* ----- Implementation ----------------------------------------------- */ + /* Get secret */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &secretIndex, &secretLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get salt */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_SALT, &saltIndex, &saltLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get iterations */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_ITERATIONS, &iterationIndex, &iterationLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get target key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, &keyElementIndex, &keyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&iterations, Crypto_30_LibCv_GetAddrKeyStorage(iterationIndex)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* Dispatch key derivation according the given algorithm */ + switch (algorithm) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1: + /* Derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA1(workspace, + secretLength, Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, Crypto_30_LibCv_GetAddrKeyStorage(saltIndex), + keyLength, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(keyElementIndex), + iterations); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256: + /* Derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256(workspace, + secretLength, Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, Crypto_30_LibCv_GetAddrKeyStorage(saltIndex), + keyLength, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(keyElementIndex), + iterations); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + break; +# endif + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + retVal = E_NOT_OK; + break; + } + + if (retVal == E_OK) + { + /* Update key element */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(keyElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, keyElementIndex, keyLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS() */ +#endif /* ( CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON || CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceKDF2HMACSHA256 workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal= Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS(&workspace, cryptoKeyId, targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA256() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256( + P2VAR(eslt_WorkSpaceKDF2HMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint32 iterations) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_KDF2HMACSHA256, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initKDF2HMACSHA256((P2VAR(eslt_WorkSpaceKDF2HMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, (eslt_Length)iterations); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyKDF2HMACSHA256((P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_PBKDF2_HMAC_SHA256() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet, localRet_2; + uint32 iterationLength = CRYPTO_30_LIBCV_SIZEOF_HKDF_ITERATIONSLENGTH; + uint32 secretLength, saltLength, infoLength, keyLength; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex, saltIndex = 0u, infoIndex = 0u, iterationIndex; + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex; + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltPtr; + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr; + + /* ----- Implementation ----------------------------------------------- */ + /* Get salt */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_SALT, &saltIndex, &saltLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRet == CRYPTO_E_KEY_NOT_AVAILABLE) + { + localRet = E_OK; + saltPtr = NULL_PTR; + saltLength = 0u; + } + else + { + saltPtr = Crypto_30_LibCv_GetAddrKeyStorage(saltIndex); + } + + /* Get additional info */ + localRet_2 = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO, &infoIndex, &infoLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRet_2 == CRYPTO_E_KEY_NOT_AVAILABLE) + { + infoPtr = NULL_PTR; + infoLength = 0u; + } + else + { + localRet |= localRet_2; + infoPtr = Crypto_30_LibCv_GetAddrKeyStorage(infoIndex); + } + + /* Get secret */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &secretIndex, &secretLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get iterations */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_ITERATIONS, &iterationIndex, &iterationLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get target key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, &keyElementIndex, &keyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* Dispatch key derivation according the given algorithm */ + /* Derive key */ + switch(hashAlgorithmId) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256: + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256(workspace, + secretLength, Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, saltPtr, + infoLength, infoPtr, + keyLength, Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(keyElementIndex)), + *Crypto_30_LibCv_GetAddrKeyStorage(iterationIndex)); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384: + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384(workspace, + secretLength, Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + saltLength, saltPtr, + infoLength, infoPtr, + keyLength, Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(keyElementIndex)), + *Crypto_30_LibCv_GetAddrKeyStorage(iterationIndex)); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + break; +# endif + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported algorithm */ + retVal = E_NOT_OK; + break; + } + + if (retVal == E_OK) + { + /* Update key element */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(keyElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, keyElementIndex, keyLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceHKDFHMAC workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS(&workspace, cryptoKeyId, targetCryptoKeyId, hashAlgorithmId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 10 */ /* MD_MSR_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 saltLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint8 iterations) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_HKDF_HMAC, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initHKDF_HMAC_SHA256((P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, iterations); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyHKDF_HMAC_SHA256((P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)saltLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))saltPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA256() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256_ENABLED == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS( + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + eslt_HashAlgorithm hashId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet; + uint32 secretLength, infoLength, keyLength = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex = 0u, infoIndex = 0u; + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex; + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr; + + /* ----- Implementation ----------------------------------------------- */ + /* Get additional info */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO, &infoIndex, &infoLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRet == CRYPTO_E_KEY_NOT_AVAILABLE) + { + infoPtr = NULL_PTR; + infoLength = 0u; + localRet = E_OK; + } + else + { + infoPtr = Crypto_30_LibCv_GetAddrKeyStorage(infoIndex); + } + + /* Get secret */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &secretIndex, &secretLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get target key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, &keyElementIndex, &keyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* Dispatch key derivation according the given algorithm */ + /* Derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1(workspace, + secretLength, Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), + infoLength, infoPtr, + keyLength, Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(keyElementIndex)), + hashId); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Update key element */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(keyElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, keyElementIndex, keyLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + eslt_HashAlgorithm hashId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceHKDFHASH workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS(&workspace, cryptoKeyId, targetCryptoKeyId, hashId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON) || ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 10 */ /* MD_MSR_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1( + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + eslt_HashAlgorithm hashId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_HKDF_HASH, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initHKDF_Hash_OneStep((P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, hashId); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyHKDF_Hash_OneStep((P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_Hash_Option_1() */ + +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256_ENABLED == STD_ON) || ((CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 10 */ /* MD_MSR_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 secretLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 saltLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) saltPtr, + uint32 infoLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr, + uint32 keyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + uint8 iterations) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ----------------------------------------------- */ + + /* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_HKDF_HMAC, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initHKDF_HMAC_SHA384((P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, iterations); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_deriveKeyHKDF_HMAC_SHA384((P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (eslt_Length)secretLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)saltLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))saltPtr, + (eslt_Length)infoLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))infoPtr, + (eslt_Length)keyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_HKDF_HMAC_SHA384() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_WorkSpaceHKDFHMAC workspace; + + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS(&workspace, cryptoKeyId, targetCryptoKeyId, hashAlgorithmId); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_STACK_WORKSPACE */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS( + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + uint8 hashAlgorithmId) +{ + Std_ReturnType retVal = E_NOT_OK, localRet = E_NOT_OK; + eslt_ErrorCode eslRet = ESL_ERC_ERROR; + uint32 keyDerivationKeyLength = 0u, infoLength = 0u, targetLength = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType keyDerivationKeyIndex = 0u, infoIndex = 0u; + Crypto_30_LibCv_SizeOfKeyElementsType targetIndex = 0u; + P2CONST(uint8, AUTOMATIC, AUTOMATIC) infoPtr = NULL_PTR; + + /* # Get additional info key element index. */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO, &infoIndex, &infoLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (localRet == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* infoPtr remains NULL_PTR and infoLength remains 0u. */ + localRet = E_OK; + } + else + { + infoPtr = Crypto_30_LibCv_GetAddrKeyStorage(infoIndex); + } + + /* # Get key element index to expand from. */ + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &keyDerivationKeyIndex, &keyDerivationKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* # Get target key element index, length and check access. */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(targetCryptoKeyId, CRYPTO_30_LIBCV_KE_TARGET_KEY, &targetIndex, &targetLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* # Init workspace header. */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workspace->header), ESL_MAXSIZEOF_WS_HKDF_HMAC, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE_PARAMETER */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* # Apply key expansion according the given algorithm. */ + switch (hashAlgorithmId) + { +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256: + eslRet = esl_initHKDF_HMAC_SHA256(workspace, ESL_HKDF_TWO_STEP_VARIANT); /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_expandKeyHKDF_HMAC_SHA256(workspace, + Crypto_30_LibCv_GetAddrKeyStorage(keyDerivationKeyIndex), (eslt_Length)keyDerivationKeyLength, + infoPtr, (eslt_Length)infoLength, + Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(targetIndex)), (eslt_Length)targetLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + } + break; +# endif +# if (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384: + eslRet = esl_initHKDF_HMAC_SHA384(workspace, ESL_HKDF_TWO_STEP_VARIANT); /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_expandKeyHKDF_HMAC_SHA384(workspace, + Crypto_30_LibCv_GetAddrKeyStorage(keyDerivationKeyIndex), (eslt_Length)keyDerivationKeyLength, + infoPtr, (eslt_Length)infoLength, + Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(targetIndex)), (eslt_Length)targetLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + } + break; +# endif + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported algorithm */ + break; + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* # Update key element. */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(targetIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, targetIndex, targetLength); + retVal = E_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS( + P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK, localRet; + uint32 secretLength, w0Length, w1Length, lLength; + Crypto_30_LibCv_SizeOfKeyStorageType secretIndex; + Crypto_30_LibCv_SizeOfKeyElementsType w0ElementIndex, w1ElementIndex, lElementIndex; + + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr; + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr; + + /* ----- Implementation ----------------------------------------------- */ + + /* Curve Sizes */ + domainPtr = (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain; + domainExtPtr = (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt; + w0Length = CRYPTO_30_LIBCV_SIZEOF_ECC_256_N; + w1Length = CRYPTO_30_LIBCV_SIZEOF_ECC_256_N; + lLength = 1u + (2u * CRYPTO_30_LIBCV_SIZEOF_ECC_256_P); /* Prefix + Double P Size */ + + /* Get secret [w0s|w1s] */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYDERIVATION_PASSWORD, &secretIndex, &secretLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get w0 key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength(targetCryptoKeyId, CRYPTO_KE_CUSTOM_W0, &w0ElementIndex, w0Length, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get w1 key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength(targetCryptoKeyId, CRYPTO_KE_CUSTOM_W1, &w1ElementIndex, w1Length, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Get l (lx | ly) key element index, length and check access */ + localRet |= Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength(targetCryptoKeyId, CRYPTO_KE_CUSTOM_L, &lElementIndex, lLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRet == E_OK) + { + /* Derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus(workspace, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + domainPtr, + domainExtPtr, + Crypto_30_LibCv_GetAddrKeyStorage(secretIndex), secretLength, + Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(w0ElementIndex), w0Length, + Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(w1ElementIndex), w1Length, + Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(lElementIndex), lLength); + + if (retVal == E_OK) + { + /* Update key element */ + /* w0 */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(w0ElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, w0ElementIndex, w0Length); + /* w1 */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(w1ElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, w1ElementIndex, w1Length); + /* l */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(lElementIndex); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(targetCryptoKeyId, lElementIndex, lLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Spake2Plus() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Spake2Plus( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + eslt_WorkSpaceSPAKE2PPreamble workspace; + + /* ----- Implementation ----------------------------------------------- */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS(&workspace, cryptoKeyId, targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Spake2Plus() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6060 12 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus( + P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) secretPtr, + uint32 secretLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) w1Ptr, + uint32 w1Length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) lPtr, + uint32 lLength) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + eslt_Length lLengthPtr, w0LengthPtr, w1LengthPtr; + + /* ----- Implementation ----------------------------------------------- */ + + lLengthPtr = (eslt_Length)lLength; + w0LengthPtr = (eslt_Length)w0Length; + w1LengthPtr = (eslt_Length)w1Length; +/* Init workspace header */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_SIZEOF_WS_SPAKE2PPRE, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init workspace */ + eslRet = esl_initSPAKE2PPreamble((P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, + domainPtr, + domainExtPtr); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Derive a key with the given length. */ + eslRet = esl_calcSPAKE2PPreamble((P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))secretPtr, + (eslt_Length)secretLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))w0Ptr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&w0LengthPtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))w1Ptr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&w1LengthPtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))lPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&lLengthPtr); + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyDerive_Calc_Spake2Plus() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1_ENABLED == STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEYDERIVENISTFIPS186ERB == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNistFips186Erb() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNistFips186Erb( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveNistFips186Erb(Crypto_30_LibCv_GetKeyDeriveNistFips186ErbIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveNistFips186Erb() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVENISTFIPS186ERB() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEISO15118 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveISO15118() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveISO15118( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveISO15118(Crypto_30_LibCv_GetKeyDeriveISO15118IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_ISO15118 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveISO15118() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVEISO15118() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEISO15118_20 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveISO15118_20() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveISO15118_20( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118_20, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveISO15118_20(Crypto_30_LibCv_GetKeyDeriveISO15118_20IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_ISO15118_20 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_ISO15118_20_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveISO15118_20() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVEISO15118_20() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEX963SHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceKDFX963SHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveX963SHA256(Crypto_30_LibCv_GetKeyDeriveX963SHA256IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_256_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA256() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVEX963SHA256() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEX963SHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA512() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceKDFX963SHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveX963SHA512(Crypto_30_LibCv_GetKeyDeriveX963SHA512IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_KDF_963_512_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA512() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVEX963() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVENIST80056AONEPASS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceISO15118, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveNist80056AOnePass(Crypto_30_LibCv_GetKeyDeriveNist80056AOnePassIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_AndLoadKey */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist80056A_OnePass_C1E1S_With_Ws_AndLoadKey(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVENIST80056AONEPASS() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVENIST800108CNTSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CntSha256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CntSha256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveNist800108CntSha256(Crypto_30_LibCv_GetKeyDeriveNist800108CntSha256IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108NistFips1864_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CntSha256() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVENIST800108CNTSHA256() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVENIST800108CTRCMACAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CtrCmacAes() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CtrCmacAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceKDFnist800108, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveNist800108CtrCmacAes(Crypto_30_LibCv_GetKeyDeriveNist800108CtrCmacAesIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + retVal = Crypto_30_LibCv_Local_KeyDerive_Nist800108_Generic_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + /* If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + else + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CtrCmacAes() */ +#endif /* CRYPTO_30_LIBCV_KEYDERIVENIST800108CNTSHA256() */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA1( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceKDF2HMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveKDF2HMACSHA1(Crypto_30_LibCv_GetKeyDeriveKDF2HMACSHA1IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA1() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceKDF2HMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveKDF2HMACSHA256(Crypto_30_LibCv_GetKeyDeriveKDF2HMACSHA256IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_PBKDF2_HMAC_SHA_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA256() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFHMACSHA256(Crypto_30_LibCv_GetKeyDeriveHKDFHMACSHA256IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS with SHA256 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA256() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA256 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA384 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA384() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA384( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFHMACSHA384(Crypto_30_LibCv_GetKeyDeriveHKDFHMACSHA384IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS with SHA384 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA384() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA384 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + Std_ReturnType retVal = E_OK; + + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFExpandHMACSHA256(Crypto_30_LibCv_GetKeyDeriveHKDFExpandHMACSHA256IdxOfObjectInfo(objectId)); + + /* # Call Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS with SHA256 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + if (retVal == E_OK) + { + /* # If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA256() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA384 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA384() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA384( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + Std_ReturnType retVal = E_OK; + + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFExpandHMACSHA384(Crypto_30_LibCv_GetKeyDeriveHKDFExpandHMACSHA384IdxOfObjectInfo(objectId)); + + /* # Call Crypto_30_LibCv_Local_KeyDerive_HKDF_HMAC_WS with SHA348 */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Expand_HMAC_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + if (retVal == E_OK) + { + /* # If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA384() */ +#endif /* (CRYPTO_30_LIBCV_KDF_ALGO_HKDF_EXPAND_HMAC_SHA348_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVESPAKE2P == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveSpake2P() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveSpake2P( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceSPAKE2PPreamble, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveSpake2P(Crypto_30_LibCv_GetKeyDeriveSpake2PIdxOfObjectInfo(objectId)); + + /* #10 Derive key */ + retVal = Crypto_30_LibCv_Local_KeyDerive_Spake2Plus_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveSpake2P() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVESPAKE2P == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA256() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFHashOption1SHA256(Crypto_30_LibCv_GetKeyDeriveHKDFHashOption1SHA256IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, ESL_HA_SHA2_256); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA256() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA256 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA512() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceHKDFHASH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyDeriveHKDFHashOption1SHA512(Crypto_30_LibCv_GetKeyDeriveHKDFHashOption1SHA512IdxOfObjectInfo(objectId)); + + /* #10 Call Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS */ + retVal = Crypto_30_LibCv_Local_KeyDerive_HKDF_Hash_Option_1_WS(workspace, job->cryptoKeyId, job->targetCryptoKeyId, ESL_HA_SHA2_512); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_Local_Derive_UpdateKeyState(objectId, job->targetCryptoKeyId, retVal); + + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA512() */ +#endif /* (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA512 == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyDerive.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.h new file mode 100644 index 0000000..eb75b78 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyDerive.h @@ -0,0 +1,502 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyDerive.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for Key Derive Services. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYDERIVE_H +# define CRYPTO_30_LIBCV_KEYDERIVE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a key + * \details Dispatch the key derivation. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \param[in,out] writeBlock Holds the result if the NvM need to be written. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId is a valid key id. + * targetCryptoKeyId is a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock); +# endif /* (CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEYDERIVENISTFIPS186ERB == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNistFips186Erb() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveNistFips186Erb job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-145592 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNistFips186Erb( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif/* CRYPTO_30_LIBCV_KEYDERIVENISTFIPS186ERB() */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEISO15118 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveISO15118() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveISO15118 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_ISO15118CertificateInstallationAndUpdate + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveISO15118( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* Crypto_30_LibCv_Dispatch_KeyDeriveISO15118 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEISO15118_20 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveISO15118_20() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveISO15118_20 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_ISO15118-20-CertificateInstallation + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveISO15118_20( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEISO15118_20 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVENIST80056AONEPASS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveNist80056AOnePass job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-145593 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* Crypto_30_LibCv_Dispatch_KeyDeriveNist80056AOnePass */ + +# if (CRYPTO_30_LIBCV_KEYDERIVENIST800108CNTSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CntSha256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveNist800108CntSha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-132407 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CntSha256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVENIST800108CNTSHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVENIST800108CTRCMACAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CtrCmacAes() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveNist800108CtrCmacAes job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-Crypto-KeyDeriveNist800108CtrCmacAes + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveNist800108CtrCmacAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVENIST800108CTRCMACAES */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEX963SHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveX963SHA256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-191710 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEX963SHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEX963SHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA512() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveX963SHA512 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-191710 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveX963SHA512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEX963SHA512 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA1() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHmacSha1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-248610 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA1( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA1 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHmacSha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-248610 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveKDF2HMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEKDF2HMACSHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFHmacSha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-266053 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA384 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA384() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFHmacSha384 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-266053 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHMACSHA384( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFHMACSHA384 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFExpandHmacSha256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-Crypto-HKDFExpand + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA384 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA384() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFHmacSha384 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-Crypto-HKDFExpand + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFExpandHMACSHA384( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFEXPANDHMACSHA384 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA256 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA256() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFHashOneStep SHA256 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-304740 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA256( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA256 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA512() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDeriveHKDFHashOneStep SHA512 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-304740 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveHKDFHashOption1SHA512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVEHKDFHASHOPTION1SHA512 */ + +# if (CRYPTO_30_LIBCV_KEYDERIVESPAKE2P == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyDeriveSpake2P() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyDerive Spake2+ preamble job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the job's + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyDeriveSpake2P( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYDERIVESPAKE2P */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYDERIVE_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyDerive.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.c new file mode 100644 index 0000000..58abeb0 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.c @@ -0,0 +1,4477 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyExchange.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of Key Exchange Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_KEYEXCHANGE_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_KeyExchange.h" +#include "Crypto_30_LibCv_KeyGenerate.h" +#include "Crypto_30_LibCv_Custom.h" +#include "Crypto_30_LibCv_Curve.h" + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) +# include "ESLib_SPAKE2PConstants.h" +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Spake2+ */ +#define CRYPTO_30_LIBCV_SPAKE2P_MODE_NORMAL (0u) +#define CRYPTO_30_LIBCV_SPAKE2P_MODE_CHANGED_VERIFICATION (1u) + +#define CRYPTO_30_LIBCV_SPAKE2P_STATE_UNINIT (0u) +#define CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_PUBVAL (1u) +#define CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_SECRET (2u) +#define CRYPTO_30_LIBCV_SPAKE2P_STATE_VERIFICATION (3u) + +/* Elliptic curve with burmester desmedt */ +#define CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_NUM_ECU_LENGTH (1u) +#define CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_ECU_ID_LENGTH (1u) +#define CRYPTO_30_LIBCV_ECDHE_BD_MIN_NUM_ECU (3u) + +#define CRYPTO_30_LIBCV_ECBD_STATE_UNINIT (0u) +#define CRYPTO_30_LIBCV_ECBD_STATE_CALC_PUBVAL (1u) +#define CRYPTO_30_LIBCV_ECBD_STATE_CALC_INTERMEDIATE (2u) +#define CRYPTO_30_LIBCV_ECBD_STATE_REC_INTERMEDIATE (3u) +#define CRYPTO_30_LIBCV_ECBD_STATE_CALC_SECRET (4u) + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre() + **********************************************************************************************************************/ +/*! \brief Set Preamble Spake2+ Party A + * \details The service stores w0 and w1 in the workspace and sets a preamble flag in the workspace. + * \param[in,out] ws Contains the workspace. + * \param[in] w0Ptr Pointer to w0 + * \param[in] w0Length Length of w0 + * \param[in] w1Ptr Pointer to w1 + * \param[in] w1Length Length of w1 + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be a valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w1Ptr, + uint32 w1Length); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre() + **********************************************************************************************************************/ +/*! \brief Set Preamble Spake2+ Party B + * \details The service stores w0 and l in the workspace and sets a preamble flag in the workspace. + * \param[in,out] ws Contains the workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * \param[in] w0Ptr Pointer to w0 + * \param[in] w0Length Length of w0 + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointers need to be a valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre() + **********************************************************************************************************************/ +/*! \brief Set Preamble Spake2+ + * \details Set Preamble Spake2+ for Party A or Party B + * \param[in,out] ws Contains the workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointers need to be a valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public() + **********************************************************************************************************************/ +/*! \brief Calculation of the public value according to Spake2+ + * \details - + * \param[in,out] ws Contains the workspace. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointers need to be a valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc() + **********************************************************************************************************************/ +/*! \brief Calculation of the public value according to Spake2+ + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in,out] ws Contains the workspace. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] mode Contain the Spake2+ calculation Mode + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointers need to be a valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + uint8 mode); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P() + **********************************************************************************************************************/ +/*! \brief Calculation of the public value according to Spake2+ + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] mode Contain the Spake2+ calculation Mode + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointers need to be a valid. + * \note This service locks the long term workspace if possible. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + uint8 mode); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead() + **********************************************************************************************************************/ +/*! \brief Read single data element. + * \details [info-a | info-b | aad] each [DataLength 4-Byte | Data X-Byte] + * \param[in] infoPtr Holds the pointer to the memory location which contains the info. + * \param[in] infoLength Holds the Length of the infoPtr. + * \param[in,out] readPos Holds the current read position. + * \param[out] dataPos Holds the position of the data. + * \param[out] dataLength Holds the Length of the dataPos. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointer need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) infoPtr, + uint32 infoLength, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) readPos, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) dataPos, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo() + **********************************************************************************************************************/ +/*! \brief Set additional info for secret for Spake2+ + * \details [info-a | info-b | aad] each [DataLength 4-Byte | Data X-Byte] + * \param[in,out] ws Contains the workspace. + * \param[in] infoPtr Holds the pointer to the memory location which contains the info. + * \param[in] infoLength Holds the Length of the infoPtr. + * \param[in] infoElementRetVal Holds the retval from the key element operation of info data + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointer need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) infoPtr, + uint32 infoLength, + Std_ReturnType infoElementRetVal); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret() + **********************************************************************************************************************/ +/*! \brief Calculation of the secret for Spake2+ + * \details Secret is calculation. + * \param[in,out] ws Contains the workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Holds the Length of the partnerPublicValuePtr. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointer need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification() + **********************************************************************************************************************/ +/*! \brief Key confirmation for Spake2+ + * \details - + * \param[in,out] ws Contains the workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerConfirmationValuePtr Holds the pointer to the memory location which contains the partners + * confirmation value. + * \param[in] partnerConfirmationValueLength Holds the Length of the partnerConfirmationValuePtr. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointer need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerConfirmationValuePtr, + uint32 partnerConfirmationValueLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P() + **********************************************************************************************************************/ +/*! \brief Calculation of the secret for Spake2+ + * \details Depending on the state either secret is calculation or key confirmation is executed. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public/confirmation value. + * \param[in] partnerPublicValueLength Holds the Length of the partnerPublicValuePtr. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * All pointer need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value for x25519 + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value for x448 + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] speedUpExtPtr Pointer to precomputation structure + * \param[in] keySize Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Holds the Length of the partnerPublicValuePtr. + * \param[in] keySize Contains the length of the key element in bytes. + * \param[in] keaId Key exchange algorithm identifier. + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerPublicValuePtr has to be a valid pointer with size 2*CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength, + uint32 keySize, + uint8 keaId, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] speedUpExtPtr Pointer to precomputation structure + * \param[in] keySize Contains the length of the key element in bytes. + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths() + *********************************************************************************************************************/ +/*! \brief Check of the domain key lengths + * \details Checks if the private and public key lengths provided by the domain parameters are equal to the given expected values. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] expectedPrivateKeyLength Expected private key length of given curve + * \param[in] expectedPublicKeyLength Expected public key length of given curve + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre EcDomainPtr has to be a valid pointer pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths( + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Checks the key length length provided by the domain. If lengths are ok, the given parameters are + * forwarded to the KeyExchangeCalcSecret_BD_Prime function calculating the secret. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerIntermediateValuePtr Holds the pointer to the memory location which contains the intermediate + * value. The value must contain the following format + * [EcuId (1Byte) | Partner intermediate value X | Partner intermediate value Y]. + * \param[in] partnerIntermediateValueLength Holds the Length of the partnerIntermediateValuePtr. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] expectedPrivateKeyLength Expected private key length of given curve + * \param[in] expectedPublicKeyLength Expected public key length of given curve + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerIntermediateValuePtr has to be a valid pointer with size (1 + CRYPTO_30_LIBCV_SIZEOF_ECC_..._KEY_PUBLIC_XY). + * EcDomainPtr has to be a valid pointer pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerIntermediateValuePtr Holds the pointer to the memory location which contains the intermediate + * value. The value must contain the following format + * [EcuId (1Byte) | Partner intermediate value X | Partner intermediate value Y]. + * \param[in] partnerIntermediateValueLength Holds the Length of the partnerIntermediateValuePtr. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerIntermediateValuePtr has to be a valid pointer with size (1 + CRYPTO_30_LIBCV_SIZEOF_ECC_..._KEY_PUBLIC_XY). + * EcDomainPtr has to be a valid pointer pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First() + *********************************************************************************************************************/ +/*! \brief First calc secret + * \details Init calc secret + * \param[in,out] wsPtr Pointer to the Crypto_30_LibCv_WorkSpaceECBD workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE, for different workspaces + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update() + *********************************************************************************************************************/ +/*! \brief Update calc secret with intermediate value of next key exchange partner. + * \details - + * \param[in,out] wsPtr Pointer to the Crypto_30_LibCv_WorkSpaceECBD workspace. + * \param[in] partnerIntermediateValuePtr Holds the pointer to the memory location which contains the intermediate + * value. The value must contain the following format + * [EcuId (1Byte) | Partner intermediate value X | Partner intermediate value Y]. + * \param[in] partnerIntermediateValueLength Holds the Length of the partnerIntermediateValuePtr. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre wsPtr has to be a valid pointer. + * partnerIntermediateValuePtr has to be a valid pointer with size (1 + CRYPTO_30_LIBCV_SIZEOF_ECC_..._KEY_PUBLIC_XY). + * EcDomainPtr has to be a valid pointer pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different workspaces + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish() + *********************************************************************************************************************/ +/*! \brief Calculate shared secret + * \details - + * \param[in,out] wsPtr Pointer to the Crypto_30_LibCv_WorkSpaceECBD workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange protocol. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre wsPtr has to be a valid pointer. + * cryptoKeyId has to be a valid crypto key. + * EcDomainPtr has to be a valid pointer pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different workspaces + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) */ + +#endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerPublicValuePtr has to be a valid pointer with size ESL_SIZEOF_X25519_PUBLIC_KEY. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value for x25519 + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in,out] wsX25519 Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret. + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in,out] wsX25519 Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details After initializing the workspace, the private key is loaded and the secret is calculated. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in,out] wsX25519 Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerPublicValuePtr has to be a valid pointer with size ESL_SIZEOF_X448_PUBLIC_KEY. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value for x448 + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in,out] wsX448 Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX448); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in,out] wsX448 Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX448); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Holds the Length of the partnerPublicValuePtr. + * \param[in] keySize Contains the length of the key element in bytes. + * \param[in] keaId Key exchange algorithm identifier. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerPublicValuePtr has to be a valid pointer with size 2*CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength, + uint32 keySize, + uint8 keaId); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc() + *********************************************************************************************************************/ +/*! \brief Calculation of the public key + * \details Checks the key length length provided by the domain. If lengths are ok, the given parameters are + * forwarded to the KeyExchangeCalcPubVal_BD_Prime function calculating the public key. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters. + * \param[in] EcSpeedUpExtPtr Pointer to the curve speed up extension parameters. + * \param[in] expectedPrivateKeyLength Expected private key length of given curve + * \param[in] expectedPublicKeyLength Expected public key length of given curve + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr need to be valid and have at least the length of publicValueLengthPtr. + * all domain pointers have to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub() + *********************************************************************************************************************/ +/*! \brief Load left and right public value + * \details Load the left and right public value is ready to use. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] leftStorageIndexPtr Pointer to the storage index of the left public value. + * \param[out] rightStorageIndexPtr Pointer to the storage index of the right public value. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre wsPtr and StorageIndexPtr have to be valid pointers. + * cryptoKeyId has to be a valid crypto key. + * all domain pointers need to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, for different keys. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyStorageIndexType, AUTOMATIC, AUTOMATIC) leftStorageIndexPtr, + P2VAR(Crypto_30_LibCv_KeyStorageIndexType, AUTOMATIC, AUTOMATIC) rightStorageIndexPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init() + *********************************************************************************************************************/ +/*! \brief Init CalcPubVal elliptic curve burmester desmedt. + * \details - + * \param[in,out] wsPtr Pointer to the Crypto_30_LibCv_WorkSpaceECBD workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters. + * \param[in] EcSpeedUpExtPtr Pointer to the curve speed up extension parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre wsPtr has to be a valid pointer. + * cryptoKeyId has to be a valid crypto key. + * all domain pointers need to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair() + *********************************************************************************************************************/ +/*! \brief Generate own public and private key. + * \details Generate own public and private key according to the given curve. + * \param[in,out] wsPtr Pointer to the Crypto_30_LibCv_WorkSpaceECBD workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters. + * \param[in] EcSpeedUpExtPtr Pointer to the curve speed up extension parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre wsPtr has to be a valid pointer. + * cryptoKeyId has to be a valid crypto key. + * publicValuePtr need to be valid and have at least the length of publicValueLengthPtr. + * all domain pointers need to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, true for different workspaces. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate() + *********************************************************************************************************************/ +/*! \brief Generate intermediate value. + * \details Generate intermediate value according to the given partner public values. + * \param[in,out] wsPtr Pointer to the eslt_WorkSpaceECBD workspace. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the intermediate value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre wsPtr has to be a valid pointer. + * cryptoKeyId has to be a valid crypto key. + * publicValuePtr need to need to be valid and have at least the length of publicValueLengthPtr. + * EcDomainPtr need to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE, true for different workspaces. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace() + *********************************************************************************************************************/ +/*! \brief Delete workspace if it is locked for key. + * \details - + * \param[in] longWsIdx Holds the valid identifier of the long term workspace. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace( + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys() + *********************************************************************************************************************/ +/*! \brief Delete all required key elements in key. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime() + *********************************************************************************************************************/ +/*! \brief Dispatch public value generation. + * \details Generate own public and private key according to the given curve or + * intermediate value according to the given partner public values. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters. + * \param[in] EcSpeedUpExtPtr Pointer to the curve speed up extension parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr need to have at least the length of publicValueLengthPtr. + * all domain pointers need to be valid pointing to valid domain parameters. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr); + +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) */ +#endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculate shared secret + * \details Calculate shared secret for ECDHE Prime for the given values. + * \param[in] privateKeyPtr Pointer to the private key array. + * \param[in] partnerPubKeyPtr Pointer to the partner public key array. + * \param[out] sharedSecretPtr Pointer to the shared secret. + * \param[in,out] workspace Contains workspace. + * \param[in] EcDomainPtr Pointer to the curve domain parameters. + * \param[in] EcDomainExtPtr Pointer to the extended curve domain parameters. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre privateKeyPtr has to be a valid pointer with a valid length. + * partnerPubKeyPtr has to be a valid pointer with a valid length. + * sharedSecretPtr has to be a valid pointer with the length 2*esl_getLengthOfEcPsecret_comp(EcDomainPtr). + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr); + +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w1Ptr, + uint32 w1Length) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ------------------------------------------------- */ + + /* Set Preamble Members for A */ + eslRet = esl_setPreambleDataPartyASPAKE2P(ws, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))w0Ptr, (eslt_Length)w0Length, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))w1Ptr, (eslt_Length)w1Length); + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) w0Ptr, + uint32 w0Length) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode eslRet; + Crypto_30_LibCv_SizeOfKeyStorageType lElementIndex; + uint32 lElementLength; + /* ----- Implementation ------------------------------------------------- */ + + /* Get L */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_L, &lElementIndex, &lElementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (localRetVal == E_OK) + { + /* Set Preamble Members for B */ + eslRet = esl_setPreambleDataPartyBSPAKE2P(ws, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))w0Ptr, (eslt_Length)w0Length, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(lElementIndex), (eslt_Length)lElementLength); + + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + Crypto_30_LibCv_SizeOfKeyStorageType w0ElementIndex, w1ElementIndex; + uint32 w0ElementLength, w1ElementLength; + + /* ----- Implementation ------------------------------------------------- */ + + /* Get w0 */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_W0, &w0ElementIndex, &w0ElementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + /* Get w1 to determine if this is Party A or Party B */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_W1, &w1ElementIndex, &w1ElementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal != CRYPTO_E_KEY_NOT_AVAILABLE) + { + if (localRetVal == E_OK) + { + /* Party A */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_A_Pre(ws, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + Crypto_30_LibCv_GetAddrKeyStorage(w0ElementIndex), w0ElementLength, + Crypto_30_LibCv_GetAddrKeyStorage(w1ElementIndex), w1ElementLength); + } + } + else + { + /* Party B */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_B_Pre(ws, cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + Crypto_30_LibCv_GetAddrKeyStorage(w0ElementIndex), w0ElementLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + eslt_Length reqLength; + + /* ----- Implementation ------------------------------------------------- */ + /* Set Sizes for Cipher Suite */ + reqLength = CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC; + + /* Check Length Calc Public Value */ + /* Public Value = [pubVal_x | pubVal_y] */ + if ((Crypto_30_LibCv_Math_Mul2((uint32)reqLength)) > *publicValueLengthPtr) + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + else + { + eslRet = esl_calcPubValSPAKE2P(ws, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicValuePtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&publicValuePtr[reqLength], + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&reqLength); + + if (eslRet == ESL_ERC_NO_ERROR) + { + *publicValueLengthPtr = Crypto_30_LibCv_Math_Mul2((uint32)reqLength); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else + { + Crypto_30_LibCv_ClearData(publicValuePtr, *publicValueLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + uint8 mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + eslt_SPAKE2PMode spakeMode; + + /* ----- Implementation ------------------------------------------------- */ + + /* Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&ws->header, ESL_SIZEOF_WS_SPAKE2P, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (mode == CRYPTO_30_LIBCV_SPAKE2P_MODE_NORMAL) + { + spakeMode = ESL_SPAKE2P_MODE_CIPHERSUITE_8_1; + } + else + { + spakeMode = ESL_SPAKE2P_MODE_CIPHERSUITE_8_2; + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initSPAKE2P(ws, + domainPtr, + domainExtPtr, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))esl_SPAKE2P_pointM_P256, + (eslt_Length)sizeof(esl_SPAKE2P_pointM_P256), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))esl_SPAKE2P_pointN_P256, + (eslt_Length)sizeof(esl_SPAKE2P_pointN_P256), + spakeMode); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + + /* Set Preamble */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Pre(ws, cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + + if (retVal == E_OK) + { + /* Calc Public Value */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2_Public(ws, publicValuePtr, publicValueLengthPtr); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6050, 6060 8 */ /* MD_MSR_STCAL, MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + uint8 mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + P2VAR(Crypto_30_LibCv_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws; + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx; + + /* ----- Implementation ------------------------------------------------- */ + /* Lock long term workspace */ + if (Crypto_30_LibCv_Local_LongWsLockGet(cryptoKeyId, &longWsIdx) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + + ws = (P2VAR(Crypto_30_LibCv_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsSPAKE2P; + ws->state = CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_PUBVAL; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + + /* Calculate public value */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P_Calc(cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + publicValuePtr, publicValueLengthPtr, + &ws->wsSpake, + domainPtr, + domainExtPtr, + mode); + if (retVal != E_OK) + { + /* Release long term workspace */ + Crypto_30_LibCv_Local_LongWsLockRelease(cryptoKeyId, longWsIdx); + } + } + else + { + retVal = CRYPTO_E_BUSY; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) infoPtr, + uint32 infoLength, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) readPos, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) dataPos, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) dataLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint32 length; + /* ----- Implementation ------------------------------------------------- */ + *dataLength = 0u; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* [DataLength 4-Byte | Data X-Byte] */ + if ((infoLength >= (*readPos + CRYPTO_30_LIBCV_SIZEOF_UINT32)) && !Crypto_30_LibCv_IsUint32Overflow(*readPos, CRYPTO_30_LIBCV_SIZEOF_UINT32)) + { + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&length, &infoPtr[*readPos]); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + *readPos += CRYPTO_30_LIBCV_SIZEOF_UINT32; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + if ((infoLength >= (*readPos + length)) && !Crypto_30_LibCv_IsUint32Overflow(*readPos, length)) + { + *dataLength = length; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *dataPos = *readPos; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *readPos += length; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) infoPtr, + uint32 infoLength, + Std_ReturnType infoElementRetVal) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode eslRet; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) aPtr = NULL_PTR; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) bPtr = NULL_PTR; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) aadPtr = NULL_PTR; + uint32 aLength, bLength, aadLength, readPos, dataPos; + /* ----- Implementation ------------------------------------------------- */ + + readPos = 0u; + dataPos = 0u; + if (infoElementRetVal == E_OK) + { + /* Read info-a */ + localRetVal = Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead(infoPtr, infoLength, &readPos, &dataPos, &aLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (aLength != 0u) + { + aPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&infoPtr[dataPos]; + } + + /* Read info-b */ + localRetVal |= Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead(infoPtr, infoLength, &readPos, &dataPos, &bLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (bLength != 0u) + { + bPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&infoPtr[dataPos]; + } + + /* Read aad */ + localRetVal |= Crypto_30_LibCv_Local_Spake2P_AdditionalInfoRead(infoPtr, infoLength, &readPos, &dataPos, &aadLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (aadLength != 0u) + { + aadPtr = (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&infoPtr[dataPos]; + } + + if (localRetVal == E_OK) + { + eslRet = esl_setAdditionalInformationSPAKE2P(ws, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + aPtr, (eslt_Length)aLength, + bPtr, (eslt_Length)bLength, + aadPtr, (eslt_Length)aadLength); + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode eslRet; + eslt_Length halfLength, secretLength, verificationLength; + Crypto_30_LibCv_SizeOfKeyStorageType elementIndex; + uint32 elementLength; + uint8 secret[ESL_SIZEOF_SHA256_DIGEST /2u]; + uint8 verification[CRYPTO_30_LIBCV_CMACAES_MAC_SIZE]; + + /* ----- Implementation ------------------------------------------------- */ + secretLength = ESL_SIZEOF_SHA256_DIGEST /2u; + verificationLength = CRYPTO_30_LIBCV_CMACAES_MAC_SIZE; + + /* Set Additional Info (only if required) */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_ADDITIONAL_INFO, &elementIndex, &elementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal != CRYPTO_E_KEY_NOT_AVAILABLE) + { + localRetVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_AdditionalInfo(ws, Crypto_30_LibCv_GetAddrKeyStorage(elementIndex), elementLength, localRetVal); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + } + else + { + localRetVal = E_OK; + } + + /* Calc Secret */ + if (((Crypto_30_LibCv_Math_Mul2((uint32)CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC)) == partnerPublicValueLength) && (localRetVal == E_OK)) + { + halfLength = (eslt_Length)Crypto_30_LibCv_Math_Div2(partnerPublicValueLength); + { + eslRet = esl_calcSharedSecretSPAKE2P(ws, + partnerPublicValuePtr, &partnerPublicValuePtr[halfLength], halfLength, + secret, &secretLength, + verification, &verificationLength); /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Store calculated sharedSecret */ + localRetVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, secret, (uint32)secretLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + localRetVal |= Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_VERIFICATION, verification, (uint32)verificationLength);/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (localRetVal == E_OK) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(secret, ESL_SIZEOF_SHA256_DIGEST /2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(verification, CRYPTO_30_LIBCV_CMACAES_MAC_SIZE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification( + P2VAR(eslt_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerConfirmationValuePtr, + uint32 partnerConfirmationValueLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal = E_NOT_OK; + eslt_ErrorCode eslRet; + uint8 verification; + + /* ----- Implementation ------------------------------------------------- */ + verification = CRYPTO_E_VER_NOT_OK; + + /* Check verification */ + eslRet = esl_confirmKeySPAKE2P(ws, partnerConfirmationValuePtr, (eslt_Length)partnerConfirmationValueLength); /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (eslRet == ESL_ERC_INCORRECT_MAC) + { + localRetVal = E_OK; + } + else if (eslRet == ESL_ERC_NO_ERROR) + { + localRetVal = E_OK; + verification = CRYPTO_E_VER_OK; + } + else + { + /* Nothing to do */ + } + + /* Store verification result */ + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_VERIFICATION_RESULT, &verification, 1u) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + retVal = localRetVal; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) ws; + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx; + + /* ----- Implementation ------------------------------------------------- */ + /* Check if long term workspace is locked */ + if (Crypto_30_LibCv_Local_LongWsIsLock(cryptoKeyId, &longWsIdx) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + + ws = (P2VAR(Crypto_30_LibCv_WorkSpaceSPAKE2P, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsSPAKE2P; + if (ws->state == CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_PUBVAL) + { + /* Calc Secret */ + ws->state = CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_SECRET; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Secret(&ws->wsSpake, cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + } + else /* (ws->state == CRYPTO_30_LIBCV_SPAKE2P_STATE_CALC_SECRET) */ + { + /* Verification */ + ws->state = CRYPTO_30_LIBCV_SPAKE2P_STATE_VERIFICATION; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P_Verification(&ws->wsSpake, cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_GLOBAL_DATA_PTR */ + } + + /* release lock if request is finished */ + if (retVal != E_OK) + { + Crypto_30_LibCv_ClearData(ws, sizeof(Crypto_30_LibCv_WorkSpaceSPAKE2P)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + Crypto_30_LibCv_Local_LongWsLockRelease(cryptoKeyId, longWsIdx); + } + else if (ws->state == CRYPTO_30_LIBCV_SPAKE2P_STATE_VERIFICATION) + { + Crypto_30_LibCv_Local_LongWsLockRelease(cryptoKeyId, longWsIdx); + } + else + { + /* keep workspace locked, request is continued */ + } + + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P() */ + +#endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Init Workspace */ + eslt_WorkSpaceX25519 localWsX25519; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws(cryptoKeyId, publicValuePtr, publicValueLengthPtr, &localWsX25519); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 publicKeyBuf[ESL_SIZEOF_X25519_PUBLIC_KEY]; + eslt_Length publicKeyLength = ESL_SIZEOF_X25519_PUBLIC_KEY; + eslt_ErrorCode eslRet; + Std_ReturnType retValKeyElementSetPrivateKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Std_ReturnType retValKeyElementSetPublicKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* ----- Implementation ------------------------------------------------- */ + + /* #20 Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&wsX25519->header, ESL_SIZEOF_WS_X25519, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initECDH(wsX25519, ESL_Curve25519); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #25 Calculate Keys */ + + if (esl_generateEphemeralKeyPairECDH(wsX25519, publicKeyBuf, &publicKeyLength) == ESL_ERC_NO_ERROR) /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + /* #30 Store public and private key to key elements if calculation was successfully */ + retValKeyElementSetPrivateKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))(((actX25519Struct*)wsX25519->wsX25519)->privateKey), ESL_SIZEOF_X25519_PRIVATE_KEY); /* PRQA S 3305, 0310 */ /* MD_CRYPTO_30_LIBCV_3305_CRYPTOLIBRARY_CAST, MD_CRYPTO_30_LIBCV_0310_CRYPTOLIBRARY_CAST */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + retValKeyElementSetPublicKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))publicKeyBuf, ESL_SIZEOF_X25519_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + if ((retValKeyElementSetPrivateKey == E_OK) && + (retValKeyElementSetPublicKey == E_OK)) + { + /* #35 Copy public key to output buffer and overwrite local copy if store key was successfully */ + /* [SWS_Crypto_00109] return public key */ + if (*publicValueLengthPtr >= ESL_SIZEOF_X25519_PUBLIC_KEY) + { + Crypto_30_LibCv_CopyData(publicValuePtr, publicKeyBuf, ESL_SIZEOF_X25519_PUBLIC_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + Crypto_30_LibCv_ClearData(publicKeyBuf, ESL_SIZEOF_X25519_PUBLIC_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + *publicValueLengthPtr = ESL_SIZEOF_X25519_PUBLIC_KEY; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + retVal = E_OK; + } + else + /* #40 If buffer is too small return with error */ + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Init Workspace */ + eslt_WorkSpaceEdDH localWsX448; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws(cryptoKeyId, publicValuePtr, publicValueLengthPtr, &localWsX448); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX448) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 publicKeyBuf[ESL_SIZEOF_X448_PUBLIC_KEY]; + eslt_Length publicKeyLength = ESL_SIZEOF_X448_PUBLIC_KEY; + uint8 privateKeyBuf[ESL_SIZEOF_X448_PRIVATE_KEY]; + eslt_Length privateKeyLength = ESL_SIZEOF_X448_PRIVATE_KEY; + eslt_ErrorCode eslRet; + Std_ReturnType retValKeyElementSetPrivateKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Std_ReturnType retValKeyElementSetPublicKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* ----- Implementation ------------------------------------------------- */ + + /* #20 Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&wsX448->header, ESL_SIZEOF_WS_EDDH, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE_PARAMETER */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initEdDH(wsX448, ESL_CURVE448); /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #25 Calculate Keys */ + if (esl_generateEphemeralKeyPairEdDH(wsX448, publicKeyBuf, &publicKeyLength, privateKeyBuf, &privateKeyLength) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + { + /* #30 Store public and private key to key elements if calculation was successful */ + retValKeyElementSetPrivateKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))privateKeyBuf, privateKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_WORKSPACE_MEMBER */ + retValKeyElementSetPublicKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))publicKeyBuf, publicKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + if ((retValKeyElementSetPrivateKey == E_OK) && + (retValKeyElementSetPublicKey == E_OK)) + { + /* #35 Copy public key to output buffer and overwrite local copy if store key was successfully */ + /* [SWS_Crypto_00109] return public key */ + if (*publicValueLengthPtr >= ESL_SIZEOF_X448_PUBLIC_KEY) + { + + Crypto_30_LibCv_CopyData(publicValuePtr, publicKeyBuf, ESL_SIZEOF_X448_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + Crypto_30_LibCv_ClearData(publicKeyBuf, ESL_SIZEOF_X448_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + Crypto_30_LibCv_ClearData(privateKeyBuf, ESL_SIZEOF_X448_PRIVATE_KEY); /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + *publicValueLengthPtr = publicKeyLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + retVal = E_OK; + } + else + /* #40 If buffer is too small return with error */ + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize) +{ + /* #10 Init Workspace */ + eslt_WorkSpaceEcP workspace; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws(cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + publicValuePtr, + publicValueLengthPtr, + domainPtr, + domainExtPtr, + speedUpExtPtr, + keySize, + &workspace); +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6050, 6060, 6080 9 */ /* MD_MSR_STCAL, MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 privKey[CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE]; + uint8 pubKey[Crypto_30_LibCv_Math_Mul2(CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE)]; + Std_ReturnType retValKeyElementSetPrivateKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Std_ReturnType retValKeyElementSetPublicKey = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* ----- Implementation ------------------------------------------------- */ + if (keySize > CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) + { + /* The requested key size exceeds the maximum ECC key size (CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) */ + retVal = E_NOT_OK; + } + else + { + /* Calculate Keys */ + if (Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws(pubKey, privKey, domainPtr, domainExtPtr, speedUpExtPtr, keySize, workspace) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + uint32 doubleKeySize = Crypto_30_LibCv_Math_Mul2(keySize); + + /* Store public and private key to key elements if calculation was successfully */ + retValKeyElementSetPublicKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, pubKey, doubleKeySize); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + retValKeyElementSetPrivateKey = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, privKey, keySize); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if ((retValKeyElementSetPrivateKey == E_OK) && + (retValKeyElementSetPublicKey == E_OK)) + { + /* Copy public key to output buffer and overwrite local copy if store key was successfully */ + /* [SWS_Crypto_00109] return public key */ + if (*publicValueLengthPtr >= doubleKeySize) + { + + Crypto_30_LibCv_CopyData(publicValuePtr, pubKey, doubleKeySize); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + + *publicValueLengthPtr = doubleKeySize; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + retVal = E_OK; + } + else + /* If buffer is too small return with error */ + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + } + + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(privKey, keySize); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(pubKey, doubleKeySize); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyStorageIndexType, AUTOMATIC, AUTOMATIC) leftStorageIndexPtr, + P2VAR(Crypto_30_LibCv_KeyStorageIndexType, AUTOMATIC, AUTOMATIC) rightStorageIndexPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + const uint32 publicKeyLength = esl_getLengthOfEcPpublicKey_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + + /* predecessor = left neighbor / successor = right neighbor */ + uint32 keyLengthLeft = publicKeyLength * 2u; + uint32 keyLengthRight = publicKeyLength * 2u; + + /* ----- Implementation ------------------------------------------------- */ + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + cryptoKeyId, + CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY, + leftStorageIndexPtr, + (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&keyLengthLeft, + CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + cryptoKeyId, + CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY_2, + rightStorageIndexPtr, + (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&keyLengthRight, + CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) + { + retVal = E_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint32 numberDevicesLength = CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_NUM_ECU_LENGTH; + uint32 deviceIdLength = CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_ECU_ID_LENGTH; + Crypto_30_LibCv_KeyStorageIndexType numberDevicesIndex; /* limited to uint8 */ + Crypto_30_LibCv_KeyStorageIndexType deviceIdIndex; /* limited to uint8 */ + Std_ReturnType retVal = E_NOT_OK, localRet; + uint8 numEcu, ecuId; + + /* ----- Implementation ------------------------------------------------- */ + /* Get and check ecu id and number. */ + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_NUM_ECU, /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + &numberDevicesIndex, + &numberDevicesLength, + CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_ECU_ID, /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + &deviceIdIndex, + &deviceIdLength, + CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); + if (localRet == E_OK) + { + numEcu = Crypto_30_LibCv_GetKeyStorage(numberDevicesIndex); + ecuId = Crypto_30_LibCv_GetKeyStorage(deviceIdIndex); + if ((ecuId <= numEcu) && (numEcu >= CRYPTO_30_LIBCV_ECDHE_BD_MIN_NUM_ECU)) + { + wsPtr->ecuNum = numEcu; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + /* Init Workspace */ + if (ESL_ERC_NO_ERROR == esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(wsPtr->wsBD.header), ESL_MAXSIZEOF_WS_ECBD, CRYPTO_30_LIBCV_WATCHDOG_PTR)) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + if (ESL_ERC_NO_ERROR == esl_initECBD(&wsPtr->wsBD, (eslt_Size32)numEcu, (eslt_Size32)ecuId, EcDomainPtr, EcDomainExtPtr, EcSpeedUpExtPtr)) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + { + retVal = E_OK; + } + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType localRet = E_NOT_OK; + uint8 privKey[CRYPTO_30_LIBCV_MAX_SIZEOF_PRIVATE_ECBD_KEY]; + uint8 publicKey[CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY_XY]; + + const uint32 privateKeyLength = esl_getLengthOfEcPprivateKey(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + const uint32 publicKeyLength = esl_getLengthOfEcPpublicKey_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + const uint32 publicKeyLengthXY = publicKeyLength * 2u; + + /* ----- Implementation ------------------------------------------------- */ + /* Init workspace */ + if (Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair_Init(wsPtr, cryptoKeyId, EcDomainPtr, EcDomainExtPtr, EcSpeedUpExtPtr) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + { + if (esl_generateEphemeralKeyPairECBD( /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + &wsPtr->wsBD, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))privKey, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicKey, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(publicKey[publicKeyLength])) + == ESL_ERC_NO_ERROR) + { + /* Store public and private key to key elements if calculation was successfully */ + localRet = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + publicKey, + publicKeyLengthXY); + localRet |= Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + privKey, + privateKeyLength); + } + + if (localRet == E_OK) + { + /* Copy public key to output buffer and overwrite local copy if store key was successfully */ + /* [SWS_Crypto_00109] return public key */ + if (*publicValueLengthPtr >= publicKeyLengthXY) + { + Crypto_30_LibCv_CopyData(publicValuePtr, publicKey, publicKeyLengthXY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *publicValueLengthPtr = publicKeyLengthXY; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + retVal = E_OK; + } + else + { + /* If buffer is too small return with error */ + retVal = CRYPTO_E_SMALL_BUFFER; + } + + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(privKey, privateKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_ClearData(publicKey, publicKeyLengthXY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + /* predecessor = left neighbor / successor = right neighbor */ + Crypto_30_LibCv_KeyStorageIndexType leftPublicStorageIndex; + Crypto_30_LibCv_KeyStorageIndexType rightPublicStorageIndex; + + uint8 intermediateKey[CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY_XY]; + + const uint32 publicKeyLength = esl_getLengthOfEcPpublicKey_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + const uint32 publicKeyLengthXY = publicKeyLength * 2u; + + /* ----- Implementation ------------------------------------------------- */ + /* Load partner public values and generate intermediate value.*/ + if (Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GetPartnerPub(cryptoKeyId, &leftPublicStorageIndex, &rightPublicStorageIndex, EcDomainPtr) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + if (esl_calculateIntermediateECBD(wsPtr, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(leftPublicStorageIndex), + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&((Crypto_30_LibCv_GetAddrKeyStorage(leftPublicStorageIndex))[publicKeyLength]), + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(rightPublicStorageIndex), + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&((Crypto_30_LibCv_GetAddrKeyStorage(rightPublicStorageIndex))[publicKeyLength]), + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))intermediateKey, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(intermediateKey[publicKeyLength])) == ESL_ERC_NO_ERROR) + { + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_INTERMEDIATE, intermediateKey, publicKeyLengthXY) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* Copy intermediate key to output buffer and overwrite local copy if store key was successfully */ + /* [SWS_Crypto_00109] return public key */ + if (*publicValueLengthPtr >= publicKeyLengthXY) + { + Crypto_30_LibCv_CopyData(publicValuePtr, intermediateKey, publicKeyLengthXY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *publicValueLengthPtr = publicKeyLengthXY; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(intermediateKey, publicKeyLengthXY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + retVal = E_OK; + } + else + { + /* If buffer is too small return with error */ + retVal = CRYPTO_E_SMALL_BUFFER; + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace( + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx) +{ + /* Delete workspace. */ + Crypto_30_LibCv_ClearData(&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsECBD, sizeof(Crypto_30_LibCv_WorkSpaceECBD)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ +} /* Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + +CRYPTO_30_LIBCV_LOCAL FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys( + uint32 cryptoKeyId) +{ + uint8 keyBuf = 0; + /* key element delete need to be enabled */ + + /* Delete required key elements. */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY_2, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_CUSTOM_KEYEXCHANGE_INTERMEDIATE, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (void)Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, &keyBuf, 0u); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ +} /* Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) localWsEcBPPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx; + + /* ----- Implementation ------------------------------------------------- */ + /* Try to lock workspace */ + if (Crypto_30_LibCv_Local_LongWsIsLock(cryptoKeyId, &longWsIdx) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* Workspace is already locked. */ + localWsEcBPPtr = (P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsECBD; + } + else if (Crypto_30_LibCv_Local_LongWsLockGet(cryptoKeyId, &longWsIdx) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* New Locked Workspace. */ + localWsEcBPPtr = (P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsECBD; + localWsEcBPPtr->state = CRYPTO_30_LIBCV_ECBD_STATE_CALC_PUBVAL; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + } + else + { + retVal = CRYPTO_E_BUSY; + } + + if (localWsEcBPPtr != NULL_PTR) + { + switch (localWsEcBPPtr->state) + { + /* Calculate own key pair */ + default: /* CRYPTO_30_LIBCV_ECBD_STATE_CALC_PUBVAL */ + { + /* reset state members */ + localWsEcBPPtr->ecuCount = 0u; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + localWsEcBPPtr->ecuNum = 0u; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + /* calculate private and public key */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_GenKeyPair(localWsEcBPPtr, + cryptoKeyId, publicValuePtr, publicValueLengthPtr, + EcDomainPtr, EcDomainExtPtr, EcSpeedUpExtPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + localWsEcBPPtr->state = CRYPTO_30_LIBCV_ECBD_STATE_CALC_INTERMEDIATE; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + break; + } + + /* Calculate intermediate value */ + case CRYPTO_30_LIBCV_ECBD_STATE_CALC_INTERMEDIATE: + { + /* calculate intermediate */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime_CalcIntermediate(&localWsEcBPPtr->wsBD, cryptoKeyId, publicValuePtr, publicValueLengthPtr, EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + localWsEcBPPtr->ecuCount = 1u; /* own intermediate value stored */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + localWsEcBPPtr->state = CRYPTO_30_LIBCV_ECBD_STATE_REC_INTERMEDIATE; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + break; + } + } + + /* delete working products if there was a failure */ + if (retVal != E_OK) + { + Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace(longWsIdx); + Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys(cryptoKeyId); + Crypto_30_LibCv_Local_LongWsLockRelease(cryptoKeyId, longWsIdx); + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths( + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* # Check domain key lengths */ + if (expectedPrivateKeyLength == esl_getLengthOfEcPprivateKey(EcDomainPtr)) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + if (expectedPublicKeyLength == esl_getLengthOfEcPpublicKey_comp(EcDomainPtr)) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* # Check domain key lengths */ + if (Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths(EcDomainPtr, expectedPrivateKeyLength, expectedPublicKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + /* # Calculate shared secret according to ECBD */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime(cryptoKeyId, + partnerIntermediateValuePtr, partnerIntermediateValueLength, + EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr, + const uint32 expectedPrivateKeyLength, + const uint32 expectedPublicKeyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (Crypto_30_LibCv_Local_KeyExchange_CheckDomainKeyLengths(EcDomainPtr, expectedPrivateKeyLength, expectedPublicKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + /* # Calculate public value (Key pair of private and public) according to ECBD curve p224r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + EcDomainPtr, EcDomainExtPtr, EcSpeedUpExtPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType keaIndex; + uint32 keaLength = CRYPTO_30_LIBCV_KEY_EXCHANGE_SIZEOF_ALGORITHM; + + /* ----- Implementation ------------------------------------------------- */ + +# if ((CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) && (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON)) + uint32 partitionIdx = Crypto_30_LibCv_CurrentPartitionIdx(); + +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (partitionIdx >= Crypto_30_LibCv_GetSizeOfPartitionIdentifiers()) + { + retVal = E_NOT_OK; + } + else +# endif +# endif + { + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + { +# if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + uint32 defaultRandomKey = Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(partitionIdx); + + /* Lock read access for the DefaultRandomKey */ + if (Crypto_30_LibCv_Local_KeyReadLockGetNotProtected(defaultRandomKey) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +# endif + { + /* Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else + { + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +# endif + + /* Read and check algorithm key element. */ + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_ALGORITHM, &keaIndex, &keaLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + + } + else + { + switch (Crypto_30_LibCv_GetKeyStorage(keaIndex)) + { +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519: + /* execute KEA x25519 / RFC 7748 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519(cryptoKeyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_X448: + /* execute KEA x25519 / RFC 7748 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448(cryptoKeyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P224R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1: + /* execute KEA NIST/SECp244r1 */ + /* NISTp224r1 = SECp224r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1: + /* execute KEA SECp256r1 / ANSI X9.63 */ + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_ANSIP256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1: + /* execute KEA ANSIp256r1 / ANSI X9.63 */ + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1: + /* execute KEA SECp384r1 */ + /* NISTp384r1 = SECp384r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP521R1: + /* execute KEA SECp521r1 */ + /* NISTp521r1 = SECp521r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) + /* execute KEA Spake2+ */ + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8: + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + CRYPTO_30_LIBCV_SPAKE2P_MODE_NORMAL); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8_1: + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P(cryptoKeyId, publicValuePtr, publicValueLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + CRYPTO_30_LIBCV_SPAKE2P_MODE_CHANGED_VERIFICATION); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_NISTP224R1_BD_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_NISTP224R1_BD: + /* execute KEA NISTp224r1 BD */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + cryptoKeyId, publicValuePtr, publicValueLengthPtr, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_EccCurveNistSecP224R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt, + Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC); + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P256R1_BD_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_BD: + /* execute KEA p256r1 BD */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + cryptoKeyId, publicValuePtr, publicValueLengthPtr, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC); + break; +# endif + default: + /* invalid algorithm */ + break; + } + } + /* Release key write lock. */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(cryptoKeyId); + } +# if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(defaultRandomKey); +# endif + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcPubVal() */ +#endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr) +{ + /* #10 Initialize workspace */ + eslt_WorkSpaceX25519 localWsX25519; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws(cryptoKeyId, partnerPublicValuePtr, &localWsX25519); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519) +{ + eslt_Length sharedSecretLength_eslt = ESL_SIZEOF_X25519_SHARED_SECRET; + uint8 sharedSecret[ESL_SIZEOF_X25519_SHARED_SECRET]; + + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet = ESL_ERC_ERROR; + + /* #30 generate secret by using public key from key element */ + eslRet = esl_generateSharedSecretECDH(wsX25519, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))partnerPublicValuePtr, sharedSecret, &sharedSecretLength_eslt); /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #35 Store calculated sharedSecret */ + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, sharedSecret, (uint32)sharedSecretLength_eslt) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + retVal = E_OK; + } + } + + /* #40 delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(sharedSecret, ESL_SIZEOF_X25519_SHARED_SECRET); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate() */ +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX25519) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyStorageType keyExchangePrivateKeyIndex; + uint32 keyExchangePrivateKeyLength = ESL_SIZEOF_X25519_PRIVATE_KEY; + + /* ----- Implementation ------------------------------------------------- */ + /* #20 Initialize workspace */ + /* initialize Ed25519 */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&wsX25519->header, ESL_SIZEOF_WS_X25519, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initECDH(wsX25519, ESL_Curve25519); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #25 Load private key */ + /* copy content of key elements to local buffers */ + Std_ReturnType localRetVal; + + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, &keyExchangePrivateKeyIndex, &keyExchangePrivateKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + /* import private key from key elements */ + if (esl_importStaticPrivateKeyECDH(wsX25519, Crypto_30_LibCv_GetAddrKeyStorage(keyExchangePrivateKeyIndex)) == ESL_ERC_NO_ERROR) /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + /* #30 generate secret */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_Calculate(cryptoKeyId, partnerPublicValuePtr, wsX25519); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr) +{ + /* #10 Initialize workspace */ + eslt_WorkSpaceEdDH localWsX448; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws(cryptoKeyId, partnerPublicValuePtr, &localWsX448); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsX448) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType keyExchangePrivateKeyIndex; + uint32 keyExchangePrivateKeyLength = ESL_SIZEOF_X448_PRIVATE_KEY; + uint32 sharedSecretLength = ESL_SIZEOF_X448_SHARED_SECRET; + uint8 sharedSecret[ESL_SIZEOF_X448_SHARED_SECRET]; + + /* ----- Implementation ------------------------------------------------- */ + Std_ReturnType localRetVal; + + /* #10 Load private key */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, &keyExchangePrivateKeyIndex, &keyExchangePrivateKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + /* #20 generate secret by using public key from key element */ + localRetVal = Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws( /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER_AND_STACK_BUFFER */ + Crypto_30_LibCv_GetAddrKeyStorage(keyExchangePrivateKeyIndex), + keyExchangePrivateKeyLength, + partnerPublicValuePtr, + ESL_SIZEOF_X448_PUBLIC_KEY, + sharedSecret, + &sharedSecretLength, + wsX448 + ); + + if (localRetVal == E_OK) + { + /* #30 Store calculated sharedSecret */ + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, sharedSecret, sharedSecretLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + retVal = E_OK; + } + } + + /* #40 Delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(sharedSecret, ESL_SIZEOF_X448_KEY); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength, + uint32 keySize, + uint8 keaId) +{ + /* #10 Init workspace */ + eslt_WorkSpaceEcP workspace; + + /* #20 Call Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws */ + return Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws(cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + partnerPublicValuePtr, + partnerPublicValueLength, + keySize, + keaId, + &workspace); +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6050, 6060, 6080 7 */ /* MD_MSR_STCAL, MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength, + uint32 keySize, + uint8 keaId, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType keyExchangePrivateKeyIndex; + uint32 keyExchangePrivateKeyLength; + uint8 sharedSecret[Crypto_30_LibCv_Math_Mul2(CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE)] = { 0u }; + + /* ----- Implementation ------------------------------------------------- */ + + if (keySize > CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) + { + /* The requested key size exceeds the maximum ECC key size (CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) */ + /* return E_NOT_OK */ + } + /* Load private key */ + else if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex( + cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_PRIVKEY, + &keyExchangePrivateKeyIndex, &keyExchangePrivateKeyLength, + CRYPTO_30_LIBCV_LENGTH_CHECK_NONE) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + /* return E_NOT_OK */ + } + else + { + /* generate secret by using public key from key element */ + if (Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws( + Crypto_30_LibCv_GetAddrKeyStorage(keyExchangePrivateKeyIndex), + keyExchangePrivateKeyLength, + partnerPublicValuePtr, partnerPublicValueLength, + sharedSecret, + keaId, workspace) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + /* Try to store calculated sharedSecret as X|Y coordinate */ + Std_ReturnType localRetVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, sharedSecret, Crypto_30_LibCv_Math_Mul2(keySize)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (localRetVal == E_OK) + { + retVal = E_OK; + } + else if (localRetVal == CRYPTO_E_KEY_SIZE_MISMATCH) + { + /* If not enough space in key element, store shared secret as x-coordinate only */ + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, sharedSecret, keySize) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + retVal = E_OK; + } + else + { + /* retVal remains E_NOT_OK */ + } + } + else + { + /* retVal remains E_NOT_OK */ + } + } + + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(sharedSecret, (uint32)Crypto_30_LibCv_Math_Mul2(keySize)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First( + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + + if (esl_initSharedSecretECBD(&wsPtr->wsBD) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + const uint32 publicKeyLength = esl_getLengthOfEcPpublicKey_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + const uint32 publicKeyLengthXY = publicKeyLength * 2u; + + /* ----- Implementation ------------------------------------------------- */ + /* add intermediate value for ecu x */ + /* EcuId (1Byte) | Partner intermediate value X | Partner intermediate value Y */ + if (partnerIntermediateValueLength == (CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_ECU_ID_LENGTH + publicKeyLengthXY)) + { + if (esl_updateSharedSecretECBD(wsPtr, /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + (eslt_Size32)partnerIntermediateValuePtr[0], + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&partnerIntermediateValuePtr[CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_ECU_ID_LENGTH], + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&partnerIntermediateValuePtr[CRYPTO_30_LIBCV_SIZEOF_ECDHE_BD_ECU_ID_LENGTH + publicKeyLength]) + == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish( + P2VAR(eslt_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsPtr, + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 sharedSecret[CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY_XY]; + Std_ReturnType retVal = E_NOT_OK; + const uint32 publicKeyLength = esl_getLengthOfEcPpublicKey_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + const uint32 publicKeyLengthXY = publicKeyLength * 2u; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Retrieve shared secret */ + if (esl_retrieveSharedSecretECBD(wsPtr, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))sharedSecret, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&sharedSecret[publicKeyLength]) + == ESL_ERC_NO_ERROR) + { + /* #20 Try to store calculated sharedSecret as X|Y coordinate */ + Std_ReturnType localRetVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + sharedSecret, publicKeyLengthXY); + if (localRetVal == E_OK) + { + retVal = E_OK; + } + else if (localRetVal == CRYPTO_E_KEY_SIZE_MISMATCH) + { + /* #30 If not enough space in key element, store sharedSecret as x-coordinate only */ + if (Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE, sharedSecret, publicKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + retVal = E_OK; + } + + } + else + { + /* retVal remains E_NOT_OK */ + } + } + + /* #40 Delete sharedSecret buffer content from RAM */ + Crypto_30_LibCv_ClearData(sharedSecret, publicKeyLengthXY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerIntermediateValuePtr, + uint32 partnerIntermediateValueLength, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + + Std_ReturnType retVal = E_NOT_OK; + + P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) localWsEcBPPtr; + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx; + boolean release = FALSE; + + /* ----- Implementation ------------------------------------------------- */ + /* Is workspace already locked for key */ + if (Crypto_30_LibCv_Local_LongWsIsLock(cryptoKeyId, &longWsIdx) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + localWsEcBPPtr = (P2VAR(Crypto_30_LibCv_WorkSpaceECBD, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&Crypto_30_LibCv_GetLongTermWs(longWsIdx).wsECBD; + + if (localWsEcBPPtr->state == CRYPTO_30_LIBCV_ECBD_STATE_REC_INTERMEDIATE) + { + /* distinguish mode dependent on the number of received ecus */ + /* own value already set by Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_Prime */ + if (localWsEcBPPtr->ecuCount == 1u) + { + /* init workspace at first call */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_First(localWsEcBPPtr); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + } + else + { + retVal = E_OK; + } + + if (retVal == E_OK) + { + /* Update always workspace with new intermediate value.*/ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Update(&localWsEcBPPtr->wsBD, partnerIntermediateValuePtr, partnerIntermediateValueLength, EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + } + + if ((retVal == E_OK) && (localWsEcBPPtr->ecuCount == (localWsEcBPPtr->ecuNum - 1u))) /* own value not required */ + { + /* Finalize and generate shared secret, if it is the last intermediate value. */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime_Finish(&localWsEcBPPtr->wsBD, cryptoKeyId, EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace(longWsIdx); + release = TRUE; + } + } + if (retVal != E_OK) + { + /* delete workspace if there was an error */ + Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteWorkspace(longWsIdx); + Crypto_30_LibCv_Local_KeyExchange_BD_Prime_DeleteKeys(cryptoKeyId); + release = TRUE; + } + else + { + /* update for added value */ + localWsEcBPPtr->ecuCount = (uint8)(localWsEcBPPtr->ecuCount + 1u); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + } + + if (release) + { + /* unlock if necessary */ + Crypto_30_LibCv_Local_LongWsLockRelease(cryptoKeyId, longWsIdx); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_Prime() */ +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType keaIndex; + uint32 keaLength = CRYPTO_30_LIBCV_KEY_EXCHANGE_SIZEOF_ALGORITHM; + + /* Lock write access for the CryptoKey */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + if (Crypto_30_LibCv_Local_KeyWriteLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +# endif + { + /* ----- Implementation ------------------------------------------------- */ + /* Read and check algorithm key element. */ + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_ALGORITHM, &keaIndex, &keaLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + { + + } + else + { + switch (Crypto_30_LibCv_GetKeyStorage(keaIndex)) + { +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X25519_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519: + /* execute KEA x25519 / RFC 7748 */ + if (partnerPublicValueLength == ESL_SIZEOF_X25519_PUBLIC_KEY) + { + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519(cryptoKeyId, partnerPublicValuePtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_X448: + /* execute KEA x25519 / RFC 7748 */ + if (partnerPublicValueLength == ESL_SIZEOF_X448_PUBLIC_KEY) + { + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448(cryptoKeyId, partnerPublicValuePtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P224R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1: + /* execute KEA NIST/SEC P224R1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_224_ID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_ANSIP256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1: + /* execute KEA ANSIp256r1 / ANSI X9.63 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_256_ID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1: + /* execute KEA SECp256r1 / ANSI X9.63 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_256_ID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1: + /* execute KEA SECp384r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_384_ID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP521R1: + /* execute KEA SECp521r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_521_ID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SPAKE2_PLUS_CIPHERSUITE_8_ENABLED == STD_ON) + /* execute KEA Spake2+ */ + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8: + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + case CRYPTO_30_LIBCV_KEY_EXCHANGE_SPAKE2_PLUS_CIPHERSUITE_8_1: + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_NISTP224R1_BD_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_NISTP224R1_BD: + /* execute KEA NISTp224r1 BD */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_EccCurveNistSecP224R1Domain,/* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC); + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P256R1_BD_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_BD: + /* execute KEA p256r1 BD */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain,/* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC); + break; +# endif + default: + /* invalid algorithm */ + break; + } + } +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* Release key write lock. */ + Crypto_30_LibCv_Local_KeyWriteLockRelease(cryptoKeyId); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyExchangeCalcSecret() */ +#endif /* CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON */ + +#if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) sharedSecretLengthPtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet = ESL_ERC_ERROR; + eslt_Length localSharedSecretLength = (eslt_Length)*sharedSecretLengthPtr; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Initialize workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_SIZEOF_WS_EDDH, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE_PARAMETER */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initEdDH(workspace, ESL_CURVE448); /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #20 Load private key */ + if (esl_importStaticPrivateKeyEdDH(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + privateKeyPtr, + (eslt_Length)privateKeyLength) == ESL_ERC_NO_ERROR) + { + /* #30 generate secret by using public key */ + eslRet = esl_generateSharedSecretEdDH( /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER_AND_PARAMETER_BUFFER */ + workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))partnerPubKeyPtr, + (eslt_Length)partnerPubKeyLength, + sharedSecretPtr, + &localSharedSecretLength); + + if (eslRet == ESL_ERC_NO_ERROR) + { + *sharedSecretLengthPtr = localSharedSecretLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws() */ +#endif /* ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + uint8 keaId, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType retValDispatching = E_NOT_OK; + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + + switch (keaId) + { +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P224R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_ECDHE_224_ID: + /* NISTp224r1 = SECp224r1 */ + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP224R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_P224R1_DOMAIN == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_DOMAIN == STD_ON) + case CRYPTO_30_LIBCV_ECDHE_256_ID: + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + EcDomainPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_DOMAIN == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_ECDHE_384_ID: + /* NISTp384r1 = SECp384r1 */ + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP384R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) */ + +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) + case CRYPTO_30_LIBCV_ECDHE_521_ID: + /* NISTp521r1 = SECp521r1 */ + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP521R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt; + retValDispatching = E_OK; + break; +# endif /* ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + + default: + /* not reachable, misra only. */ + break; + } + + /* ----- Implementation ----------------------------------------------- */ + if (retValDispatching == E_OK) + { + /* Check key sizes */ + if (privateKeyLength != esl_getLengthOfEcPprivateKey(EcDomainPtr)) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + /* invalid private key length */ + } + else if (partnerPubKeyLength != (uint32)Crypto_30_LibCv_Math_Mul2((uint32)esl_getLengthOfEcPpublicKey_comp(EcDomainPtr))) /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + { + /* invalid partner public key length */ + } + else + { + retVal = Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws(privateKeyPtr, + partnerPubKeyPtr, + sharedSecretPtr, + workspace, + EcDomainPtr, + EcDomainExtPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + /* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR_VSECPRIM */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* #1 init EcP workspaces */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_ECP, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initGenerateSharedSecretDHEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, EcDomainPtr, EcDomainExtPtr); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + + /* #2 Verify that the key is valid. */ + /* This is already implemented in actECPointIsOnCurve and is part of esl_generateSharedSecretDHEcP_prim */ + + /* #3 generate shared Secret */ + eslRet = esl_generateSharedSecretDHEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, /* PRQA S 0310, 0311 */ /* MD_CRYPTO_30_LIBCV_0310, MD_CRYPTO_30_LIBCV_0311 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))privateKeyPtr, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&partnerPubKeyPtr[0], (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&partnerPubKeyPtr[esl_getLengthOfEcPprivateKey(EcDomainPtr)], /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&sharedSecretPtr[0], (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&sharedSecretPtr[esl_getLengthOfEcPsecret_comp(EcDomainPtr)]); /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR_AS_PARAM */ + if (eslRet == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_EcP_CalculateSharedSecret_With_Ws() */ +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEYX25519SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX25519Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX25519Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyX25519Secret(Crypto_30_LibCv_GetKeyX25519SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == ESL_SIZEOF_X25519_PUBLIC_KEY) + { + /* Calculate shared secret according to X25519 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X25519_With_Ws(job->cryptoKeyId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyX25519Secret() */ +#endif /* Crypto_30_LibCv_Dispatch_KeyX448Secret() */ + +#if (CRYPTO_30_LIBCV_KEYX448SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX448Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX448Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyX448Secret(Crypto_30_LibCv_GetKeyX448SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == ESL_SIZEOF_X448_PUBLIC_KEY) + { + /* Calculate shared secret according to X448 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_X448_With_Ws(job->cryptoKeyId, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, workspace); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_GLOBAL_WORKSPACE_AND_CONST_BUFFER */ + } + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyX448Secret() */ +#endif /* Crypto_30_LibCv_Dispatch_KeyX448Secret() */ + +#if (CRYPTO_30_LIBCV_KEYP224R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP224R1Secret(Crypto_30_LibCv_GetKeyP224R1SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate shared secret according to ECC curve p224r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws(job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_224_ID, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP224R1Secret() */ +#endif /* CRYPTO_30_LIBCV_KEYP224R1SECRET == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYP256R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP256R1Secret(Crypto_30_LibCv_GetKeyP256R1SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate shared secret according to ECC curve p256r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws(job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_256_ID, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP256R1Secret() */ +#endif /* CRYPTO_30_LIBCV_KEYP256R1SECRET */ + +#if (CRYPTO_30_LIBCV_KEYP384R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP384R1Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP384R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP384R1Secret(Crypto_30_LibCv_GetKeyP384R1SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate shared secret according to ECC curve p384r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws(job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_384_ID, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP384R1Secret() */ +#endif /* CRYPTO_30_LIBCV_KEYP384R1SECRET */ + +#if (CRYPTO_30_LIBCV_KEYP521R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP521R1Secret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP521R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP521R1Secret(Crypto_30_LibCv_GetKeyP521R1SecretIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate shared secret according to ECC curve p521r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Generic_With_Ws(job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE, CRYPTO_30_LIBCV_ECDHE_521_ID, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP521R1Secret() */ +#endif /* CRYPTO_30_LIBCV_KEYP521R1SECRET */ + +#if (CRYPTO_30_LIBCV_KEYSPAKE2PSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySpake2PSecret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySpake2PSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate shared secret according to Spake2+ */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_Spake2P(job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeySpake2PSecret() */ +#endif /* CRYPTO_30_LIBCV_KEYSPAKE2PSECRET */ + +#if (CRYPTO_30_LIBCV_KEYP224R1BDSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1BDSecret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1BDSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Check domain key lengths */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + Crypto_30_LibCv_EccCurveNistSecP224R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP224R1BDSecret() */ +#endif /* CRYPTO_30_LIBCV_KEYP224R1BDSECRET */ + +#if (CRYPTO_30_LIBCV_KEYP256R1BDSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1BDSecret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1BDSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Check domain key lengths */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret_BD_CheckDomainKeyLengthsAndProcessCalc( + job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP256R1BDSecret() */ +#endif /* CRYPTO_30_LIBCV_KEYP256R1BDSECRET */ + +#if (CRYPTO_30_LIBCV_KEYX25519PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX25519PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX25519PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceX25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyX25519PubVal(Crypto_30_LibCv_GetKeyX25519PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to X25519 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X25519_With_Ws( job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyX25519PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYX25519PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYX448PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX448PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX448PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyX448PubVal(Crypto_30_LibCv_GetKeyX448PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to X448 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_X448_With_Ws(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_GLOBAL_WORKSPACE_AND_JOB_BUFFER */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyX448PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYX448PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP224R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP224R1PubVal(Crypto_30_LibCv_GetKeyP224R1PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECC curve p224r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP224R1PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP224R1PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP256R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP256R1PubVal(Crypto_30_LibCv_GetKeyP256R1PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECC curve p256r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP256R1PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP256R1PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP384R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP384R1PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP384R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP384R1PubVal(Crypto_30_LibCv_GetKeyP384R1PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECC curve p384r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP384R1PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP384R1PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP224R1BDPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1BDPubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1BDPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECBD curve p224r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + Crypto_30_LibCv_EccCurveNistSecP224R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveNistSecP224R1DomainExt, + Crypto_30_LibCv_EccCurveNistSecP224R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP224R1BDPubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP224R1BDPUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP256R1BDPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1BDPubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1BDPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECBD curve p256r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_BD_CheckDomainKeyLengthsAndProcessCalc( + job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP256R1BDPubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP256R1BDPUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYP521R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP521R1PubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP521R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyP521R1PubVal(Crypto_30_LibCv_GetKeyP521R1PubValIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + /* Calculate public value (Key pair of private and public) according to ECC curve p521r1 */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Generic_With_Ws(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE, + workspace); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyP521R1PubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYP521R1PUBVAL */ + +#if (CRYPTO_30_LIBCV_KEYSPAKE2PPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySpake2PPubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySpake2PPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT_CONST(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + /* nothing to do. */ + retVal = E_OK; + break; + + case CRYPTO_OPERATIONMODE_FINISH: + { + uint8 spakeMode = (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_NOT_SET) ? (uint8) CRYPTO_30_LIBCV_SPAKE2P_MODE_NORMAL : (uint8) CRYPTO_30_LIBCV_SPAKE2P_MODE_CHANGED_VERIFICATION; + + /* Calculate public value according to Spake2+ */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal_Spake2P(job->cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + spakeMode); + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* unsupported mode */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeySpake2PPubVal() */ +#endif /* CRYPTO_30_LIBCV_KEYSPAKE2PPUBVAL */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyExchange.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.h new file mode 100644 index 0000000..6bca183 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyExchange.h @@ -0,0 +1,663 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyExchange.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for Key Exchange Services. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYEXCHANGE_H +# define CRYPTO_30_LIBCV_KEYEXCHANGE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SIZEOF_ALGORITHM (1u) + + /* ECDHE */ +# define CRYPTO_30_LIBCV_ECDHE_224_ID (0u) +# define CRYPTO_30_LIBCV_ECDHE_256_ID (1u) +# define CRYPTO_30_LIBCV_ECDHE_384_ID (2u) +# define CRYPTO_30_LIBCV_ECDHE_521_ID (3u) + + /* ECBD max key size */ +# if(CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P256R1_BD_ENABLED == STD_ON) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PRIVATE_ECBD_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY_XY (CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC_XY) +# elif(CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_NISTP224R1_BD_ENABLED == STD_ON) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PRIVATE_ECBD_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_PUBLIC_ECBD_KEY_XY (CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC_XY) +# endif + + /* Key Exchange ECBD */ +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_NISTP224R1_BD_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P256R1_BD_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED STD_ON +# else +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ECBD_ENABLED STD_OFF +# endif + + /* Key Exchange Generic */ +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P224R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_ANSIP256R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP256R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED STD_ON +# else +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED STD_OFF +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_KEYX25519SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX25519Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyX25519Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX25519Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYX25519SECRET */ + +# if (CRYPTO_30_LIBCV_KEYX448SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX448Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyX448Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX448Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYX448SECRET */ + +# if (CRYPTO_30_LIBCV_KEYP224R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP224R1Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP224R1SECRET */ + +# if (CRYPTO_30_LIBCV_KEYP256R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP256R1Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP256R1SECRET */ + +# if (CRYPTO_30_LIBCV_KEYP384R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP384R1Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP384R1Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP384R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP384R1SECRET */ + +# if (CRYPTO_30_LIBCV_KEYP521R1SECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP521R1Secret() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP521R1Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP521R1Secret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP521R1SECRET */ + +# if (CRYPTO_30_LIBCV_KEYSPAKE2PSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySpake2PSecret() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key Spake2+ Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySpake2PSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYSPAKE2PSECRET */ + +# if (CRYPTO_30_LIBCV_KEYP224R1BDSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1BDSecret() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key P224R1 BD Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1BDSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP224R1BDSECRET */ + +# if (CRYPTO_30_LIBCV_KEYP256R1BDSECRET == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1BDSecret() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key P256R1 BD Secret job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1BDSecret( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP256R1BDSECRET */ + +# if (CRYPTO_30_LIBCV_KEYX25519PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX25519PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyX25519PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX25519PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYX25519PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYX448PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyX448PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyX448PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyX448PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYX448PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP224R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP224R1PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP224R1PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP256R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP256R1PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP256R1PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP384R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP384R1PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP384R1PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP384R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP384R1PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP224R1BDPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP224R1BDPubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key P224R1 BD PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP224R1BDPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP224R1BDPUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP256R1BDPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP256R1BDPubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key P256R1 BD PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_ECBD + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP256R1BDPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP256R1BDPUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYP521R1PUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyP521R1PubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeyP521R1PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyP521R1PubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYP521R1PUBVAL */ + +# if (CRYPTO_30_LIBCV_KEYSPAKE2PPUBVAL == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySpake2PPubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the Key Spake2+ PubVal job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_Spake2+ + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySpake2PPubVal( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYSPAKE2PPUBVAL */ + +# if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Dispatches the public value calculation. + * \details Dispatches the public value calculation dependent on the given algorithm. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid crypto key. + * publicValuePtr has to be a valid pointer. + * publicValueLengthPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Dispatch the shared secret calculation. + * \details Dispatch the shared secret calculation depending on the given algorithm. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Holds the length of th partner public value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * partnerPublicValuePtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); +# endif /* (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) */ + +# if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculate shared secret + * \details Calculate shared secret for ECDHE Prime for the given values. + * \param[in] privateKeyPtr Pointer to the private key array. + * \param[in] privateKeyLength Length of the private key array. + * \param[in] partnerPubKeyPtr Pointer to the partner public key array. + * \param[in] partnerPubKeyLength Length of the partner public key array. + * \param[out] sharedSecretPtr Pointer to the shared secret. + * \param[in] keaId Key exchange algorithm identifier. + * \param[in,out] workspace Contains workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre privateKeyPtr has to be a valid pointer with the length privateKeyLength. + * partnerPubKeyPtr has to be a valid pointer with the length partnerPubKeyLength. + * sharedSecretPtr has to be a valid pointer with the length 2*esl_getLengthOfEcPsecret_comp(EcDomainPtr). + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Dispatch_EcP_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + uint8 keaId, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +# endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_GENERIC_ENABLED == STD_ON)) */ + +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] privateKeyPtr Holds the private key which shall be used for the key exchange + * protocol. + * \param[in] privateKeyLength The length of the private key which shall be used for the key exchange + * protocol. + * \param[in] partnerPubKeyPtr Holds the partner public key which shall be used for the key exchange + * protocol. + * \param[in] partnerPubKeyLength The length of the partner public key which shall be used for the key exchange + * protocol. + * \param[out] sharedSecretPtr Pointer to the memory location where the calculated shared secret should be stored. + * \param[in,out] sharedSecretLengthPtr Pointer to the memory location where the number of available bytes for the + * shared secret is stored. The memory location will be overwritten by the actual + * stored length of the shared secret. + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Dispatch_EdDH_CalculateSharedSecret_With_Ws( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) privateKeyPtr, + uint32 privateKeyLength, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) partnerPubKeyPtr, + uint32 partnerPubKeyLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sharedSecretPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) sharedSecretLengthPtr, + P2VAR(eslt_WorkSpaceEdDH, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +# endif /* ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_X448_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYEXCHANGE_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyExchange.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.c new file mode 100644 index 0000000..1a0a13c --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.c @@ -0,0 +1,1156 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyGenerate.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of Key Generate Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_KEYGENERATE_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_KeyGenerate.h" +#include "Crypto_30_LibCv_Curve.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_KEY_GENERATE_SIZEOF_ALGORITHM (1u) + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_DispatchKga() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generation without checking key availability and access. + * \details Dispatches the key value generation dependent on the given algorithm. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \param[in] kgaIndex Index in the key storage where the element which holds the kga identifier + * is stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_DispatchKga(uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyStorageType kgaIndex); +#endif /* (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Symmetric() + *********************************************************************************************************************/ +/*! \brief Generation of the symmetric key values + * \details Generates the symmetric key values and stores the key in the memory location pointed to by the key + * value pointer. The write access right for the destination key element must be less than or equal + * to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Symmetric(uint32 cryptoKeyId); +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC_ENABLED == STD_ON */ + +#if ((CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic() + *********************************************************************************************************************/ +/*! \brief Key value generation + * \details Generates the key value for the key generate and stores the key in the memory location pointed + * by the key value pointer. The write access right for the destination key element must be less + * or equal than WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] speedUpExtPtr Pointer to precomputation structure + * \param[in] keySize Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * all pointers need to be valid. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic( + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws() + *********************************************************************************************************************/ +/*! \brief Generation of the key value + * \details Generates the key value and stores the public key in the memory location pointed to by the public + * value pointer. The write access right for the destination key element must be less or equal + * than WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] speedUpExtPtr Pointer to precomputation structure + * \param[in] keySize Contains the length of the key element in bytes. + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws( + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +#endif /* ((CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Ed25519() + *********************************************************************************************************************/ +/*! \brief Key value generation + * \details Generates the key values for the Ed25519 key generate algorithm by passing a suitable workspace to + * Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws and stores the keys in the memory location + * pointed to by the key value pointer. The write access right for the destination key elements must + * be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Ed25519( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws() + *********************************************************************************************************************/ +/*! \brief Generation of the key values + * \details Generates the key values according to Ed25519 key generation algorithm and stores the keys in the + * memory location pointed to by the key value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * workspace has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculate Ed25519 key pair + * \details Calculates the private and public Ed25519 key pair. + * \param[in,out] workspace Contains the workspace. + * \param[out] privateValuePtr Contains the pointer to the data where the private value shall be stored. + * \param[in,out] privateValueLengthPtr Contains the pointer to the data where the private length value shall be stored. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Contains the pointer to the data where the public length value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValuePtr, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValueLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519_ENABLED */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1() + *********************************************************************************************************************/ +/*! \brief Key value generation + * \details Generates the key values for the SM2P256V1 key generate algorithm by passing a suitable workspace to + * Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws and stores the keys in the memory location + * pointed to by the key value pointer. The write access right for the destination key elements must + * be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws() + *********************************************************************************************************************/ +/*! \brief Generation of the key values + * \details Generates the key values according to SM2P256V1 key generation algorithm and stores the keys in the + * memory location pointed to by the key value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid crypto key. + * workspace has to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculate SM2P256V1 key pair + * \details Calculates the private and public SM2P256V1 key pair. + * \param[in,out] workspace Contains the workspace. + * \param[out] privateKey Contains the pointer to the data where the private value shall be stored. + * \param[in,out] privateLength Contains the pointer to the data where the private length value shall be stored. + * \param[out] publicKeyX Contains the pointer to the data where the public x value shall be stored. + * \param[in,out] publicLengthX Contains the pointer to the data where the public x length value shall be stored. + * \param[out] publicKeyY Contains the pointer to the data where the public y value shall be stored. + * \param[in,out] publicLengthY Contains the pointer to the data where the public y length value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateKey, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateLength, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicKeyX, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicLengthX, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicKeyY, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicLengthY); +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1_ENABLED */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Symmetric() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Symmetric(uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_ErrorCode getBytesRetVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint32 kgkLength; + uint8 keyBuffer[CRYPTO_30_LIBCV_KEY_GENERATE_MAX_LENGTH]; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Search Key Element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_KEYGENERATE_KEY, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + kgkLength = Crypto_30_LibCv_GetLengthOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)); + + /* #20 Check key length */ + if (kgkLength <= CRYPTO_30_LIBCV_KEY_GENERATE_MAX_LENGTH) + { + /* #30 Generate random values */ + getBytesRetVal = esl_getBytesRNG((eslt_Length)kgkLength, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))keyBuffer); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (getBytesRetVal == E_OK) + { + /* #40 Set random values to the key element */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYGENERATE_KEY, (P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))keyBuffer, kgkLength); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + Crypto_30_LibCv_ClearData(keyBuffer, kgkLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + else + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate_Symmetric() */ +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC_ENABLED == STD_ON */ + +#if ((CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic( + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize) +{ + /* #10 Init Workspace */ + eslt_WorkSpaceEcP workspace; + + /* #20 Call Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws */ + return Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws( + cryptoKeyId, + domainPtr, + domainExtPtr, + speedUpExtPtr, + keySize, + &workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ +} /* Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_MSR_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws( + uint32 cryptoKeyId, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 privKey[CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE] = { 0u }; + uint8 pubKey[Crypto_30_LibCv_Math_Mul2(CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE)] = { 0u }; + + /* ----- Implementation ------------------------------------------------- */ + if (keySize > CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) + { + /* The requested key size exceeds the maximum ECC key size (CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE) */ + retVal = E_NOT_OK; + } + else + { + /* Calculate Keys */ + if (Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws(pubKey, privKey, domainPtr, domainExtPtr, speedUpExtPtr, keySize, workspace) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + uint32 doubleKeySize = Crypto_30_LibCv_Math_Mul2(keySize); + + /* Store public and private key to key elements if calculation was successfully */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, pubKey, doubleKeySize); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYGENERATE_KEY, privKey, keySize); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + /* delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(privKey, keySize); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(pubKey, doubleKeySize); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws() */ +#endif /* ((CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON) || \ + (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Ed25519() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Ed25519( + uint32 cryptoKeyId) +{ + /* #10 Init Workspace */ + eslt_WorkSpaceEd25519 workspace; + + /* #20 Call Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws */ + return Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws( + cryptoKeyId, + &workspace); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ +} /* Crypto_30_LibCv_Local_KeyGenerate_Ed25519() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 privKey[ESL_SIZEOF_Ed25519_SECRET_KEY]; + uint8 pubKey[ESL_SIZEOF_Ed25519_PUBLIC_KEY]; + eslt_Length privKeyLength = ESL_SIZEOF_Ed25519_SECRET_KEY; + eslt_Length pubKeyLength = ESL_SIZEOF_Ed25519_PUBLIC_KEY; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Calculate Keys */ + if (Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws(workspace, + privKey, + &privKeyLength, + pubKey, + &pubKeyLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + { + /* #11 Store public and private key to key elements if calculation was successfully */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, pubKey, pubKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYGENERATE_KEY, privKey, privKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + /* #12 delete buffer content from RAM */ + Crypto_30_LibCv_ClearData(privKey, privKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(pubKey, pubKeyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValuePtr, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValueLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_SIZEOF_WS_Ed25519, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initGenerateKeyPairEdDSA(workspace, ESL_Curve25519); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* #20 Calculate Keys */ + if (esl_generateKeyPairEdDSA(workspace, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))privateValuePtr, + privateValueLengthPtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicValuePtr, + publicValueLengthPtr) == ESL_ERC_NO_ERROR) /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + retVal = E_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Local_Ed25519_Calculate_With_Ws() */ + +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519_ENABLED */ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1_ENABLED == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1( + uint32 cryptoKeyId) +{ + /* Init Workspace */ + eslt_WorkSpaceSM2 workspace; + + /* Call Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws */ + return Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws( + cryptoKeyId, + &workspace); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_STACK_WORKSPACE */ +} /* Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 privKey[CRYPTO_30_LIBCV_SM2_SIZEOF_PRIVATE_KEY]; + uint8 pubKey[CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY]; + eslt_Length privKeyLength = CRYPTO_30_LIBCV_SM2_SIZEOF_PRIVATE_KEY; + eslt_Length pubKeyLengthX = CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY_HALF; + eslt_Length pubKeyLengthY = CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY_HALF; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* Calculate Keys. */ + if (Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws(workspace, + privKey, + &privKeyLength, + pubKey, + &pubKeyLengthX, + &pubKey[pubKeyLengthX], + &pubKeyLengthY) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + uint32 pubKeyLength = (uint32)pubKeyLengthX + (uint32)pubKeyLengthX; + + /* Store public and private key to key elements if calculation was successfully. */ + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY, pubKey, pubKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + retVal = Crypto_30_LibCv_Local_KeyElementSet(cryptoKeyId, CRYPTO_KE_KEYGENERATE_KEY, privKey, privKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + /* Delete buffer content from RAM. */ + Crypto_30_LibCv_ClearData(privKey, sizeof(privKey)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_ClearData(pubKey, sizeof(pubKey)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateKey, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateLength, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicKeyX, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicLengthX, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicKeyY, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicLengthY) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ------------------------------------------------- */ + + /* Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_SIZEOF_WS_SM2, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Init SM2 algorithm */ + eslRet = esl_initGenerateKeyPairSM2_ECP(workspace, + Crypto_30_LibCv_EccCurveSm2P256v1Domain, + Crypto_30_LibCv_EccCurveSm2P256v1DomainExt, + Crypto_30_LibCv_EccCurveSm2P256v1SpeedUpExt); /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + /* Calculate Keys */ + if (esl_generateKeyPairSM2_ECP(workspace, + privateKey, privateLength, + publicKeyX, publicLengthX, + publicKeyY, publicLengthY) == ESL_ERC_NO_ERROR)/* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + retVal = E_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_Sm2P256V1_Calculate_With_Ws() */ + +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1_ENABLED */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate(uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType kgaIndex; + uint32 kgaLength = CRYPTO_30_LIBCV_KEY_GENERATE_SIZEOF_ALGORITHM; + + /* ----- Implementation ------------------------------------------------- */ + +# if ((CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) && (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON)) + uint32 partitionIdx = Crypto_30_LibCv_CurrentPartitionIdx(); + +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (partitionIdx >= Crypto_30_LibCv_GetSizeOfPartitionIdentifiers()) + { + retVal = E_NOT_OK; + } + else +# endif +# endif + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + { +# if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + uint32 defaultRandomKey = Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(partitionIdx); + + /* #5 Lock read access for the DefaultRandomKey */ + if (Crypto_30_LibCv_Local_KeyReadLockGetNotProtected(defaultRandomKey) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +# endif + { + /* #10 Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else + { + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +# endif + + /* #20 Read and check algorithm key element */ + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_KEYGENERATE_ALGORITHM, &kgaIndex, &kgaLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* Fail to read necessary KeyElement */ + } + else + { + /* #30 Dispatch KGA */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_DispatchKga(cryptoKeyId, kgaIndex); + } + /* #40 Release key write lock */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(cryptoKeyId); + } +# if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(defaultRandomKey); +# endif + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate_DispatchKga() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate_DispatchKga(uint32 cryptoKeyId, Crypto_30_LibCv_SizeOfKeyStorageType kgaIndex) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + switch (Crypto_30_LibCv_GetKeyStorage(kgaIndex)) + { +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SYMMETRIC_GENERIC_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_SYMMETRIC: + /* #10 Execute KGA Symmetric */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Symmetric(cryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_P256R1: + /* #20 Execute KGA ANSI_NIST_P256R1 */ + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic(cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_P384R1: + /* #30 Execute KGA NIST_SEC_P384R1 */ + /* NISTp384r1 = SECp384r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic(cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_P521R1: + /* #40 Execute KGA NIST_SEC_P521R1 */ + /* NISTp521 = SECp521r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic(cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ED25519: + /* #50 Execute KGA ED25519 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Ed25519(cryptoKeyId); + break; +# endif +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1_ENABLED == STD_ON) + case CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_SM2P256V1: + /* #60 Execute KGA SM2P256V1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1(cryptoKeyId); + break; +# endif + + default: + /* invalid algorithm */ + break; + } + + if (retVal != E_OK) + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyGenerate_DispatchKga() */ +#endif /* CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON */ + +#if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_MSR_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValuePtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Init Workspace */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workspace->header, ESL_MAXSIZEOF_WS_ECP, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initGenerateKeyEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, domainPtr, domainExtPtr, speedUpExtPtr); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE */ + } + + if (eslRet == ESL_ERC_NO_ERROR) + { + if (esl_getLengthOfEcPprivateKey(domainPtr) == keySize) /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + { + if (esl_getLengthOfEcPpublicKey_comp(domainPtr) == keySize) /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + { + /* #20 Calculate Keys */ + if (esl_generateKeyEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))workspace, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))privateValuePtr, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicValuePtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(publicValuePtr[keySize])) == ESL_ERC_NO_ERROR) /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + { + retVal = E_OK; + } + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws() */ +#endif /* ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KEYGENSYMGENERIC == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenSymGeneric() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenSymGeneric( uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Generate symmetric key */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Symmetric(job->cryptoKeyId); + } + + CRYPTO_30_LIBCV_DUMMY_STATEMENT(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenSymGeneric() */ +#endif /* CRYPTO_30_LIBCV_KEYGENSYMGENERIC == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYGENP256R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP256R1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP256R1( uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyGenP256R1(Crypto_30_LibCv_GetKeyGenP256R1IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #20 Calculate public value (Key pair of private and public) according to ECC curve p256r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws(job->cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE, + workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenP256R1() */ +#endif /* CRYPTO_30_LIBCV_KEYGENP256R1 == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYGENP384R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP384R1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP384R1( uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyGenP384R1(Crypto_30_LibCv_GetKeyGenP384R1IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Calculate public value (Key pair of private and public) according to ECC curve p384r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws(job->cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE, + workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenP384R1() */ +#endif /* CRYPTO_30_LIBCV_KEYGENP384R1 == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYGENP521R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP521R1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP521R1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyGenP521R1(Crypto_30_LibCv_GetKeyGenP521R1IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Calculate public value (Key pair of private and public) according to ECC curve p521r1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_ECC_Generic_With_Ws(job->cryptoKeyId, + (P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1Domain, + (P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt, + (P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt, + CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE, + workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_WITH_ECC_CURVE_DATA */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenP521R1() */ +#endif /* CRYPTO_30_LIBCV_KEYGENP521R1 == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYGENED25519 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenEd25519() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenEd25519( uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyGenEd25519(Crypto_30_LibCv_GetKeyGenEd25519IdxOfObjectInfo(objectId)); + + /* #10 Calculate Key pair of private and public according to Ed25519 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Ed25519_With_Ws(job->cryptoKeyId, workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenEd25519() */ +#endif /* CRYPTO_30_LIBCV_KEYGENED25519 == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYGENSM2P256V1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenSm2P256V1() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenSm2P256V1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyGenSm2P256V1(Crypto_30_LibCv_GetKeyGenSm2P256V1IdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* Calculate public value (Key pair of private and public) according to SM2 with curve Sm2P256v1 */ + retVal = Crypto_30_LibCv_Local_KeyGenerate_Sm2P256V1_With_Ws(job->cryptoKeyId, + workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyGenSm2P256V1() */ +#endif /* CRYPTO_30_LIBCV_KEYGENSM2P256V1 == STD_ON */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyGenerate.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.h new file mode 100644 index 0000000..15d27e6 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyGenerate.h @@ -0,0 +1,297 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyGenerate.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for Key Generate Services. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYGENERATE_H +# define CRYPTO_30_LIBCV_KEYGENERATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_P224R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_ANSIP256R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP256R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) \ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED STD_ON +# else +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED STD_OFF +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGenerate() + *********************************************************************************************************************/ +/*! \brief Checks key availability and access, then dispatches the key generation. + * \details Dispatches the key value generation dependent on the given algorithm. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key generation + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId has to be a valid crypto key. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGenerate(uint32 cryptoKeyId); +# endif /* (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEYGENSYMGENERIC == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenSymGeneric() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate symmetric Generic job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-265506 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenSymGeneric(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENSYMGENERIC == STD_ON */ + +# if (CRYPTO_30_LIBCV_KEYGENP256R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP256R1() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate P256R1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-240342 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP256R1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENP256R1 == STD_ON */ + +# if (CRYPTO_30_LIBCV_KEYGENP384R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP384R1() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate P384R1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-240342 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP384R1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENP384R1 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEYGENP521R1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenP521R1() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate P521R1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-240342 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenP521R1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENP521R1 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEYGENSM2P256V1 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenSm2P256V1() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate Sm2P256V1 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-240342 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenSm2P256V1(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENSM2P256V1 == STD_ON) */ + +# if (CRYPTO_30_LIBCV_KEYGENED25519 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyGenEd25519() + *********************************************************************************************************************/ +/*! \brief Dispatches the key generate ED25519 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-240342 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyGenEd25519(uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYGENED25519 == STD_ON) */ + +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws() + *********************************************************************************************************************/ +/*! \brief Calculate Ecc + * \details Calculate Ecc for ECDHE for the given values. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * The publicValuePtr contains the x- and y-value pair. + * \param[out] privateValuePtr Contains the pointer to the data where the private value shall be stored. + * \param[in] domainPtr Pointer to domain parameter structure + * \param[in] domainExtPtr Pointer to domain parameter extension structure + * \param[in] speedUpExtPtr Pointer to precomputation structure + * \param[in] keySize Contains the length of the key element in bytes. + * \param[in,out] workspace Contains the workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre privateValuePtr has to be a valid pointer with keySize. + * publicValuePtr has to be a valid pointer with size 2*keySize. + * all pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Ecc_Calculate_With_Ws( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) privateValuePtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) domainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) speedUpExtPtr, + uint32 keySize, + P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +# endif /* ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_USING_KEY_GENERATE_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_GENERATE_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyGenerate.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.c new file mode 100644 index 0000000..83c6326 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.c @@ -0,0 +1,8444 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyManagement.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation of the MICROSAR Crypto Driver (Crypto) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_KEYMANAGEMENT_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_Curve.h" +#include "Crypto_30_LibCv_RandomSeed.h" +#include "Crypto_30_LibCv_KeyExchange.h" +#include "Crypto_30_LibCv_KeyGenerate.h" +#include "Crypto_30_LibCv_KeyDerive.h" +#include "Crypto_30_LibCv_KeySetValid.h" +#include "Crypto_30_LibCv_KeySetInvalid.h" +#include "Crypto_30_LibCv_InternalApi.h" + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +# include "NvM.h" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +#if !defined (CRYPTO_30_LIBCV_LOCAL) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL static +#endif + +#if !defined (CRYPTO_30_LIBCV_LOCAL_INLINE) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL_INLINE LOCAL_INLINE +#endif + +#define Crypto_30_LibCv_GetKeyElementWrittenLength(Index) ((uint32)(((uint32)Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements((Index))) << 8) | (uint32)Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements((Index))+1u))) +#define CRYPTO_30_LIBCV_EMPTY_KEY_LENGTH (0u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_KEY (16u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT (16u) +#define CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER (CRYPTO_30_LIBCV_SIZEOF_SHE_KEY+ CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT) +#define CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER (CRYPTO_30_LIBCV_SIZEOF_SHE_KEY+ CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT) + +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_UID (0u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID (15u) +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS (CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M1_IDS (1u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M1 (CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID + CRYPTO_30_LIBCV_SIZEOF_SHE_M1_IDS) + +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M2 (CRYPTO_30_LIBCV_SIZEOF_SHE_M1) +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M2_COUNTER (CRYPTO_30_LIBCV_STARTINDEX_SHE_M2) +#define CRYPTO_30_LIBCV_MASK_SHE_M2_COUNTER (0xFFFFFFF0uL) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M2_COUNTER_BIT (28u) +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M2_KEYFLAG (CRYPTO_30_LIBCV_STARTINDEX_SHE_M2) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M2 (32u) + +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M3 (CRYPTO_30_LIBCV_STARTINDEX_SHE_M2 + CRYPTO_30_LIBCV_SIZEOF_SHE_M2) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M3 (16u) + +#define CRYPTO_30_LIBCV_STARTINDEX_SHE_M4 (CRYPTO_30_LIBCV_STARTINDEX_SHE_M3 + CRYPTO_30_LIBCV_SIZEOF_SHE_M3) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M4 (32u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES (4u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M4_ENC (16u) + +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M5 (16u) + +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3 (CRYPTO_30_LIBCV_SIZEOF_SHE_M1 + CRYPTO_30_LIBCV_SIZEOF_SHE_M2 + CRYPTO_30_LIBCV_SIZEOF_SHE_M3) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5 (CRYPTO_30_LIBCV_SIZEOF_SHE_M4 + CRYPTO_30_LIBCV_SIZEOF_SHE_M5) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M5 (CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3 + CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5) + +#define CRYPTO_30_LIBCV_SHE_M1_SECRET_KEY_ID (0u) +#define CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID (1u) +#define CRYPTO_30_LIBCV_SHE_M1_MAC_KEY_ID (2u) +#define CRYPTO_30_LIBCV_SHE_M1_MAC_ID (3u) +#define CRYPTO_30_LIBCV_SHE_M1_KEY_N_START_ID (4u) +#define CRYPTO_30_LIBCV_SHE_M1_KEY_N_END_ID (13u) +#define CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID (14u) +#define CRYPTO_30_LIBCV_SHE_NUM_KEYS (25u) + +#define CRYPTO_30_LIBCV_SHE_TYPE_SECRET_KEY (0u) +#define CRYPTO_30_LIBCV_SHE_TYPE_MASTER_KEY (1u) +#define CRYPTO_30_LIBCV_SHE_TYPE_MAC_KEY (2u) +#define CRYPTO_30_LIBCV_SHE_TYPE_MAC (3u) +#define CRYPTO_30_LIBCV_SHE_TYPE_KEY_N (4u) +#define CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY (5u) +#define CRYPTO_30_LIBCV_SHE_NUM_KEY_TYPES (6u) + +#define CRYPTO_30_LIBCV_SHE_UID_WILDCARD_VALUE (0x00u) + +#define CRYPTO_30_LIBCV_SHE_PAGE0 (0u) +#define CRYPTO_30_LIBCV_SHE_PAGE1 (1u) + +#define CRYPTO_30_LIBCV_SIZEOF_SHE_CHALLENGE (16u) +#define CRYPTO_30_LIBCV_SIZEOF_CMAC (16u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_STATUS (1u) +#define CRYPTO_30_LIBCV_SIZEOF_SHE_CMD_GET_ID_OUTPUT (CRYPTO_30_LIBCV_SIZEOF_SHE_STATUS + CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID + CRYPTO_30_LIBCV_SIZEOF_CMAC) + +#define CRYPTO_30_LIBCV_SHE_CLEARED_STATUS (0x00u) /* Cleared status */ +#define CRYPTO_30_LIBCV_SHE_STATUS_BUSY (0x01u) /* Whenever SHE is processing a command. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_SECURE_BOOT (0x02u) /* If the secure booting is activated. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_BOOT_INIT (0x04u) /* If the secure booting has been personalized during the boot sequence. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_BOOT_FINISHED (0x08u) /* When the secure booting has been finished by calling either CMD_BOOT_FAILURE or CMD_BOOT_OK or if CMD_SECURE_BOOT failed in verifying BOOT_MAC. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_BOOT_OK (0x10u) /* If the secure booting (CMD_SECURE_BOOT) succeeded. If CMD_BOOT_FAILURE is called the bit is erased. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_RND_INIT (0x20u) /* If the random number generator has been initialized. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_EXT_DEBUGGER (0x40u) /* If an external debugger is connected to the chip, i.e. it reflects the input for debugger activation. */ +#define CRYPTO_30_LIBCV_SHE_STATUS_INT_DEBUGGER (0x80u) /* If the internal debugging mechanisms of SHE are activated */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION (0x80u) +/* The FID for boot protection is only checked if the feature is enabled. + * Otherwise use 0x00 Mask to ignore boot protection. */ +# if (CRYPTO_30_LIBCV_KEYELEMENTSBOOTPROTECTIONIDXOFSHEPAGE == STD_ON) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION (0x40u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION_INV (0xBFu) +# else +# define CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION (0x00u) +# endif +/* The FID for debugger protection is only checked if the feature is enabled. + * Otherwise use 0x00 Mask to ignore debugger protection. */ +# if (CRYPTO_30_LIBCV_KEYELEMENTSDEBUGGERPROTECTIONIDXOFSHEPAGE == STD_ON) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION (0x20u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION_INV (0xDFu) +# else +# define CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION (0x00u) +# endif +# define CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE (0x10u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD (0x08u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_CMAC_USAGE (0x04u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED (0x02u) +# define CRYPTO_30_LIBCV_SHE_FID_MASK_DEFAULT (0x00u) +# endif +#endif + +/* NvM Block Handling */ +/* State: + * 1Byte State: [ Bit7-3 not used | DataCopied | WriteRequested| DataChanged ] + */ +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE (0x01u) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_WRITE_REQUESTED (0x02u) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_WRITE_COPIED (0x04u) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_CLEAR_WRITE_COPIED (0xFBu) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_CLEAR_WRITE_REQUESTED (0xFDu) + +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_IDLE (0x00u) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_WRITE_REQ_PENDING (CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_WRITE_REQ (CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE|CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_WRITE_REQUESTED) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_COPY_DATA (CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_WRITE_COPIED) +#define CRYPTO_30_LIBCV_NVBLOCK_STATE_REQ_WHILE_PENDING (CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_WRITE_COPIED|CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE) + +/* Nv Header Length and Position */ +#define CRYPTO_30_LIBCV_POS_NVBLOCK_VERSION (0u) +#define CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_VERSION (1u) +#define CRYPTO_30_LIBCV_POS_NVBLOCK_FLAGS (CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_VERSION) +#define CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_FLAGS (1u) +#define CRYPTO_30_LIBCV_POS_NVBLOCK_CRC (CRYPTO_30_LIBCV_POS_NVBLOCK_FLAGS+CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_FLAGS) +#define CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_CRC (4u) +#define CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_HEADER_CRC (CRYPTO_30_LIBCV_POS_NVBLOCK_CRC + CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_CRC) + +/* Nv Version and Flags */ +#define CRYPTO_30_LIBCV_NVBLOCK_VERSION_0 (0u) +#define CRYPTO_30_LIBCV_NVBLOCK_FLAGS_0 (0u) + +/* Nvm Service Id for NvM_WriteBlock */ +#ifndef CRYPTO_30_LIBCV_NVM_WRITE_BLOCK /* COV_CRYPTO_30_LIBCV_COMPATIBILITY_DEFINE */ +# define CRYPTO_30_LIBCV_NVM_WRITE_BLOCK NVM_WRITE_BLOCK /* Service ID NvM_WriteBlock() */ +#endif +/* Nvm Service Id for NvM_WriteBlock */ +#ifndef CRYPTO_30_LIBCV_NVM_WRITE_ALL /* COV_CRYPTO_30_LIBCV_COMPATIBILITY_DEFINE */ +# define CRYPTO_30_LIBCV_NVM_WRITE_ALL NVM_WRITE_ALL /* Service ID NvM_WriteAll() */ +#endif + +/* KeyNvStatus */ +/* State: + * 1Byte State: [ Bit7-5 not used | WRITE_FAILED | KEY_COPIED | NV_WRITE_REQ | KEY_CHANGED | NV_SYNC ] + */ + /* Bit masks */ +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_NV_SYNC (0x01u) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED (0x02u) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_NV_WRITE_REQ (0x04u) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_COPIED (0x08u) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_WRITE_FAILED (0x10u) + +/* States */ +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_NOT_NV (0x00u) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_SYNC (CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_NV_SYNC) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_CHANGED (CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_WRITE_REQ (CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED|CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_NV_WRITE_REQ) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_COPIED (CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_COPIED) +#define CRYPTO_30_LIBCV_KEY_NV_STATUS_WRITE_FAILED (CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED|CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_WRITE_FAILED) + + /********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/* SHE Key Update */ +#define Crypto_30_LibCv_She_M1_GetAuthId(value) ((uint8)((value) & 0x0Fu)) /* Mask authentication id */ +#define Crypto_30_LibCv_She_M1_GetId(value) ((uint8)((value) >> 4)) /* Mask update SHE id */ +#define Crypto_30_LibCv_She_M1_BuildIds(Id, AuthId) (((uint8)(((Id) << 4) & 0xF0u)) | ((uint8)((AuthId) & 0x0Fu)))/* Mask update SHE id */ +#define Crypto_30_LibCv_She_IsDebugCmd(cryptoKeyId, elementId) ((cryptoKeyId == Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate()) && (elementId == CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD)) + +/* Convert Counter from M1 to Store Value */ +#define Crypto_30_LibCv_She_ConvertCounter(value) (((value) & CRYPTO_30_LIBCV_MASK_SHE_M2_COUNTER) >> 4) + +/* Get SHE Constant */ +#define Crypto_30_LibCv_She_GetPtrMacConst(indexOfSheKey) (Crypto_30_LibCv_GetAddrSheConstants(Crypto_30_LibCv_GetSheConstantsMacStartIdxOfShePage(Crypto_30_LibCv_GetShePageIdxOfSheKeys((indexOfSheKey))))) +#define Crypto_30_LibCv_She_GetPtrEncConst(indexOfSheKey) (Crypto_30_LibCv_GetAddrSheConstants(Crypto_30_LibCv_GetSheConstantsEncStartIdxOfShePage(Crypto_30_LibCv_GetShePageIdxOfSheKeys((indexOfSheKey))))) + +/* NvM Block Handling */ +#define Crypto_30_LibCv_GetNvBlockState(blockIdx) (Crypto_30_LibCv_NvBlock_State[blockIdx]) +#define Crypto_30_LibCv_SetNvBlockState(blockIdx, state) ((Crypto_30_LibCv_NvBlock_State[blockIdx]) = (state)) +#define Crypto_30_LibCv_IsNvBlockState(blockIdx, state) ((Crypto_30_LibCv_NvBlock_State[blockIdx]) == (state)) +#define Crypto_30_LibCv_IsNvBlockStateMask(blockIdx, Mask) (((Crypto_30_LibCv_NvBlock_State[blockIdx]) & (Mask)) == (Mask)) +#define Crypto_30_LibCv_SetNvBlockStateMask(blockIdx, Mask) ((Crypto_30_LibCv_NvBlock_State[blockIdx]) = (Crypto_30_LibCv_NvBlock_State_Type)((Crypto_30_LibCv_NvBlock_State[blockIdx]) | (Mask))) +#define Crypto_30_LibCv_ClearNvBlockStateMask(blockIdx, Mask) ((Crypto_30_LibCv_NvBlock_State[blockIdx]) = (Crypto_30_LibCv_NvBlock_State_Type)((Crypto_30_LibCv_NvBlock_State[blockIdx]) & (Mask))) + +#ifndef Crypto_30_LibCv_NvM_WriteBlock /* COV_CRYPTO_30_LIBCV_COMPATIBILITY_DEFINE */ +# define Crypto_30_LibCv_NvM_WriteBlock Crypto_30_LibCv_GetNvWriteBlockFctNameOfNvStorage() +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* Typedef for she key type */ +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +typedef uint8 Crypto_30_LibCv_SheKeyTypeType; +#endif + +/* NvM Block Handling */ +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +typedef uint8 Crypto_30_LibCv_NvBlock_State_Type; +#endif + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_START_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_SheKeyCheckFlags[CRYPTO_30_LIBCV_SHE_NUM_KEY_TYPES - 1u] = /* Ram Key is not checked. */ /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ +{ + /* SECRET_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION, + /* ECU_MASTER_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD, + /* BOOT_MAC_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD, + /* BOOT_MAC */ CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD, + /* KEY_N */ CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE | CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD | CRYPTO_30_LIBCV_SHE_FID_MASK_CMAC_USAGE, +}; + +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_SheKeySetAccessFlags[CRYPTO_30_LIBCV_SHE_NUM_KEY_TYPES - 1u] = /* Ram Key is not checked. */ /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ +{ + /* SECRET_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED, + /* ECU_MASTER_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED, + /* BOOT_MAC_KEY */ CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE | CRYPTO_30_LIBCV_SHE_FID_MASK_CMAC_USAGE, + /* BOOT_MAC */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED, + /* KEY_N */ 0u, +}; + +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_SheKeyServiceFlags[CRYPTO_30_LIBCV_SHE_NUM_SERVICES] = /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ +{ + /* Enc/Decrypt */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED | CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE, + /* Mac Generate */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED | CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE | CRYPTO_30_LIBCV_SHE_FID_MASK_CMAC_USAGE, + /* Mac Verify */ CRYPTO_30_LIBCV_SHE_FID_MASK_DENIED | CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE, + /* SHE Update Read */ CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION | CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION +}; + +CRYPTO_30_LIBCV_LOCAL CONST(uint8, CRYPTO_30_LIBCV_CONST) Crypto_30_LibCv_SheKeyServiceFlagsResult[CRYPTO_30_LIBCV_SHE_NUM_SERVICES] = /* PRQA S 3218 */ /* MD_CRYPTO_30_LIBCV_8.7 */ +{ + /* Enc/Decrypt */ 0u, + /* Mac Generate */ CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE, /* Use for Mac */ + /* Mac Verify */ CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE, /* Use for Mac */ + /* SHE Update Read */ 0u +}; +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ +#endif /* (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CONST_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_LIBCV_START_SEC_VAR_NOINIT_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) +/* It is only allowed to access this data if the SheInfoKey is locked */ +CRYPTO_30_LIBCV_LOCAL VAR(uint8, CRYPTO_30_LIBCV_VAR_NOINIT) Crypto_30_LibCv_She_Debug_Cmd_Challenge[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; +# endif +#endif + +/* NvM Block Handling */ +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +CRYPTO_30_LIBCV_LOCAL VAR(Crypto_30_LibCv_NvBlock_State_Type, CRYPTO_30_LIBCV_VAR_NOINIT) Crypto_30_LibCv_NvBlock_State[Crypto_30_LibCv_GetSizeOfNvBlock()]; +#endif + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) +/* It is only allowed to access this data if the SheInfoKey is locked */ +VAR(boolean, CRYPTO_30_LIBCV_VAR_NOINIT) Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag; +# endif +#endif + +#define CRYPTO_30_LIBCV_STOP_SEC_VAR_NOINIT_8BIT +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck() + **********************************************************************************************************************/ +/*! \brief Check access rights for copy key element + * \details The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * \param[in] elementIndexSrc Holds the element index of the source key element. Has to be in bounds. + * \param[in] elementIndexDst Holds the element index of the destination key element. Has to be in bounds. + * \return E_OK Request successful. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * \pre elementIndexSrc has to be a valid element storage index. + * elementIndexDst has to be a valid element storage index. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopy() + *********************************************************************************************************************/ +/*! \brief Copy key element + * \details Copies a key element to another key element in the same crypto driver. + * \param[in] elementIndexSrc Holds the element index of the source key element. Has to be in bounds. + * \param[in] elementIndexDst Holds the element index of the destination key element. Has to be in bounds. + * \param[in] dstCryptoKeyId Holds the identifier of the destination key whose key element shall be set. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre elementIndexSrc has to be a valid element storage index. + * elementIndexDst has to be a valid element storage index. + * dstCryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopy( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst, + uint32 dstCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopyPartial() + **********************************************************************************************************************/ +/*! \brief Copy key element partial + * \details Copies a key element to another key element in the same crypto driver. The keyElementSourceOffset + * and keyElementCopyLength allows to copy just a part of the source key element into the destination. + * The offset of the target key is also specified with this function. + * The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * \param[in] elementIndexSrc Holds the element index of the source key element. Has to be in bounds. + * \param[in] elementIndexDst Holds the element index of the destination key element. Has to be in bounds. + * \param[in] dstCryptoKeyId Holds the identifier of the destination key whose key element shall be set. + * \param[in] keyElementSourceOffset Holds the offset of the of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset Holds the offset of the of the target key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Holds the number of bytes that shall be copied. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + * \pre elementIndexSrc and elementIndexDst must be valid. + * dstCryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopyPartial( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst, + uint32 dstCryptoKeyId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyCopy_Internal() + **********************************************************************************************************************/ +/*! \brief Copy each key element of given keys. + * \details Copy key element which matches their key element IDs of given keys. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, at least one key is not available. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre cryptoKeyId and targetCryptoKeyId are valid IDs of non-identical crypto keys, + * cryptoKeyId is read-locked, targetCryptoKeyId is write-locked. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyCopy_Internal( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetLengthCheck() + **********************************************************************************************************************/ +/*! + * \brief Check the length. + * \details Check the length according to lengthCheck (NONE, MAX, EQUAL). + * NONE Provide key always / key length is written to resultLengthPtr. + * MAX Provide key if the stored key length is smaller or equal to resultLengthPtr / key length is written to resultLengthPtr. + * EQUAL Provide key if the stored key length is equal to resultLengthPtr / key length is written to resultLengthPtr. + * \param[in] resultLengthptr Pointer which contains the size of the available buffer. + * \param[in] elementIndex Index of the Key element. + * \param[in] lengthCheck Length check mode. + * \return TRUE Length check passed. + * FALSE Length check failed. + * \pre elementIndex is a valid parameter + * resultIndexPtr need to be valid ptr + * resultLengthPtr need to be valid ptr + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetLengthCheck( + P2CONST(uint32, AUTOMATIC, AUTOMATIC) resultLengthptr, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGet_Standard() + *********************************************************************************************************************/ +/*! + * \brief Gets content of the key element. + * \details Gets content of the key element from the key storage. + * \param[in,out] resultIndexPtr Holds the identifier of the key element storage index. + * \param[in,out] resultLengthPtr Pointer to a variable which contains the size of the available buffer. + * After calling this function, the parameter contains the number of bytes written to the buffer. + * \param[in] elementIndex Index of the Key element. + * \param[in] lengthCheck Length check mode. + * \return E_OK Request successful. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. / Size mismatch for length check equal. + * \pre elementIndex is a valid parameter + * resultIndexPtr need to be valid ptr + * resultLengthPtr need to be valid ptr + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGet_Standard( + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeySetValidity() + *********************************************************************************************************************/ +/*! + * \brief Sets the given key to the requested validity. + * \details Sets all key elements of the given key to the requested validity, calls the KeyNvStatus keyChanged + * transition and triggers the key-validity-changed callout. + * \param[in] cryptoKeyId Holds the identifier of the key whose validity shall be set. + * \param[in] requestedValidity Validity to which the key shall be set: Valid (TRUE) or Invalid (FALSE) + * \return TRUE Request NvM Write. + * FALSE No writing necessary. + * \pre cryptoKeyId has to hold a valid identifier of a key + * \context TASK + * \reentrant TRUE, for different cryptoKeyIds + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeySetValidity( + uint32 cryptoKeyId, boolean requestedValidity); + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetSheId() + **********************************************************************************************************************/ +/*! \brief Get SHE Id for element. + * \details - + * \param[in] elementIndex Holds the identifier of the key element + * \param[out] sheIdPtr Holds the pointer to the SHE id + * \pre elementIndex must identify a valid key element for a SHE key + * sheIdPtr has to be a valid ptr + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetSheId( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sheIdPtr); +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetSheIndex() + **********************************************************************************************************************/ +/*! \brief Get index of SHE key in SheKeys. + * \details - + * \param[in] elementIndex Holds the identifier of the key element + * \param[out] indexSheKeyPtr Holds the pointer to the sheKeys index + * \return E_OK Request successful, SHE key found. + * E_NOT_OK Request failed. + * \pre elementIndex must identify a valid key element for a SHE key + * indexSheKeyPtr has to be a valid ptr + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetSheIndex( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, AUTOMATIC) indexSheKeyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetKeyType() + **********************************************************************************************************************/ +/*! \brief Get SHE key type for SHE Id. + * \details - + * \param[in] sheId Holds the identifier to the SheKeyId. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre sheId must identify a valid key element + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(uint8, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetKeyType( + uint8 sheId); + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetElementIndex() + **********************************************************************************************************************/ +/*! \brief Check if the element with the given SheKeyId is present. + * \details - + * \param[in] sheKeyId Holds the identifier to the SheKeyId. + * \param[out] elementIndex Pointer to the element index. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre sheId must identify a valid key element + * All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetElementIndex( + uint8 sheKeyId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) elementIndex); +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetSheCheckFid() + **********************************************************************************************************************/ +/*! \brief Check FID access rights for key usage. + * \details - + * \param[in] elementIndex Holds the identifier of the key element + * \param[in] serviceType Holds the usage service type + * \return TRUE Request successful / Usage allowed. + * FALSE Request failed. + * \pre elementIndex must identify a valid key element + * serviceType must to be a valid service type + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetSheCheckFid( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_ServiceType serviceType); +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel() + *********************************************************************************************************************/ +/*! \brief The function derives a key from given input data. + * \details The function derives a key from given input data. This is used during the SHE key updated protocol. + * \param[in] dataPtr Pointer to input data from which the key is derived + * \param[in] length Length of input data. + * \param[out] outputPtr Pointer to derived key + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by outputPtr has to be 16 Bytes. + * Length of the buffer provided by dataPtr has to be a multiple of 16. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) dataPtr, + uint32 length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCmac() + *********************************************************************************************************************/ +/*! \brief Generates Cmac based on given data and given key. + * \details The function calculates the cmac based on the given data and the key. This is used during the SHE key updated protocol. + * \param[in] dataPtr Pointer to data from which the mac is calculated + * \param[in] length Length of input data + * \param[in] keyPtr Pointer to key buffer + * \param[out] outputPtr Pointer to derived key + * \param[out] workspace Pointer to workspace + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by outputPtr has to be 16 Bytes + * Length of the key provided by keyPtr has to be 16 Bytes + * Length of the provided dataPtr has to be a multiple of 16 Bytes. + * workspace has to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCmac( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataPtr, + uint32 length, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputPtr, + P2VAR(eslt_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract() + *********************************************************************************************************************/ +/*! \brief Verify and extract key + * \details Verify M3, extract key and generate M4 and M5. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] elementIndex Holds the identifier of the key element which shall be set + * \param[in] m1m2m3 Holds the pointer to the key buffer which shall be used to update the key element with M1M2M3. + * \param[in] indexOfSheKey Index of the update key element in SheKeys + * \param[in] indexOfAuthSheKey Index of the authentication key element in SheKeys + * \param[in] outputElement Index of the destination key element + * \param[in] proofAvailable Holds the value if the proof element is available. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId and outputElement as well as elementIndex must identify a valid key - key element pair + * keyPtr has to be a valid ptr with the length of CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3 + * indexOfSheKey and indexOfAuthSheKey need to be valid index for SheKeys. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + Crypto_30_LibCv_SizeOfKeyElementsType outputElement, + Std_ReturnType proofAvailable); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdate() + *********************************************************************************************************************/ +/*! \brief Updates key element based on SHE key update mechanism. + * \details Interprets the given key buffer as M1M2M3 of the SHE key update mechanism and extracts relevant + * information for setting the key element. This is used during the SHE key updated protocol. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] elementIndex Holds the identifier of the key element which shall be set + * \param[in] indexOfSheKey Hold the index of the update key in SheKeys. + * \param[in] m1m2m3 Holds the pointer to the key buffer which shall be used to update the key element which holds M1M2M3. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * \pre cryptoKeyId, elementIndex as well as indexOfSheKey must identify a valid key - key element pair + * keyPtr has to be a valid ptr with the length of CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3 + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdate( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSetShe() + *********************************************************************************************************************/ +/*! \brief Sets a she key element. + * \details Sets the given key element using she behavior. She key updated for she key and plaintext update for ram key. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] elementIndex Holds the index of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \param[in] oldRetVal Contains the old return value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId and elementIndex have to be a valid identifiers to a key in the keyStorage. + * The crypto key has to be locked for write access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSetShe( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength, + Std_ReturnType oldRetVal); + +# if (CRYPTO_30_LIBCV_RAM_KEY_EXPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetShe() + *********************************************************************************************************************/ +/*! \brief Get a she key element. + * \details Get the given key element using she behavior. Only the She ram key can be provided for key export. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be provided. + * \param[in] elementIndex Holds the index of the key element which shall be provided. + * \param[out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId and elementIndex have to be a valid identifiers to a key in the keyStorage. + * The crypto key has to be locked for read access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetShe( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyExport_M1M2M3() + *********************************************************************************************************************/ +/*! \brief Calculate M1M2M3 + * \details Calculate M1M2M3 for She ram key export. + * \param[out] m1m2m3 Pointer to key buffer with M1M2M3 (Sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3) + * \param[in,out] KDFbufferPtr Pointer to the key derive function buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER. + * The first 16 bytes contain to be the secret key. + * \param[in,out] encBufferPtr Pointer to the working buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER. + * \param[in] uid Pointer to the She uid. Size need to be CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID. + * \param[in] ramKey Holds the pointer to the She ram key with sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_KEY. + * \param[in] indexOfSheKey Hold the index of the update key in SheKeys. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre indexOfSheKey have to be a valid identifiers to a key in the keyStorage. + * All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyExport_M1M2M3( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) encBufferPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ramKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyExport() + *********************************************************************************************************************/ +/*! \brief She key export calculate M1-M3 or M1-M5 + * \details Calculate M1-M3 or M1-M5 She ram key export. + * (64 Bytes for M1-M3 and 112Bytes for M1-M5) + * \param[in] indexOfSheKey Hold the index of the update key in SheKeys. + * \param[in] indexOfAuthSheKey Hold the index of the authentication key in SheKeys. + * \param[out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre indexOfSheKey and indexOfAuthSheKey have to be a valid identifiers to a key in the keyStorage. + * All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyExport( + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr); +# endif /* (CRYPTO_30_LIBCV_RAM_KEY_EXPORT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateDecrypt() + *********************************************************************************************************************/ +/*! \brief Decrypts data based on given key. + * \details The function decrypts the given data using the provided key. AES128 is used as underlying algorithm. + * This is used during the SHE key updated protocol. + * \param[in] m2m3 Pointer to data which shall be decrypted which hold M2M3. + * \param[in] keyPtr Pointer to key buffer + * \param[out] outputPtr Pointer to buffer where the decrypted data will be copied to + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by dataPtr has to be 32 Bytes + * Length of the key provided by keyPtr has to be 16 Bytes + * Length of the buffer provided by outputPtr has to be 32 Bytes + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateDecrypt( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m2m3, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateEncrypt() + *********************************************************************************************************************/ +/*! \brief Encrypts data based on given key. + * \details The function encrypts the given data using the provided key. AES128 is used as underlying algorithm. + * This is used during the SHE key updated protocol. + * \param[in] dataPtr Pointer to data which shall be encrypted + * \param[in] keyPtr Pointer to key buffer + * \param[out] outputPtr Pointer to buffer where the encrypted data will be copied to + * \param[in] numberOfBlocks Specifies the number of blocks. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by dataPtr has to be numberOfBlocks * 16 Bytes + * Length of the key provided by keyPtr has to be 16 Bytes + * Length of the buffer provided by outputPtr has to be numberOfBlocks * 16 Bytes + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateEncrypt( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) dataPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr, + uint8 numberOfBlocks); + +/********************************************************************************************************************** + * Crypto_30_LibCv_GetSheKey() + **********************************************************************************************************************/ +/*! \brief Get SHE index in SheKeys for the given SHE Id and Page. + * \details - + * \param[in] sheKeyId Holds the SHE key id. + * \param[in] shePage Holds the SHE key page. + * \param[out] indexOfSheKeyPtr Pointer to the Index of the key element in SheKeys. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetSheKey( + uint8 sheKeyId, + Crypto_30_LibCv_SizeOfShePageType shePage, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) indexOfSheKeyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckM1Ids() + *********************************************************************************************************************/ +/*! \brief Determines the authentication key element based on M1. + * \details The function checks if the authentication key element should be the element itself + * or the SHE master key. This is done by processing ID byte of M1. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3 + * \param[in] indexOfSheKey Index of the key element in SheKeys + * \param[out] indexOfAuthSheKeyPtr Pointer to the Index of the authentication key element in SheKeys + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the key provided by keyPtr has to be 16 Bytes + * indexOfSheKey has to be a valid SheKeysIndex. + * All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckM1Ids( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) indexOfAuthSheKeyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckUid() + **********************************************************************************************************************/ +/*! \brief Check M1 UID is valid. + * \details Check if the M1 UID is the wildcard or the ECU UID. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3. + * \param[in] elementIndex Index of the key element. + * \param[in] sheKeyType Type of the SHE key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the key provided by keyPtr has to be 15 Bytes + * elementIndex has to be a valid index of a key element. + * All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckUid( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_SheKeyTypeType sheKeyType); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateVerifyM3() + *********************************************************************************************************************/ +/*! \brief Verifies M3. + * \details The function verifies the M3. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3 + * \param[in] indexOfAuthSheKey Index of the authentication key element in SheKeys. + * \param[in] indexOfSheKey Index of the update key element in SheKeys. + * \param[in,out] KDFbufferPtr Pointer to the key derive function buffer + * \param[in] KDFbufferLength Length of the KDF buffer + * \param[in,out] outputBufferPtr pointer to the working buffer. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by outputBufferPtr has to be 32 Bytes. + * Length of the buffer provided by KDFbufferPtr has to be 32 Bytes. + * indexOfSheKey and indexOfAuthSheKey need to be valid sheKeys Index. + * page need to be a valid SHE key page. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateVerifyM3( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + uint8 KDFbufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr); + +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckCounter() + **********************************************************************************************************************/ +/*! \brief Check if the used counter from M1 is valid. + * \details - + * \param[in] elementIndexCounter Index of the counter key element. + * \param[in] decryptedKeyPtr Pointer to key buffer + * \param[in] sheKeyType Holds the type of the SHE key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId must identify a valid key. + * Length of the buffer provided by decryptedKeyPtr has to be 32 Bytes. + * All pointers need to be valid. + * elementIndexCounter need to be a valid element index of a SHE counter. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckCounter( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexCounter, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr, + Crypto_30_LibCv_SheKeyTypeType sheKeyType); +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) */ + +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCopyCounter() + **********************************************************************************************************************/ +/*! \brief Save the new counter value. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] elementIndexCounter Index of the counter key element. + * \param[in] decryptedKeyPtr Pointer to key buffer + * \pre Length of the buffer provided by decryptedKeyPtr has to be 32 Bytes. + * All pointers need to be valid. + * elementIndexCounter need to be a valid element index of a SHE counter. + * cryptoKeyId must identify a valid key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCopyCounter( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexCounter, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr); +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCopyFid() + **********************************************************************************************************************/ +/*! \brief Convert and save FID from M1. + * \details - + * \param[in] elementIndex Index of the update key element. + * \param[in] decryptedKeyPtr Pointer to key buffer + * \param[in] sheKeyType Holds the type of the SHE key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre Length of the buffer provided by decryptedKeyPtr has to be 32 Bytes. + * All pointers need to be valid. + * elementIndex need to be a valid element index of a SHE key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCopyFid( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr, + Crypto_30_LibCv_SheKeyTypeType sheKeyType); +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateExtractKey() + *********************************************************************************************************************/ +/*! \brief Extracts new Key. + * \details The function provides the new key. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3 + * \param[in] elementIndex Index of the key element. + * \param[in,out] KDFbufferPtr Pointer to the key derive function buffer + * \param[in] KDFbufferLength Length of the KDF buffer + * \param[in,out] outputBufferPtr pointer to the working buffer. + * \param[in] indexOfSheKey Index of the update key element in SheKeys. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId must identify a valid key. + * Length of the buffer provided by outputBufferPtr has to be 32 Bytes. + * Length of the buffer provided by KDFbufferPtr has to be 32 Bytes. + * indexOfSheKey need to be valid sheKeys Index. + * sheKeyType need to be a valid SHE key type. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateExtractKey( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + uint8 KDFbufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateProofM4M5() + *********************************************************************************************************************/ +/*! \brief Calculates M4 and M5 + * \details The function calculate the proof elements M4 and M5. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3 + * \param[in] outputElement Index of the destination key element + * \param[in,out] KDFbufferPtr Pointer to the key derive function buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER. + * The first 16 bytes contain to be the ram key. + * \param[in,out] outputBufferPtr pointer to the working buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER. + * The first 16 bytes contain to be the counter. + * \param[in] indexOfSheKey Hold the index of the update key in SheKeys. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId must identify a valid key. + * Length of the buffer provided by outputBufferPtr has to be 32 Bytes. + * indexOfSheKey need to be a valid index of sheKeys. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateProofM4M5( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType outputElement, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateGenM4M5() + *********************************************************************************************************************/ +/*! \brief Calculates M4 and M5 + * \details The function calculate the proof elements M4 and M5. + * \param[in] m1m2m3 Pointer to key buffer with M1M2M3 (Sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3) + * \param[out] m4m5 Pointer to key buffer for M4M5. (Sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5) + * \param[in] uid Pointer to the She uid. Size need to be CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID. + * \param[in,out] KDFbufferPtr Pointer to the key derive function buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER. + * The first 16 bytes contain to be the ram key. + * \param[in,out] encBufferPtr Pointer to the working buffer. Size need to be CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER. + * The first 16 bytes contain to be the counter. + * \param[in] indexOfSheKey Hold the index of the update key in SheKeys. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointer need to be valid. + * indexOfSheKey need to be a valid index of sheKeys. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateGenM4M5( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m4m5, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) encBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateFindProof() + **********************************************************************************************************************/ +/*! \brief Check if the Proof element is available. + * \details Allowed is CRYPTO_KE_MAC_PROOF and CRYPTO_KE_CIPHER_PROOF. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[out] outputElementIndexPtr Ptr to the identifier of the proof key element which shall be set. + * \return E_OK Request successful. + * CRYPTO_E_KEY_NOT_AVAILABLE Request successful no proof element found. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed. + * \pre cryptoKeyId must identify a valid key. + * outputElementIndexPtr need to be a valid ptr. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateFindProof( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementsIterType, AUTOMATIC, AUTOMATIC) outputElementIndexPtr); + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateLockKeys() + **********************************************************************************************************************/ +/*! \brief Lock the info and authentication key for reading. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] authKeyId Holds the identifier of the key which is used for authentication. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as authKeyId must identify a valid key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateLockKeys( + uint32 cryptoKeyId, + uint32 authKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateUnlockKeys() + **********************************************************************************************************************/ +/*! \brief Release the lock for the info and authentication key. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] authKeyId Holds the identifier of the key which is used for authentication. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as authKeyId must identify a valid key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateUnlockKeys( + uint32 cryptoKeyId, + uint32 authKeyId); +# endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_GetChallenge() + *********************************************************************************************************************/ +/*! \brief Provide challenge for She DEBUG_CMD + * \details Provide the challenge required for She DEBUG_CMD and save request. + * \param[out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_GetChallenge( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock() + *********************************************************************************************************************/ +/*! \brief Execute She DEBUG_CMD + * \details Set Authorization and verify access. Delete deletion keys on success. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_SetAuthorization() + *********************************************************************************************************************/ +/*! \brief Execute She DEBUG_CMD + * \details Set Authorization and verify access. Delete deletion keys on success. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element + * with length of CRYPTO_30_LIBCV_SIZEOF_SHE_KEY. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_SetAuthorization( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_DeleteKeys() + *********************************************************************************************************************/ +/*! \brief Delete deletion keys. + * \details Overwrite deletion keys with zero and restore inital values. + * \pre All deletion keys need to be locked for write access. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_DeleteKeys(void); + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_IsWriteProtected() + *********************************************************************************************************************/ +/*! \brief Is a deletion key write protected? + * \details - + * \return TRUE At least one key is write protected. + * FALSE No key is write protected. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_IsWriteProtected(void); +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_Authorization() + *********************************************************************************************************************/ +/*! \brief Verify She DEBUG_CMD Authorization + * \details - + * \param[in] masterKey Holds the pointer to the She master key with sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_KEY. + * \param[in] uid Holds the pointer to the She uid with sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID. + * \param[in] challenge Holds the pointer to the She challenge with sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_KEY. + * \param[in] authorization Holds the pointer to the She authorization with sizeof CRYPTO_30_LIBCV_SIZEOF_SHE_KEY. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_Authorization( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) masterKey, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) challenge, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) authorization); +# endif /* (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) */ +#endif /* (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) */ + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Trigger_Write_Req() + **********************************************************************************************************************/ +/*! \brief Trigger write request. + * \details Call NvM_SetRamBlockStatus and NvM_WriteBlock dependent on the block processing + * \param[in] blockIdx Holds the identifier of the nv block. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre blockIdx has to be a valid identifier. + * \context TASK + * \reentrant TRUE, for different blocks. + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Trigger_Write_Req( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock() + **********************************************************************************************************************/ +/*!\brief Write Block request finished Block callback routine. + * \details Block specific callback routine which is called by NvM in order to notify the Crypto driver that an + * asynchronous single block request has been finished. + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_WrittenToBlock() + **********************************************************************************************************************/ +/*!\brief Update State for WrittenToBlock + * \details - + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_WrittenToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock_Copy() + **********************************************************************************************************************/ +/*!\brief Copy data to NvMBufferPtr + * \details Copy header and data. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[out] NvMBufferPtr RAM mirror where Ram block data shall be written to. + * \pre blockIdx need to be valid. + * NvMBufferPtr need to be a valid pointer. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock_Copy( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement() + **********************************************************************************************************************/ +/*!\brief Check if lengths of given key element is valid + * \details Check if configured key element length is equal or greater than key element length read from NvM data + * \param[out] validLengthsPtr Pointer where the result of lengths check is written (TRUE: all lengths valid, + FALSE: at least one length invalid + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] NvMBufferPtr RAM mirror where Ram block data can be read from. + * \param[in] dataStartPos Start position of data as NvMBufferPtr index. + * \pre blockIdx and dataStartPos need to be valid. + * NvMBufferPtr and validLengthsPtr need to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement( + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) validLengthsPtr, + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + Crypto_30_LibCv_KeyElementsIterType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr, + Crypto_30_LibCv_SizeOfKeyStorageType dataStartPos); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_CheckKeyElementLengths() + **********************************************************************************************************************/ +/*!\brief Check if key element lengths are valid + * \details Get keyIdx matching the blockIdx and check key element lengths of key + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] NvMBufferPtr RAM mirror where Ram block data can be read from. + * \param[in] dataStartPos Start position of data as NvMBufferPtr index. + * \return E_OK Data was either copied from buffer or restored. + * \pre blockIdx and dataStartPos need to be valid. + * NvMBufferPtr need to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_CheckKeyElementLengths( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr, + Crypto_30_LibCv_SizeOfKeyStorageType dataStartPos); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy() + **********************************************************************************************************************/ +/*!\brief Read from Block callback routine. + * \details Block specific callback routine which is called by NvM in order to let the Crypto driver copy data from + * NvM RAM mirror to Crypto RAM block. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] NvMBuffer RAM mirror where Ram block data can be read from. + * \return E_OK Data was either copied from buffer or restored. + * \pre blockIdx need to be valid. + * NvMBufferPtr need to be a valid pointer. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc() + **********************************************************************************************************************/ +/*!\brief Check Header for CRC + * \details - + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] NvMBufferPtr RAM mirror where Ram block data can be read from. + * \return TRUE Header valid. + * \return FALSE Header not valid. + * \pre blockIdx need to be valid. + * NvMBufferPtr need to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc() + **********************************************************************************************************************/ +/*!\brief Copy Header for CRC + * \details - + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[out] NvMBufferPtr RAM mirror where Ram block data shall be written to. + * \param[out] writtenLengthPtr Pointer where written Length shall be written to. + * \pre blockIdx need to be valid. + * All pointers need to be a valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) writtenLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore() + **********************************************************************************************************************/ +/*!\brief Restore data for the given block. + * \details - + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm() + *********************************************************************************************************************/ +/*! \brief Reports if the given cryptoKey is currently updated by NvM. + * \details This function returns true if the KeyNvState of the given key is in one of the following states: + * NV_WRITE_REQ, KEY_COPIED, WRITE_FAILED. Else false. + * \param[in] cryptoKeyId Holds the identifier of the key for which the key state shall be returned. + * \pre cryptoKeyId has to be a valid identifier to a cryptoKey. + * \return TRUE The key with the given cryptoKeyId is currently updated by NvM. + * FALSE The key is currently not updated. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm( + uint32 cryptoKeyId); +#endif /* (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) */ + +#if(CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_Cmd_Get_Status() + *********************************************************************************************************************/ +/*! \brief Get the current she status + * \details - + * \param[out] statusPtr Holds the pointer to the current she status. + * \return E_OK Request successful. + * \return E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_Cmd_Get_Status( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) statusPtr); +#endif /* (CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_BinarySearchCryptoKeyId() + *********************************************************************************************************************/ +/*! \brief Binary search for the key index. + * \details Binary search for the key Index of the given elementIndex in the global key list. + * \param[in] elementIndex Holds the identifier of the keyElement in the keyStorage. + * \param[out] cryptoKeyId Will hold the identifier of the key after it has been found. + * \return E_OK Request successful. + * E_NOT_OK Request failed, key not found. + * \pre elementIndex has to be a valid identifier to a keyElement in the keyStorage. + * cryptoKeyId pointer need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_BinarySearchCryptoKeyId( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGet() + *********************************************************************************************************************/ +/*! \brief This interface shall be used to get a key element of the key identified by the cryptoKeyId and store + * the key element in the memory location pointed to by the result pointer. + * \details The key element can only be provided, if the read access right is RA_ALLOWED. If the key element + * is configured to allow partial access, resultLengthPtr contains the amount of data which should + * be read from the key element. + * The behavior for partial access can be switched on or off in the configuration. + * If the read access right is RA_ENCRYPTED the She ram key can be exported. + * (64 Bytes for M1-M3 and 112Bytes for M1-M5) + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[out] errorIdPtr Holds the pointer to the error id. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId needs to be a valid key id. + * keyElementId needs to be a valid key element id. + * resultPtr pointer needs to be valid. + * resultLengthPtr pointer needs to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetNoShe() + *********************************************************************************************************************/ +/*! \brief Stores the key element identified by the provided elementIndex in the in the memory location + * pointed to by the result pointer. + * \details If the key element has partial access enabled, also only parts of the key element can be stored. + * This behavior depends on the available buffer and on the configuration. + * \param[in] elementIndex Holds the identifier of the keyElement in the keyStorage. + * \param[out] resultPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed, key not found. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre elementIndex has to be a valid identifier to a keyElement in the keyStorage. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetNoShe( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGetStatus() + *********************************************************************************************************************/ +/*! \brief Reports the status of the given cryptoKey. + * \details Reports UPDATE_IN_PROGRESS if the key has changed and is currently updated by the NVM. Otherwise + * is reports the validity of the key. + * \param[in] cryptoKeyId Holds the identifier of the key for which the key state shall be returned. + * \param[out] keyStatusPtr Contains the pointer to the data where the status of the key shall be stored. + * \pre cryptoKeyId has to be a valid identifier to a cryptoKey. + * keyStatusPtr has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyStatusPtr); + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLength( + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength) +{ + /* #10 Set high- and low-byte for keyElement written length */ +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_OFF) + volatile P2VAR(Crypto_30_LibCv_KeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) lowBytePtr = + &Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(keyElementIndex)); + volatile P2VAR(Crypto_30_LibCv_KeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) highBytePtr = + &Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(keyElementIndex) + 1u); + + *lowBytePtr = 0u; /* SBSW_CRYPTO_30_LIBCV_VOLATILE_KEY_STORAGE_VIA_KEY_ELEMENT */ + *highBytePtr = 0u; /* SBSW_CRYPTO_30_LIBCV_VOLATILE_KEY_STORAGE_VIA_KEY_ELEMENT */ +#endif + Crypto_30_LibCv_SetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(keyElementIndex), (uint8)((keyElementLength >> 8) & 0xFFu)); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + Crypto_30_LibCv_SetKeyStorage(Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(keyElementIndex) + 1u, (uint8)(keyElementLength & 0xFFu)); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ +} /* Crypto_30_LibCv_SetKeyElementWrittenLength() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch( + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength) +{ + Std_ReturnType retVal = E_NOT_OK; + uint32 cryptoKeyId = 0u; + + /* #10 Search the Crypto Key Id if the functionality is enabled and trigger that the key value is changed */ + retVal = Crypto_30_LibCv_Local_BinarySearchCryptoKeyId(keyElementIndex, &cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(cryptoKeyId, keyElementIndex, keyElementLength); + } + + return retVal; +} /* Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength) +{ + + /* #10 Set high- and low-byte for keyElement written length */ + Crypto_30_LibCv_SetKeyElementWrittenLength(keyElementIndex, keyElementLength); + +#if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* #20 Call the callout if the functionality is enabled and trigger that the key value is changed */ + Crypto_30_LibCv_GetKeyValueChangedCalloutFctNameOfConfigurableCallouts()(cryptoKeyId, Crypto_30_LibCv_GetIdOfKeyElements(keyElementIndex)); +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif +#if(CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/* Call KeyNvStatus KeyChanged transition */ + Crypto_30_LibCv_KeyNvStatus_KeyChanged(cryptoKeyId, keyElementIndex); +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + +} /* Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_SetKeyElementStateWritten() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_SetKeyElementStateWritten( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + /* Clear Key Flags and set write once if required. */ + Crypto_30_LibCv_ClearKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_NORMAL_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + if (Crypto_30_LibCv_IsKeyElementWriteOnce(elementIndex)) + { + Crypto_30_LibCv_SetKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + } +} /* Crypto_30_LibCv_Local_SetKeyElementStateWritten() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeySetValidity() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeySetValidity( + uint32 cryptoKeyId, boolean requestedValidity) +{ + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + boolean writeReq = FALSE; + + /* Set key state for all key elements */ + + /* Loop over all elements of the given key */ + for (elementIndex = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); elementIndex < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); elementIndex++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (requestedValidity) + { + /* Set key element to valid */ + + /* Check if key element is invalid */ + if (!Crypto_30_LibCv_IsKeyElementValid(elementIndex)) + { + /* Set validity bit */ + Crypto_30_LibCv_SetKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + writeReq = TRUE; + Crypto_30_LibCv_KeyNvStatus_KeyChanged(cryptoKeyId, elementIndex); + } +#endif + } + } + else + { + /* Set key element to invalid */ + + /* Clear validity bit */ + Crypto_30_LibCv_ClearKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + writeReq = TRUE; + /* Even though the key may not actually change, it shall always be written by NVM if KeySetInvalid is called, thus mark it as changed to comply the KeyNvStatus statemachine */ + Crypto_30_LibCv_KeyNvStatus_KeyChanged(cryptoKeyId, elementIndex); + } +#endif + } + } + + /* Call the callout if the functionality is enabled and trigger that the key is set to the requested validity */ +#if(CRYPTO_30_LIBCV_KEYVALIDITYSETCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + Crypto_30_LibCv_GetKeyValiditySetCalloutFctNameOfConfigurableCallouts()(cryptoKeyId, requestedValidity); +#endif + + return writeReq; +} /* Crypto_30_LibCv_Local_KeySetValidity() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Internal_KeySetValid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Internal_KeySetValid( + uint32 cryptoKeyId) +{ + return Crypto_30_LibCv_Local_KeySetValidity(cryptoKeyId, TRUE); +} /* Crypto_30_LibCv_Internal_KeySetValid() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Internal_KeySetInvalid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Internal_KeySetInvalid( + uint32 cryptoKeyId) +{ + return Crypto_30_LibCv_Local_KeySetValidity(cryptoKeyId, FALSE); +} /* Crypto_30_LibCv_Internal_KeySetInvalid() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst) +{ + Std_ReturnType retVal = E_OK; + /* #10 Check if the access flags are matching the conditions to copy a key element */ + /* Read != DENIED and Destination Protection >= Source Protection */ + if (((Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndexSrc))) == CRYPTO_30_LIBCV_RA_DENIED) || + ((Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndexSrc))) > (Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndexDst))))) + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + /* WRITE <= Internal Copy */ + else if ((Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndexDst))) == CRYPTO_30_LIBCV_WA_DENIED) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + /* #20 Check if it is a write once key which is written already. */ + else if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIndexDst, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + else + { + /* #30 Check She key rights */ +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + if (Crypto_30_LibCv_IsSheKey(elementIndexSrc)) + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + else if (Crypto_30_LibCv_IsSheKey(elementIndexDst)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + else + { + /* Success */ + } +#endif + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopy() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6030, 6080 3 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopy( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst, + uint32 dstCryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + Crypto_30_LibCv_KeyStorageIterType keyStorageIndexSrc; + Crypto_30_LibCv_KeyStorageIterType keyStorageIndexDst; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Check if the access flags are matching the conditions to copy a key element */ + retVal = Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck(elementIndexSrc, elementIndexDst); + if (retVal == E_OK) + { + retVal = E_NOT_OK; /* PRQA S 2982 */ /* MD_MSR_RetVal */ + { + /* Check if the available data is not bigger than the maximum size of the destination element */ + /* #35 Copy key element data if the size is matching */ + if ((Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexSrc) == Crypto_30_LibCv_GetKeyElementLength(elementIndexDst)) || + ((Crypto_30_LibCv_IsKeyElementPartial(elementIndexDst) == TRUE) && + (Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexSrc) <= Crypto_30_LibCv_GetKeyElementLength(elementIndexDst)))) + { + keyStorageIndexSrc = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndexSrc); + keyStorageIndexDst = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndexDst); + /* Copy the source element to the destination element */ + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndexDst), Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndexSrc), Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexSrc)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* store the written length in the destination element */ + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(dstCryptoKeyId, elementIndexDst, Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexSrc)); + Crypto_30_LibCv_Local_SetKeyElementStateWritten(elementIndexDst); + + retVal = E_OK; + } + else + { + /* The destination element is to short to store the available data of the source element */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementCopy() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementCopyPartial() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* PRQA S 6030, 6060, 6080 6 */ /* MD_MSR_STCYC, MD_CRYPTO_30_LIBCV_STPAR_ASR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementCopyPartial( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst, + uint32 dstCryptoKeyId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + Crypto_30_LibCv_KeyStorageIterType keyStorageIndexSrc, keyStorageIndexDst; + uint32 writtenLengthSrc, writtenLengthDst; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Check if the access flags are matching the conditions to copy a key element */ + retVal = Crypto_30_LibCv_Local_KeyElementCopy_RightsCheck(elementIndexSrc, elementIndexDst); + if (retVal == E_OK) + { + retVal = E_NOT_OK; /* PRQA S 2982 */ /* MD_MSR_RetVal */ + { + writtenLengthSrc = Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexSrc); + writtenLengthDst = Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndexDst); + + if (writtenLengthSrc == CRYPTO_30_LIBCV_EMPTY_KEY_LENGTH) + { + retVal = CRYPTO_E_KEY_EMPTY; + } + else if ( + (Crypto_30_LibCv_IsKeyElementPartial(elementIndexDst) == TRUE) && + /* [SWS_Crypto_00207] readLength */ + ((keyElementSourceOffset + keyElementCopyLength) <= writtenLengthSrc) && + ((Crypto_30_LibCv_IsUint32Overflow(keyElementSourceOffset, keyElementCopyLength)) == FALSE) && + /* [SWS_Crypto_00208] writeLength */ + ((keyElementTargetOffset + keyElementCopyLength) <= Crypto_30_LibCv_GetKeyElementLength(elementIndexDst)) && + ((Crypto_30_LibCv_IsUint32Overflow(keyElementTargetOffset, keyElementCopyLength)) == FALSE)) + { + keyStorageIndexSrc = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndexSrc); + keyStorageIndexDst = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndexDst); + + /* If there is a gap between offset and written length, clear it. */ + if (writtenLengthDst < keyElementTargetOffset) + { + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndexDst + writtenLengthDst), (uint32)(keyElementTargetOffset - writtenLengthDst)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + + /* Copy the source element to the destination element */ + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndexDst + keyElementTargetOffset), Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndexSrc + keyElementSourceOffset), keyElementCopyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* store the written length in the destination element */ + /* [SWS_Crypto_00210], [SWS_Crypto_00211] */ + if (writtenLengthDst < (keyElementTargetOffset + keyElementCopyLength)) + { + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(dstCryptoKeyId, elementIndexDst, (keyElementTargetOffset + keyElementCopyLength)); + } + Crypto_30_LibCv_Local_SetKeyElementStateWritten(elementIndexDst); + + retVal = E_OK; + } + else + { + /* The destination element is too short to store the available data of the source element */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementCopyPartial() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyCopy_Internal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyCopy_Internal( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + Std_ReturnType retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + Std_ReturnType retValBuf = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst = 0u; + + /* #1 Loop over all elements of the source key */ + for (elementIndexSrc = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); elementIndexSrc < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); elementIndexSrc++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* #2 Loop over all elements of the destination key to find a matching element for the current source element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(targetCryptoKeyId, Crypto_30_LibCv_GetIdOfKeyElements(elementIndexSrc), &elementIndexDst) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #3 copy key element with Crypto_30_LibCv_Local_KeyElementCopy */ + retValBuf = Crypto_30_LibCv_Local_KeyElementCopy((Crypto_30_LibCv_SizeOfKeyElementsType)elementIndexSrc, elementIndexDst, targetCryptoKeyId); + if (retVal != E_OK) + { + /* #4 Return E_OK if at least one keyElement has been successfully copied [SWS_CryIf_00121] */ + retVal = retValBuf; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_KeyCopy_Internal() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetLengthCheck() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetLengthCheck( + P2CONST(uint32, AUTOMATIC, AUTOMATIC) resultLengthptr, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_LengthCheckType lengthCheck) +{ + boolean retVal = FALSE; + + switch (lengthCheck) + { + case CRYPTO_30_LIBCV_LENGTH_CHECK_NONE: + retVal = TRUE; + break; + + case CRYPTO_30_LIBCV_LENGTH_CHECK_MAX: + if (Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndex) <= *resultLengthptr) + { + retVal = TRUE; + } + break; + + case CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL: + if (Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndex) == *resultLengthptr) + { + retVal = TRUE; + } + break; + + case CRYPTO_30_LIBCV_LENGTH_CHECK_MIN: + if (Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndex) >= *resultLengthptr) + { + retVal = TRUE; + } + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetLengthCheck() */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetSheId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetSheId( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) sheIdPtr) +{ + Crypto_30_LibCv_SheKeysIterType i; + + /* Get key SHE id of SHE key list. */ + for (i = 0u; i < Crypto_30_LibCv_GetSizeOfSheKeys(); i++) + { + if (Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(i) == elementIndex) + { + *sheIdPtr = Crypto_30_LibCv_GetSheIdOfSheKeys(i); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + break; + } + } +} /* Crypto_30_LibCv_SheKeyGetSheId() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetSheIndex() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetSheIndex( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, AUTOMATIC) indexSheKeyPtr) +{ + Crypto_30_LibCv_SheKeysIterType i; + Std_ReturnType retVal = E_NOT_OK; + + /* Get index of SHE key in list. */ + for (i = 0u; i < Crypto_30_LibCv_GetSizeOfSheKeys(); i++) + { + if (Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(i) == elementIndex) + { + *indexSheKeyPtr = (Crypto_30_LibCv_SizeOfSheKeysType)i; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + retVal = E_OK; + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyGetSheIndex() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetKeyType() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(uint8, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetKeyType( + uint8 sheId) +{ + uint8 keyType; + /* Get key type for SHE key. */ + if (sheId == CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID) + { + keyType = CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY; + } + else if (sheId >= CRYPTO_30_LIBCV_SHE_M1_KEY_N_START_ID) + { + keyType = CRYPTO_30_LIBCV_SHE_TYPE_KEY_N; + } + else + { + keyType = sheId; + } + return keyType; +} /* Crypto_30_LibCv_SheKeyGetKeyType() */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyGetElementIndex() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyGetElementIndex( + uint8 sheKeyId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) elementIndex) +{ + Std_ReturnType found = E_NOT_OK; + + Crypto_30_LibCv_SheKeysIterType i; + + /* Check if the element with the given SheKeyId is present. */ + for (i = 0u; i < Crypto_30_LibCv_GetSizeOfSheKeys(); i++) + { + if (Crypto_30_LibCv_GetSheIdOfSheKeys(i) == sheKeyId) + { + *elementIndex = Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(i); /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + found = E_OK; + break; + } + } + + return found; +} /* Crypto_30_LibCv_SheKeyGetElementIndex() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetSheCheckFid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetSheCheckFid( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_ServiceType serviceType) +{ + boolean retVal = FALSE; + uint8 fid, keyType, sheId = 0u; + Crypto_30_LibCv_SizeOfKeyElementsType localElementIndex = 0u; + + /* Get SHE id for element */ + Crypto_30_LibCv_SheKeyGetSheId(elementIndex, &sheId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + keyType = Crypto_30_LibCv_SheKeyGetKeyType(sheId); + + /* Ram key usage is always allowed. */ + if (keyType != CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY) + { + + if (keyType == CRYPTO_30_LIBCV_SHE_TYPE_SECRET_KEY) + { + /* If it is the secret key load FID from master key. */ + if (Crypto_30_LibCv_SheKeyGetElementIndex(CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID, &localElementIndex) == E_OK) /* COV_CRYPTO_30_LIBCV_SHE_ECU_MASTER_KEY */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + fid = Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageExtensionIdxOfKeyElements(localElementIndex)); + } + else + { + /* Use default values if there is no master key. */ + fid = CRYPTO_30_LIBCV_SHE_FID_MASK_DEFAULT; + } + } + else + { + /* load FID */ + fid = Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageExtensionIdxOfKeyElements(elementIndex)); + } + + fid &= Crypto_30_LibCv_SheKeyCheckFlags[keyType]; /* clear flags which not need to be checked according to key type */ + fid |= Crypto_30_LibCv_SheKeySetAccessFlags[keyType]; /* set additional flags for access protection according to key type */ + fid &= Crypto_30_LibCv_SheKeyServiceFlags[serviceType]; /* clear flags which not need to be checked according to service type */ + + /* Check Boot Protection */ +# if (CRYPTO_30_LIBCV_KEYELEMENTSBOOTPROTECTIONIDXOFSHEPAGE == STD_ON) + localElementIndex = Crypto_30_LibCv_GetKeyElementsBootProtectionIdxOfShePage(CRYPTO_30_LIBCV_SHE_PAGE0); + if ((Crypto_30_LibCv_IsModuleBootProtected(Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(localElementIndex)))) && + (Crypto_30_LibCv_GetKeyElementWrittenLength(localElementIndex) == 1u)) + { + /* If Boot is passed clear bit to allow access. */ + fid &= CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION_INV; + } +# endif + + /* Check Debugger Protection */ +# if (CRYPTO_30_LIBCV_KEYELEMENTSDEBUGGERPROTECTIONIDXOFSHEPAGE == STD_ON) + localElementIndex = Crypto_30_LibCv_GetKeyElementsDebuggerProtectionIdxOfShePage(CRYPTO_30_LIBCV_SHE_PAGE0); + if ((Crypto_30_LibCv_IsModuleDebuggerProtected(Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(localElementIndex)))) && + (Crypto_30_LibCv_GetKeyElementWrittenLength(localElementIndex) == 1u)) + { + /* If no Debugger is attached clear bit to allow access. */ + fid &= CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION_INV; + } +# endif + + /* Check Result */ + if (fid == Crypto_30_LibCv_SheKeyServiceFlagsResult[serviceType]) + { + retVal = TRUE; + } + } + else + { + retVal = TRUE; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetSheCheckFid() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ +#endif /* (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGet_Standard() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGet_Standard( + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_LengthCheckType lengthCheck) +{ + Std_ReturnType retVal; + + if (Crypto_30_LibCv_Local_KeyElementGetLengthCheck(resultLengthPtr, elementIndex, lengthCheck) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + { + *resultIndexPtr = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndex); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + /* [SWS_Crypto_00092] */ + *resultLengthPtr = Crypto_30_LibCv_GetKeyElementWrittenLength(elementIndex); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + retVal = E_OK; + } + else + { + /* [SWS_Crypto_00093] */ + retVal = CRYPTO_E_SMALL_BUFFER; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGet_Standard() */ + +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) dataPtr, + uint32 length, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr) +{ + /* + AES-MP(x i): OUT_i = ENC_(ECB, OUT_i-1) (x i) XOR x_i XOR OUT_i-1; i > 0; OUT_0 = 0; + */ + eslt_WorkSpaceAES128Block workSpaceAes128Block; + Std_ReturnType retVal = E_NOT_OK; + uint32 currentOffset = 0u; + uint8_least i; + uint8 Out[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + uint8 Out_last[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + uint8 tempCalcByte; + eslt_ErrorCode eslRetVal = ESL_ERC_ERROR; + + /* #10 initialize all parameters */ + /* Init Out_i-1 (Out_last) */ + Crypto_30_LibCv_ClearData(Out, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_ClearData(Out_last, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* #15 initialize workspace */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128Block.header, /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + ESL_MAXSIZEOF_WS_AES128, + CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) + { + /* #20 Calculate Block-Hash until data size is reached */ + for(currentOffset = 0u; currentOffset < length; currentOffset += CRYPTO_30_LIBCV_SIZEOF_SHE_KEY) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + /* Set Key */ + /* #25 Set old Hash as round Key */ + eslRetVal = esl_initEncryptAES128Block((P2VAR(eslt_WorkSpaceAES128Block, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128Block, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Out_last); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS */ + + /* Encrypt */ + /* #30 Calculate new Hash */ + if (eslRetVal == ESL_ERC_NO_ERROR) + { + eslRetVal = esl_encryptAES128Block((P2VAR(eslt_WorkSpaceAES128Block, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128Block, + &dataPtr[currentOffset], + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Out); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + } + + if (eslRetVal == ESL_ERC_NO_ERROR) + { + /* #35 Exor new and old hash */ + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; i++) + { + /* Calculate Out and Out_last */ + tempCalcByte = (uint8)(Out_last[i] ^ Out[i] ^ dataPtr[currentOffset + i]); + Out_last[i] = tempCalcByte; /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Out[i] = tempCalcByte; /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + } + } + else + { + break; + } + } + } + + /* #40 Save Result if compression was successful */ + if (eslRetVal == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + + Crypto_30_LibCv_CopyData(outputPtr, Out, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCmac() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC( Std_ReturnType, CRYPTO_30_LIBCV_CODE ) Crypto_30_LibCv_SheKeyUpdateCmac( + P2CONST( uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR ) dataPtr, + uint32 length, + P2CONST( uint8, AUTOMATIC, AUTOMATIC ) keyPtr, + P2VAR( uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR ) outputPtr, + P2VAR(eslt_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* #10 Init work space */ + if (esl_initWorkSpaceHeader(&workspace->header, /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + ESL_MAXSIZEOF_WS_CMACAES, + CRYPTO_30_LIBCV_WATCHDOG_PTR ) == ESL_ERC_NO_ERROR) + { + /* #15 Init CMAC */ + if (esl_initCMACAES128( workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_KEY_PTR */ + CRYPTO_30_LIBCV_CMACAES128_KEY_SIZE, + (P2CONST( eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR ))keyPtr ) == ESL_ERC_NO_ERROR) + { + + /* #25 Update Calculation */ + if (esl_updateCMACAES128(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_PTR */ + (eslt_Length)length, + (P2CONST( eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR ))dataPtr ) == ESL_ERC_NO_ERROR) + { + /* Finalize */ + if (esl_finalizeCMACAES128(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_OUTPUT_PTR */ + outputPtr ) == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + } + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateCmac() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateDecrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateDecrypt( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m2m3, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_WorkSpaceAES128 workSpaceAes128; + eslt_ErrorCode eslRet; + eslt_Length outLength = 2u * CRYPTO_30_LIBCV_AES_BLOCK_SIZE; + eslt_Length written; + + /* #10 Init work space */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128.header, + ESL_MAXSIZEOF_WS_AES128, + CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + + /* #15 Init AES decryption */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initDecryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_KEY_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))keyPtr, + ESL_BM_CBC, + ESL_PM_OFF, + NULL_PTR); + } + + /* #20 Decrypt data */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_decryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, + (eslt_Length)2u * CRYPTO_30_LIBCV_AES_BLOCK_SIZE, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))m2m3, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))outputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_OUTPUT */ + } + + written = outLength; + outLength = (eslt_Length)(((eslt_Length)(2u * CRYPTO_30_LIBCV_AES_BLOCK_SIZE)) - written); + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_finalizeDecryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputPtr[written]); + } + + written = (eslt_Length)(written + outLength); + + if ((eslRet == ESL_ERC_NO_ERROR) && + (written == (2u * CRYPTO_30_LIBCV_AES_BLOCK_SIZE))) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateDecrypt() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateEncrypt() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateEncrypt( + P2CONST(uint8, AUTOMATIC, AUTOMATIC) dataPtr, + P2CONST(uint8, AUTOMATIC, AUTOMATIC) keyPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputPtr, + uint8 numberOfBlocks) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode eslRet; + eslt_WorkSpaceAES128 workSpaceAes128; + eslt_Length outLength = (eslt_Length)((eslt_Length)(numberOfBlocks) * CRYPTO_30_LIBCV_AES_BLOCK_SIZE); + eslt_Length written; + + /* #10 Init work space */ + eslRet = esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workSpaceAes128.header), /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_STACK_WORKSPACE */ + ESL_MAXSIZEOF_WS_AES128, + CRYPTO_30_LIBCV_WATCHDOG_PTR); + + /* #15 Init AES encryption */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_initEncryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_KEY_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))keyPtr, + ESL_BM_CBC, + ESL_PM_OFF, + NULL_PTR); + } + + /* #20 encrypt data */ + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_encryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, /* SBSW_CRYPTO_30_LIBCV_ESL_STACK_WORKSPACE_WITH_DATA_OUTPUT */ + (eslt_Length)((eslt_Length)(numberOfBlocks) * CRYPTO_30_LIBCV_AES_BLOCK_SIZE), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))dataPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&outLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))outputPtr); + } + + written = outLength; + outLength = (eslt_Length)(((eslt_Length)numberOfBlocks * CRYPTO_30_LIBCV_AES_BLOCK_SIZE) - written); + + if (eslRet == ESL_ERC_NO_ERROR) + { + eslRet = esl_finalizeEncryptAES128((P2VAR(eslt_WorkSpaceAES128, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceAes128, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputPtr[written]); + } + + written = (eslt_Length)(written + outLength); + + if ((eslRet == ESL_ERC_NO_ERROR) && + (written == ((eslt_Length)numberOfBlocks * CRYPTO_30_LIBCV_AES_BLOCK_SIZE))) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateEncrypt() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_GetSheKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetSheKey( + uint8 sheKeyId, + Crypto_30_LibCv_SizeOfShePageType shePage, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) indexOfSheKeyPtr) +{ + Std_ReturnType found = E_NOT_OK; + Crypto_30_LibCv_SheKeysIterType i; + + /* Get SHE index in SheKeys for the given SHE Id and Page. */ + for (i = 0u; i < Crypto_30_LibCv_GetSizeOfSheKeys(); i++) + { + if ((Crypto_30_LibCv_GetSheIdOfSheKeys(i) == sheKeyId) && + (Crypto_30_LibCv_GetShePageIdxOfSheKeys(i) == shePage)) + { + *indexOfSheKeyPtr = (Crypto_30_LibCv_SizeOfSheKeysType)i; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + found = E_OK; + break; + } + } + + return found; +} /* Crypto_30_LibCv_GetSheKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckM1Ids() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckM1Ids( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2VAR(Crypto_30_LibCv_SizeOfSheKeysType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) indexOfAuthSheKeyPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + uint8 m1AuthId, m1SheId; + Crypto_30_LibCv_SizeOfShePageType authPage; + boolean loadAuthKey = FALSE; + + m1AuthId = Crypto_30_LibCv_She_M1_GetAuthId(m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS]); + m1SheId = Crypto_30_LibCv_She_M1_GetId(m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS]); + + /* Secret key */ + if (m1SheId == CRYPTO_30_LIBCV_SHE_M1_SECRET_KEY_ID) + { + /* not possible */ + } + /* check if keyId matches configured key elementId */ + else if (m1SheId == Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey)) + { + /* set default page to 0 */ + authPage = CRYPTO_30_LIBCV_SHE_PAGE0; + + /* master key, mac key and key_ */ + if ((m1SheId != CRYPTO_30_LIBCV_SHE_M1_MAC_ID) && + (m1SheId <= CRYPTO_30_LIBCV_SHE_M1_KEY_N_END_ID)) + { + /* Master key authentication */ + if (m1AuthId == CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID) /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION */ + { + loadAuthKey = TRUE; + } + /* Self update */ + else if (m1AuthId == m1SheId) + { + /* Use index from update key to refer to all required information e.g. SHE page */ + *indexOfAuthSheKeyPtr = indexOfSheKey; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + retVal = E_OK; + } + else + { + /* not valid */ + } + } + /* mac */ + else if (m1SheId == CRYPTO_30_LIBCV_SHE_M1_MAC_ID) + { + /* Master key authentication */ + if (m1AuthId == CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID) /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION */ + { + loadAuthKey = TRUE; + } + /* Mac key authentication */ + else if (m1AuthId == CRYPTO_30_LIBCV_SHE_M1_MAC_KEY_ID) /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION */ + { + loadAuthKey = TRUE; + } + else + { + /* not valid */ + } + } + /* ram key */ + else + { + /* Secret key authentication */ + if (m1AuthId == CRYPTO_30_LIBCV_SHE_M1_SECRET_KEY_ID) + { + loadAuthKey = TRUE; + } + /* KEY_N authentication on the same page */ + else if ((m1AuthId >= CRYPTO_30_LIBCV_SHE_M1_KEY_N_START_ID) && + (m1AuthId <= CRYPTO_30_LIBCV_SHE_M1_KEY_N_END_ID)) + { + loadAuthKey = TRUE; + authPage = Crypto_30_LibCv_GetShePageIdxOfSheKeys(indexOfSheKey); + } + else + { + /* retVal is already set */ + } + } + + if (loadAuthKey == TRUE) + { + retVal = Crypto_30_LibCv_GetSheKey(m1AuthId, authPage, indexOfAuthSheKeyPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + else + { + /* not possible */ + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateCheckM1Ids() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckUid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckUid( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_SheKeyTypeType sheKeyType) +{ + uint8 i; + Std_ReturnType retVal = E_NOT_OK; + boolean verified; + uint32 uidLength = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; + Crypto_30_LibCv_SizeOfKeyStorageType uIdStorageIndex; + + verified = TRUE; + /* Check if the value is wildcard */ + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; i++) + { + if (m1m2m3[i] != CRYPTO_30_LIBCV_SHE_UID_WILDCARD_VALUE) + { + verified = FALSE; + break; + } + } + + /* check UID if the wildcard is not matching. */ + if (verified == FALSE) + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_UID, &uIdStorageIndex, &uidLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + verified = TRUE; + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; i++) + { + if (m1m2m3[i] != Crypto_30_LibCv_GetKeyStorage(uIdStorageIndex + i)) + { + verified = FALSE; + break; + } + } + } + } + else + { +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) + /* If the wildcard is valid, check if it is valid to use the wildcard. */ + if ((Crypto_30_LibCv_IsKeyElementExtensionByMask(elementIndex, CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD)) && + (sheKeyType != CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY)) + { + verified = FALSE; + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(sheKeyType); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(elementIndex); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + } + + if (verified == TRUE) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateCheckUid() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateVerifyM3() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060, 6080 8 */ /* MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateVerifyM3( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + uint8 KDFbufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + uint8_least i; + /* Buffer */ + uint8 key[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; /* K2 */ + uint32 authKeyLength = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; + Crypto_30_LibCv_SizeOfKeyStorageType keyStorageIndex; + eslt_WorkSpaceCMACAES workSpaceCmacAes; + + if (Crypto_30_LibCv_IsKeyElementValid(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfAuthSheKey))) + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfAuthSheKey), &keyStorageIndex, &authKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE) == E_OK) /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* Set constant for SHE page handling */ + /* Set Key_Update_Mac_C constant */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrMacConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* #10 Generate K2 */ + /* KDF AuthKey|Key_Update_Mac_C */ + Crypto_30_LibCv_CopyData(KDFbufferPtr, Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, KDFbufferLength, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + + /* #15 Calculate M3 / CMAC and verify */ + /* M3 proof: M3* = outputBufferPtr */ + if (Crypto_30_LibCv_SheKeyUpdateCmac(m1m2m3, CRYPTO_30_LIBCV_STARTINDEX_SHE_M3, key, outputBufferPtr, (P2VAR(eslt_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&workSpaceCmacAes) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR_KEY_OUTPUT */ + { + retVal = E_OK; + /* Check (M3 = M3*) */ + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_M3; i++) + { + if (m1m2m3[i + CRYPTO_30_LIBCV_STARTINDEX_SHE_M3] != outputBufferPtr[i]) + { + retVal = E_NOT_OK; + } + } + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateVerifyM3() */ + +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCheckCounter() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCheckCounter( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexCounter, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr, + Crypto_30_LibCv_SheKeyTypeType sheKeyType) +{ + uint32 oldCounter, newCounter; + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyStorageType keyStorage; + uint32 counterLength = CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES; + + if (sheKeyType == CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY) + { + /* no counter check for ram key */ + retVal = E_OK; + } + else + { + /* There is a validation that there need to be a counter */ + (void)Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( elementIndexCounter, &keyStorage, &counterLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE);/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&oldCounter, Crypto_30_LibCv_GetAddrKeyStorage(keyStorage));/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&newCounter, decryptedKeyPtr);/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + newCounter = Crypto_30_LibCv_She_ConvertCounter(newCounter); + + /* check if new counter is bigger */ + if ((newCounter) > (oldCounter)) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateCheckCounter() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) */ + +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCopyCounter() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCopyCounter( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexCounter, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr) +{ + uint32 newCounter; + uint8 counterValue[CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES]; + + /* Save the new counter value. */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&newCounter, decryptedKeyPtr); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + newCounter = Crypto_30_LibCv_She_ConvertCounter(newCounter); + Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(counterValue, newCounter);/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId(cryptoKeyId, elementIndexCounter, counterValue, CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES);/* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ +} /* Crypto_30_LibCv_SheKeyUpdateCopyCounter() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateCopyFid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateCopyFid( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) decryptedKeyPtr, + Crypto_30_LibCv_SheKeyTypeType sheKeyType) +{ + uint8 fid; + + /* Convert FID */ + fid = (uint8)(((uint8)(decryptedKeyPtr[3] << 4)) | ((uint8)(decryptedKeyPtr[4] >> 4) & 0x0Cu)); + + /* Add flag for SHE key identification. */ + fid |= CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_KEY_MASK; + Crypto_30_LibCv_SetKeyStorage(Crypto_30_LibCv_GetKeyStorageExtensionIdxOfKeyElements(elementIndex), fid); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* Add write once flag in key element state. */ + if ((Crypto_30_LibCv_Uint8CheckMask(fid, CRYPTO_30_LIBCV_SHE_FID_MASK_WRITE_PROTECTION)) && + (sheKeyType != CRYPTO_30_LIBCV_SHE_TYPE_RAM_KEY)) + { + Crypto_30_LibCv_SetKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + } + else + { + Crypto_30_LibCv_ClearKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + } +} /* Crypto_30_LibCv_SheKeyUpdateCopyFid() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateExtractKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateExtractKey( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + uint8 KDFbufferLength, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey) +{ + Std_ReturnType retVal = E_NOT_OK; + uint8_least i; + /* Buffer */ + uint8 key[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + Crypto_30_LibCv_KeyStorageIterType keyStorageIndex = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndex); + /* #10 Generate K1 */ + /* Set Key_Update_Enc_C constant */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrEncConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, KDFbufferLength, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + Crypto_30_LibCv_ClearData(outputBufferPtr, CRYPTO_30_LIBCV_SIZEOF_SHE_M2); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* #15 Decrypt C,K,F */ + if (Crypto_30_LibCv_SheKeyUpdateDecrypt(&m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M2], key, outputBufferPtr) == E_OK) /* SBSW_CRYPTO_30_LIBCV_KEY_OUTPUT_BUFFER_PARAMETER_KEY_STACK */ + { + /* check counter */ +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) + Crypto_30_LibCv_SheKeyTypeType sheKeyType; + sheKeyType = Crypto_30_LibCv_SheKeyGetKeyType(Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey)); + if (Crypto_30_LibCv_SheKeyUpdateCheckCounter(Crypto_30_LibCv_GetKeyElementsCounterIdxOfSheKeys(indexOfSheKey), outputBufferPtr, sheKeyType) == E_OK) /* SBSW_CRYPTO_30_LIBCV_KEY_OUTPUT_BUFFER_PARAMETER_KEY_STACK */ +# endif + { + /* #20 Store new Key and key length. */ + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; i++) + { + Crypto_30_LibCv_SetKeyStorage(keyStorageIndex + i, outputBufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY + i]); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* KDF Key|Key_Update_Enc_C */ + KDFbufferPtr[i] = outputBufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY + i]; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(cryptoKeyId, elementIndex, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); + retVal = E_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateExtractKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateGenM4M5() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateGenM4M5( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m4m5, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) encBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey) +{ + Std_ReturnType retVal = E_NOT_OK; + /* Buffer */ + uint8 key[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; /* Key3 and Key4 */ + eslt_WorkSpaceCMACAES workSpaceCmacAes; + + /* Set Key_Update_Enc_C constant */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrEncConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* # Generate K3 */ + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + /* # Generate M4* */ + /* counter(28bits) | "1" | "0" ... "0"x99 (=128 bit) */ + encBufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES - 1u] |= 0x08u; /* Add leading one for padding ENC(ECB,K3) */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + encBufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES - 1u] &= 0xF8u; /* Add leading zero for padding ENC(ECB,K3) */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* Add padding */ + Crypto_30_LibCv_ClearData(&(encBufferPtr[4]), CRYPTO_30_LIBCV_SIZEOF_SHE_M4_ENC - CRYPTO_30_LIBCV_SIZEOF_SHE_M4_COUNTER_FULL_BYTES); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* # Copy UID of M4 */ + Crypto_30_LibCv_CopyData(m4m5, uid, CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* # Copy Ids of M4 */ + Crypto_30_LibCv_CopyData(&m4m5[CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS], &m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS], CRYPTO_30_LIBCV_SIZEOF_SHE_M1_IDS); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* # Generate and store second block of M4 */ + if (Crypto_30_LibCv_SheKeyUpdateEncrypt(encBufferPtr, key, &m4m5[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], 1u) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR_KEY_OUTPUT */ + { + /* Set Key_Update_Mac_C constant */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrMacConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* # Generate K4 */ + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + /* Generate M5 */ + retVal = Crypto_30_LibCv_SheKeyUpdateCmac(m4m5, 32u, key, &m4m5[32], &workSpaceCmacAes); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + } + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateGenM4M5() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateProofM4M5() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateProofM4M5( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfKeyElementsType outputElement, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) outputBufferPtr, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey) +{ + Std_ReturnType retVal = E_NOT_OK; + uint32 uidLength = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; + Crypto_30_LibCv_SizeOfKeyStorageType uIdStorageIndex; + /* Buffer */ + uint8 m4m5[CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5]; + + /* # Copy UID of M4 */ + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_UID, &uIdStorageIndex, &uidLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + + /* # Build M4 and M5 */ + retVal = Crypto_30_LibCv_SheKeyUpdateGenM4M5(m1m2m3, m4m5, Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), KDFbufferPtr, outputBufferPtr, indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + if (retVal == E_OK) + { + /* # Copy M4 & M5 */ + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(outputElement), m4m5, CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* # Store written length */ + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(cryptoKeyId, outputElement, CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5); + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateProofM4M5() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateFindProof() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateFindProof( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementsIterType, AUTOMATIC, AUTOMATIC) outputElementIndexPtr) +{ + Std_ReturnType retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + Crypto_30_LibCv_KeyElementsIterType outputElement; + + /* Determine proof output slot */ + for (outputElement = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + outputElement < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); + outputElement++) + { + if ((Crypto_30_LibCv_GetIdOfKeyElements(outputElement) == CRYPTO_KE_MAC_PROOF)|| + (Crypto_30_LibCv_GetIdOfKeyElements(outputElement) == CRYPTO_KE_CIPHER_PROOF)) + { + if ((Crypto_30_LibCv_GetKeyStorageEndIdxOfKeyElements(outputElement) - Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(outputElement)) >= (uint16)CRYPTO_30_LIBCV_SIZEOF_SHE_M4_M5) + { + *outputElementIndexPtr = outputElement; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + retVal = E_OK; + } + else + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateFindProof() */ + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateLockKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateLockKeys( + uint32 cryptoKeyId, + uint32 authKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + uint32 sheInfoKeyId; + + sheInfoKeyId = Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(); + /* check if SHE info need to be locked */ + if (Crypto_30_LibCv_Local_KeyReadLockGet(sheInfoKeyId) == E_OK) + { + /* check if SHE info need to be locked */ + if (authKeyId != cryptoKeyId) + { + if (Crypto_30_LibCv_Local_KeyReadLockGet(authKeyId) == E_OK) + { + retVal = E_OK; + } + else + { + Crypto_30_LibCv_Local_KeyReadLockRelease(sheInfoKeyId); + } + } + else + { + retVal = E_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateLockKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateUnlockKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateUnlockKeys( + uint32 cryptoKeyId, + uint32 authKeyId) +{ + uint32 sheInfoKeyId; + + sheInfoKeyId = Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(); + + Crypto_30_LibCv_Local_KeyReadLockRelease(sheInfoKeyId); + + if (authKeyId != cryptoKeyId) + { + Crypto_30_LibCv_Local_KeyReadLockRelease(authKeyId); + } +} /* Crypto_30_LibCv_SheKeyUpdateUnlockKeys() */ +# endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + Crypto_30_LibCv_SizeOfKeyElementsType outputElement, + Std_ReturnType proofAvailable) +{ + /* # Init KDF Parameters */ + /* KDF Buffer */ + uint8 KDFbuffer[CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER]; + + /* # Init Workspace */ + /* Working Buffers */ + uint8 encBuffer[CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER]; + + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SheKeyTypeType sheKeyType = Crypto_30_LibCv_SheKeyGetKeyType(Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey)); + + /* # Verify M3 */ + if (Crypto_30_LibCv_SheKeyUpdateVerifyM3(m1m2m3, indexOfAuthSheKey, indexOfSheKey, KDFbuffer, CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER, encBuffer) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + { + /* # check UID */ + if (Crypto_30_LibCv_SheKeyUpdateCheckUid(m1m2m3, elementIndex, sheKeyType) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + { + /* # Extract Key */ + retVal = Crypto_30_LibCv_SheKeyUpdateExtractKey(cryptoKeyId, m1m2m3, elementIndex, KDFbuffer, CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER, encBuffer, indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + + if (retVal == E_OK) + { + /* store FID and Counter */ +# if(CRYPTO_30_LIBCV_SHE_ENABLE_COUNTER == STD_ON) + /* RAM key has no counter */ + if (Crypto_30_LibCv_IsKeyElementsCounterUsedOfSheKeys(indexOfSheKey)) + { + Crypto_30_LibCv_SheKeyUpdateCopyCounter(cryptoKeyId, Crypto_30_LibCv_GetKeyElementsCounterIdxOfSheKeys(indexOfSheKey), encBuffer); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } +# endif +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) + Crypto_30_LibCv_SheKeyUpdateCopyFid(elementIndex, encBuffer, sheKeyType); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ +# else + Crypto_30_LibCv_ClearKeyElementExtensionByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_CLEAR_PLAIN_KEY_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ +# endif + + /* # Generate M4 & M5, if proof slot is available */ + if (proofAvailable == E_OK) + { + retVal = Crypto_30_LibCv_SheKeyUpdateProofM4M5(cryptoKeyId, m1m2m3, (Crypto_30_LibCv_SizeOfKeyElementsType)outputElement, KDFbuffer, encBuffer, indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyUpdate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyUpdate( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3) +{ + Std_ReturnType retVal = E_NOT_OK; + Std_ReturnType proofAvailable; + Crypto_30_LibCv_KeyElementsIterType outputElement = 0u; + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey = 0u; + + /* # Determine proof output slot */ + proofAvailable = Crypto_30_LibCv_SheKeyUpdateFindProof(cryptoKeyId, &outputElement); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if ((proofAvailable == E_OK) || + (proofAvailable == CRYPTO_E_KEY_NOT_AVAILABLE)) + { + /*# Check key ID */ + if (Crypto_30_LibCv_SheKeyUpdateCheckM1Ids(m1m2m3, indexOfSheKey, &indexOfAuthSheKey) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + retVal = Crypto_30_LibCv_SheKeyUpdateLockKeys(cryptoKeyId, Crypto_30_LibCv_GetKeyIdxOfSheKeys(indexOfAuthSheKey)); + + if (retVal == E_OK) + { +# endif + /* # Verify M3, Extract Key and Generate M4 & M5, if proof slot is available */ + retVal = Crypto_30_LibCv_SheKeyUpdateVerifyAndExtract(cryptoKeyId, elementIndex, m1m2m3, indexOfSheKey, indexOfAuthSheKey, (Crypto_30_LibCv_SizeOfKeyElementsType)outputElement, proofAvailable); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_SheKeyUpdateUnlockKeys(cryptoKeyId, Crypto_30_LibCv_GetKeyIdxOfSheKeys(indexOfAuthSheKey)); + } + else + { + retVal = CRYPTO_E_BUSY; + } +# endif + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSetShe() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 6 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSetShe( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength, + Std_ReturnType oldRetVal) +{ + Std_ReturnType retVal = oldRetVal; + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey; + + /* Check if it is a write once key which is written already. */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + /* Key update using SHE key update protocol */ + else if ((keyLength == CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3) && + (Crypto_30_LibCv_GetKeyElementLength(elementIndex) == CRYPTO_30_LIBCV_SIZEOF_SHE_KEY)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + if (Crypto_30_LibCv_SheKeyGetSheIndex(elementIndex, &indexOfSheKey) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + if ((CRYPTO_30_LIBCV_WA_ENCRYPTED == Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex))) || + ((CRYPTO_30_LIBCV_WA_ALLOWED == Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex))) && + (Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey) == CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID))) + { + /* She Key Protocol */ + retVal = Crypto_30_LibCv_SheKeyUpdate(cryptoKeyId, elementIndex, indexOfSheKey, keyPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + } + } + /* Set plaintext ram key */ + else if (keyLength == CRYPTO_30_LIBCV_SIZEOF_SHE_KEY) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + if (CRYPTO_30_LIBCV_WA_ALLOWED == Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex))) + { + /* Is the given key a she key and is it a ram key. */ + if (Crypto_30_LibCv_SheKeyGetSheIndex(elementIndex, &indexOfSheKey) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + if (Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey) == CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID) + { + /* Set ram key as plaintext. */ + retVal = Crypto_30_LibCv_Local_KeyElementSetInternal(cryptoKeyId, elementIndex, keyPtr, keyLength, CRYPTO_30_LIBCV_WA_ENCRYPTED); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + + if (retVal == E_OK) + { + Crypto_30_LibCv_SetKeyElementExtensionByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_PLAIN_KEY_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + } + } + } + } + } + else + { + /* nothing to do */ + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementSetShe() */ + +# if (CRYPTO_30_LIBCV_RAM_KEY_EXPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetShe() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetShe( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, indexOfAuthSheKey = 0u; + /* Is it a she key */ + if (Crypto_30_LibCv_SheKeyGetSheIndex(elementIndex, &indexOfSheKey) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* Is it the ram key */ + if (Crypto_30_LibCv_GetSheIdOfSheKeys(indexOfSheKey) == CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID) + { + if (*resultLengthPtr >= CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3) + { + /* Get Secret Key, find key can be voided because secret key must be available for ram key */ + (void)Crypto_30_LibCv_GetSheKey(CRYPTO_30_LIBCV_SHE_M1_SECRET_KEY_ID, CRYPTO_30_LIBCV_SHE_PAGE0, &indexOfAuthSheKey); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* Lock Keys */ + retVal = Crypto_30_LibCv_SheKeyUpdateLockKeys(cryptoKeyId, (uint32)Crypto_30_LibCv_GetKeyIdxOfSheKeys(indexOfAuthSheKey)); + + if (retVal == E_OK) + { +# endif + /* export key */ + retVal = Crypto_30_LibCv_SheKeyExport(indexOfSheKey, indexOfAuthSheKey, resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* Unlock Keys */ + Crypto_30_LibCv_SheKeyUpdateUnlockKeys(cryptoKeyId, Crypto_30_LibCv_GetKeyIdxOfSheKeys(indexOfAuthSheKey)); + } + else + { + retVal = CRYPTO_E_BUSY; + } +# endif + } + else + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + } + else + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + } + else + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_OFF) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetShe() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyExport_M1M2M3() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyExport_M1M2M3( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) m1m2m3, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) KDFbufferPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) encBufferPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ramKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey) +{ + Std_ReturnType retVal = E_NOT_OK; + uint8 key[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + eslt_WorkSpaceCMACAES workSpaceCmacAes; + + /* M1 */ + Crypto_30_LibCv_CopyData(m1m2m3, uid, CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M1_IDS] = Crypto_30_LibCv_She_M1_BuildIds(CRYPTO_30_LIBCV_SHE_M1_RAM_KEY_ID, CRYPTO_30_LIBCV_SHE_M1_SECRET_KEY_ID); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + /* M2 */ + /* Generate K1 */ + /* Set AuthKey|Key_Update_Enc_C constant */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrEncConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY + CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + + /* Encrypt C,K,F */ + Crypto_30_LibCv_ClearData(encBufferPtr, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + Crypto_30_LibCv_CopyData(&encBufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], ramKey, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + if (Crypto_30_LibCv_SheKeyUpdateEncrypt(encBufferPtr, key, &m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M2], 2u) == E_OK) /* SBSW_CRYPTO_30_LIBCV_KEY_OUTPUT_BUFFER_PARAMETER_KEY_STACK */ + { + /* M3 */ + /* Generate K2 */ + /* KDF AuthKey|Key_Update_Mac_C */ + Crypto_30_LibCv_CopyData(&KDFbufferPtr[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], Crypto_30_LibCv_She_GetPtrMacConst(indexOfSheKey), CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(KDFbufferPtr, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY + CRYPTO_30_LIBCV_SIZEOF_SHE_UPDATE_CONSTANT, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_AND_KEY */ + { + + /* Calculate M3 CMAC */ + if (Crypto_30_LibCv_SheKeyUpdateCmac(m1m2m3, CRYPTO_30_LIBCV_STARTINDEX_SHE_M3, key, &m1m2m3[CRYPTO_30_LIBCV_STARTINDEX_SHE_M3], &workSpaceCmacAes) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR_KEY_OUTPUT */ + { + retVal = E_OK; + } + } + } + + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyExport_M1M2M3() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_SheKeyExport() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SheKeyExport( + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey, + Crypto_30_LibCv_SizeOfSheKeysType indexOfAuthSheKey, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK, localRet; + uint8 m1m5[CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M5]; + uint8 kdfBuffer[CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER]; + uint8 encBuffer[CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER]; + uint32 writtenLength = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M3; + + Crypto_30_LibCv_SizeOfKeyStorageType uIdStorageIndex, keyStorageIndex, authKeyStorageIndex; + uint32 length; + + /* Get UID */ + length = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_UID, &uIdStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* Get SecretKey */ + if (localRet == E_OK) + { + length = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfAuthSheKey), &authKeyStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE); /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (!Crypto_30_LibCv_IsKeyElementValid(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfAuthSheKey))) + { + localRet = E_NOT_OK; + } + + /* Get RamKey */ + if (localRet == E_OK) + { + length = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfSheKey), &keyStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE); /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* Check if Ram key is written as plaintext */ + if (localRet == E_OK) + { + if (!Crypto_30_LibCv_IsKeyElementExtensionByMask(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfSheKey), CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_PLAIN_KEY_MASK)) + { + retVal = CRYPTO_E_KEY_READ_FAIL; + localRet = E_NOT_OK; + } + + if (localRet == E_OK) + { + /* Calculate m1-m3 */ + Crypto_30_LibCv_CopyData(kdfBuffer, Crypto_30_LibCv_GetAddrKeyStorage(authKeyStorageIndex), CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + retVal = Crypto_30_LibCv_SheKeyExport_M1M2M3(m1m5, kdfBuffer, encBuffer, Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + + /* Calculate m4-m5 if required */ + if ((retVal == E_OK) && + (*resultLengthPtr >= CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M5)) + { + Crypto_30_LibCv_CopyData(kdfBuffer, Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + retVal = Crypto_30_LibCv_SheKeyUpdateGenM4M5(m1m5, &m1m5[CRYPTO_30_LIBCV_STARTINDEX_SHE_M4], Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), kdfBuffer, encBuffer, indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KDFBUFFER_KEY_OUTPUTBUFFER */ + writtenLength = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_M5; + } + + /* Copy key Export to the given Buffer. */ + if (retVal == E_OK) + { + Crypto_30_LibCv_CopyData(resultPtr, m1m5, writtenLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + *resultLengthPtr = writtenLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_SheKeyExport() */ +# endif /* (CRYPTO_30_LIBCV_RAM_KEY_EXPORT == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_Authorization() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_Authorization( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) masterKey, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) uid, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) challenge, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) authorization) +{ + Std_ReturnType retVal = E_NOT_OK; + const uint8 debugKeyC[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY] = { 0x01U, 0x03U, 0x53U, 0x48U, 0x45U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0xB0U }; + + uint8 key[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + uint8 result[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY]; + uint8 buffer[CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER]; + uint8_least i; + eslt_WorkSpaceCMACAES workSpaceCmacAes; + + /* K = KDF(KEYMASTER_ECU_KEY, DEBUG_KEY_C) */ + Crypto_30_LibCv_CopyData(buffer, masterKey, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], debugKeyC, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + if (Crypto_30_LibCv_SheKeyUpdateMiyaguchiPreneel(buffer, CRYPTO_30_LIBCV_SIZEOF_KDF_BUFFER, key) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* AUTHORIZATION = CMAC(CHALLENGE | UID) with K */ + Crypto_30_LibCv_CopyData(buffer, challenge, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_KEY], uid, CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + if (Crypto_30_LibCv_SheKeyUpdateCmac(buffer, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY + CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID, key, result, &workSpaceCmacAes) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* Check (authorization = authorization*) */ + retVal = E_OK; + for (i = 0u; i < CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; i++) + { + if (authorization[i] != result[i]) + { + retVal = E_NOT_OK; + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_She_DebugCmd_Authorization() */ + +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_IsWriteProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_IsWriteProtected(void) +{ + boolean writeProtection = FALSE; + Crypto_30_LibCv_KeyIterType keyIdx; + Crypto_30_LibCv_KeyElementsIterType elementIdx; + + /* Check if a key is write protected. */ + for (keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKey(); keyIdx++) + { + if (Crypto_30_LibCv_IsDebugDeletionOfKey(keyIdx)) + { + /* Iterate over all elements in the key */ + for (elementIdx = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(keyIdx); elementIdx < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(keyIdx); elementIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIdx, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + writeProtection = TRUE; + break; + } + } + } + } + + return writeProtection; +} /* Crypto_30_LibCv_She_DebugCmd_IsWriteProtected() */ +# endif /* (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_DeleteKeys() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_DeleteKeys(void) +{ + Crypto_30_LibCv_SizeOfKeyType keyIdx; + Crypto_30_LibCv_SheKeysIterType sheKeyIndex; + Crypto_30_LibCv_SizeOfKeyElementsType elementIdx; + + /* Set keys to initial state. */ + for (keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKey(); keyIdx++) + { + if (Crypto_30_LibCv_IsDebugDeletionOfKey(keyIdx)) + { + for (elementIdx = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(keyIdx); elementIdx < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(keyIdx); elementIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* Delete old value */ + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(elementIdx), Crypto_30_LibCv_GetKeyElementLength(elementIdx)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + + /* init key again */ + Crypto_30_LibCv_Init_Key(elementIdx, FALSE); + +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key value is changed. */ + Crypto_30_LibCv_GetKeyValueChangedCalloutFctNameOfConfigurableCallouts()(keyIdx, Crypto_30_LibCv_GetIdOfKeyElements(elementIdx)); +# endif +# if(CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + /* Call KeyNvStatus KeyChanged transition */ + Crypto_30_LibCv_KeyNvStatus_KeyChanged(keyIdx, elementIdx); +# endif + } + } + } + + for (sheKeyIndex = 0u; sheKeyIndex < Crypto_30_LibCv_GetSizeOfSheKeys(); sheKeyIndex++) + { + elementIdx = Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(sheKeyIndex); + Crypto_30_LibCv_Init_KeySheAdditional(elementIdx); + } + +# if(CRYPTO_30_LIBCV_KEYVALIDITYSETCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key is set to valid */ + { + boolean isValid; + + for (keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKey(); keyIdx++) + { + isValid = TRUE; + + if (Crypto_30_LibCv_IsDebugDeletionOfKey(keyIdx)) + { + for (elementIdx = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(keyIdx); elementIdx < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(keyIdx); elementIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (!Crypto_30_LibCv_IsKeyElementValid(elementIdx)) + { + isValid = FALSE; + break; + } + } + + if (isValid == TRUE) + { + Crypto_30_LibCv_GetKeyValiditySetCalloutFctNameOfConfigurableCallouts()(keyIdx, TRUE); + } + } + } + } +# endif +} /* Crypto_30_LibCv_She_DebugCmd_DeleteKeys() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_GetChallenge() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_GetChallenge( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode localRet; + /* Check length */ + if (*resultLengthPtr >= CRYPTO_30_LIBCV_SIZEOF_SHE_KEY) + { + /* Check write protection */ +# if (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON) + if (!Crypto_30_LibCv_She_DebugCmd_IsWriteProtected()) +# endif + { + /* Provide RNG as challenge */ + localRet = esl_getBytesRNG( CRYPTO_30_LIBCV_SIZEOF_SHE_KEY, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))Crypto_30_LibCv_She_Debug_Cmd_Challenge ); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (localRet == E_OK) + { + Crypto_30_LibCv_CopyData(resultPtr, Crypto_30_LibCv_She_Debug_Cmd_Challenge, CRYPTO_30_LIBCV_SIZEOF_SHE_KEY); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + *resultLengthPtr = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag = TRUE; + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + else + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + + return retVal; +} /* Crypto_30_LibCv_She_DebugCmd_GetChallenge() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_SetAuthorization() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_SetAuthorization( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr) +{ + Std_ReturnType retVal = E_NOT_OK, localRet; + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheKey = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType uIdStorageIndex, keyStorageIndex = 0u; + uint32 length; + + Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag = FALSE; + /* Get Master Key She Idx */ + localRet = Crypto_30_LibCv_GetSheKey(CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID, CRYPTO_30_LIBCV_SHE_PAGE0, &indexOfSheKey); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + /* Get UID */ + length = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_UID, &uIdStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* Get Master Key */ + if (localRet == E_OK) + { + length = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; + localRet = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfSheKey), &keyStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE); /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (localRet == E_OK) + { + /* Check Authorization */ + retVal = Crypto_30_LibCv_She_DebugCmd_Authorization(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), Crypto_30_LibCv_She_Debug_Cmd_Challenge, keyPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + if (retVal == E_OK) + { + /* Delete keys */ + Crypto_30_LibCv_She_DebugCmd_DeleteKeys(); + } + } + } + + return retVal; +} /* Crypto_30_LibCv_She_DebugCmd_SetAuthorization() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6030, 6080 3 */ /* MD_MSR_STPTH , MD_MSR_STCYC , MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + Crypto_30_LibCv_KeyElementsIterType elementIdx; + boolean persist; +# endif + Std_ReturnType retVal = E_NOT_OK; + + /* Is it a valid request */ + if ((keyLength == CRYPTO_30_LIBCV_SIZEOF_SHE_KEY) && + Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag) + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_KeyIterType lockedKeyIdx; + + /* Lock keys for write access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (lockedKeyIdx = 0u; lockedKeyIdx < Crypto_30_LibCv_GetSizeOfKey(); lockedKeyIdx++) + { + if (Crypto_30_LibCv_IsDebugDeletionOfKey(lockedKeyIdx)) + { + if (Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected((uint32)lockedKeyIdx) != E_OK) + { + retVal = CRYPTO_E_BUSY; + break; + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + if (retVal != CRYPTO_E_BUSY) +# endif + { + retVal = Crypto_30_LibCv_She_DebugCmd_SetAuthorization(keyPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + { + Crypto_30_LibCv_KeyIterType releaseKeyIdx; + + /* Release keys for write access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (releaseKeyIdx = 0; releaseKeyIdx < lockedKeyIdx; releaseKeyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_IsDebugDeletionOfKey(releaseKeyIdx)) + { + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected((uint32)releaseKeyIdx); + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + } +# endif + +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (retVal == E_OK) + { + Crypto_30_LibCv_KeyIterType persistKeyIdx; + /* Trigger write block. */ + for (persistKeyIdx = 0; persistKeyIdx < Crypto_30_LibCv_GetSizeOfKey(); persistKeyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + persist = FALSE; + + if (Crypto_30_LibCv_IsDebugDeletionOfKey(persistKeyIdx)) + { + for (elementIdx = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(persistKeyIdx); elementIdx < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(persistKeyIdx); elementIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_IsKeyElementPersist(elementIdx)) + { + persist = TRUE; + } + } + if (persist == TRUE) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(persistKeyIdx)); + } + } + } + } +# endif + } + else + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + + return retVal; +} /* Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock() */ +# endif /* (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) */ +#endif /* CRYPTO_30_LIBCV_SHEKEYS == STD_ON */ + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Trigger_Write_Req() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Trigger_Write_Req( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRet = E_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + /* ----- Implementation ------------------------------------------------- */ + + /* Set Ram Block Status */ +# if (CRYPTO_30_LIBCV_NVM_ENABLE_SET_RAM_BLOCK_STATUS == STD_ON) + localRet = NvM_SetRamBlockStatus((NvM_BlockIdType)Crypto_30_LibCv_GetDescriptorOfNvBlock(blockIdx), TRUE); + if (localRet == E_OK) +# endif + { + /* Trigger write request if it is a IMMEDIATE block. */ + if ((Crypto_30_LibCv_GetProcessingOfNvBlock(blockIdx) == CRYPTO_30_LIBCV_NV_PROCESSING_IMMEDIATE)) + { + localRet = Crypto_30_LibCv_NvM_WriteBlock((NvM_BlockIdType)Crypto_30_LibCv_GetDescriptorOfNvBlock(blockIdx), NULL_PTR); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_NULL_PTR */ + } + } + + /* If an error occurred clear write requested bit mask in state. */ + if (localRet == E_OK) + { + retVal = E_OK; + } + else + { + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + Crypto_30_LibCv_ClearNvBlockStateMask(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_CLEAR_WRITE_REQUESTED); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + } + return retVal; +} /* Crypto_30_LibCv_NvBlock_Trigger_Write_Req() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_MainFunction() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_MainFunction(void) +{ + /* ----- Local Variables ------------------------------------------------ */ + Crypto_30_LibCv_NvBlockIterType blockIdx; + + /* ----- Implementation ------------------------------------------------- */ + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Check if write request need to be triggered for any block. */ + for (blockIdx = 0u; blockIdx < Crypto_30_LibCv_GetSizeOfNvBlock(); blockIdx++) + { + if (Crypto_30_LibCv_GetNvBlockState(blockIdx) == CRYPTO_30_LIBCV_NVBLOCK_STATE_WRITE_REQ_PENDING) + { + Crypto_30_LibCv_SetNvBlockState(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_WRITE_REQ); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + (void)Crypto_30_LibCv_NvBlock_Trigger_Write_Req((Crypto_30_LibCv_SizeOfNvBlockType)blockIdx); + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_NvBlock_MainFunction() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Write_Req() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Write_Req( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) + if (GetApplicationID() == Crypto_30_LibCv_MainApplicationId) +# endif + { + /* ----- Local Variables ------------------------------------------------ */ + + boolean setBlockStatus = FALSE; + /* ----- Implementation ------------------------------------------------- */ + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* If idle trigger new request */ + if (Crypto_30_LibCv_IsNvBlockState(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_IDLE)) + { + Crypto_30_LibCv_SetNvBlockState(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_WRITE_REQ); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + setBlockStatus = TRUE; + } + /* Otherwise set only flag for changed data .*/ + else + { + Crypto_30_LibCv_SetNvBlockStateMask(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* Update KeyNvStatus of the keys of this block */ + Crypto_30_LibCv_KeyNvStatus_NvWriteReq(blockIdx); + + if (setBlockStatus) + { + (void)Crypto_30_LibCv_NvBlock_Trigger_Write_Req(blockIdx); + } + } +} /* Crypto_30_LibCv_NvBlock_Write_Req() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Update state */ + Crypto_30_LibCv_ClearNvBlockStateMask(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_CLEAR_WRITE_COPIED); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_WrittenToBlock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_WrittenToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + /* Update state if data is marked as changed. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + if (Crypto_30_LibCv_IsNvBlockStateMask(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_MASK_DATA_CHANGE)) + { + Crypto_30_LibCv_SetNvBlockState(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_COPY_DATA); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_NvBlock_State_WrittenToBlock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock_Copy() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock_Copy( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Crypto_30_LibCv_SizeOfKeyStorageType length, writtenLength = 0u; + + /* ----- Development Error Checks ------------------------------------- */ + + /* ----- Implementation ------------------------------------------------- */ + + /* Update State */ + Crypto_30_LibCv_NvBlock_State_WrittenToBlock(blockIdx); + + /* Set header */ + if (Crypto_30_LibCv_GetConsistencyLevelOfNvBlock(blockIdx) == CRYPTO_30_LIBCV_NV_CONSISTENCY_LEVEL_DETECT) + { + Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc(blockIdx, NvMBufferPtr, &writtenLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + } + else + { + /* CRYPTO_30_LIBCV_NV_STORAGE_KIND_NONE */ + } + + /* Data */ + length = (Crypto_30_LibCv_SizeOfKeyStorageType)(Crypto_30_LibCv_GetKeyStorageEndIdxOfNvBlock(blockIdx) - Crypto_30_LibCv_GetKeyStorageStartIdxOfNvBlock(blockIdx)); + /* Copy Key Storage to Buffer */ + Crypto_30_LibCv_CopyData(&NvMBufferPtr[writtenLength], Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfNvBlock(blockIdx)), length); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + writtenLength = (Crypto_30_LibCv_SizeOfKeyStorageType)(writtenLength + length); + /* Clear remaining Bytes of Buffer to have a specified value */ + Crypto_30_LibCv_ClearData(&NvMBufferPtr[writtenLength], (Crypto_30_LibCv_SizeOfKeyStorageType)(Crypto_30_LibCv_GetLengthOfNvBlock(blockIdx) - (writtenLength))); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ +} /* Crypto_30_LibCv_NvBlock_WriteToBlock_Copy() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement( + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) validLengthsPtr, + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + Crypto_30_LibCv_KeyElementsIterType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr, + Crypto_30_LibCv_SizeOfKeyStorageType dataStartPos) +{ + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + /* Check if configured key element length is equal or greater than key element length read from NvM data */ + uint32 nvmKeyElementWrittenLengthOffset = dataStartPos + + ((uint32)Crypto_30_LibCv_GetKeyStorageWrittenLengthStartIdxOfKeyElements(elementIndex)) - + Crypto_30_LibCv_GetKeyStorageStartIdxOfNvBlock(blockIdx); + + uint32 keyElementNvmLength = ((uint32)NvMBufferPtr[nvmKeyElementWrittenLengthOffset] << 8) | (uint32)NvMBufferPtr[nvmKeyElementWrittenLengthOffset + 1u]; + + if (keyElementNvmLength > Crypto_30_LibCv_GetKeyElementLength(elementIndex)) + { + *validLengthsPtr = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } +} /* Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_CheckKeyElementLengths() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_CheckKeyElementLengths( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr, + Crypto_30_LibCv_SizeOfKeyStorageType dataStartPos) +{ + Std_ReturnType retVal = E_NOT_OK; + boolean validLengths = TRUE; + Crypto_30_LibCv_KeyIterType keyIdx; + Crypto_30_LibCv_KeyElementsIterType elementIndex; + + for (keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKey(); keyIdx++) + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + for (elementIndex = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(keyIdx); elementIndex < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(keyIdx); elementIndex++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + Crypto_30_LibCv_NvBlock_CheckLengthOfGivenKeyElement(&validLengths, blockIdx, elementIndex, NvMBufferPtr, dataStartPos); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_AND_ACCESS_TO_NVBUFFER */ + } + } + } + + if (validLengths == TRUE) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_NvBlock_CheckKeyElementLengths() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + boolean validHeader = TRUE; + boolean dataCopiedFromNvM = FALSE; + Crypto_30_LibCv_SizeOfKeyStorageType length, dataStartPos = 0u; + + /* ----- Development Error Checks ------------------------------------- */ + + /* ----- Implementation ------------------------------------------------- */ + + /* Set header */ + Crypto_30_LibCv_NvBlock_State_Init(blockIdx); + + /* Check header */ + if ((Crypto_30_LibCv_GetConsistencyLevelOfNvBlock(blockIdx) == CRYPTO_30_LIBCV_NV_CONSISTENCY_LEVEL_DETECT)) + { + validHeader = Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc(blockIdx, NvMBufferPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + dataStartPos = (Crypto_30_LibCv_SizeOfKeyStorageType)CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_HEADER_CRC; + } + + if (validHeader) + { + /* Check if key element lengths are valid */ + if(Crypto_30_LibCv_NvBlock_CheckKeyElementLengths(blockIdx, NvMBufferPtr, dataStartPos) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + { + /* Copy data to Key Storage */ + length = (Crypto_30_LibCv_SizeOfKeyStorageType)(Crypto_30_LibCv_GetKeyStorageEndIdxOfNvBlock(blockIdx) - Crypto_30_LibCv_GetKeyStorageStartIdxOfNvBlock(blockIdx)); + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfNvBlock(blockIdx)), &NvMBufferPtr[dataStartPos], length); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_KEY_STORAGE_ACCESS_NV */ + dataCopiedFromNvM = TRUE; + /* Update KeyNvStatus of keys of NvBlock. */ + Crypto_30_LibCv_KeyNvStatus_ReadFromBlock(blockIdx); + } + } + + /* Restore data in Key Storage */ + if(dataCopiedFromNvM == FALSE) + { + Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore(blockIdx); + } + + return E_OK; +} /* Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBufferPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + boolean validHeader = TRUE; + uint32 crc; + + /* ----- Implementation ------------------------------------------------- */ + /* Header */ + /* Version */ + if (NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_VERSION] != CRYPTO_30_LIBCV_NVBLOCK_VERSION_0) + { + validHeader = FALSE; + } + /* Flags */ + if (NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_FLAGS] != CRYPTO_30_LIBCV_NVBLOCK_FLAGS_0) + { + validHeader = FALSE; + } + /* Check Structure Crc */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&crc, &NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_CRC]); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + if (crc != Crypto_30_LibCv_GetCrcOfNvBlock(blockIdx)) + { + validHeader = FALSE; + } + + return validHeader; +} /* Crypto_30_LibCv_NvBlock_ReadFromBlock_HeaderCrc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) writtenLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + /* Header */ + /* Version */ + NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_VERSION] = CRYPTO_30_LIBCV_NVBLOCK_VERSION_0; /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + + /* Flags */ + NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_FLAGS] = CRYPTO_30_LIBCV_NVBLOCK_FLAGS_0; /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + + /* Copy Structure Crc */ + Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(&NvMBufferPtr[CRYPTO_30_LIBCV_POS_NVBLOCK_CRC], Crypto_30_LibCv_GetCrcOfNvBlock(blockIdx)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + *writtenLengthPtr = (Crypto_30_LibCv_SizeOfKeyStorageType)(*writtenLengthPtr + CRYPTO_30_LIBCV_SIZEOF_NVBLOCK_HEADER_CRC); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ +} /* Crypto_30_LibCv_NvBlock_WriteToBlock_HeaderCrc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + /* Restore new init values for the given block. */ + (void)Crypto_30_LibCv_NvBlock_Init(blockIdx); +} /* Crypto_30_LibCv_NvBlock_ReadFromBlock_Restore() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm( + uint32 cryptoKeyId) { + boolean retVal = FALSE; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + Crypto_30_LibCv_KeyNvStatusType currentStatus = Crypto_30_LibCv_GetKeyNvStatus(cryptoKeyId); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if ((currentStatus == CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_WRITE_REQ) || + (currentStatus == CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_COPIED) || + (currentStatus == CRYPTO_30_LIBCV_KEY_NV_STATUS_WRITE_FAILED)) + { + retVal = TRUE; + } + return retVal; +} /* Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm() */ +#endif /* (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) */ + +#if(CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_She_Cmd_Get_Status() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_She_Cmd_Get_Status( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) statusPtr) +{ + Std_ReturnType retVal; + Crypto_30_LibCv_SizeOfKeyStorageType bootProtectionElementIndexPtr = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType debuggerProtectionElementIndexPtr = 0u; + uint32 elementLength = 1u; + + /* Init status */ + *statusPtr = CRYPTO_30_LIBCV_SHE_CLEARED_STATUS; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + + /* Get BOOT_PROTECTION and DEBUGGER_PROTECTION element id */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION, &bootProtectionElementIndexPtr, &elementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + retVal |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION, &debuggerProtectionElementIndexPtr, &elementLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Check boot protection */ + if (*(Crypto_30_LibCv_GetAddrKeyStorage(bootProtectionElementIndexPtr)) == 1u) + { + *statusPtr |= CRYPTO_30_LIBCV_SHE_STATUS_BOOT_FINISHED; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *statusPtr |= CRYPTO_30_LIBCV_SHE_STATUS_BOOT_OK; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* Check debugger protection */ + if (*(Crypto_30_LibCv_GetAddrKeyStorage(debuggerProtectionElementIndexPtr)) == 0u) + { + *statusPtr |= CRYPTO_30_LIBCV_SHE_STATUS_EXT_DEBUGGER; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } + else + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_She_Cmd_Get_Status() */ +#endif /* (CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* [SWS_Crypto_91006] */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) errorIdPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex = 0u; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* Try to get read lock */ + if (Crypto_30_LibCv_Local_KeyReadLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { +#if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) + /* Check if it is She DEBUG_CMD */ + if (Crypto_30_LibCv_She_IsDebugCmd(cryptoKeyId, keyElementId)) + { +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (GetApplicationID() == Crypto_30_LibCv_MainApplicationId) +# endif + { + retVal = Crypto_30_LibCv_She_DebugCmd_GetChallenge(resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } + } + else +#endif + /* Search Key Element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00087] Check that keyElementId is in valid range */ + *errorIdPtr = CRYPTO_E_PARAM_HANDLE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_INLINE_STACK */ + /* Info: This return value is according to the Spec although CRYPTO_E_KEY_NOT_AVAILABLE would make more sense */ + retVal = E_NOT_OK; + } + else + { + /* Check if the Key element is valid */ + if (FALSE == Crypto_30_LibCv_IsKeyElementValid(elementIndex)) + { + /* [SWS_Crypto_00039] */ + /* Info: This return value is according to the Spec although CRYPTO_E_KEY_NOT_VALID would make more sense */ + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + /* Check if read access is allowed */ + if (CRYPTO_30_LIBCV_RA_ALLOWED == (Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)))) + { + retVal = Crypto_30_LibCv_Local_KeyElementGetNoShe(elementIndex, resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } +#if (CRYPTO_30_LIBCV_RAM_KEY_EXPORT == STD_ON) + /* She key */ + else if (CRYPTO_30_LIBCV_RA_ENCRYPTED == (Crypto_30_LibCv_GetReadOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)))) + { + retVal = Crypto_30_LibCv_Local_KeyElementGetShe(cryptoKeyId, elementIndex, resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } +#endif + else + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + } + } + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockRelease(cryptoKeyId); +#endif + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetNoShe() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* [SWS_Crypto_91006] */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetNoShe( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyStorageType resultIndex; + Crypto_30_LibCv_LengthCheckType lengthCheck; + uint32 writtenKeyLength = 0u; + +#if (CRYPTO_30_LIBCV_STRICT_LENGTH_CHECK_FOR_KEY_ELEMENT_GET == STD_OFF) + /* If the Key Element has partial access allowed, length check should not be strict */ + if (Crypto_30_LibCv_IsKeyElementPartial(elementIndex) == TRUE) + { + lengthCheck = CRYPTO_30_LIBCV_LENGTH_CHECK_NONE; + } + else +#endif + { + lengthCheck = CRYPTO_30_LIBCV_LENGTH_CHECK_MAX; + } + + writtenKeyLength = *resultLengthPtr; + + /* Get SHE key always if ra is allowed */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic(elementIndex, &resultIndex, &writtenKeyLength, lengthCheck, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + +#if (CRYPTO_30_LIBCV_STRICT_LENGTH_CHECK_FOR_KEY_ELEMENT_GET == STD_OFF) + if (Crypto_30_LibCv_IsKeyElementPartial(elementIndex) == TRUE) + { + /* Check if written length is less than requested length */ + if (writtenKeyLength < *resultLengthPtr) + { + /* Use written length of key */ + *resultLengthPtr = writtenKeyLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + } + else + { + /* Use requested length of the key (already set). This will result in a partial copy. */ + } + } + else +#endif + { + /* Use written length of key */ + *resultLengthPtr = writtenKeyLength; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + } + + /* Copy key element if access is allowed */ + if (retVal == E_OK) + { + Crypto_30_LibCv_CopyData(resultPtr, Crypto_30_LibCv_GetAddrKeyStorage(resultIndex), *resultLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetNoShe() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_BinarySearchCryptoKeyId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_BinarySearchCryptoKeyId( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* Check if the found crypto key ID is smaller than the key element end index. */ + if (elementIndex < Crypto_30_LibCv_GetSizeOfKeyElements()) + { + Crypto_30_LibCv_SizeOfKeyType minKey = 0u; + Crypto_30_LibCv_SizeOfKeyType maxKey = (Crypto_30_LibCv_SizeOfKeyType)(Crypto_30_LibCv_GetSizeOfKey()); + Crypto_30_LibCv_SizeOfKeyType middleKey = 0u; + + /* Iterate through the list to find a key whose value is less than the Key Element End Index and + greater than or equal to Key Element Start Index. The element index is less than the maximum element + index and there is no gap between them, so we find the CryptoKeyId and exit the loop. */ + while (minKey < maxKey) /* COV_CRYPTO_30_LIBCV_BINARYSEARCH */ /* FETA_CRYPTO_30_LIBCV_BINARY_SEARCH */ + { + /* Start at the middle and check if the elementIndex is smaller or larger than the beginning of the middle key index. + If it is smaller, set the new middle key value to the middle between 0 and the old middle key. + If it is larger, set the new middle key value to the middle between the old middle key value and the maximum key size. */ + middleKey = (Crypto_30_LibCv_SizeOfKeyType)Crypto_30_LibCv_Math_CalcMiddle(minKey, maxKey); + + if (Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(middleKey) > elementIndex) + { + /* cryptoKeyId must be lower than the middle */ + maxKey = (Crypto_30_LibCv_SizeOfKeyType)(middleKey); + } + else if (Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(middleKey) <= elementIndex) + { + /* cryptoKeyId must be higher than the middle */ + minKey = (Crypto_30_LibCv_SizeOfKeyType)(middleKey + 1u); + } + else + { + *cryptoKeyId = middleKey; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + retVal = E_OK; + /* Key has been found. Leave loop. */ + break; + } + } + + /* If key couldn't be found, retVal is already set to E_NOT_OK */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_BinarySearchCryptoKeyId() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyGetStatus() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyStatusPtr) +{ +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + /* Check if NVM is currently updating the given cryptoKey */ + if (Crypto_30_LibCv_KeyNvStatus_IsKeyUpdatedByNvm(cryptoKeyId)) + { + /* Report update in progress */ + /* [SWS_Crypto_00245] */ + *keyStatusPtr = CRYPTO_KEYSTATUS_UPDATE_IN_PROGRESS; /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + else +#endif + { + Crypto_KeyStatusType localKeyStatus = CRYPTO_KEYSTATUS_VALID; + /* Check if any key element of the given cryptoKey is invalid */ + for (Crypto_30_LibCv_KeyElementsIterType elementIndex = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); elementIndex < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); elementIndex++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* Check if current KeyElement is invalid */ + if (!Crypto_30_LibCv_IsKeyElementValid(elementIndex)) + { + localKeyStatus = CRYPTO_KEYSTATUS_INVALID; + break; + } + } + /* Report validity of key */ + /* [SWS_Crypto_00235] */ + *keyStatusPtr = localKeyStatus; /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } +} /* Crypto_30_LibCv_Local_KeyGetStatus() */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_OFF) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_CopyData_Implementation() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_CopyData_Implementation( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) sourceData, + uint32 dataLength) +{ + uint32_least byteIdx; + /* #10 Copy data bytewise to the target buffer */ + for (byteIdx = 0u; byteIdx < dataLength; byteIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + targetData[byteIdx] = sourceData[byteIdx]; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } +} /* Crypto_30_LibCv_Local_CopyData_Implementation() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_SetData_Implementation() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_SetData_Implementation( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) dataBuf, + uint8 pattern, + uint32 dataLength) +{ + uint32_least byteIdx; + /* #10 Set data bytewise */ + for (byteIdx = 0u; byteIdx < dataLength; byteIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + dataBuf[byteIdx] = pattern; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } +} /* Crypto_30_LibCv_Local_SetData_Implementation() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ClearData_Implementation() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ClearData_Implementation( + P2VAR(uint8, AUTOMATIC, AUTOMATIC) dataBuf, + uint32 dataLength) +{ + /* #10 Clear data bytewise */ + Crypto_30_LibCv_Local_SetData_Implementation(dataBuf, 0x00u, dataLength); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ +} /* Crypto_30_LibCv_Local_ClearData_Implementation() */ +#endif /* (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_OFF) */ + +#if ((CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_CompareData_IsSmaller() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_CompareData_IsSmaller( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) referenceData, + uint32 dataLength) +{ + uint32_least byteIdx; + Std_ReturnType retVal = E_NOT_OK; + /* #10 Compare data bytewise. */ + for (byteIdx = 0u; byteIdx < dataLength; byteIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + if (targetData[byteIdx] < referenceData[byteIdx]) + { + retVal = E_OK; + break; + } + } + return retVal; +} /* Crypto_30_LibCv_Local_CompareData_IsSmaller() */ +#endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockGetNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockGetNotProtected( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + + if ((Crypto_30_LibCv_GetKeyLock(cryptoKeyId) >= CRYPTO_30_LIBCV_KEY_LOCK_FREE) && (Crypto_30_LibCv_GetKeyLock(cryptoKeyId) < CRYPTO_30_LIBCV_KEY_LOCK_READ_MAX)) + { + Crypto_30_LibCv_IncKeyLock(cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyReadLockGetNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected( + uint32 cryptoKeyId) +{ + if (Crypto_30_LibCv_GetKeyLock(cryptoKeyId) > CRYPTO_30_LIBCV_KEY_LOCK_FREE) /* COV_CRYPTO_30_LIBCV_KEY_LOCKING_RELEASE */ + { + Crypto_30_LibCv_DecKeyLock(cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } +} /* Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (Crypto_30_LibCv_GetKeyLock(cryptoKeyId) == CRYPTO_30_LIBCV_KEY_LOCK_FREE) + { + Crypto_30_LibCv_SetKeyLock(cryptoKeyId, CRYPTO_30_LIBCV_KEY_LOCK_WRITE); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected( + uint32 cryptoKeyId) +{ + if (Crypto_30_LibCv_GetKeyLock(cryptoKeyId) == CRYPTO_30_LIBCV_KEY_LOCK_WRITE) /* COV_CRYPTO_30_LIBCV_KEY_LOCKING_RELEASE */ + { + Crypto_30_LibCv_SetKeyLock(cryptoKeyId, CRYPTO_30_LIBCV_KEY_LOCK_FREE); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } +} /* Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockGet( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + retVal = Crypto_30_LibCv_Local_KeyReadLockGetNotProtected(cryptoKeyId); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + return retVal; +} /* Crypto_30_LibCv_Local_KeyReadLockGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockRelease() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockRelease( + uint32 cryptoKeyId) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(cryptoKeyId); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +} /* Crypto_30_LibCv_Local_KeyReadLockRelease() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockGet( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + retVal = Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected(cryptoKeyId); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + return retVal; +} /* Crypto_30_LibCv_Local_KeyWriteLockGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockRelease() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockRelease( + uint32 cryptoKeyId) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(cryptoKeyId); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); +} /* Crypto_30_LibCv_Local_KeyWriteLockRelease() */ +#endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSearch() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSearch( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndex) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_KeyElementsIterType elementIdx; + + /* #10 Iterate over all elements in the key to find a matching key element */ + for (elementIdx = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); elementIdx < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); elementIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (keyElementId == Crypto_30_LibCv_GetIdOfKeyElements(elementIdx)) + { + retVal = E_OK; + *elementIndex = (Crypto_30_LibCv_SizeOfKeyElementsType)elementIdx; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementSearch() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementIdsGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementIdsGet( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyElementIdsPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyElementIdsLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00161] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (keyElementIdsPtr == NULL_PTR) + { + /* [SWS_Crypto_00162] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (keyElementIdsLengthPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00162] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Implementation ------------------------------------------------- */ + Crypto_30_LibCv_KeyElementsIterType elementIndex; + uint32 writeIdx = 0u; + retVal = E_OK; + + /* #20 Iterate over all Key Element Ids */ + for(elementIndex = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(cryptoKeyId); elementIndex < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(cryptoKeyId); elementIndex++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + /* #25 Copy Key Element Id, if the buffer is to small return with error */ + if (writeIdx < *(keyElementIdsLengthPtr)) + { + keyElementIdsPtr[writeIdx] = Crypto_30_LibCv_GetIdOfKeyElements(elementIndex); /* SBSW_CRYPTO_30_LIBCV_ARRAY_ACCESS_WITH_SIZE_CHECK */ + } + else + { + /* provided array is too small to store all element ids */ + retVal = CRYPTO_E_SMALL_BUFFER; + /* [SWS_Crypto_00164] Check that provided buffer is big enough */ + errorId = CRYPTO_E_SMALL_BUFFER; + break; + } + + writeIdx++; + } + + /* #30 save written data length */ + *keyElementIdsLengthPtr = writeIdx; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS_WITH_DET_CHECK */ + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #40 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_ELEMENT_IDS_GET, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyElementIdsGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyCopy() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyCopy( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00156] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00157] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (targetCryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00158] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + /* #16 Check if source and target key IDs are the same */ + else if (cryptoKeyId == targetCryptoKeyId) + { + /* Source and target shall not be the same, retVal remains on E_NOT_OK. */ + } + else + /* ----- Implementation ------------------------------------------------- */ + { +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #17 Lock write access for the target CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(targetCryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #18 Lock read access for the source CryptoKey */ + if (Crypto_30_LibCv_Local_KeyReadLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { + /* #19 Copy keys internally */ + retVal = Crypto_30_LibCv_KeyCopy_Internal(cryptoKeyId, targetCryptoKeyId); + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockRelease(cryptoKeyId); +#endif + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(targetCryptoKeyId); +#endif + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #40 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_COPY, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyCopy() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementCopy() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementCopy( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc = 0u; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst = 0u; + uint8 errorId = CRYPTO_E_PARAM_HANDLE; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00149] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00150] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (targetCryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00151] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* #20 Find source element. Otherwise return with Error. */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndexSrc) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* ----- Implementation ------------------------------------------------- */ + /* [SWS_Crypto_00152] if keyElementId is out of valid range return E_NOT_OK */ + /* [SWS_Crypto_00153] if targetKeyElementId is out of valid range return E_NOT_OK */ + retVal = E_NOT_OK; + } + else + { + /* ----- Implementation ------------------------------------------------- */ + /* #25 Find destination element. Otherwise return with Error. */ + if (Crypto_30_LibCv_Local_KeyElementSearch(targetCryptoKeyId, targetKeyElementId, &elementIndexDst) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00152] Check that keyElementId is in valid range */ + /* [SWS_Crypto_00153] Check that targetKeyElementId is in valid range */ + errorId = CRYPTO_E_NO_ERROR; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #30 Lock write access for the target CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(targetCryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { + /* #35 Lock read access for the source CryptoKey if necessary */ + /* #40 copy key element with Crypto_30_LibCv_Local_KeyElementCopy */ + if (cryptoKeyId == targetCryptoKeyId) + { + retVal = Crypto_30_LibCv_Local_KeyElementCopy(elementIndexSrc, elementIndexDst, targetCryptoKeyId); + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + else if (Crypto_30_LibCv_Local_KeyReadLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } +#endif + else + { + retVal = Crypto_30_LibCv_Local_KeyElementCopy(elementIndexSrc, elementIndexDst, targetCryptoKeyId); +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockRelease(cryptoKeyId); +#endif + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(targetCryptoKeyId); +#endif + } + } + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #50 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_ELEMENT_COPY, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + return retVal; +} /* Crypto_30_LibCv_KeyElementCopy() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementCopyPartial() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060, 6080 8 */ /* MD_MSR_STPAR, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementCopyPartial( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexSrc = 0u; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndexDst = 0u; + uint8 errorId = CRYPTO_E_PARAM_HANDLE; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00205] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00206] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (targetCryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00206] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* #20 Find source element. Otherwise return with Error. */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndexSrc) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* ----- Implementation ------------------------------------------------- */ + /* [SWS_Crypto_00206] if keyElementId is out of valid range return E_NOT_OK */ + /* [SWS_Crypto_00206] if targetKeyElementId is out of valid range return E_NOT_OK */ + } + else + { + /* ----- Implementation ------------------------------------------------- */ + /* #25 Find destination element. Otherwise return with Error. */ + if (Crypto_30_LibCv_Local_KeyElementSearch(targetCryptoKeyId, targetKeyElementId, &elementIndexDst) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00206] Check that keyElementId is in valid range */ + /* [SWS_Crypto_00206] Check that targetKeyElementId is in valid range */ + errorId = CRYPTO_E_NO_ERROR; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #30 Lock write access for the target CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(targetCryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { + /* #35 Lock read access for the source CryptoKey if necessary */ + /* #40 copy key element with Crypto_30_LibCv_Local_KeyElementCopyPartial */ + if (cryptoKeyId == targetCryptoKeyId) + { + retVal = Crypto_30_LibCv_Local_KeyElementCopyPartial(elementIndexSrc, elementIndexDst, targetCryptoKeyId, keyElementSourceOffset, keyElementTargetOffset, keyElementCopyLength); /* PRQA S 2963, 2982 */ /* MD_CRYPTO_30_LIBCV_2963, MD_MSR_RetVal */ + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + else if (Crypto_30_LibCv_Local_KeyReadLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } +#endif + else + { + retVal = Crypto_30_LibCv_Local_KeyElementCopyPartial(elementIndexSrc, elementIndexDst, targetCryptoKeyId, keyElementSourceOffset, keyElementTargetOffset, keyElementCopyLength); +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockRelease(cryptoKeyId); +#endif + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(targetCryptoKeyId); +#endif + } + } + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #50 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_ELEMENT_COPY_PARTIAL, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + return retVal; +} /* Crypto_30_LibCv_KeyElementCopyPartial() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSetInternalStandard() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSetInternalStandard( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_KeyStorageIterType keyStorageIndex; + uint32 maxLength = Crypto_30_LibCv_GetKeyElementLength(elementIndex); + + keyStorageIndex = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndex); + /* #10 Copy keyPtr to key storage. */ + + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), keyPtr, keyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + /* #15 If the new written length is shorter than the old, delete the rest of the old key. */ + if (maxLength > keyLength) + { + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex + keyLength), (uint32)(maxLength - keyLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + + retVal = Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch(elementIndex, keyLength); + + return retVal; +} /* Crypto_30_LibCv_KeyElementSetInternalStandard() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ + Crypto_30_LibCv_KeyStorageIterType keyStorageIndex; + uint32 maxLength = Crypto_30_LibCv_GetKeyElementLength(elementIndex); + + keyStorageIndex = Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(elementIndex); + /* #10 Copy keyPtr to key storage. */ + + Crypto_30_LibCv_CopyData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex), keyPtr, keyLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + /* #15 If the new written length is shorter than the old, delete the rest of the old key. */ + if (maxLength > keyLength) + { + Crypto_30_LibCv_ClearData(Crypto_30_LibCv_GetAddrKeyStorage(keyStorageIndex + keyLength), (uint32)(maxLength - keyLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(cryptoKeyId, elementIndex, keyLength); +} /* Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSetInternal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSetInternal( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* ----- Implementation ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + if ((writeAccess != CRYPTO_30_LIBCV_WA_ENCRYPTED) && + Crypto_30_LibCv_IsSheKey(elementIndex)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + else +#endif + { + { + /* #10 Check if it is a write once key which is written already. */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + /* #20 Copy data if there is enough free space */ + /* Check if the available data is not bigger than the maximum size of the destination element */ + else if ((keyLength == Crypto_30_LibCv_GetKeyElementLength(elementIndex)) || + ((Crypto_30_LibCv_IsKeyElementPartial(elementIndex) == TRUE) && + (keyLength <= Crypto_30_LibCv_GetKeyElementLength(elementIndex)))) + { + if (writeAccess >= (Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(elementIndex)))) + { + Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId(cryptoKeyId, elementIndex, keyPtr, keyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + retVal = E_OK; + } + else + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + } + else + { + /* Key length is to large */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; /* [SWS_Crypto_00146] */ + } + } + } + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementSetInternal() */ + +#if ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* [SWS_Crypto_91004] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Find key element, otherwise return with Error */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else + { + /* #15 Set Key Element internally */ + retVal = Crypto_30_LibCv_Local_KeyElementSetInternal(cryptoKeyId, elementIndex, keyPtr, keyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (retVal == E_OK) + { + Crypto_30_LibCv_Local_SetKeyElementStateWritten(elementIndex); + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementSet() */ +#endif /* ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* [SWS_Crypto_91004] */ +/* PRQA S 6030, 6050, 6080 5 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00075] */ + } + /* #15 Check plausibility of parameters */ + else if (keyPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; /* [SWS_Crypto_00078] */ + } + else +# if (CRYPTO_30_LIBCV_KEY_ELEMENT_DELETE == STD_OFF) + if (keyLength == 0u) + { + errorId = CRYPTO_E_PARAM_VALUE; /* [SWS_Crypto_00079] */ + } + else +# endif +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + errorId = CRYPTO_E_PARAM_HANDLE; /* [SWS_Crypto_00076] */ + } + else + { + /* ----- Implementation ------------------------------------------------- */ + /* ----- Local Variables ------------------------------------------------ */ + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex = 0u; + + /* ----- Implementation ------------------------------------------------- */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #20 Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { +#if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) + /* Check if it is She DEBUG_CMD */ + if (Crypto_30_LibCv_She_IsDebugCmd(cryptoKeyId, keyElementId)) + { +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (GetApplicationID() == Crypto_30_LibCv_MainApplicationId) +# endif + { + retVal = Crypto_30_LibCv_She_DebugCmd_SetAuthorizationAndLock(keyPtr, keyLength); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } + } + else +#endif + /* #23 Find key element, otherwise return with Error */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00077] check if keyElementId is in valid range */ + errorId = CRYPTO_E_PARAM_HANDLE; + retVal = E_NOT_OK; + } + else + { + /* #25 Set Key Element internally */ + retVal = Crypto_30_LibCv_Local_KeyElementSetInternal(cryptoKeyId, elementIndex, keyPtr, keyLength, CRYPTO_30_LIBCV_WA_ALLOWED); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ +#if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (GetApplicationID() == Crypto_30_LibCv_MainApplicationId) +# endif + { + if ((retVal == CRYPTO_E_KEY_SIZE_MISMATCH) || + (retVal == CRYPTO_E_KEY_WRITE_FAIL)) + { + /* [SWS_Crypto_00146] */ + /* #30 Else: if key size matching update using SHE key update protocol */ + retVal = Crypto_30_LibCv_Local_KeyElementSetShe(cryptoKeyId, elementIndex, keyPtr, keyLength, retVal); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } + } +#endif + + if (retVal == E_OK) + { + /* Keep write once flag this can be set with M1M2M3. */ + Crypto_30_LibCv_ClearKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_NORMAL_MASK | CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + if (Crypto_30_LibCv_IsKeyElementWriteOnce(elementIndex)) + { + Crypto_30_LibCv_SetKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + } + } + } +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(cryptoKeyId); +#endif + } + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #40 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_ELEMENT_SET, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyElementSet() */ + +#if ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219_1 */ + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) keyLengthPtr, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + /* Check if keyElementId is available */ + retVal = Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, elementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal != E_OK) + { + /* Parse return value */ + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + else +# if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + if (Crypto_30_LibCv_IsSheKey(*elementIndexPtr)) + { + /* Access not allowed due to she key */ + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + else +# endif + /* Check if it is a write once key which is written already. */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(*elementIndexPtr, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + else if (writeAccess >= (Crypto_30_LibCv_GetWriteOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(*elementIndexPtr)))) + { + /* Access allowed due to access permission check */ + /* Get configured key element length */ + *keyLengthPtr = Crypto_30_LibCv_GetKeyElementLength(*elementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else + { + retVal = CRYPTO_E_KEY_WRITE_FAIL; + } + + return retVal; +} /* Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219_1 */ + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndexPtr, + uint32 requestedKeyLength, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + uint32 keyLength; + + /* ----- Implementation ----------------------------------------------- */ + /* Check if keyElementId is available */ + retVal = Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess(cryptoKeyId, /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + keyElementId, + elementIndexPtr, + &keyLength, + writeAccess); + + if (retVal == E_OK) + { + if (keyLength < requestedKeyLength) + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + else if ((keyLength > requestedKeyLength) && (Crypto_30_LibCv_IsKeyElementPartial(*elementIndexPtr) == FALSE)) + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + else + { + /* retVal is already set */ + } + } + + return retVal; +} /* Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength() */ +#endif /* ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEYWRAP == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeySetValid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* [SWS_Crypto_91014] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeySetValid( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + boolean writeBlock; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00196] 4.3.1, [SWS_Crypto_00082] 4.3.0 */ + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + errorId = CRYPTO_E_PARAM_HANDLE; /* [SWS_Crypto_00197] 4.3.1, [SWS_Crypto_00083] 4.3.0 */ + } + else + { + /* ----- Implementation ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #17 Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { + /* #20 Set the given KeyId valid */ + writeBlock = Crypto_30_LibCv_Internal_KeySetValid(cryptoKeyId); + +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey(cryptoKeyId); +#endif +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(cryptoKeyId); +#endif + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (writeBlock) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(cryptoKeyId)); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(writeBlock); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + retVal = E_OK; + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #25 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_SET_VALID, /* == CRYPTO_30_LIBCV_SID_KEY_VALID_SET */ + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeySetValid() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyValidSet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ + /* [SWS_Crypto_91014] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyValidSet( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + retVal = Crypto_30_LibCv_KeySetValid(cryptoKeyId); + + return retVal; +} /* Crypto_30_LibCv_KeyValidSet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeySetInvalid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ + /* [SWS_Crypto_91020] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeySetInvalid( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + boolean writeBlock; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00236] */ + } + else +#endif + /* Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + errorId = CRYPTO_E_PARAM_HANDLE; /* [SWS_Crypto_00237] */ + } + else + { + /* ----- Implementation ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +#endif + { + /* [SWS_Crypto_00238] */ + /* Set the given KeyId invalid */ + writeBlock = Crypto_30_LibCv_Internal_KeySetInvalid(cryptoKeyId); + +#if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey(cryptoKeyId); +#endif +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(cryptoKeyId); +#endif + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (writeBlock) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(cryptoKeyId)); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(writeBlock); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + retVal = E_OK; + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_SET_INVALID, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeySetInvalid() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + /* ----- Implementation ------------------------------------------------- */ +#if ((CRYPTO_30_LIBCV_SHEKEYS == STD_ON) && (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON)) + /* Check if we are allowed to access the key regarding SHE */ + boolean access = FALSE; + /* If the key element is not SHE: allowed */ + if (!Crypto_30_LibCv_IsSheKey(elementIndex)) + { + access = TRUE; + } + else + { + /* If the key element is SHE and we are accessing with a SHE service: Check the FID */ + if (serviceType != CRYPTO_30_LIBCV_SHE_SERVICE_OTHER) + { + access = Crypto_30_LibCv_Local_KeyElementGetSheCheckFid(elementIndex, serviceType); + } + } + + if (access == FALSE) + { + retVal = CRYPTO_E_KEY_READ_FAIL; + } + else +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(serviceType); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + { + { + /* Get storage index of the key element */ + retVal = Crypto_30_LibCv_Local_KeyElementGet_Standard(resultIndexPtr, (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))resultLengthPtr, elementIndex, lengthCheck); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* [SWS_Crypto_91006] */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex = 0u; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Search Key Element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + retVal = CRYPTO_E_KEY_NOT_AVAILABLE; + } + /* #15 Check if the Key element is valid */ + else if (FALSE == Crypto_30_LibCv_IsKeyElementValid(elementIndex)) + { + /* [SWS_Crypto_00039] */ + retVal = CRYPTO_E_KEY_NOT_VALID; + } + else + { + /* #20 Get Key Element */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic(elementIndex, resultIndexPtr, resultLengthPtr, lengthCheck, serviceType); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndex() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndex( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + /* # Get key element storage index. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended(cryptoKeyId, keyElementId, resultIndexPtr, resultLengthPtr, lengthCheck, CRYPTO_30_LIBCV_SHE_SERVICE_OTHER); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetStorageIndex() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + /* # Get key element storage index. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended(cryptoKeyId, keyElementId, resultIndexPtr, resultLengthPtr, lengthCheck, CRYPTO_30_LIBCV_SHE_SERVICE_OTHER); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* # Parse allowed return values for job processing. */ + if (retVal == E_OK) + { + + } + else if (retVal == CRYPTO_E_KEY_NOT_VALID) + { + + } + else if (retVal == CRYPTO_E_SMALL_BUFFER) + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + else + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + /* # Get key element storage index. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended(cryptoKeyId, keyElementId, resultIndexPtr, resultLengthPtr, lengthCheck, CRYPTO_30_LIBCV_SHE_SERVICE_OTHER); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* # Parse allowed return values for job processing. */ + if (retVal == E_OK) + { + + } + else if (retVal == CRYPTO_E_KEY_NOT_VALID) + { + + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + + } + else + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + + return retVal; +} /* Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetElementsIndexJob() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetElementsIndexJob( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType numberOfElements, + Crypto_30_LibCv_LengthCheckType lengthCheck + ) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_KeyElementGetSizeType i; + + /* Iterate over the given number of key elements */ + for (i = 0; i < numberOfElements; i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + /* Get the storage index for each key element*/ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(cryptoKeyId, keyElements[i].keyElementId, &keyElements[i].keyElementIndex, &keyElements[i].keyElementLength, lengthCheck); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + if (retVal != E_OK) + { + break; + } + } + return retVal; +} /* Crypto_30_LibCv_Local_GetElementsIndexJob() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ElementGetterSetId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ElementGetterSetId( + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType elementNumber, + uint32 keyElementId) +{ + keyElements[elementNumber].keyElementId = keyElementId; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ +} /* Crypto_30_LibCv_Local_ElementGetterSetId() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ElementGetterSetIdAndLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* [SWS_Crypto_91006] */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ElementGetterSetIdAndLength( + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType elementNumber, + uint32 keyElementId, + uint32 keyLength) +{ + keyElements[elementNumber].keyElementId = keyElementId; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + keyElements[elementNumber].keyElementLength = keyLength; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ +} /* Crypto_30_LibCv_Local_ElementGetterSetIdAndLength() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementGet() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* [SWS_Crypto_91006] */ +/* PRQA S 6080 5 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00085] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (resultPtr == NULL_PTR) + { + /* [SWS_Crypto_00088] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (resultLengthPtr == NULL_PTR) + { + /* [SWS_Crypto_00089] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (*resultLengthPtr == 0u) + { + /* [SWS_Crypto_00090] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00086] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + retVal = Crypto_30_LibCv_Local_KeyElementGet(cryptoKeyId, keyElementId, resultPtr, resultLengthPtr, &errorId); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #90 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_ELEMENT_GET, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyElementGet() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RandomSeed() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* [SWS_Crypto_91013] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00128] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (entropyPtr == NULL_PTR) + { + /* [SWS_Crypto_00130] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (entropyLength == 0u) + { + /* [SWS_Crypto_00131] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00129] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { +#if ((CRYPTO_30_LIBCV_FIPS186 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) + retVal = Crypto_30_LibCv_Local_RandomSeed(cryptoKeyId, entropyPtr, entropyLength); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ +#else + retVal = E_NOT_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(entropyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(entropyLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #25 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_RANDOM_SEED, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_RandomSeed() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +/* [SWS_Crypto_91007] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyGenerate( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00094] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00095] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Implementation ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON) + retVal = Crypto_30_LibCv_Local_KeyGenerate(cryptoKeyId); +#else + retVal = E_NOT_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #20 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_GENERATE, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyGenerate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyDerive() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* [SWS_Crypto_91008] */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00097] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00098] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (targetCryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00180] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Implementation ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) + boolean writeBlock = FALSE; +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #30 Lock write access for the target CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(targetCryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +# endif + { + /* #35 Lock read access for the source CryptoKey if necessary */ + /* #40 derive key element with Crypto_30_LibCv_Local_KeyDerive */ + if (cryptoKeyId == targetCryptoKeyId) + { + retVal = Crypto_30_LibCv_Local_KeyDerive(cryptoKeyId, targetCryptoKeyId, &writeBlock); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + else if (Crypto_30_LibCv_Local_KeyReadLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } +# endif + else + { + retVal = Crypto_30_LibCv_Local_KeyDerive(cryptoKeyId, targetCryptoKeyId, &writeBlock); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyReadLockRelease(cryptoKeyId); +# endif + } + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(targetCryptoKeyId); +# endif + +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (writeBlock) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(targetCryptoKeyId)); + } +# endif + } +#else + retVal = E_NOT_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(targetCryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #80 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, CRYPTO_30_LIBCV_INSTANCE_ID, CRYPTO_30_LIBCV_SID_KEY_DERIVE, errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyDerive() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyExchangeCalcPubVal() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* [SWS_Crypto_91009] */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_API_REQUIREMENT */ + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_API_REQUIREMENT */ +{ + /* ----- Local Variables ------------------------------------------------ */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00103] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (publicValuePtr == NULL_PTR) + { + /* [SWS_Crypto_00105] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (publicValueLengthPtr == NULL_PTR) + { + /* [SWS_Crypto_00106] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (*publicValueLengthPtr == 0u) + { + /* [SWS_Crypto_00107] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00104] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + /* The retVal is already captured in the methods body. */ + /* [SWS_Crypto_00110] */ + else + { + /* ----- Implementation ------------------------------------------------- */ + +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) + /* #20 Calculate Public Value */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcPubVal(cryptoKeyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + if (retVal == CRYPTO_E_SMALL_BUFFER) + { + /* [SWS_Crypto_00110] */ + errorId = CRYPTO_E_PARAM_VALUE; + } +# endif +#else + retVal = E_NOT_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(publicValuePtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(publicValueLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #30 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_EXCHANGE_CALC_PUB_VAL, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyExchangeCalcPubVal() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyExchangeCalcSecret() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* [SWS_Crypto_91010] */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00111] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (partnerPublicValuePtr == NULL_PTR) + { + /* [SWS_Crypto_00113] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (partnerPublicValueLength == 0u) + { + /* [SWS_Crypto_00115] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00112] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Runtime Error Check ------------------------------------------------- */ +#if (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) + /* #20 Calculate Secret Value */ + retVal = Crypto_30_LibCv_Local_KeyExchangeCalcSecret(cryptoKeyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ +#else + retVal = E_NOT_OK; + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(partnerPublicValuePtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(partnerPublicValueLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #45 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_EXCHANGE_CALC_SECRET, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyExchangeCalcSecret() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_CertificateParse() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CertificateParse( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00168] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif + /* #15 Check plausibility of parameters */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00169] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Implementation ------------------------------------------------- */ + + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #20 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_CERTIFICATE_PARSE, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_CertificateParse() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_CertificateVerify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ + +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CertificateVerify( + uint32 cryptoKeyId, + uint32 verifyCryptoKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + /* [SWS_Crypto_00172] */ + errorId = CRYPTO_E_UNINIT; + } + /* #15 Check plausibility of parameters */ + else if (verifyPtr == NULL_PTR) + { + /* [SWS_Crypto_00175] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00173] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (verifyCryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + /* [SWS_Crypto_00174] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else + { + /* ----- Implementation ------------------------------------------------- */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(verifyCryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #20 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_CERTIFICATE_VERIFY, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_CertificateVerify() */ + +#if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_Init() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_Init( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + /* ----- Implementation ------------------------------------------------- */ + Crypto_30_LibCv_SetNvBlockState(blockIdx, CRYPTO_30_LIBCV_NVBLOCK_STATE_IDLE); /* SBSW_CRYPTO_30_LIBCV_CSL02_NV_BLOCK */ +} /* Crypto_30_LibCv_NvBlock_State_Init() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(void, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBuffer) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr = (P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))NvMBuffer; /* PRQA S 0316 */ /* MD_CRYPTO_30_LIBCV_0316 */ + uint8 errorId = CRYPTO_E_NO_ERROR; + +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + else if (NvMBuffer == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +# endif + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_KeyIterType lockedKeyIdx; + boolean locked = FALSE; + + /* Lock keys for write access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (lockedKeyIdx = 0u; lockedKeyIdx < Crypto_30_LibCv_GetSizeOfKey(); lockedKeyIdx++) + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(lockedKeyIdx) == blockIdx) + { + locked = TRUE; + if (Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected((uint32)lockedKeyIdx) != E_OK) + { + locked = FALSE; + break; + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + if (locked == TRUE) +# endif + { + /* Copy Buffer to Key Storage */ + retVal = Crypto_30_LibCv_NvBlock_ReadFromBlock_Copy(blockIdx, NvMBufferPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + } + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + { + Crypto_30_LibCv_KeyIterType releaseKeyIdx; + /* Release keys for write access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (releaseKeyIdx = 0; releaseKeyIdx < lockedKeyIdx; releaseKeyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(releaseKeyIdx) == blockIdx) + { + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected((uint32)releaseKeyIdx); + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + } +# endif + } +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_NVBLOCK_READFROMBLOCK, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* Crypto_30_LibCv_NvBlock_ReadFromBlock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(void, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBuffer) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBufferPtr = (P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))NvMBuffer; /* PRQA S 0316 */ /* MD_CRYPTO_30_LIBCV_0316 */ + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + else if (NvMBuffer == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ------------------------------------------------- */ +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_KeyIterType lockedKeyIdx; + boolean locked = FALSE; + + /* Lock keys for read access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (lockedKeyIdx = 0u; lockedKeyIdx < Crypto_30_LibCv_GetSizeOfKey(); lockedKeyIdx++) + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(lockedKeyIdx) == blockIdx) + { + locked = TRUE; + if (Crypto_30_LibCv_Local_KeyReadLockGetNotProtected((uint32)lockedKeyIdx) != E_OK) + { + locked = FALSE; + break; + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + + if (locked == TRUE) +# endif + { + /* Copy Key Storage to Buffer. */ + Crypto_30_LibCv_NvBlock_WriteToBlock_Copy(blockIdx, NvMBufferPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_AND_ACCESS_TO_NVBUFFER */ + /* Update KeyNvStatus of keys of NvBlock */ + Crypto_30_LibCv_KeyNvStatus_NvCopied(blockIdx); + retVal = E_OK; + } + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + { + Crypto_30_LibCv_KeyIterType releaseKeyIdx; + /* Release keys for read access. */ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + for (releaseKeyIdx = 0; releaseKeyIdx < lockedKeyIdx; releaseKeyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(releaseKeyIdx) == blockIdx) + { + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected((uint32)releaseKeyIdx); + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1(); + } +# endif + } +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_NVBLOCK_WRITETOBLOCK, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* Crypto_30_LibCv_NvBlock_WriteToBlock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Init() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 2 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Init( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + Crypto_30_LibCv_KeyIterType keyIdx; + Crypto_30_LibCv_KeyElementsIterType elementIndex; +# if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + Crypto_30_LibCv_SheKeysIterType sheKeyIndex; +# endif + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + else +# endif + { + /* ----- Implementation ------------------------------------------------- */ + retVal = E_OK; + Crypto_30_LibCv_NvBlock_State_Init(blockIdx); + + /* Initialize keys */ + for (keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKey(); keyIdx++) + { + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + for (elementIndex = Crypto_30_LibCv_GetKeyElementsStartIdxOfKey(keyIdx); elementIndex < Crypto_30_LibCv_GetKeyElementsEndIdxOfKey(keyIdx); elementIndex++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA */ + { + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + Crypto_30_LibCv_Init_Key(elementIndex, TRUE); + } + } + } + } + + /* Initialize she keys */ +# if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) + for (sheKeyIndex = 0u; sheKeyIndex < Crypto_30_LibCv_GetSizeOfSheKeys(); sheKeyIndex++) + { + keyIdx = Crypto_30_LibCv_GetKeyIdxOfSheKeys(sheKeyIndex); + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + elementIndex = Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(sheKeyIndex); + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex)) + { + Crypto_30_LibCv_Init_KeySheAdditional(elementIndex); + } + } + } +# endif + } +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_NVBLOCK_INIT, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* Crypto_30_LibCv_NvBlock_Init() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Callback() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Callback( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + uint8 ServiceId, + NvM_RequestResultType JobResult) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; + } + else +# endif + { + /* ----- Implementation ------------------------------------------------- */ + retVal = E_OK; + switch (ServiceId) + { + case CRYPTO_30_LIBCV_NVM_WRITE_BLOCK: +# if (CRYPTO_30_LIBCV_NVM_WRITE_BLOCK != CRYPTO_30_LIBCV_NVM_WRITE_ALL) /* For compatibility to ASR 20-11 */ + case CRYPTO_30_LIBCV_NVM_WRITE_ALL: +# endif + { + Crypto_30_LibCv_NvBlock_State_CallbackWrittenToBlock(blockIdx); + Crypto_30_LibCv_KeyNvStatus_NvBlockCallback(blockIdx, JobResult); + break; + } + + default: + /* Service not handled. */ + break; + } + /* ----- Development Error Report --------------------------------------- */ + } +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_NVBLOCK_CALLBACK, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* Crypto_30_LibCv_NvBlock_Callback() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_InitKey() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_InitKey(uint32 cryptoKeyId) +{ + /* Set KeyNvStatus of current key to NV_SYNC */ + Crypto_30_LibCv_SetKeyNvStatus(cryptoKeyId, CRYPTO_30_LIBCV_KEY_NV_STATUS_NOT_NV); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ +} /* Crypto_30_LibCv_KeyNvStatus_InitKey() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_ReadFromBlock() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_ReadFromBlock(Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Loop through all cryptoKeys */ + for (uint32 keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKeyNvStatus(); keyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + /* Check if current key is referenced to the given NvBlock */ + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + /* Set KeyNvStatus of current key to NV_SYNC */ + Crypto_30_LibCv_SetKeyNvStatus(keyIdx, CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_SYNC); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_KeyNvStatus_ReadFromBlock() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected(uint32 cryptoKeyId, Crypto_30_LibCv_SizeOfKeyElementsType elementIdx) +{ + /* If key is referenced to a NvBlock */ + if (Crypto_30_LibCv_IsKeyElementPersist(elementIdx)) + { + /* Check if key is in NV_WRITE_REQ */ + if (Crypto_30_LibCv_GetKeyNvStatus(cryptoKeyId) == CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_WRITE_REQ) + { + /* Stay in this state */ + } + else + { + /* Set KEY_CHANGED state */ + Crypto_30_LibCv_SetKeyNvStatus(cryptoKeyId, CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_CHANGED); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + } +} /* Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_KeyChanged() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_KeyChanged(uint32 cryptoKeyId, Crypto_30_LibCv_SizeOfKeyElementsType elementIdx) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected(cryptoKeyId, elementIdx); + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_KeyNvStatus_KeyChanged() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvWriteReq() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvWriteReq(Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Loop through all cryptoKeys */ + for (uint32 keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKeyNvStatus(); keyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + /* Check if current key is referenced to the given NvBlock */ + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + /* Check if key has changed by checking the KEY_CHANGED bit */ + if ((Crypto_30_LibCv_GetKeyNvStatus(keyIdx) & CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED) == CRYPTO_30_LIBCV_KEY_NV_STATUS_MASK_KEY_CHANGED) + { + /* Set KeyNvStatus of current key to NV_WRITE_REQ */ + Crypto_30_LibCv_SetKeyNvStatus(keyIdx, CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_WRITE_REQ); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_KeyNvStatus_NvWriteReq() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvCopied() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvCopied(Crypto_30_LibCv_SizeOfNvBlockType blockIdx) +{ + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Loop through all cryptoKeys */ + for (uint32 keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKeyNvStatus(); keyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + /* Check if current key is referenced to the given NvBlock */ + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + /* Check if key is in state NV_WRITE_REQ or KEY_CHANGED */ + /* All keys of a block are copied when writing. This means that a key that has only changed is also updated by the NvM. */ + if ((Crypto_30_LibCv_GetKeyNvStatus(keyIdx) == CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_WRITE_REQ) || + (Crypto_30_LibCv_GetKeyNvStatus(keyIdx) == CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_CHANGED)) + { + /* Set KeyNvStatus of current key to KEY_COPIED */ + Crypto_30_LibCv_SetKeyNvStatus(keyIdx, CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_COPIED); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_KeyNvStatus_NvCopied() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvBlockCallback() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvBlockCallback(Crypto_30_LibCv_SizeOfNvBlockType blockIdx, NvM_RequestResultType jobResult) +{ + /* Define the next state depending on the job result of the callback */ + Crypto_30_LibCv_KeyNvStatusType nextState = (jobResult == NVM_REQ_OK) ? CRYPTO_30_LIBCV_KEY_NV_STATUS_NV_SYNC : CRYPTO_30_LIBCV_KEY_NV_STATUS_WRITE_FAILED; + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* Loop through all cryptoKeys */ + for (uint32 keyIdx = 0u; keyIdx < Crypto_30_LibCv_GetSizeOfKeyNvStatus(); keyIdx++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_UNCHANGED_UPPER_BOUND_STATIC_GENDATA */ + { + /* Check if current key is referenced to the given NvBlock */ + if (Crypto_30_LibCv_GetNvBlockIdxOfKey(keyIdx) == blockIdx) + { + /* Check if key is in state KEY_COPIED */ + if (Crypto_30_LibCv_GetKeyNvStatus(keyIdx) == CRYPTO_30_LIBCV_KEY_NV_STATUS_KEY_COPIED) + { + /* Set KeyNvStatus of current key to NV_SYNC or WRITE_FAIL depending on jobResult */ + Crypto_30_LibCv_SetKeyNvStatus(keyIdx, nextState); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); +} /* Crypto_30_LibCv_KeyNvStatus_NvBlockCallback() */ + +#endif /* (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) */ + +#if(CRYPTO_30_LIBCV_KEYSETVALIDJOB == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySetValidJob() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/* [SWS_Crypto_91014] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySetValidJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* #10 Set the given KeyId valid */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, Crypto_30_LibCv_Internal_KeySetValid(job->cryptoKeyId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + } + return E_OK; +} /* Crypto_30_LibCv_Dispatch_KeySetValidJob() */ +#endif /* (CRYPTO_30_LIBCV_KEYSETVALIDJOB == STD_ON) */ + +#if(CRYPTO_30_LIBCV_KEYSETINVALIDJOB == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySetInvalidJob() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* [SWS_Crypto_91014] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySetInvalidJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + /* Set key invalid */ + /* Foward write request */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, Crypto_30_LibCv_Internal_KeySetInvalid(job->cryptoKeyId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + return E_OK; +} /* Crypto_30_LibCv_Dispatch_KeySetInvalidJob() */ +#endif /* (CRYPTO_30_LIBCV_KEYSETINVALIDJOB == STD_ON) */ + +#if(CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SheCmdGetId() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6050,6080 4 */ /* MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SheCmdGetId( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + Std_ReturnType retVal = E_NOT_OK, localRet; + Crypto_30_LibCv_SizeOfSheKeysType indexOfSheMasterKey = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType uIdStorageIndex, masterKeyStorageIndex; + uint32 length; + uint8 result[CRYPTO_30_LIBCV_SIZEOF_CMAC]; + uint8 buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_CMD_GET_ID_OUTPUT]; + uint8 status; + + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + P2VAR(eslt_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSheCmdGetId(Crypto_30_LibCv_GetSheCmdGetIdIdxOfObjectInfo(objectId)); + + /* #10 Get Master Key She Idx */ + /* Find key can be voided because master key must be available for cmd get id */ + (void)Crypto_30_LibCv_GetSheKey(CRYPTO_30_LIBCV_SHE_M1_ECU_MASTER_KEY_ID, CRYPTO_30_LIBCV_SHE_PAGE0, &indexOfSheMasterKey); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* #20 The input must have a length of 16 bytes, the crypto key must be set to the master key and must also be valid */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == CRYPTO_30_LIBCV_SIZEOF_SHE_CHALLENGE) && + (Crypto_30_LibCv_GetKeyIdxOfSheKeys(indexOfSheMasterKey) == job->cryptoKeyId) && + (Crypto_30_LibCv_IsKeyElementValid(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfSheMasterKey)))) + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #30 Lock key for reading */ + if (Crypto_30_LibCv_Local_KeyReadLockGet(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate()) == E_OK) +# endif + { + /* #40 Get she status */ + localRet = Crypto_30_LibCv_She_Cmd_Get_Status(&status); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* #50 Get UID */ + length = CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID; + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndex(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate(), CRYPTO_KE_CUSTOM_SHE_UID, &uIdStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + /* #60 Get Master Key */ + length = CRYPTO_30_LIBCV_SIZEOF_SHE_KEY; + localRet |= Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic(Crypto_30_LibCv_GetKeyElementsKeyIdxOfSheKeys(indexOfSheMasterKey), &masterKeyStorageIndex, &length, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE); /* COV_CRYPTO_30_LIBCV_SHE_KEY_CONFIGURATION_2 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (localRet == E_OK) + { + /* MAC = CMAC[ 16 bytes CHALLENGE | 15 bytes UID | 1 byte STATUS ] with Master K */ + Crypto_30_LibCv_CopyData(buffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, CRYPTO_30_LIBCV_SIZEOF_SHE_CHALLENGE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_CHALLENGE], Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_CHALLENGE + CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID], &status, CRYPTO_30_LIBCV_SIZEOF_SHE_STATUS); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* #70 Calculate Mac */ + if (Crypto_30_LibCv_SheKeyUpdateCmac(buffer, CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER, Crypto_30_LibCv_GetAddrKeyStorage(masterKeyStorageIndex), result, workspace) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { + /* Output = [ 15 bytes UID | 1 byte STATUS | 16 bytes CMAC ] */ + Crypto_30_LibCv_CopyData(buffer, Crypto_30_LibCv_GetAddrKeyStorage(uIdStorageIndex), CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID], &status, CRYPTO_30_LIBCV_SIZEOF_SHE_STATUS); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&buffer[CRYPTO_30_LIBCV_SIZEOF_SHE_M1_UID + CRYPTO_30_LIBCV_SIZEOF_SHE_STATUS], result, CRYPTO_30_LIBCV_SIZEOF_CMAC); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* Adapt output size */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = CRYPTO_30_LIBCV_SIZEOF_ENC_BUFFER; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* #80 Copy result to output buffer */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, buffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + retVal = E_OK; + } + } +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #90 Unlock Key */ + Crypto_30_LibCv_Local_KeyReadLockRelease(Crypto_30_LibCv_GetSheInfoKeyRefOfSheKeyUpdate()); +# endif + } + } + } + else + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SheCmdGetId() */ +#endif /* (CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_GetKeyFlags() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6030 3 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_GetKeyFlags( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_KeyFlagType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyFlagsPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex = 0u; + + /* ----- Implementation ------------------------------------------------- */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + /* Get elementIndex, keyElementId is checked implicitly */ + retVal = Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, keyElementId, &elementIndex); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + + if (retVal == E_OK) + { + /* Set correct Flags */ + /* TRUE: Key is valid + FALSE: Key is invalid */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK)) + { + keyFlagsPtr->isKeyValid = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + keyFlagsPtr->isKeyValid = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* TRUE: Rewriting and erasing disabled + FALSE: Rewriting and erasing enabled */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK)) + { + keyFlagsPtr->write_protection = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + keyFlagsPtr->write_protection = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + { +#if ((CRYPTO_30_LIBCV_SHEKEYS == STD_ON) && (CRYPTO_30_LIBCV_SHE_ENABLE_FID == STD_ON)) + uint8 sheExtensions; + sheExtensions = Crypto_30_LibCv_GetKeyElementExtension(elementIndex); + + /* TRUE: Key is an SHE Key + FALSE: Key is not a SHE Key */ + if (Crypto_30_LibCv_IsSheKey(elementIndex)) + { + keyFlagsPtr->isSheKey = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + +# if (CRYPTO_30_LIBCV_KEYELEMENTSBOOTPROTECTIONIDXOFSHEPAGE == STD_ON) + /* TRUE: usage is limited + FALSE: Key usage is not limited according to result of secure boot */ + if (Crypto_30_LibCv_Uint8CheckMask(sheExtensions, CRYPTO_30_LIBCV_SHE_FID_MASK_BOOT_PROTECTION)) + { + keyFlagsPtr->boot_protection = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else +# endif + { + keyFlagsPtr->boot_protection = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + +# if (CRYPTO_30_LIBCV_KEYELEMENTSDEBUGGERPROTECTIONIDXOFSHEPAGE == STD_ON) + /* TRUE: key can not be used if debugger is attached + FALSE: Use of a debug interface does not impose a limitation on key usage */ + if (Crypto_30_LibCv_Uint8CheckMask(sheExtensions, CRYPTO_30_LIBCV_SHE_FID_MASK_DEBUGGER_PROTECTION)) + { + keyFlagsPtr->debugger_protection = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else +# endif + { + keyFlagsPtr->debugger_protection = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* TRUE: key can be used for CMAC generate/verify + FALSE: Key can be used for AES ECB+CBC encrypt/decrypt */ + if (Crypto_30_LibCv_Uint8CheckMask(sheExtensions, CRYPTO_30_LIBCV_SHE_FID_MASK_KEY_USAGE)) + { + keyFlagsPtr->key_usage = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + keyFlagsPtr->key_usage = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* TRUE: Key update by wildcard is disabled + FALSE: Key update by wildcard UID is enabled */ + if (Crypto_30_LibCv_Uint8CheckMask(sheExtensions, CRYPTO_30_LIBCV_SHE_FID_MASK_WILDCARD)) + { + keyFlagsPtr->disable_wildcard = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + keyFlagsPtr->disable_wildcard = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + + /* TRUE: Key can not be used to execute CMAC generate but only for CMAC verify + FALSE: Key can be used to execute CMAC generate */ + if (Crypto_30_LibCv_Uint8CheckMask(sheExtensions, CRYPTO_30_LIBCV_SHE_FID_MASK_CMAC_USAGE)) + { + keyFlagsPtr->cmac_usage = TRUE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + else + { + keyFlagsPtr->cmac_usage = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } + else +#endif + { + keyFlagsPtr->isSheKey = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + keyFlagsPtr->boot_protection = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + keyFlagsPtr->debugger_protection = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + keyFlagsPtr->key_usage = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + keyFlagsPtr->disable_wildcard = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + keyFlagsPtr->cmac_usage = FALSE; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + } + } + } + return retVal; +} /* Crypto_30_LibCv_Api_GetKeyFlags() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementGetStorageIndex() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 6 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementGetStorageIndex( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + /* Call Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended( + cryptoKeyId, + keyElementId, + resultIndexPtr, + resultLengthPtr, + lengthCheck, + serviceType); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyElementGetStorageIndex() */ + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyReadLockGetNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyReadLockGetNotProtected( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + /* Call Crypto_30_LibCv_Local_KeyReadLockGetNotProtected */ + retVal = Crypto_30_LibCv_Local_KeyReadLockGetNotProtected(cryptoKeyId); + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyReadLockGetNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyReadLockReleaseNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyReadLockReleaseNotProtected( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + /* Call Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected */ + Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected(cryptoKeyId); + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyReadLockReleaseNotProtected() */ +#endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementSearch() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementSearch( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndex) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + retVal = Crypto_30_LibCv_Local_KeyElementSearch( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + cryptoKeyId, + keyElementId, + elementIndex); + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyElementSearch() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyWriteLockGetNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyWriteLockGetNotProtected( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + retVal = Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected(cryptoKeyId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyWriteLockGetNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyWriteLockReleaseNotProtected() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyWriteLockReleaseNotProtected( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; + +#if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected(cryptoKeyId); + retVal = E_OK; + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_LibCv_Api_KeyWriteLockReleaseNotProtected() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Api_KeyElementSetInternalStandard() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Api_KeyElementSetInternalStandard( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + + if (elementIndex >= Crypto_30_LibCv_GetSizeOfKeyElements()) + { + retVal = E_NOT_OK; + } + else + { + retVal = Crypto_30_LibCv_KeyElementSetInternalStandard(elementIndex, keyPtr, keyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_Api_KeyElementSetInternalStandard() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyGetStatus() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* [SWS_Crypto_91019] */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyStatusPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + /* Check initialization state of the component */ + if (Crypto_30_LibCv_IsModuleSharedNotInitialized()) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00232] */ + } + /* Check validity of keyStatusPtr */ + else if (keyStatusPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; /* [SWS_Crypto_00234] */ + } + else +#endif + /* Check plausibility of cryptoKeyId */ + if (cryptoKeyId >= Crypto_30_LibCv_GetSizeOfKey()) + { + errorId = CRYPTO_E_PARAM_HANDLE; /* [SWS_Crypto_00233] */ + } + else + { + /* ----- Implementation ------------------------------------- */ + Crypto_30_LibCv_Local_KeyGetStatus(cryptoKeyId, keyStatusPtr); /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + retVal = E_OK; + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_KEY_GET_STATUS, + errorId); + } +#else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif + + return retVal; +} /* Crypto_30_LibCv_KeyGetStatus() */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyManagement.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.h new file mode 100644 index 0000000..3aa9d81 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyManagement.h @@ -0,0 +1,667 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyManagement.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for service key management function prototypes + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYMANAGEMENT_H +# define CRYPTO_30_LIBCV_KEYMANAGEMENT_H +# include "Csm_Types.h" +# include "Crypto_30_LibCv_Cfg.h" + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyCopy() + *********************************************************************************************************************/ +/*! \brief Copy the key + * \details Copies a key with all its elements to another key in the same crypto driver. + * The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * The function returns E_OK if at least one keyElement has been successfully copied. + * cryptoKeyId and targetCryptoKeyId shall not be identical, otherwise the function returns E_NOT_OK. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \return E_OK Request successful, at least one keyElement was successfully copied. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131140 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyCopy( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementCopy() + *********************************************************************************************************************/ +/*! \brief Copy key element + * \details Copies a key element to another key element in the same crypto driver. + * The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131141 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementCopy( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementCopyPartial() + **********************************************************************************************************************/ +/*! \brief Copy key element partial + * \details Copies a key element to another key element in the same crypto driver. The keyElementSourceOffset + * and keyElementCopyLength allows to copy just a part of the source key element into the destination. + * The offset of the target key is also specified with this function. + * The target key element needs to have partial access. + * The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset Holds the offset of the of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset Holds the offset of the of the target key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Holds the number of bytes that shall be copied. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-174489 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementCopyPartial( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementIdsGet() + *********************************************************************************************************************/ +/*! \brief Used to retrieve information which key elements are available in a given key. + * \details The service provides a list of key element which are available in the given key. + * \param[in] cryptoKeyId Holds the identifier of the key whose available element ids shall be exported. + * \param[out] keyElementIdsPtr Contains the pointer to the array where the ids of the key + * elements shall be stored. + * \param[out] keyElementIdsLengthPtr Holds a pointer to the memory location in which the number of key element + * in the given key is stored. On calling this function, this parameter + * shall contain the size of the buffer provided by keyElementIdsPtr. When the + * request has finished, the actual number of key elements is stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131139 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementIdsGet( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyElementIdsPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyElementIdsLengthPtr); + +/* [SWS_Crypto_91004] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet() + *********************************************************************************************************************/ +/*! \brief Sets a key element + * \details Sets the given key element bytes to the key identified by cryptoKeyId. + * The key element can only be set, if the write access right is WA_ALLOWED or WA_ENCRYPTED. + * The access right need to be WA_ALLOWED for normal key, WA_ENCRYPTED for She key and WA_ALLOWED for She ram key. + * If keyLength is zero the old value is deleted. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131144 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); + +# if ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess() + **********************************************************************************************************************/ +/*! \brief Checks the availability of the key element, the write access and determines the configured key element length + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the id of the key element which shall be set. + * \param[out] elementIndexPtr Holds the index of the key element which shall be set. + * \param[out] keyLengthPtr Contains the length of the key element in bytes. + * \param[in] writeAccess Hold the max write access right which could be accessed. + * \return E_OK Request successful. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * \pre cryptoKeyId has to be a valid identifier. + * The crypto key has to be locked for write access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccess( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219_1 */ + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) keyLengthPtr, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength() + **********************************************************************************************************************/ +/*! \brief Checks the availability of the key element, the write access, determines and checks the configured key element length + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the id of the key element which shall be set. + * \param[out] elementIndexPtr Holds the index of the key element which shall be set. + * \param[in] requestedKeyLength Contains the length of the key element in bytes. + * \param[in] writeAccess Hold the max write access right which could be accessed. + * \return E_OK Request successful. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre cryptoKeyId has to be a valid identifier. + * The crypto key has to be locked for write access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219_1 */ + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndexPtr, + uint32 requestedKeyLength, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess); +# endif + +/* [SWS_Crypto_91005] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyValidSet() + *********************************************************************************************************************/ +/*! \brief Sets the key state of the key identified by cryptoKeyId to valid. + * \details Sets all key elements of the given cryptoKey to valid. If the key contains at least one invalid + * persistent key element when called, the NvM is requested to write the block to which the cryptoKey + * refers. This API is an alias for KeySetValid() and does not differ in functionality, but is used + * for compliance with AUTOSAR 4.3.0 in terms of naming. + * \param[in] cryptoKeyId Holds the identifier of the key whose key elements shall be set to valid. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131143 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyValidSet( + uint32 cryptoKeyId); + +/* [SWS_Crypto_91014] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeySetValid() + *********************************************************************************************************************/ +/*! \brief Sets the key state of the key identified by cryptoKeyId to valid. + * \details Sets all key elements of the given cryptoKey to valid. If the key contains at least one invalid + * persistent key element when called, the NvM is requested to write the block to which the cryptoKey + * refers. This API is an alias for KeyValidSet() and does not differ in functionality, but is used + * for compliance with AUTOSAR 4.3.1 (and higher) in terms of naming. + * \param[in] cryptoKeyId Holds the identifier of the key whose key elements shall be set to valid. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131143 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeySetValid( + uint32 cryptoKeyId); + +/* [SWS_Crypto_91020] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Sets invalid for the status of the key identified by cryptoKeyId. + * \details Sets all key elements of the given cryptoKey to invalid. If the key has at least one persistent + * key element, the NvM is requested to write the block to which the cryptoKey refers. + * \param[in] cryptoKeyId Holds the identifier of the key for which the status shall be set to invalid. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-Crypto-KeySetInvalid + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeySetInvalid( + uint32 cryptoKeyId); + +/* [SWS_Crypto_91006] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementGet() + *********************************************************************************************************************/ +/*! \brief This interface shall be used to get a key element of the key identified by the cryptoKeyId and store + * the key element in the memory location pointed to by the result pointer. + * \details The key element can only be provided, if the read access right is RA_ALLOWED. If the key element + * is configured to allow partial access, resultLengthPtr contains the amount of data which should + * be read from the key element. + * The behavior for partial access can be switched on or off in the configuration. + * If the read access right is RA_ENCRYPTED the She ram key can be exported. + * (64 Bytes for M1-M3 and 112Bytes for M1-M5) + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be returned. + * \param[in] keyElementId Holds the identifier of the key element which shall be returned. + * \param[out] resultPtr Holds the pointer of the buffer for the returned key element. + * \param[in,out] resultLengthPtr Holds a pointer to a memory location in which the length + * information is stored. On calling this function this parameter shall + * contain the size of the buffer provided by resultPtr. If the key + * element is configured to allow partial access, this parameter + * contains the amount of data which should be read from the key + * element. The size may not be equal to the size of the provided + * buffer anymore. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131142 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr); + +/* [SWS_Crypto_91013] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_RandomSeed() + *********************************************************************************************************************/ +/*! \brief Initialize the seed + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-131137 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength); + +/* [SWS_Crypto_91007] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyGenerate() + *********************************************************************************************************************/ +/*! \brief Generates a key + * \details This function shall dispatch the key generate function to the configured crypto driver object. + * \param[in] cryptoKeyId Holds the identifier of the key which is to be updated with the generated + * value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyGenerate( + uint32 cryptoKeyId); + +/* [SWS_Crypto_91008] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a key + * \details Derives a new key by using the key elements in the given key identified by the cryptoKeyId. + * The key derivation function supports different algorithm which are specified by the + * algorithm key element(CRYPTO_KE_KEYDERIVATION_ALGORITHM). + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 and + * CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB: + * The given key must contain the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD), + * salt (CRYPTO_KE_KEYDERIVATION_SALT), algorithm (CRYPTO_KE_KEYDERIVATION_ALGORITHM) and the custom + * element label(CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL). The number of iterations is automatically + * determined by the needed key length. The derived key is stored in the key element with id 1 of the + * given key identified by targetCryptoKeyId. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256: The KDF reads the algorithm + * configuration from the cryptoKeyId key elements. The KDF requires the following key elements: the private key + * (CRYPTO_KE_KEYDERIVATION_PASSWORD), the public key (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY) and the other + * Information (CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO). Other Information is only supported up to a length + * of 5 bytes. + * The derived key is set at the target key element (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING: + * For certificate installation the cryptoKeyId need to be the root certificate. + * For certificate update the cryptoKeyId and targetCryptoKeyId need to be the same key Id. + * The KDF is reads the algorithm configuration from the cryptoKeyId key elements. The KDF requires + * the following key element the private key (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * The following key elements need to be set at the targetCryptoKeyId: + * the contract/new public key (CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY), + * the IV and encrypted private key (CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY) and + * the public key (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY). + * The derived key is set at the target key element (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_20_CERTIFICATE_HANDLING: + * The KDF reads the algorithm configuration from the cryptoKeyId key elements. + * The following key element need to be set at the cryptoKeyId: + * the private key of the provision certificate (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * The following key elements need to be set at the targetCryptoKeyId: + * the contract public key (CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY), + * the IV, encrypted private key and tag (CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY), + * the PCID and SKI (CRYPTO_KE_CUSTOM_SCC_CONTRACT_AAD) and + * the public key needed for ECDH (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY). + * The derived key is set at the target key element (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512: + * Derives a key according to KDF X9.63 with the given CRYPTO_KE_KEYDERIVATION_PASSWORD(Secret) + * and optional CRYPTO_KE_KEYDERIVATION_SALT(Seed). + * - For CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA1 and CRYPTO_30_LIBCV_KDF_ALGO_PBKDF2_HMAC_SHA256: + * The given key must contain the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD), + * salt (CRYPTO_KE_KEYDERIVATION_SALT), algorithm (CRYPTO_KE_KEYDERIVATION_ALGORITHM) + * and the iteration element (CRYPTO_KE_KEYDERIVATION_ITERATIONS). + * The number of iterations is determined by the CRYPTO_KE_KEYDERIVATION_ITERATIONS + * element and must always be set with 4 bytes. The derived key is stored + * in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_HKDF_HMAC_SHA384: + * The given key must contain the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD), + * salt (CRYPTO_KE_KEYDERIVATION_SALT), algorithm (CRYPTO_KE_KEYDERIVATION_ALGORITHM) + * iteration element (CRYPTO_KE_KEYDERIVATION_ITERATIONS) and optionally + * CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional information). + * The iteration element specifies whether the one-step or two-step variant is to be used. + * The derived key is stored in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA256 and CRYPTO_KDF_ALGO_HKDF_EXPAND_HMAC_SHA384: + * The given key must contain the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD) and optionally + * CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional information). + * The derived key is stored in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA256 and CRYPTO_30_LIBCV_KDF_ALGO_HKDF_OPTION1_SHA512: + * The given key must contain the key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD), + * algorithm (CRYPTO_KE_KEYDERIVATION_ALGORITHM) and optionally CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (additional information). + * The Algorithm element specifies which hash variant is to be used. + * The derived key is stored in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_30_LIBCV_KDF_ALGO_SPAKE2_PLUS_P256R1: + * The given key must contain the key element for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD). + * The derived key is stored in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * - For CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_108_CTR_CMAC_AES: + * The given key must contain key elements for the password (CRYPTO_KE_KEYDERIVATION_PASSWORD) and + * algorithm (CRYPTO_KE_KEYDERIVATION_ALGORITHM). Optional additional inputs are label + * (CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL) and context (CRYPTO_KE_CUSTOM_KEYDERIVATION_CONTEXT). + * The password length defines the CMAC cipher: 16 Bytes (AES128) or 32 Bytes (AES256). + * The derived key is stored in the key element with id 1 of the given key identified by targetCryptoKeyId. + * The write access right for the destination key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/* [SWS_Crypto_91009] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed to by the public value pointer. The write access right for the destination + * key element must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-132409 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) publicValueLengthPtr); + +/* [SWS_Crypto_91010] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. The write access right for the destination key element + * must be less than or equal to WA_INTERNAL_COPY. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partners public value in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-132408 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_CertificateParse() + *********************************************************************************************************************/ +/*! \brief Parse stored certificate + * \details Parses the certificate data stored in the key element CRYPTO_KE_CERT_DATA and fills the key elements + * CRYPTO_KE_CERT_SIGNEDDATA, CRYPTO_KE_CERT_PARSEDPUBLICKEY and CRYPTO_KE_CERT_SIGNATURE + * \param[in] cryptoKeyId Holds the identifier of the key slot in which the certificate has been + * stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CertificateParse( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_CertificateVerify() + *********************************************************************************************************************/ +/*! \brief Certificate verification + * \details Verifies the certificate stored in the key referenced by verifyCryptoKeyId with the + * certificate stored in the key referenced by cryptoKeyId. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used to validate the + * certificate. + * \param[in] verifyCryptoKeyId Holds the identifier of the key containing the certificate, which shall be + * verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the + * certificate verification. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CertificateVerify( + uint32 cryptoKeyId, + uint32 verifyCryptoKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) verifyPtr); + +# if(CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SheCmdGetId() + *********************************************************************************************************************/ +/*! \brief Dispatches the She Cmd Get Id job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SheCmdGetId( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SHECMDGETID == STD_ON) */ + +/* [SWS_Crypto_91019] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyGetStatus() + *********************************************************************************************************************/ +/*! \brief Returns the key state of the key identified by cryptoKeyId. + * \details This function reports the validity of a key. If the key is currently written by + * the NVM e.g. KeyElementSet() followed by KeySetValid(), it reports UPDATE_IN_PROGRESS + * until the key was successfully written by the NVM. If the update was not successful + * the status remains on UPDATE_IN_PROGRESS. The reported state reflects the state + * of the last initiated update routine. Which means if the key is changed again during + * the NVM update, the UPDATE_IN_PROGRESS is no longer reported. + * + * \param[in] cryptoKeyId Holds the identifier of the key for which the key state shall be returned. + * \param[out] keyStatusPtr Contains the pointer to the data where the status of the key shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_Libcv_KeyNvStatus + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyStatusPtr); + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYMANAGEMENT_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyManagement.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetInvalid.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetInvalid.h new file mode 100644 index 0000000..cf11192 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetInvalid.h @@ -0,0 +1,73 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeySetInvalid.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for key set valid service. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYSETINVALID_H +# define CRYPTO_30_LIBCV_KEYSETINVALID_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if(CRYPTO_30_LIBCV_KEYSETINVALIDJOB == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySetInvalidJob() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeySetInvalid job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySetInvalidJob(uint32 objectId, P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYSETINVALIDJOB */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYSETINVALID_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeySetInvalid.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetValid.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetValid.h new file mode 100644 index 0000000..725357a --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeySetValid.h @@ -0,0 +1,74 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeySetValid.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for key set valid service. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_KEYSETVALID_H +# define CRYPTO_30_LIBCV_KEYSETVALID_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if(CRYPTO_30_LIBCV_KEYSETVALIDJOB == STD_ON) +/* [SWS_Crypto_91014] */ +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySetValidJob() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeySetValid job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySetValidJob(uint32 objectId, P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYSETVALID */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYSETVALID_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeySetValid.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyUnwrap.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyUnwrap.h new file mode 100644 index 0000000..1618393 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyUnwrap.h @@ -0,0 +1,79 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyUnwrap.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for KeyWrap Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_KEYUNWRAP_H) +# define CRYPTO_30_LIBCV_KEYUNWRAP_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyUnwrapAes() + *********************************************************************************************************************/ +/*! \brief Dispatches the key unwrap job to the lower layer. + * \details Dispatch the key unwrapping. Only available in single call mode + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-KeyUnwrapAes + * \note key wrap and unwrap have the same init-API + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyUnwrapAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYUNWRAP_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyUnwrap.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.c new file mode 100644 index 0000000..4662933 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.c @@ -0,0 +1,556 @@ +/*********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------ + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------ + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_30_LibCv_KeyWrap.c + * \brief MICROSAR Crypto Driver (Crypto) + * \details Implementation for key wrapping and unwrapping services + **********************************************************************************************************************/ + + /*********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------ + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------ + * Refer to the VERSION CHECK below. + **********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_KEYWRAP_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_KeyUnwrap.h" +#include "Crypto_30_LibCv_KeyWrap.h" + +/*********************************************************************************************************************** + * LOCAL CONSTANT MACROS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTION MACROS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if ((CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) || (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrappingAesStart() + *********************************************************************************************************************/ +/*! + * \brief This function dispatches and executes the Key Wrap/Unwrap Aes init function. + * \details This function initializes the vSecPrim workspace, gets the key encryption key and determines the + * Aes variant according to the key length. + * Supported variants are: + * - Key Wrap/Unwrap Aes 128 + * - Key Wrap/Unwrap Aes 192 + * - Key Wrap/Unwrap Aes 256 + * \param[in,out] workspace Pointer to the vSecPrim key wrap/unwrap workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] mode Mode of the start function - it determines whether the start is used for a key wrap + * or a key unwrap. The supported modes are: + * - ESL_KEYWRAP_WRAP_MODE + * - ESL_KEYWRAP_UNWRAP_MODE + * \return E_OK Dispatching was successful. + * \return E_NOT_OK Dispatching failed. + * \return CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \return CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrappingAesStart( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, eslt_Mode mode); +#endif /* ((CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) || (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrapAesFinish() + *********************************************************************************************************************/ +/*! + * \brief This function dispatches and executes the Key Wrap Aes finish function. + * \details This function gets the key to wrap, checks its length and calls the underlying vSecPrim function + * \param[in,out] workspace Pointer to the vSecPrim workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * \return E_NOT_OK Dispatching failed. + * \return CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * \return CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrapAesFinish( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish() + *********************************************************************************************************************/ +/*! + * \brief This function dispatches and executes the Key Unwrap Aes finish function. + * \details This function checks the length of the input ptr: + * \param[in,out] workspace Pointer to the vSecPrim hash workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre job has to be a pointer to a valid job object. + * inputPtrLength must be at least 3 * ESL_SIZEOF_AES_SEMIBLOCK and + * a multiple of ESL_SIZEOF_AES_SEMIBLOCK + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 objectId); +#endif /* (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if ((CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) || (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrappingAesStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrappingAesStart( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, eslt_Mode mode) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_AESKEYWRAP, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + eslt_Mode cipher = 0u; + + /* get key encryption/wrapping key */ + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyEncryptionKey = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType indexOfkeyEncryptionKey = 0u; + uint32 keyEncryptionKeyLength = ESL_SIZEOF_AES128_KEY; /* key must be at least 16 bytes for key wrapping with AES128, it must be larger for other AES variants */ + + /* get index of key to encrypt */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_CIPHER_KEY, &indexOfkeyEncryptionKey, &keyEncryptionKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + keyEncryptionKey = Crypto_30_LibCv_GetAddrKeyStorage(indexOfkeyEncryptionKey); + + /* length check to get ID of the used cipher */ + switch (keyEncryptionKeyLength) + { + case ESL_SIZEOF_AES128_KEY: + { + cipher = ESL_KEYWRAP_AES128; + break; + } + + case ESL_SIZEOF_AES192_KEY: + { + cipher = ESL_KEYWRAP_AES192; + break; + } + + case ESL_SIZEOF_AES256_KEY: + { + cipher = ESL_KEYWRAP_AES256; + break; + } + + default: + { + /* Kek is invalid */ + retVal = E_NOT_OK; + break; + } + } + } + + if (retVal == E_OK) + { + retValCv = esl_initAESKeyWrap(workspace, keyEncryptionKey, (eslt_Length)keyEncryptionKeyLength, cipher, mode); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyWrappingAesStart() */ +#endif + +#if (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrapAesFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrapAesFinish( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* get key to wrap */ + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) plaintextKey = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType indexOfPlaintextKey = 0u; + uint32 plaintextKeyLength = ESL_SIZEOF_AES_BLOCK; /* key must be at least 16 bytes */ + + /* get index of the plaintext key and check if the key element is big enough */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->targetCryptoKeyId, CRYPTO_KE_KEYWRAP_KEY, &indexOfPlaintextKey, &plaintextKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MIN); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + plaintextKey = Crypto_30_LibCv_GetAddrKeyStorage(indexOfPlaintextKey); + + /* the plaintext key must be a multiple of ESL_SIZEOF_AES_SEMIBLOCK */ + if ((plaintextKeyLength % ESL_SIZEOF_AES_SEMIBLOCK) != 0u) + { + retVal = E_NOT_OK; + } + /* the buffer for wrapped key must be at least plaintextKeyLength + ESL_SIZEOF_AES_SEMIBLOCK */ + else if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr < (plaintextKeyLength + ESL_SIZEOF_AES_SEMIBLOCK)) + { + retVal = E_NOT_OK; + } + else + { + eslt_Length outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* call vSecPrim key wrap function */ + retValCv = esl_wrapAESKeyWrap(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) plaintextKey, + (eslt_Length)plaintextKeyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyWrapAesFinish() */ + +#endif /* (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish( + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 objectId) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* length check - input length must be at least 3u * ESL_SIZEOF_AES_SEMIBLOCK bytes */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength < (uint32)(3u * ESL_SIZEOF_AES_SEMIBLOCK)) + { + retVal = E_NOT_OK; + } + /* length of the input must be a multiple of ESL_SIZEOF_AES_SEMIBLOCK */ + else if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength % ESL_SIZEOF_AES_SEMIBLOCK) != 0u) + { + retVal = E_NOT_OK; + } + else + { + /* get index of key where the plaintext key should be stored */ + P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) plaintextKey = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyElementsType indexOfPlaintextKey = 0u; + eslt_Length plaintextKeyLength = (eslt_Length) (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength - ESL_SIZEOF_AES_SEMIBLOCK); + + retVal = Crypto_30_LibCv_KeyElementSet_PreCheckWriteAccessAndLength(job->targetCryptoKeyId, CRYPTO_KE_KEYWRAP_KEY, &indexOfPlaintextKey, plaintextKeyLength, CRYPTO_30_LIBCV_WA_INTERNAL_COPY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + plaintextKey = Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(indexOfPlaintextKey)); + eslt_Length inputLen = (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; + + retValCv = esl_unwrapAESKeyWrap(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + inputLen, plaintextKey, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &plaintextKeyLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* Update key element. */ + Crypto_30_LibCv_Local_SetKeyElementStateWritten(indexOfPlaintextKey); + Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId(job->targetCryptoKeyId, indexOfPlaintextKey, plaintextKeyLength); + + /* set key to valid */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, Crypto_30_LibCv_Internal_KeySetValid(job->targetCryptoKeyId)); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + retVal = E_OK; + } + else if (retValCv == ESL_ERC_VERIFICATION_FAILED) + { + /* verification ptr has already been set to CRYPTO_E_VER_NOT_OK */ + retVal = E_OK; + } + else + { + /* verification ptr has already been set to CRYPTO_E_VER_NOT_OK */ + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish() */ + +#endif /* (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) +/*********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrapAes() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrapAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ----------------------------------------------- */ + /* job is single call only */ + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyWrapAes(Crypto_30_LibCv_GetKeyWrapAesIdxOfObjectInfo(objectId)); + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + /* note: key wrap and unwrap have the same init-API */ + retVal = Crypto_30_LibCv_Dispatch_KeyWrappingAesStart(workspace, job, ESL_KEYWRAP_WRAP_MODE); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = E_OK; + break; + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_Dispatch_KeyWrapAesFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyWrapAes() */ +#endif /* (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) +/*********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyUnwrapAes() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyUnwrapAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + + /* job is single call only */ + if (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(eslt_WorkspaceAESKeyWrap, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeyUnwrapAes(Crypto_30_LibCv_GetKeyUnwrapAesIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkspaceAESKeyWrap)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + /* note: key wrap and unwrap have the same init-API */ + retVal = Crypto_30_LibCv_Dispatch_KeyWrappingAesStart(workspace, job, ESL_KEYWRAP_UNWRAP_MODE); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = E_OK; + break; + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_Dispatch_KeyUnwrapAesFinish(workspace, job, objectId); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeyUnwrapAes() */ +#endif /* (CRYPTO_30_LIBCV_KEYUNWRAPAES == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyWrap.c + **********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.h new file mode 100644 index 0000000..6d109c0 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_KeyWrap.h @@ -0,0 +1,78 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_KeyWrap.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for Key Wrap Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_KEYWRAP_H) +# define CRYPTO_30_LIBCV_KEYWRAP_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeyWrapAes() + *********************************************************************************************************************/ +/*! \brief Dispatches the key wrap job to the lower layer. + * \details Dispatch the key wrapping. Only available in single call mode. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-KeyWrapAes + * \note key wrap and unwrap have the same init-API + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeyWrapAes( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_KEYWRAPAES == STD_ON) */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_KEYWRAP_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_KeyWrap.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Mac.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Mac.c new file mode 100644 index 0000000..eff8c94 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Mac.c @@ -0,0 +1,3202 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Mac.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for MAC Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_MAC_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_MacGenerate.h" +#include "Crypto_30_LibCv_MacVerify.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL_CONSTANT MACROS + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_MODULO_8(x) ((x) & (8u - 1u)) +#define CRYPTO_30_LIBCV_SIP_HASH_KEY_LENGTH (16u) +#define CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE (8u) +#define CRYPTO_30_LIBCV_SHA2_256_KEY_LENGTH (32u) +#define CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE (16u) + +#define CRYPTO_30_LIBCV_CMAC_AES_MODE_128 (0u) +#define CRYPTO_30_LIBCV_CMAC_AES_MODE_256 (1u) + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_SERVICE_MAC_VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_CompareMac() + *********************************************************************************************************************/ +/*! \brief Compares two MACs + * \details This function compares two MAC values from MSB to LSB. + * \param[in] mac1 Holds a pointer to the first mac + * \param[in] mac2 Holds a pointer to the second mac + * \param[in] lengthInBit Number of bits which shall be compared from MSB to LSB. + * \return CRYPTO_E_VER_NOT_OK Macs are not similar + * CRYPTO_E_VER_OK Macs are similar + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Crypto_VerifyResultType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CompareMac( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) mac1, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) mac2, + uint32 lengthInBit); +#endif /* (CRYPTO_30_LIBCV_SERVICE_MAC_VERIFY == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) || (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey() + *********************************************************************************************************************/ +/*! \brief Initializes the CMAC AES algorithm including calculate the round keys. + * \details Depending on the AES key size, 128bit or 256bit AES CMAC is initialized. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] sheService Holds the service for SHE key usage. + * \return E_OK Init was successful. + * E_NOT_OK Init failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided key has no proper size. + * \pre workspace has to be valid. + * job has to be a valid job object handle. + * sheService hast be be a valid SHE service. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + Crypto_30_LibCv_ServiceType sheService); + +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey() + *********************************************************************************************************************/ +/*! \brief Initializes the CMAC AES algorithm by reusing the round keys. + * \details Call esl_initExpandedCMACAES128/256 with NULL_PTR and length=0 as expanded key and key length so + * that vSecPrim reuses the previously generated expanded key. + * \param[in,out] workspace Pointer to the esl workspace. + * \return E_OK Init was successful. + * E_NOT_OK Init failed. + * \pre workspace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace); +# endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Start() + *********************************************************************************************************************/ +/*! \brief Handles operation mode START. + * \details If round key reuse is activated, the function checks if the round keys need to be recalculated or + * or can be reused and initializes the CMAC AES. If not, it just initializes the AES CMAC algorithm. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] sheService Holds the service for SHE key usage. + * \return E_OK Init was successful. + * E_NOT_OK Init failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided key has no proper size. + * \pre workspace has to be valid. + * objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * sheService hast be be a valid SHE service. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Start( + uint32 objectId, + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_ServiceType sheService); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Update() + *********************************************************************************************************************/ +/*! \brief Handles operation mode UPDATE. + * \details Forwards the plain text data to the underlying crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Request was successful. + * E_NOT_OK Request failed. + * \pre workspace has to be valid. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Update( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac() + *********************************************************************************************************************/ +/*! \brief Calculates the full-sized AES CMAC. + * \details Calls the suitable function of the underlaying crypto library based on round key reuse and AES mode. + * Checks if the calculated MAC has a proper size of CRYPTO_30_LIBCV_CMACAES_MAC_SIZE (16 bytes). + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] macBuffer Pointer to a buffer where the AES CMAC shall be stored. + * \param[in,out] macLength Pointer to a length variable providing the length of the macBuffer. + * \return E_OK Request was successful. + * E_NOT_OK Request failed. + * \pre workspace has to be valid. + * macBuffer has to be a valid buffer with a length of CRYPTO_30_LIBCV_CMACAES_MAC_SIZE (16 bytes). + * macLength hat to be a valid pointer providing the length of macBuffer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) macBuffer, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) macLength); +#endif /* ((CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) || (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) || (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesModeStart( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesModeUpdate( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) || (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart() + *********************************************************************************************************************/ +/*!\brief Handles operation mode START. + * \details This function initializes both the workspace header and algorithm. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Start operation was successful. + * E_NOT_OK Start operation failed. + * \pre workSpace has to be valid. + * job has to be a job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate() + *********************************************************************************************************************/ +/*!\brief Handles operation mode UPDATE. + * \details This function processes the input data. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Update operation was successful. + * E_NOT_OK Update operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers, adapts the output size of the tag value and + * copies the data to the output location. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish() + *********************************************************************************************************************/ +/*!\brief Handles operation mode FINISH. + * \details This function writes the results in output buffers and checks if verification was successful. + * \param[in] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Finish operation was successful. + * E_NOT_OK Finish operation failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CRYPTO_30_LIBCV_SERVICE_MAC_VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_CompareMac() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Crypto_VerifyResultType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_CompareMac( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) mac1, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) mac2, + uint32 lengthInBit) +{ + Crypto_VerifyResultType result = CRYPTO_E_VER_OK; + const uint32 numberOfFullBytesInMac = Crypto_30_LibCv_Bit2Byte(lengthInBit); + uint32 numberBitsInLastByte; + uint8 verifyBitMask; + + uint32 i = 0u; + + /* # Compare full bytes of both MACs. */ + /* # No use of VStdLib_MemCmp, so that the for-loop steps through all bytes in order to achieve a constant function runtime (security measure). */ + for (i = 0u; i < (numberOfFullBytesInMac); i++) /* FETA_CRYPTO_30_LIBCV_MONOTONIC_LOOP_UP_WITH_PARAMETER_DEPENDENT_UPPER_BOUND */ + { + if (mac1[i] != mac2[i]) + { + /* Verification does not match */ + result = CRYPTO_E_VER_NOT_OK; + } + } + + /* # Compare remaining bits. */ + /* Compute number of bits to verify in the last byte */ + numberBitsInLastByte = CRYPTO_30_LIBCV_MODULO_8(lengthInBit); /* Calculate modulo */ + if (numberBitsInLastByte != 0u) + { + /* Generate bitmask which contains all bits to be verified */ + verifyBitMask = (uint8)~((1u << (8u - numberBitsInLastByte)) - 1u); + + /* Verify the last masked byte */ + if ((mac1[numberOfFullBytesInMac] & verifyBitMask) + != (mac2[numberOfFullBytesInMac] & verifyBitMask)) + { + result = CRYPTO_E_VER_NOT_OK; + } + } + + return result; +} /* Crypto_30_LibCv_CompareMac() */ +#endif /* (CRYPTO_30_LIBCV_SERVICE_MAC_VERIFY == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) || (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + Crypto_30_LibCv_ServiceType sheService) +{ + uint32 cmacAesKeyLength; + Crypto_30_LibCv_SizeOfKeyStorageType cmacAesKeyIndex; + + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* Get MAC key */ + Std_ReturnType localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended(job->cryptoKeyId, CRYPTO_KE_MAC_KEY, + &cmacAesKeyIndex, &cmacAesKeyLength, + CRYPTO_30_LIBCV_LENGTH_CHECK_NONE, sheService); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + /* Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->wsCMACAES.header), ESL_MAXSIZEOF_WS_CMACAES, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* Distinguish AES CMAC mode based on AES key size. */ + switch (cmacAesKeyLength) + { + case CRYPTO_30_LIBCV_CMACAES128_KEY_SIZE: + { + /* Init CMAC AES128 */ + workspace->mode = CRYPTO_30_LIBCV_CMAC_AES_MODE_128; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retValCv = esl_initCMACAES128( + &workspace->wsCMACAES, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)cmacAesKeyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(cmacAesKeyIndex)); + break; + } + case CRYPTO_30_LIBCV_CMACAES256_KEY_SIZE: + { + /* Init CMAC AES256 */ + workspace->mode = CRYPTO_30_LIBCV_CMAC_AES_MODE_256; /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retValCv = esl_initCMACAES256( + &workspace->wsCMACAES, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)cmacAesKeyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(cmacAesKeyIndex)); + break; + } + default: + { + /* MAC key has no proper size. */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + retValCv = ESL_ERC_ERROR; + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + else if (localRetVal == CRYPTO_E_KEY_NOT_VALID) + { + retVal = CRYPTO_E_KEY_NOT_VALID; + } + else + { + /* retVal remains on E_NOT_OK */ + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey() */ + +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* Get the AES CMAC mode from the workspace mode which was written in the previous AES CMAC round. */ + switch (workspace->mode) + { + case CRYPTO_30_LIBCV_CMAC_AES_MODE_128: + { + retValCv = esl_initExpandedCMACAES128(&workspace->wsCMACAES, NULL_PTR, (eslt_Length) 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } + case CRYPTO_30_LIBCV_CMAC_AES_MODE_256: + { + retValCv = esl_initExpandedCMACAES256(&workspace->wsCMACAES, NULL_PTR, (eslt_Length) 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported mode. */ + /* retValCv remains error. */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey() */ +# endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Start() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080, 6030 5 */ /* MD_MSR_STMIF, MD_MSR_STCYC */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Start( + uint32 objectId, + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_30_LibCv_ServiceType sheService) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* Load key element from storage and initialize algorithm with keys. Dependent on roundkey feature, either the roundkey is loaded as key or the original key. */ +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE== STD_ON) + Crypto_30_LibCv_SizeOfKeyElementsType macElementId = 0u; + boolean reCalculate = FALSE; + + Std_ReturnType localRetVal = Crypto_30_LibCv_Local_KeyElementSearch(job->cryptoKeyId, CRYPTO_KE_MAC_KEY, &macElementId); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* Check if MAC key has changed */ + if ((localRetVal != E_OK) || (!Crypto_30_LibCv_IsKeyElementStateByMask(macElementId, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_MASK))) + { + reCalculate = TRUE; + } + /* Check if job is last job / workspace has changed */ + if (Crypto_30_LibCv_ObjectWorkspaceHasChanged(objectId, job) == TRUE) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + { + reCalculate = TRUE; + } + + if (reCalculate == TRUE) +# endif + { + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Init_CalculateKey(job, workspace, sheService); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + /* Set flag that roundkeys are calculated */ + if (retVal == E_OK) + { + Crypto_30_LibCv_SetKeyElementStateByMask(macElementId, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + } + else + { + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Init_ReuseKey(workspace); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + +# else /* !(CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE== STD_ON) */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(objectId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAes_Start() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_Update() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_Update( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* Distinguish between 128bit or 256bit based on workspace mode. */ + switch(workspace->mode) + { + case CRYPTO_30_LIBCV_CMAC_AES_MODE_128: + { + retValCv = esl_updateCMACAES128(&workspace->wsCMACAES, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + break; + } + + case CRYPTO_30_LIBCV_CMAC_AES_MODE_256: + { + retValCv = esl_updateCMACAES256(&workspace->wsCMACAES, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported mode. */ + /* retValCv remains error. */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAes_Update() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac( + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) macBuffer, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) macLength) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + switch (workspace->mode) + { +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) + case CRYPTO_30_LIBCV_CMAC_AES_MODE_128: + { + retValCv = esl_finalizeKeepStateCMACAES128(&workspace->wsCMACAES, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer, + macLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + break; + } + case CRYPTO_30_LIBCV_CMAC_AES_MODE_256: + { + retValCv = esl_finalizeKeepStateCMACAES256(&workspace->wsCMACAES, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer, + macLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + break; + } +# else /* !(CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + case CRYPTO_30_LIBCV_CMAC_AES_MODE_128: + { + retValCv = esl_finalizeCMACAES128(&workspace->wsCMACAES, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + break; + } + case CRYPTO_30_LIBCV_CMAC_AES_MODE_256: + { + retValCv = esl_finalizeCMACAES256(&workspace->wsCMACAES, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer, + macLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + + break; + } +# endif /* !(CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported mode. */ + /* retValCv remains error. */ + break; + } + } + + /* Check if MAC was fully generated */ + if ((retValCv == ESL_ERC_NO_ERROR) && (*macLength == CRYPTO_30_LIBCV_CMACAES_MAC_SIZE)) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac() */ +#endif /* ((CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) || (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAesGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAesGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + Std_ReturnType retVal = E_NOT_OK; + + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfCmacAesGenerate(Crypto_30_LibCv_GetCmacAesGenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceCMACAES)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* Distinguish modes. */ + switch (mode) + { + /* Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + /* Init CMAC AES. */ + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Start(objectId, workspace, job, CRYPTO_30_LIBCV_SHE_SERVICE_MAC_GENERATE); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Process plaintext data. */ + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* Create local buffer to store the full MAC */ + uint8 macBuffer[CRYPTO_30_LIBCV_CMACAES_MAC_SIZE]; + eslt_Length macLength = CRYPTO_30_LIBCV_CMACAES_MAC_SIZE; + + /* Calculate full MAC (16 bytes) */ + if(Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac(workspace, macBuffer, &macLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + /* Get local job output ptrs to shorten the variable names */ + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputPtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr; + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) outputLengthPtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr; + + /* Limit job output length to default AES CMAC size (16 bytes). */ + if (*outputLengthPtr > CRYPTO_30_LIBCV_CMACAES_MAC_SIZE) + { + *outputLengthPtr = CRYPTO_30_LIBCV_CMACAES_MAC_SIZE; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* Copy calculated MAC into output buffer with given outputLengthPtr (truncation possible). */ + Crypto_30_LibCv_CopyData(outputPtr, macBuffer, *outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + retVal = E_OK; + } + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAesGenerate() */ +#endif /* (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAesVerify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAesVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(Crypto_30_LibCv_WorkSpaceCMACAES, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfCmacAesVerify(Crypto_30_LibCv_GetCmacAesVerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceCMACAES)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + /* Init CMAC AES. */ + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Start(objectId, workspace, job, CRYPTO_30_LIBCV_SHE_SERVICE_MAC_VERIFY); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Process plaintext data. */ + retVal = Crypto_30_LibCv_Dispatch_CmacAes_Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* Create local buffer to store the full MAC */ + uint8 macBuffer[CRYPTO_30_LIBCV_CMACAES_MAC_SIZE]; + eslt_Length macLength = CRYPTO_30_LIBCV_CMACAES_MAC_SIZE; + + /* Check if input length is not to large. */ + /* Size is given in bits. */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= (Crypto_30_LibCv_Byte2Bit(CRYPTO_30_LIBCV_CMACAES_MAC_SIZE))) + { + /* Calculate full MAC (16 bytes) */ + if (Crypto_30_LibCv_Dispatch_CmacAes_CalcFullMac(workspace, macBuffer, &macLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + macLength = (eslt_Length) job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength; + + /* Verify the input MAC by comparing it with the calculated MAC. */ + /* Only the given length is compared to enable truncation. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, (uint32) macLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + + retVal = E_OK; + } + } + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_CmacAesVerify() */ +#endif /* (CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SIPHASHGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SipHashGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SipHashGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSipHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSipHashGenerate(Crypto_30_LibCv_GetSipHashGenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSipHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_SIPHASH, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initSipHash(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + + /* # Process plaintext data */ + retValCv = esl_updateSipHash(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + break; + } + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + eslt_Byte macBuffer[CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE]; + + retValCv = esl_finalizeSipHash(workspace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SipHashGenerate() */ +#endif /* (CRYPTO_30_LIBCV_SIPHASHGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SIPHASHVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SipHashVerify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SipHashVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSipHash, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSipHashVerify(Crypto_30_LibCv_GetSipHashVerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSipHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_SIPHASH, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initSipHash(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* # Process plaintext data */ + retValCv = esl_updateSipHash(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + eslt_Byte macBuffer[CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE]; + uint32 macLength; + retValCv = esl_finalizeSipHash(workspace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + macLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength; + if (macLength <= (CRYPTO_30_LIBCV_SIPHASH_MAC_SIZE << 3u)) + { + + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, macLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SipHashVerify() */ +#endif /* (CRYPTO_30_LIBCV_SIPHASHVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_HMACSHA1, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initHashMACSHA1(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchHmacSHA1ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update HMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateHashMACSHA1(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint8 macBuffer[ESL_SIZEOF_SHA1_DIGEST]; + + if (esl_finalizeHashMACSHA1(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > ESL_SIZEOF_SHA1_DIGEST) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = ESL_SIZEOF_SHA1_DIGEST; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Set return value */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha1Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha1Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha1Generate(Crypto_30_LibCv_GetHmacSha1GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA1)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA1ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA1GenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha1Generate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_HMACSHA256, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initHashMACSHA256(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchHmacSHA256ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update HMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateHashMACSHA256(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint8 macBuffer[ESL_SIZEOF_SHA256_DIGEST]; + + if (esl_finalizeHashMACSHA256(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > ESL_SIZEOF_SHA256_DIGEST) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = ESL_SIZEOF_SHA256_DIGEST; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Set return value */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha256Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha256Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha256Generate(Crypto_30_LibCv_GetHmacSha256GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA256)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA256ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA256GenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha256Generate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_HMACSHA384, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initHashMACSHA384(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchHmacSHA384ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update HMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateHashMACSHA384(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint8 macBuffer[ESL_SIZEOF_SHA384_DIGEST]; + + if (esl_finalizeHashMACSHA384(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > ESL_SIZEOF_SHA384_DIGEST) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = ESL_SIZEOF_SHA384_DIGEST; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Set return value */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha384Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha384Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha384Generate(Crypto_30_LibCv_GetHmacSha384GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA384)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA384ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA384GenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha384Generate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512ModeStart( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_HMACSHA512, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initHashMACSHA512(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchHmacSHA512ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update HMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateHashMACSHA512(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint8 macBuffer[ESL_SIZEOF_SHA512_DIGEST]; + eslt_Length macLength = sizeof(macBuffer); + + if (esl_finalizeHashMACSHA512(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer, (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&macLength) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > ESL_SIZEOF_SHA512_DIGEST) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = ESL_SIZEOF_SHA512_DIGEST; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Set return value */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha512Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha512Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha512Generate(Crypto_30_LibCv_GetHmacSha512GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA512)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA512ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA512GenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha512Generate() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv; + uint8 macBuffer[ESL_SIZEOF_SHA1_DIGEST]; + + retValCv = esl_finalizeHashMACSHA1(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + /* size is given in bits */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_SHA1_DIGEST)) + { + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha1Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha1Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA1, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha1Verify(Crypto_30_LibCv_GetHmacSha1VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA1)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA1ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA1ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA1VerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha1Verify() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv; + uint8 macBuffer[ESL_SIZEOF_SHA256_DIGEST]; + + retValCv = esl_finalizeHashMACSHA256(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + /* size is given in bits */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_SHA256_DIGEST)) + { + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha256Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha256Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA256, AUTOMATIC, CRYPTO_30_LIBCV_VAR_NOINIT) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha256Verify(Crypto_30_LibCv_GetHmacSha256VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA256)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA256ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA256ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA256VerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha256Verify() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv; + uint8 macBuffer[ESL_SIZEOF_SHA384_DIGEST]; + + retValCv = esl_finalizeHashMACSHA384(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + /* size is given in bits */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_SHA384_DIGEST)) + { + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha384Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha384Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA384, AUTOMATIC, CRYPTO_30_LIBCV_VAR_NOINIT) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha384Verify(Crypto_30_LibCv_GetHmacSha384VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA384)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA384ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA384ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA384VerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha384Verify() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv; + uint8 macBuffer[ESL_SIZEOF_SHA512_DIGEST]; + eslt_Length macLength = sizeof(macBuffer); + + retValCv = esl_finalizeHashMACSHA512(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))macBuffer, (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&macLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_PARAMETER_BUFFER */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + /* size is given in bits */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_SHA512_DIGEST)) + { + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha512Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha512Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACSHA512, AUTOMATIC, CRYPTO_30_LIBCV_VAR_NOINIT) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacSha512Verify(Crypto_30_LibCv_GetHmacSha512VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACSHA512)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacSHA512ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA512ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacSHA512VerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacSha512Verify() */ +#endif /* (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) || (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesModeStart( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CIPHER_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CIPHER_IV); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_GMAC, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initGMAC(workSpace, + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchGmacAesModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesModeUpdate( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update GMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateGMAC(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchGmacAesModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) || (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* buffer holding Auth Tag */ + eslt_Byte authTagTempBuffer[CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE] = { 0u }; + + /* # Write results in output buffer. */ + if (esl_finalizeGMAC(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&authTagTempBuffer[0]) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + == ESL_ERC_NO_ERROR) + { + /* # Adapt output size of auth tag. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + /* # Copy auth tag to output buffer. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, authTagTempBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + retValCv = ESL_ERC_NO_ERROR; + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_GmacAesGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6030 4 */ /* MD_MSR_STCYC */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_GmacAesGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfGmacAesGenerate(Crypto_30_LibCv_GetGmacAesGenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceGMAC)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchGmacAesModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchGmacAesModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchGmacAesGenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_GmacAesGenerate() */ +#endif /* (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish( + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* buffer holding Auth Tag */ + eslt_Byte authTagTempBuffer[CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE] = { 0u }; + uint32 authTagTempBufferLength; + + /* # Write results in output buffer. */ + if (esl_finalizeGMAC(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&authTagTempBuffer[0]) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + authTagTempBufferLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength; + /* size is given in bits */ + if (authTagTempBufferLength <= (CRYPTO_30_LIBCV_GMAC_MAX_OUT_TAG_SIZE << 3u)) + { + + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, authTagTempBuffer, authTagTempBufferLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_GmacAesVerify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6030 4 */ /* MD_MSR_STCYC */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_GmacAesVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceGMAC, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfGmacAesVerify(Crypto_30_LibCv_GetGmacAesVerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceGMAC)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchGmacAesModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchGmacAesModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchGmacAesVerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_GmacAesVerify() */ +#endif /* (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* # Initialize workspace header. */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Std_ReturnType retVal = E_NOT_OK; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_MAC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (esl_initWorkSpaceHeader(&(workSpace->header), ESL_MAXSIZEOF_WS_HMACRIPEMD160, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Initialize algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initHashMACRIPEMD160(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex)); + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv; + + /* Update HMAC Calculation */ + /* # Process input data. */ + retValCv = esl_updateHashMACRIPEMD160(workSpace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate() */ +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) || (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint8 macBuffer[ESL_SIZEOF_SHA1_DIGEST]; + + if (esl_finalizeHashMACRIPEMD160(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + { + /* # Adapt output size. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr > ESL_SIZEOF_RIPEMD160_DIGEST) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = ESL_SIZEOF_RIPEMD160_DIGEST; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + /* # Write results in output buffers. */ + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, macBuffer, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Set return value */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacRipeMd160Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacRipeMd160Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacRipeMd160Generate(Crypto_30_LibCv_GetHmacRipeMd160GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACRIPEMD160)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacRipeMd160GenerateModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacRipeMd160Generate() */ +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ + +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish( + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + eslt_ErrorCode retValCv; + uint8 macBuffer[ESL_SIZEOF_RIPEMD160_DIGEST]; + + retValCv = esl_finalizeHashMACRIPEMD160(workSpace, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) macBuffer); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER_NOLENGTHGIVEN */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if input length is not to large. */ + /* size is given in bits */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength <= Crypto_30_LibCv_Byte2Bit(ESL_SIZEOF_RIPEMD160_DIGEST)) + { + /* # Check if verification was successful. */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr) = /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CompareMac(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, macBuffer, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER_AND_PARAMETER_BUFFER */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + + return retValCv; +} /* Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacRipeMd160Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacRipeMd160Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceHMACRIPEMD160, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfHmacRipeMd160Verify(Crypto_30_LibCv_GetHmacRipeMd160VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceHMACRIPEMD160)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchHmacRipeMd160ModeStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retValCv = Crypto_30_LibCv_DispatchHmacRipeMd160ModeUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retValCv = Crypto_30_LibCv_DispatchHmacRipeMd160VerifyModeFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_HmacRipeMd160Verify() */ +#endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Mac.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacGenerate.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacGenerate.h new file mode 100644 index 0000000..1763b5d --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacGenerate.h @@ -0,0 +1,261 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_MacGenerate.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for MAC Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_MACGENERATE_H) +# define CRYPTO_30_LIBCV_MACGENERATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAesGenerate() + *********************************************************************************************************************/ +/*! \brief Dispatches the CmacAesGenerate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided key has no proper size. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_AesCmacGeneration + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAesGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_CMACAESGENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SIPHASHGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SipHashGenerate() + *********************************************************************************************************************/ +/*! \brief Dispatches the SipHashGenerate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139106 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SipHashGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SIPHASHGENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha1Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha1Generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-142966 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha1Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA1GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha256Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha256Generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139112 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha256Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA256GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha384Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha384Generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-182647 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha384Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA384GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha512Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha512Generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-HMACSHA512Generate + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha512Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA512GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_GmacAesGenerate() + *********************************************************************************************************************/ +/*! \brief Dispatches the GmacAesGenerate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-180786 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_GmacAesGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_GMACAESGENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacRipeMd160Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the Hmac RIPEMD160 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-242493 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacRipeMd160Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160GENERATE == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_LIBCV_MACGENERATE_H) */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_MacGenerate.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacVerify.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacVerify.h new file mode 100644 index 0000000..f556662 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_MacVerify.h @@ -0,0 +1,261 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_MacVerify.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for MAC Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_MACVERIFY_H) +# define CRYPTO_30_LIBCV_MACVERIFY_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_CmacAesVerify() + *********************************************************************************************************************/ +/*! \brief Dispatches the CmacAesVerify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided key has no proper size. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-DrvCrypto_LibCv_AesCmacVerification + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_CmacAesVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_CMACAESVERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SIPHASHVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SipHashVerify() + *********************************************************************************************************************/ +/*! \brief Dispatches the SipHashVerify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139105 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SipHashVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SIPHASHVERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha1Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha1Verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-142967 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha1Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA1VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha256Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha256verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-143359 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha256Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA256VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha384Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha384verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-182646 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha384Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA384VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacSha512Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the HmacSha512verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-HMACSHA512Verify + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacSha512Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACSHA512VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_GmacAesVerify() + *********************************************************************************************************************/ +/*! \brief Dispatches the GcmAesEncrypt job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-180787 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_GmacAesVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_GMACAESVERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_HmacRipeMd160Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the Hmac RIPEMD160 verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-242494 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_HmacRipeMd160Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_HMACRIPEMD160VERIFY == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_LIBCV_MACVERIFY_H) */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_MacVerify.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Random.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Random.c new file mode 100644 index 0000000..478c637 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Random.c @@ -0,0 +1,3303 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Random.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for RANDOM Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_RANDOM_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_RandomGenerate.h" +#include "Crypto_30_LibCv_RandomSeed.h" + +#include "ESLib_types.h" +#if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) +# include "actFIPS186.h" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_RANDOM_SEED_SIZEOF_ALGORITHM (1u) + +/* FIPS */ +#define CRYPTO_30_LIBCV_FIPS_SEED_LENGTH (20u) + +/* Reseed Interval */ +#define CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN (CRYPTO_30_LIBCV_SIZEOF_UINT32) /* (sizeof(uint32)) */ + +/* HASHDRBG SHA512 SEED LEN */ +#define CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN (2u * ESL_HASHDRBG_SHA512_SEED_LEN) + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomFips186Finish() + *********************************************************************************************************************/ +/*! \brief Dispatches the RandomFips186 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomFips186Finish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_Fips() + *********************************************************************************************************************/ +/*! \brief Initialize the seed for FIPS 186.2 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[out] writeBlock Determines if the block need to be written. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-139102 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_Fips( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock); +#endif /* CRYPTO_30_LIBCV_FIPS186 == STD_ON */ + +#if (CRYPTO_30_LIBCV_DRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgSeedFirst() + **********************************************************************************************************************/ +/*! \brief Initial Seed for NIST800-90A DRBG AES128 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[out] wsDRBG Pointer to the DRBG workspace + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[in] modeDRBG Contains the DRBG mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * wsDRBG has to be initialized and a valid eslt_WorkSpaceCTRDRBG pointer. + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * modeDRBG has to be a valid + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgSeedFirst( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgReseed() + **********************************************************************************************************************/ +/*! \brief Reseed for NIST800-90A DRBG AES128 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[out] wsDRBG Pointer to the DRBG workspace + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[in] modeDRBG indication which AES size the DRBG shall be based on and whether the seeding and + * generating functions shall use a derivation function or not + * \return E_OK Request was successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * wsDRBG has to be initialized and a valid eslt_WorkSpaceCTRDRBG pointer. + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * modeDRBG has to be a valid + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgReseed( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare() + **********************************************************************************************************************/ +/*! \brief Prepare Nist 800-90A DRBG Aes execution for esl_getBytesRng. + * \details Check input parameter and prepare generation. + * \param[out] ws Pointer to the workspace. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] keyElements Struct to get element informations. + * \param[out] seedStateElementIndexPtr Holds the element index for Seed state. + * \param[out] seedCounterElementIndexPtr Holds the element index for Seed counter. + * \param[out] persistPtr Determines if the block needs to be written. + * \param[in] seedLength Contains the seed length. + * \param[in] modeDRBG Contains the DRBG mode. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy exhausted, random seed need to be called. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre all pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * seedLength has to be a valid length. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare( + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedStateElementIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedCounterElementIndexPtr, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr, + uint32 seedLength, + eslt_DRBGMode modeDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes() + **********************************************************************************************************************/ +/*! \brief Initialize the seed for NIST800-90A DRBG AES128 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[out] writeBlock Determines if the block need to be written. + * \param[in] modeDRBG Contains the DRBG mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * seedStateElementIndex need to be a valid index. + * modeDRBG has to be a valid + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + eslt_DRBGMode modeDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws() + **********************************************************************************************************************/ +/*! \brief Initialize the seed for NIST800-90A DRBG AES128 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[out] writeBlock Determines if the block need to be written. + * \param[in] modeDRBG Contains the DRBG mode. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * seedStateElementIndex need to be a valid index. + * modeDRBG has to be a valid + * wsDRBG has to be initialized and a valid eslt_WorkSpaceCTRDRBG pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + eslt_DRBGMode modeDRBG, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws() + **********************************************************************************************************************/ +/*! \brief Seed for NIST800-90A DRBG AES128 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the index of the seed state + * \param[in] reseedCtElementIndex Holds the index of the reseed counter + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[in] modeDRBG Contains the DRBG mode. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * seedStateElementIndex need to be a valid index. + * reseedCtElementIndex need to be a valid index. + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * modeDRBG has to be a valid + * wsDRBG has to be initialized and a valid eslt_WorkSpaceCTRDRBG pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws( + uint32 cryptoKeyId, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); + +# if (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_AES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetRandomNistDrbgAes() + **********************************************************************************************************************/ +/*! \brief Nist 800-90A DRBG Aes execution for esl_getBytesRng. + * \details Generate random number. This includes a retry mechanism for generation collision. + * \param[in] partitionIdx The index of the currently active partition. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] requestBuffer Buffer to safe the generated data. + * \param[in] requestLength Length of the requested random data. + * \param[out] persistPtr Determines if the block needs to be written. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy exhausted, random seed need to be called. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre All pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetRandomNistDrbgAes( + uint32 partitionIdx, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate() + **********************************************************************************************************************/ +/*! \brief Generate random number with Nist 800-90A DRBG Aes. + * \details Manage seed state and generate via esl_getBytesCTRDRBG. + * \param[in,out] workspace Pointer to the DRBG workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[out] persistPtr Pointer to a variable to report if the key shall be written. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy exhausted, random seed need to be called. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre workspace pointer has to be a valid. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate( + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) persistPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish() + **********************************************************************************************************************/ +/*! \brief Prepare Nist 800-90A DRBG Aes execution. + * \details Check input parameter and prepare generation. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Generate_NistDrbgAes() + **********************************************************************************************************************/ +/*! \brief Generate random number. + * \details Check input parameter and prepare generation. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] requestBuffer Buffer to safe the generated data. + * \param[in] requestLength Length of the requested random data. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return All return values of esl_getBytesCTRDRBG. + * \pre All pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Generate_NistDrbgAes( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState() + **********************************************************************************************************************/ +/*! \brief Get and set NistDrbgAes state. + * \details Get state parameter and set seed status. + * \param[in] cryptoKeyId Holds the identifier of the key containing the key elements. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] seedCounterElementIndex Holds the identifier of the key element which shall be set + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength() + **********************************************************************************************************************/ +/*! \brief Set NistDrbgAes mode and seed length. + * \details Get correct data from the cryptoKeyId and set NistDrbgAes mode and seed length. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[in,out] modeDRBG Contains the DRBG mode. + * \param[in,out] seedLength Contains the seed length. + * \return E_OK Request was successful. + * E_NOT_OK Request failed. + * \pre All pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength( + uint32 cryptoKeyId, + P2VAR(eslt_DRBGMode, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) modeDRBG, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) seedLength); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +#endif /* CRYPTO_30_LIBCV_DRBGAES == STD_ON */ + +#if (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgSeedFirst() + **********************************************************************************************************************/ +/*! \brief Initial Seed for NIST800-90A DRBG HASH SHA2-512 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[out] wsDRBG Pointer to the DRBG workspace + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * wsDRBG has to be initialized and a valid eslt_WorkSpaceHASHDRBG pointer. + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgSeedFirst( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgReseed() + **********************************************************************************************************************/ +/*! \brief Reseed for NIST800-90A DRBG HASH SHA2-512 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[out] wsDRBG Pointer to the DRBG workspace + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \return E_OK Request was successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * wsDRBG has to be initialized and a valid eslt_WorkSpaceHASHDRBG pointer. + * reseedCnt has to be a valid pointer with the length CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN. + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgReseed( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash() + **********************************************************************************************************************/ +/*! \brief Initialize the seed for NIST800-90A DRBG HASH SHA2-512 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[out] writeBlock Determines if the block need to be written. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * seedStateElementIndex need to be a valid index. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws() + **********************************************************************************************************************/ +/*! \brief Initialize the seed for NIST800-90A DRBG HASH SHA2-512 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[out] writeBlock Determines if the block need to be written. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * seedStateElementIndex need to be a valid index. + * wsDRBG has to be initialized and a valid eslt_WorkSpaceHASHDRBG pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgSeed_With_Ws() + **********************************************************************************************************************/ +/*! \brief Seed for NIST800-90A DRBG HASH SHA2-512 + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the index of the seed state + * \param[in] reseedCtElementIndex Holds the index of the reseed counter + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre cryptoKeyId as well as elementIndex must identify a valid key - key element pair + * entropyPtr need to be a valid pointer with at least the length of entropyLength + * seedStateElementIndex need to be a valid index. + * reseedCtElementIndex need to be a valid index. + * wsDRBG has to be initialized and a valid eslt_WorkSpaceHASHDRBG pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgSeed_With_Ws( + uint32 cryptoKeyId, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState() + **********************************************************************************************************************/ +/*! \brief Get and set NistDrbgHash state. + * \details Get state parameter and set seed status. + * \param[in] cryptoKeyId Holds the identifier of the key containing the key elements. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] seedCounterElementIndex Holds the identifier of the key element which shall be set + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre All pointers need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish() + **********************************************************************************************************************/ +/*! \brief Prepare Nist 800-90A DRBG Hash execution. + * \details Check input parameter and prepare generation. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare() + **********************************************************************************************************************/ +/*! \brief Prepare Nist 800-90A DRBG Hash execution for esl_getBytesHASHDRBG. + * \details Check input parameter and prepare generation. + * \param[out] ws Pointer to the workspace. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] keyElements Struct to get element informations. + * \param[out] seedStateElementIndexPtr Holds the element index for Seed state. + * \param[out] seedCounterElementIndexPtr Holds the element index for Seed counter. + * \param[out] persistPtr Determines if the block needs to be written. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy exhausted, random seed need to be called. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre all pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare( + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ws, + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedStateElementIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedCounterElementIndexPtr, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Generate_NistDrbgHash() + **********************************************************************************************************************/ +/*! \brief Generate random number. + * \details Check input parameter and prepare generation. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] requestBuffer Buffer to safe the generated data. + * \param[in] requestLength Length of the requested random data. + * \param[in,out] wsDRBG Pointer to the DRBG workspace. + * \return All return values of esl_getBytesHASHDRBG. + * \pre All pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Generate_NistDrbgHash( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + +# if (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetRandomNistDrbgHash() + **********************************************************************************************************************/ +/*! \brief Nist 800-90A DRBG Hash execution for esl_getBytesRng. + * \details Generate random number. This includes a retry mechanism for generation collision. + * \param[in] partitionIdx The index of the currently active partition. + * \param[in] cryptoKeyId Identifier of the crypto key. + * \param[out] requestBuffer Buffer to safe the generated data. + * \param[in] requestLength Length of the requested random data. + * \param[out] persistPtr Determines if the block needs to be written. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy exhausted, random seed need to be called. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre All pointers need to be valid. + * cryptoKeyId has to be a valid key id. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetRandomNistDrbgHash( + uint32 partitionIdx, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr); /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +# endif +#endif /* CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON */ + +#if ((CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Random_Check_For_Write_Once() + *********************************************************************************************************************/ +/*! \brief Check the key element for write once + * \details This function checks the key element for write once + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in,out] reseedCtElementIndex Holds the identifier of the key element which shall be set + * \return TRUE Write once inactive. + * FALSE Write once active. + * \pre cryptoKeyId must identify a valid key + * seedStateElementIndex need to be a valid index. + * reseedCtElementIndex need to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Random_Check_For_Write_Once( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) reseedCtElementIndex); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Set_NistDrbgState() + *********************************************************************************************************************/ +/*! \brief Set the key element state and the reseed counter + * \details This function sets the key element state and the reseed counter + * \param[in] cryptoKeyId Holds the identifier of the key containing the key elements. + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] seedCounterElementIndex Holds the identifier of the key element which shall be set + * \param[in] retValCv Holds the return value + * \param[in] seedLength Holds the seed length + * \param[in] expectedSeedLength Holds the expected seed length + * \param[in] reseedCntBuf Holds the reseed counter + * \param[in] seedStatus Holds the current seed status + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre seedStateElementIndex need to be a valid index. + * reseedCtElementIndex need to be a valid index. + * retValCv need to be a valid value. + * seedLength need to be a valid length. + * expectedSeedLength need to be a valid length. + * reseedCntBuf need to be a valid buffer. + * seedStatus need to be a valid status. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Set_NistDrbgState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + eslt_ErrorCode retValCv, + eslt_Length seedLength, + eslt_Length expectedSeedLength, + uint32 reseedCntBuf, + eslt_DRBGSeedStatusType seedStatus); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist() + *********************************************************************************************************************/ +/*! \brief Check the key element for persist + * \details This function checks the key element for persist + * \param[in] seedStateElementIndex Holds the identifier of the key element which shall be set + * \param[in] seedCounterElementIndex Holds the identifier of the key element which shall be set + * \param[out] persistPtr Holds the return value + * \pre seedStateElementIndex need to be a valid index. + * reseedCtElementIndex need to be a valid index. + * persist need to be a valid pointer. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist( + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr); +#endif /* ((CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_IsRngCalculationValid() + **********************************************************************************************************************/ +/*! \brief Check if the Rng Calculation is valid. + * \details Check if the Rng counter has the expected value. + * \param[in] localCount holds the start counter. + * \param[in] currentPartitionIdx The partition Idx of the currently running partition. + * \return TRUE Same counter value. + * FALSE Different counter value. + * \pre This function need to be protected by an exclusive area + * (Crypto_30_LibCv_RandomSourceGenerateCount is accessed). + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsRngCalculationValid(uint16 localCount, uint32 currentPartitionIdx); +#endif /* CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON */ + +#if (CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyValueChangedCallout() + **********************************************************************************************************************/ +/*! \brief Call key value changed callout. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key. + * \pre cryptoKeyId must identify a valid key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyValueChangedCallout(uint32 cryptoKeyId); +#endif /* CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ +#if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomFips186Finish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 3 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomFips186Finish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + P2VAR(eslt_WorkSpaceFIPS186, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfFips186(Crypto_30_LibCv_GetFips186IdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SizeOfKeyStorageType fips186KeyIndex; + uint32 fips186KeyLength; + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) randomSeedBuffer = &Crypto_30_LibCv_GetRandomSeedBuffer(Crypto_30_LibCv_GetRandomSeedBufferStartIdxOfObjectInfo(objectId)); + + /* ----- Implementation ------------------------------------------------- */ + /* #50 Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_FIPS186, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + + /* Get index of keyElement SEED_STATE */ + if (Crypto_30_LibCv_Local_KeyElementSearch(job->cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #60 Distinguish the different modes for seeding and restoring seed state. */ + /* Check if randomSeed was called on the given key element */ + if (!Crypto_30_LibCv_IsKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_MASK)) + { + /* Get new seed value */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &fips186KeyIndex, &fips186KeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* check if initial seed is required */ + /* #70 Seed if RandomSeed was called on the given key. (first time) */ + if (!Crypto_30_LibCv_Uint8CheckMask(randomSeedBuffer[0], CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + retValCv = esl_initFIPS186(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)fips186KeyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(fips186KeyIndex), + NULL_PTR); + /* mark new seed as initiated */ + Crypto_30_LibCv_Uint8SetMask(randomSeedBuffer[0], CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ + } + else + { + /* #80 Reseed if RandomSeed was called on the given key and restore the old seed state. */ + /* Restore workspace - This is done manually since workspace is not kept forever due to shared memory (union) */ + retValCv = esl_initFIPS186(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)fips186KeyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(fips186KeyIndex), + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&randomSeedBuffer[1]); + } + /* mark new seed as used */ + Crypto_30_LibCv_SetKeyElementStateByMask(elementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL01 */ +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + /* Call KeyNvStatus KeyChanged transition since the key element is changed inside esl_initFIPS186 */ + Crypto_30_LibCv_KeyNvStatus_KeyChanged(job->cryptoKeyId, elementIndex); + + if (Crypto_30_LibCv_IsKeyElementPersist(elementIndex) == TRUE) + { + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, TRUE); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } +# endif + } + else + { + retValCv = ESL_ERC_ERROR; + /* keep retVal */ + } + } + else + { + if (Crypto_30_LibCv_Uint8CheckMask(randomSeedBuffer[0], CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + /* #85 If the rng is not seeded only restore old seed state. */ + /* Restore workspace - This is done manually since workspace is not kept forever due to shared memory (union) */ + retValCv = esl_initFIPS186(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + (eslt_Length)CRYPTO_30_LIBCV_FIPS_SEED_LENGTH, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&randomSeedBuffer[1], + NULL_PTR); + } + else + { + retValCv = ESL_ERC_ERROR; + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + } + } + else + { + retValCv = ESL_ERC_ERROR; + } + + /* #90 Generate Random Numbers. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + retValCv = esl_getBytesFIPS186(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + + /* #95 Save workspace. */ + /* Save internal state of key random method to continue with the next good value. */ + Crypto_30_LibCv_CopyData(&randomSeedBuffer[1], ((P2VAR(actFIPS186STRUCT, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))workspace->wsFIPS186)->X_KEY, CRYPTO_30_LIBCV_FIPS_SEED_LENGTH); /* PRQA S 3305, 0310, 0315 */ /* MD_CRYPTO_30_LIBCV_3305_CRYPTOLIBRARY_CAST, MD_CRYPTO_30_LIBCV_0310_CRYPTOLIBRARY_CAST, MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_ACT_RANDOM_WORKSPACE_ARRAY_ACCESS */ + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else if (retVal == CRYPTO_E_KEY_NOT_VALID) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + else + { + /* keep retVal */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomFips186Finish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_Fips() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_Fips( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Deny service for write once keys. */ + if (Crypto_30_LibCv_IsKeyElementWriteOnce(seedStateElementIndex)) + { + retVal = E_NOT_OK; + } + /* #10 Seed key element and update seed state */ + else if (Crypto_30_LibCv_Local_KeyElementSetInternal(cryptoKeyId, seedStateElementIndex, entropyPtr, entropyLength, CRYPTO_30_LIBCV_WA_ALLOWED) == E_OK) /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + { + /* The elementIndex do not need to be checked. The Code is only reachable if the key element is available. (Crypto_30_LibCv_Local_KeyElementSearch) */ + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_NORMAL_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + *writeBlock = Crypto_30_LibCv_Internal_KeySetValid(cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + retVal = E_OK; + } + else + { + *writeBlock = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_RandomSeed_Fips() */ +#endif /* (CRYPTO_30_LIBCV_FIPS186 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_DRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgReseed() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgReseed( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyStorageType additionalInputIndex = 0u, seedIndex, reseedCounter; + uint32 reseedCnt, additionalInputLength = 0u; + uint32 seedLength = ESL_CTRDRBG_AES128_SEEDLEN; + uint32 reseedCntLength = CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN; + + /* ----- Implementation ------------------------------------------------- */ + + if ((modeDRBG == ESL_DRBGMODE_CTRDRBG_AES256_NODF) || (modeDRBG == ESL_DRBGMODE_CTRDRBG_AES256_DF)) + { + seedLength = ESL_CTRDRBG_AES256_SEEDLEN; + } + + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &seedIndex, &seedLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, &reseedCounter, &reseedCntLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + /* #1 Reseed: restore seed state */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCnt, Crypto_30_LibCv_GetAddrKeyStorage(reseedCounter)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + retValCv = esl_restoreStateCTRDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(seedIndex), + (eslt_Length) seedLength, + (eslt_DRBGReseedCounterType) reseedCnt, + (eslt_Byte) ESL_DRBG_SEED_STATUS_SEEDED, + modeDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #5 check if additional input is available. (optional feature) */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT, &additionalInputIndex, &additionalInputLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + } + + if ((localRetVal == E_OK) && (additionalInputLength > 0u)) + { + /* #10 reseed via esl_seedCTRDRBG */ + retValCv = esl_seedCTRDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) entropyPtr, + (eslt_Length) entropyLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(additionalInputIndex), + (eslt_Length) additionalInputLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) || (localRetVal == E_OK)) + { + retValCv = esl_seedCTRDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) entropyPtr, + (eslt_Length) entropyLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + /* request failed */ + retValCv = ESL_ERC_ERROR; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_AesCtrDrbgReseed() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgSeedFirst() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgSeedFirst( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal = E_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyStorageType personalizationStrIndex, nonceIndex = 0u; + uint32 personalizationStrLength, nonceLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + if ((modeDRBG == ESL_DRBGMODE_CTRDRBG_AES128_DF) || (modeDRBG == ESL_DRBGMODE_CTRDRBG_AES256_DF)) + { + /* #10 Get Nonce */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_NONCE, &nonceIndex, &nonceLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + + if (localRetVal == E_OK) + { + /* #15 Get Private String (recommended feature) */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING, &personalizationStrIndex, &personalizationStrLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if ((localRetVal == E_OK) && (personalizationStrLength > 0u)) + { + /* #20 seed with personal string via esl_seedCTRDRBG */ + retValCv = esl_seedCTRDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) entropyPtr, + (eslt_Length)entropyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(nonceIndex), + (eslt_Length)nonceLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(personalizationStrIndex), + (eslt_Length)personalizationStrLength, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) || (localRetVal == E_OK)) + { + /* #25 Personal string in not available in the key so seed without personal string. */ + retValCv = esl_seedCTRDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) entropyPtr, + (eslt_Length) entropyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(nonceIndex), + (eslt_Length) nonceLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + /* request failed */ + } + + /* #30 set algorithm initiated */ + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_AesCtrDrbgSeedFirst() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws( + uint32 cryptoKeyId, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + eslt_DRBGMode modeDRBG, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + /* #1 Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(wsDRBG->header), ESL_MAXSIZEOF_WS_CTRDRBG, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + retValCv |= esl_initCTRDRBG(wsDRBG, modeDRBG); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #5 already initiated / Reseeding */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + retVal = Crypto_30_LibCv_AesCtrDrbgReseed(cryptoKeyId, wsDRBG, entropyPtr, entropyLength, modeDRBG); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + } + /* #10 need to be initiated */ + else + { + retVal = Crypto_30_LibCv_AesCtrDrbgSeedFirst(cryptoKeyId, wsDRBG, entropyPtr, entropyLength, modeDRBG); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + } + + if (retVal == E_OK) + { + /* #20 Get current DRBG state and save the seed status */ + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState( + cryptoKeyId, + seedStateElementIndex, + reseedCtElementIndex, + wsDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + } + + if ((retValCv != E_OK) || (retVal != E_OK)) + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_LibCv_ClearKeyElementStateByMask(reseedCtElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + /* #30 Call the callout if the functionality is enabled and trigger that the key value is changed */ + /* Key validity changed callout is called in Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws */ +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + Crypto_30_LibCv_KeyValueChangedCallout(cryptoKeyId); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare( + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ws, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedStateElementIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedCounterElementIndexPtr, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr, + uint32 seedLength, + eslt_DRBGMode modeDRBG) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + + /* ----- Implementation ------------------------------------------------- */ + + /* # load seed state and reseed counter */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_RANDOM_SEED_STATE, seedLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 1u, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Get index of keyElement SEED_STATE and CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER */ + (void)Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, seedStateElementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + (void)Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, seedCounterElementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(ws->header), ESL_MAXSIZEOF_WS_CTRDRBG, CRYPTO_30_LIBCV_WATCHDOG_PTR) != ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retVal = E_NOT_OK; + } + else + { + /* # Initialize CTR DRBG workspace. */ + if (esl_initCTRDRBG(ws, modeDRBG) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist(*seedStateElementIndexPtr, *seedCounterElementIndexPtr, persistPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } + else + { + retVal = E_NOT_OK; + } + } + } + else if (retVal == CRYPTO_E_KEY_NOT_VALID) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + else + { + /* keep retVal */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare() */ + +# if (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_AES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetRandomNistDrbgAes() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6050 5 */ /* MD_MSR_STPTH, MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetRandomNistDrbgAes( + uint32 partitionIdx, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_WorkSpaceCTRDRBG ws; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex = 0u, seedCounterElementIndex = 0u; + uint32 retry; + uint16 localCount; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + uint32 reseedCntBuf; + eslt_Byte seedStatus; + eslt_DRBGMode modeDRBG = 0u; + eslt_Length seedLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + /* # Get Algorithm from the algorithm key element to set the correct DRBG mode */ + if (Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength(cryptoKeyId, &modeDRBG, &seedLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* # Prepare DRBG and check key data. */ + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare(&ws, cryptoKeyId, keyElements, &seedStateElementIndex, &seedCounterElementIndex, persistPtr, (uint32)seedLength, modeDRBG); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } + + if (retVal == E_OK) + { + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* # Calculate random number until calculation is valid or max reties exhausted. */ + for (retry = 0u; retry < CRYPTO_30_LIBCV_DEFAULT_RANDOM_MAX_RETRIES; retry++) + { + /* # Copy counter and RNG paramater to local buffers. */ + localCount = Crypto_30_LibCv_GetRandomSourceGenerateCount(partitionIdx); + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCntBuf, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedCounterElementIndex)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + seedStatus = ESL_DRBG_SEED_STATUS_SEEDED; + } + else + { + seedStatus = ESL_DRBG_SEED_STATUS_UNSEEDED; + } + + retValCv = esl_restoreStateCTRDRBG( + (P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &ws, /* PRQA S 2982 */ /* MD_MSR_RetVal */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + seedLength, + reseedCntBuf, + seedStatus, + modeDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Generate random number DRBG. */ + retValCv = Crypto_30_LibCv_Local_Generate_NistDrbgAes( + cryptoKeyId, + requestBuffer, + requestLength, + &ws); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* # Check if rng counter has changed. */ + if ((Crypto_30_LibCv_IsRngCalculationValid(localCount, partitionIdx)) && (retValCv == ESL_ERC_NO_ERROR)) + { + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState( + cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + &ws); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + /* break loop */ + break; + } + else + { + retVal = E_NOT_OK; + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (retVal != E_OK) + { + /* # clear output buffer if request failed. */ + Crypto_30_LibCv_ClearData(requestBuffer, requestLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + *persistPtr = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + } + + if ((retValCv != ESL_ERC_NO_ERROR) || (retVal != E_OK)) + { + if (retValCv == ESL_ERC_ENTROPY_EXHAUSTION) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_GetRandomNistDrbgAes() */ +# endif /* (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_AES == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + /* PRQA S 6050 4 */ /* MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate( + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2VAR(boolean, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) persistPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex = 0u, seedCounterElementIndex = 0u; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + eslt_DRBGReseedCounterType reseedCntBuf; + eslt_DRBGMode modeDRBG = 0u; + eslt_Byte seedStatus; + eslt_Length seedLength = 0u; + + if (Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength(job->cryptoKeyId, &modeDRBG, &seedLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #20 Load seed state, seed counter and check key data. */ + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgAesGeneratePrepare(workspace, job->cryptoKeyId, keyElements, &seedStateElementIndex, &seedCounterElementIndex, persistPtr, (uint32)seedLength, modeDRBG); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } + + if (retVal == E_OK) + { + retVal = E_NOT_OK; + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCntBuf, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedCounterElementIndex)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + seedStatus = ESL_DRBG_SEED_STATUS_SEEDED; + } + else + { + seedStatus = ESL_DRBG_SEED_STATUS_UNSEEDED; + } + + /* #30 Set state to current seed state. */ + retValCv = esl_restoreStateCTRDRBG( + workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + seedLength, + reseedCntBuf, + seedStatus, + modeDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #31 generate random number via esl_getBytesCTRDRBG. */ + retValCv = Crypto_30_LibCv_Local_Generate_NistDrbgAes( + job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #32 Set current state. */ + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState( + job->cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + } + } + + if (retValCv == ESL_ERC_ENTROPY_EXHAUSTION) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate() */ +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6050 3 */ /* MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + boolean persist = FALSE; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 load workspace */ + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfDRBGAES(Crypto_30_LibCv_GetDRBGAESIdxOfObjectInfo(objectId)); + + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgAesFinishGenerate(workspace, job, &persist); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal != E_OK) + { + /* # clear output buffer if request failed */ + Crypto_30_LibCv_ClearData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else + { + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, persist); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key value is changed */ + Crypto_30_LibCv_KeyValueChangedCallout(job->cryptoKeyId); +# endif + /* Call the callout if the functionality is enabled and trigger that the key is set to valid */ +# if(CRYPTO_30_LIBCV_KEYVALIDITYSETCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + Crypto_30_LibCv_GetKeyValiditySetCalloutFctNameOfConfigurableCallouts()(job->cryptoKeyId, TRUE); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Generate_NistDrbgAes() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Generate_NistDrbgAes( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyStorageType additionalInputIndex; + uint32 additionalInputLength = 0u; + + /* #10 Load additional input. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT, &additionalInputIndex, &additionalInputLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* #20 Generate random number DRBG. */ + if ((localRetVal == E_OK) && (additionalInputLength > 0u)) + { + retValCv = esl_getBytesCTRDRBG( + wsDRBG, + (eslt_Length) requestLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) requestBuffer, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(additionalInputIndex), + (eslt_Length) additionalInputLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == E_OK) || (localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE)) + { + retValCv = esl_getBytesCTRDRBG( + wsDRBG, + (eslt_Length) requestLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) requestBuffer, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + + return retValCv; +} /* Crypto_30_LibCv_Local_Generate_NistDrbgAes() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv; + eslt_DRBGReseedCounterType reseedCntBuf; + eslt_DRBGSeedStatusType seedStatus; + eslt_DRBGMode modeDRBG; + eslt_Length seedLength = Crypto_30_LibCv_GetKeyElementLength(seedStateElementIndex); + eslt_Length expectedSeedLength = ESL_CTRDRBG_AES128_SEEDLEN; + + if ((wsDRBG->wsDRBG.mode == ESL_DRBGMODE_CTRDRBG_AES256_NODF) || (wsDRBG->wsDRBG.mode == ESL_DRBGMODE_CTRDRBG_AES256_DF)) + { + expectedSeedLength = ESL_CTRDRBG_AES256_SEEDLEN; + } + + /* #10 Get current DRBG state and save the seed state. */ + retValCv = esl_getStateCTRDRBG( + wsDRBG, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &seedLength, + (P2VAR(eslt_DRBGReseedCounterType, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &reseedCntBuf, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &seedStatus, + (P2VAR(eslt_DRBGMode, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &modeDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + retVal = Crypto_30_LibCv_Local_Set_NistDrbgState( + cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + retValCv, + seedLength, + expectedSeedLength, + reseedCntBuf, + seedStatus); + + return retVal; +} /* Crypto_30_LibCv_Local_Get_And_Set_NistDrbgAesState() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + eslt_DRBGMode modeDRBG) +{ + /* #10 Initialize workspace */ + eslt_WorkSpaceCTRDRBG wsDRBG; + + /* Call Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws */ + return Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + cryptoKeyId, + seedStateElementIndex, + entropyPtr, + entropyLength, + writeBlock, + modeDRBG, + &wsDRBG); +} /* Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + eslt_DRBGMode modeDRBG, + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex; + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Deny service for write once keys. */ + if (Crypto_30_LibCv_Local_Random_Check_For_Write_Once(cryptoKeyId, seedStateElementIndex, &reseedCtElementIndex) != TRUE) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* retVal is already set */ + } + /* #10 seed with new seed value */ + else if (Crypto_30_LibCv_AesCtrDrbgSeed_With_Ws(cryptoKeyId, seedStateElementIndex, reseedCtElementIndex, entropyPtr, entropyLength, modeDRBG, wsDRBG) == E_OK) /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + { + /* The elementIndex do not need to be checked. The Code is only reachable if the key element is available. (Crypto_30_LibCv_Local_KeyElementSearch) */ + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + *writeBlock = Crypto_30_LibCv_Internal_KeySetValid(cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + retVal = E_OK; + } + else + { + *writeBlock = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6080 4 */ /* MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength( + uint32 cryptoKeyId, + P2VAR(eslt_DRBGMode, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) modeDRBG, + P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) seedLength) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyElementsType algorithmElementIndex = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Search algorithm index */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_RANDOM_ALGORITHM, &algorithmElementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #20 Set correct mode and seed length */ + if (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(algorithmElementIndex)) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128) + { + *modeDRBG = ESL_DRBGMODE_CTRDRBG_AES128_NODF; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *seedLength = ESL_CTRDRBG_AES128_SEEDLEN; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else if (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(algorithmElementIndex)) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128_DF) + { + *modeDRBG = ESL_DRBGMODE_CTRDRBG_AES128_DF; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *seedLength = ESL_CTRDRBG_AES128_SEEDLEN; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else if (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(algorithmElementIndex)) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256) + { + *modeDRBG = ESL_DRBGMODE_CTRDRBG_AES256_NODF; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *seedLength = ESL_CTRDRBG_AES256_SEEDLEN; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else if (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(algorithmElementIndex)) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256_DF) + { + *modeDRBG = ESL_DRBGMODE_CTRDRBG_AES256_DF; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + *seedLength = ESL_CTRDRBG_AES256_SEEDLEN; /* SBSW_CRYPTO_30_LIBCV_PTR_ACCESS */ + retVal = E_OK; + } + else + { + /* Return value already set */ + } + } + + return retVal; +} /* Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength() */ +#endif /* (CRYPTO_30_LIBCV_DRBGAES == STD_ON) */ + +#if (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock) +{ + /* #10 Initialize workspace */ + eslt_WorkSpaceHASHDRBG wsDRBG; + + /* #20 Call Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws */ + return Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws( /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + cryptoKeyId, + seedStateElementIndex, + entropyPtr, + entropyLength, + writeBlock, + &wsDRBG); +} /* Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) writeBlock, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Deny service for write once keys. */ + if (Crypto_30_LibCv_Local_Random_Check_For_Write_Once(cryptoKeyId, seedStateElementIndex, &reseedCtElementIndex) != TRUE) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* retVal is already set */ + } + /* #20 seed with new seed value. */ + else if (Crypto_30_LibCv_HashDrbgSeed_With_Ws(cryptoKeyId, seedStateElementIndex, reseedCtElementIndex, entropyPtr, entropyLength, wsDRBG) == E_OK) /* SBSW_CRYPTO_30_LIBCV_PTR_FORWARDING_WITH_DET_CHECK */ + { + /* The elementIndex do not need to be checked. The Code is only reachable if the key element is available. (Crypto_30_LibCv_Local_KeyElementSearch) */ + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ + *writeBlock = Crypto_30_LibCv_Internal_KeySetValid(cryptoKeyId); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + + retVal = E_OK; + } + else + { + *writeBlock = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + + return retVal; +} /* Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgSeed_With_Ws() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgSeed_With_Ws( + uint32 cryptoKeyId, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType reseedCtElementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv; + + /* ----- Implementation ------------------------------------------------- */ + /* #1 Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(wsDRBG->header), ESL_MAXSIZEOF_WS_HASHDRBG, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + retValCv |= esl_initHASHDRBG(wsDRBG, ESL_DRBGMODE_HASHDRBG_SHA512); /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #5 already initiated / Reseeding */ + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + retVal = Crypto_30_LibCv_HashDrbgReseed(cryptoKeyId, wsDRBG, entropyPtr, entropyLength); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + } + /* #10 need to be initiated */ + else + { + retVal = Crypto_30_LibCv_HashDrbgSeedFirst(cryptoKeyId, wsDRBG, entropyPtr, entropyLength); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_STACK_WITH_STACK_BUFFERS_AND_PTR_AS_PARAMETER */ + } + + if (retVal == E_OK) + { + /* #20 Get current DRBG state and save the seed status */ + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState( + cryptoKeyId, + seedStateElementIndex, + reseedCtElementIndex, + wsDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + } + + if ((retValCv != E_OK) || (retVal != E_OK)) + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_LibCv_ClearKeyElementStateByMask(reseedCtElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_ELEMENT_VIA_KEY */ +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key value is changed */ + /* Key validity changed callout is called in Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws */ + Crypto_30_LibCv_KeyValueChangedCallout(cryptoKeyId); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_HashDrbgSeed_With_Ws() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgSeedFirst() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgSeedFirst( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyStorageType personalizationStrIndex, nonceIndex = 0u; + uint32 personalizationStrLength, nonceLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + /* #10 Get Nonce index */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_NONCE, &nonceIndex, &nonceLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + /* #15 Get Private String (recommended feature) */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING, &personalizationStrIndex, &personalizationStrLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if ((localRetVal == E_OK) && (personalizationStrLength > 0u)) + { + /* #20 seed with personal string via esl_seedHASHDRBG */ + retValCv = esl_seedHASHDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))entropyPtr, + (eslt_Length)entropyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(nonceIndex), + (eslt_Length)nonceLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(personalizationStrIndex), + (eslt_Length)personalizationStrLength, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) || (localRetVal == E_OK)) + { + /* #25 Personal string in not available in the key so seed without personal string. */ + retValCv = esl_seedHASHDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))entropyPtr, + (eslt_Length)entropyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(nonceIndex), + (eslt_Length)nonceLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + /* request failed */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_HashDrbgSeedFirst() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_HashDrbgReseed() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_HashDrbgReseed( + uint32 cryptoKeyId, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsDRBG, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyStorageType additionalInputIndex = 0u, seedIndex, reseedCounter; + uint32 seedLength = CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN; + uint32 reseedCntLength = CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN; + uint32 reseedCnt, additionalInputLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &seedIndex, &seedLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, &reseedCounter, &reseedCntLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + { + /* #1 Reseed: restore seed state */ + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCnt, Crypto_30_LibCv_GetAddrKeyStorage(reseedCounter)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + retValCv = esl_restoreStateHASHDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(seedIndex), + (eslt_Length)seedLength, + reseedCnt, + (eslt_Byte)ESL_DRBG_SEED_STATUS_SEEDED, + (eslt_DRBGMode)ESL_DRBGMODE_HASHDRBG_SHA512); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #5 check if additional input is available. (optional feature) */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT, &additionalInputIndex, &additionalInputLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + } + } + + if ((localRetVal == E_OK) && (additionalInputLength > 0u)) + { + /* #10 reseed via esl_seedHASHDRBG */ + retValCv = esl_seedHASHDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))entropyPtr, + (eslt_Length)entropyLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(additionalInputIndex), + (eslt_Length)additionalInputLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE) || (localRetVal == E_OK)) + { + retValCv = esl_seedHASHDRBG(wsDRBG, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))entropyPtr, + (eslt_Length)entropyLength, + NULL_PTR, + 0u, + NULL_PTR, + 0u, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + /* request failed */ + retValCv = ESL_ERC_ERROR; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_HashDrbgReseed() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv; + uint32 reseedCntBuf; + eslt_Length seedLength = Crypto_30_LibCv_GetKeyElementLength(seedStateElementIndex); + eslt_DRBGSeedStatusType seedStatus; + eslt_DRBGMode modeDRBG; + + /* #10 Get current DRBG state and save the seed state. */ + retValCv = esl_getStateHASHDRBG(wsDRBG, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + &seedLength, + &reseedCntBuf, + &seedStatus, + &modeDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + retVal = Crypto_30_LibCv_Local_Set_NistDrbgState( + cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + retValCv, + seedLength, + CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN, + reseedCntBuf, + seedStatus); + + return retVal; +} /* Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6050 3 */ /* MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, localRetVal; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, seedCounterElementIndex; + uint32 reseedCntBuf; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + boolean persist = FALSE; + eslt_DRBGSeedStatusType seedStatus; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 load workspace */ + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfDRBGHashSha512(Crypto_30_LibCv_GetDRBGHashSha512IdxOfObjectInfo(objectId)); + + /* #20 Load seed state, seed counter and check key data. */ + localRetVal = Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare(workspace, job->cryptoKeyId, keyElements, &seedStateElementIndex, &seedCounterElementIndex, &persist); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (localRetVal == E_OK) + { + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCntBuf, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedCounterElementIndex)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + seedStatus = ESL_DRBG_SEED_STATUS_SEEDED; + } + else + { + seedStatus = ESL_DRBG_SEED_STATUS_UNSEEDED; + } + + /* #30 Set state to current seed state. */ + retValCv = esl_restoreStateHASHDRBG(workspace, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + (eslt_Length)CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN, + (eslt_DRBGReseedCounterType)reseedCntBuf, + seedStatus, + ESL_DRBGMODE_HASHDRBG_SHA512); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #31 generate random number via esl_getBytesHASHDRBG. */ + retValCv = Crypto_30_LibCv_Local_Generate_NistDrbgHash( + job->cryptoKeyId, + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, + workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* #32 Set current state. */ + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState( + job->cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + workspace); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + } + } + else + { + retVal = localRetVal; + } + + if (retValCv == ESL_ERC_ENTROPY_EXHAUSTION) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + + if (retVal != E_OK) + { + /* clear output buffer if request failed */ + Crypto_30_LibCv_ClearData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else + { + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, persist); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key value is changed */ + Crypto_30_LibCv_KeyValueChangedCallout(job->cryptoKeyId); +# endif + /* Call the callout if the functionality is enabled and trigger that the key is set to valid */ +# if(CRYPTO_30_LIBCV_KEYVALIDITYSETCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + Crypto_30_LibCv_GetKeyValiditySetCalloutFctNameOfConfigurableCallouts()(job->cryptoKeyId, TRUE); +# endif + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6060 7 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare( + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) ws, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedStateElementIndexPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) seedCounterElementIndexPtr, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + + /* ----- Implementation ------------------------------------------------- */ + + /* # load seed state and reseed counter */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_RANDOM_SEED_STATE, CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 1u, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Get index of keyElement SEED_STATE and CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER */ + (void)Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, seedStateElementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + (void)Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, seedCounterElementIndexPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* # Initialize workspace header */ + if (esl_initWorkSpaceHeader(&(ws->header), ESL_MAXSIZEOF_WS_HASHDRBG, CRYPTO_30_LIBCV_WATCHDOG_PTR) != ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + retVal = E_NOT_OK; + } + else + { + /* # Initialize workspace */ + if (esl_initHASHDRBG(ws, ESL_DRBGMODE_HASHDRBG_SHA512) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist(*seedStateElementIndexPtr, *seedCounterElementIndexPtr, persistPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + } + else + { + retVal = E_NOT_OK; + } + } + } + else if (retVal == CRYPTO_E_KEY_NOT_VALID) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + else + { + /* keep retVal */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Generate_NistDrbgHash() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Generate_NistDrbgHash( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) wsDRBG) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType localRetVal; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyStorageType additionalInputIndex; + uint32 additionalInputLength = 0u; + + /* #10 Load additional input. */ + localRetVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndex(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT, &additionalInputIndex, &additionalInputLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + + /* #20 Generate random number DRBG. */ + if ((localRetVal == E_OK) && (additionalInputLength > 0u)) + { + retValCv = esl_getBytesHASHDRBG(wsDRBG, + (eslt_Length)requestLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))requestBuffer, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(additionalInputIndex), + (eslt_Length)additionalInputLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else if ((localRetVal == E_OK) || (localRetVal == CRYPTO_E_KEY_NOT_AVAILABLE)) + { + retValCv = esl_getBytesHASHDRBG(wsDRBG, + (eslt_Length)requestLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) requestBuffer, + NULL_PTR, + 0u); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + else + { + retValCv = ESL_ERC_ERROR; + } + + return retValCv; +} /* Crypto_30_LibCv_Local_Generate_NistDrbgHash() */ + +# if (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetRandomNistDrbgHash() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6010, 6050 5 */ /* MD_MSR_STPTH, MD_MSR_STCAL */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetRandomNistDrbgHash( + uint32 partitionIdx, + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) requestBuffer, + uint32 requestLength, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + eslt_WorkSpaceHASHDRBG wsDRBG; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex = 0u, seedCounterElementIndex = 0u; + uint32 retry; + uint16 localCount; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + uint32 reseedCntBuf; + eslt_DRBGSeedStatusType seedStatus; + + /* ----- Implementation ------------------------------------------------- */ + + /* # Prepare DRBG and check key data. */ + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgHashGeneratePrepare(&wsDRBG, cryptoKeyId, keyElements, &seedStateElementIndex, &seedCounterElementIndex, persistPtr); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + /* # Calculate random number until calculation is valid or max reties exhausted. */ + for (retry = 0u; retry < CRYPTO_30_LIBCV_DEFAULT_RANDOM_MAX_RETRIES; retry++) + { + /* # Copy counter and RNG paramater to local buffers. */ + localCount = Crypto_30_LibCv_GetRandomSourceGenerateCount(partitionIdx); + Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian(&reseedCntBuf, Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedCounterElementIndex)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + + if (Crypto_30_LibCv_IsKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK)) + { + seedStatus = ESL_DRBG_SEED_STATUS_SEEDED; + } + else + { + seedStatus = ESL_DRBG_SEED_STATUS_UNSEEDED; + } + + retValCv = esl_restoreStateHASHDRBG( + (P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) &wsDRBG, /* PRQA S 2982 */ /* MD_MSR_RetVal */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedStateElementIndex), + (eslt_Length)CRYPTO_30_LIBCV_RANDOM_HASH_INTERNAL_STATE_BUFFER_LEN, + reseedCntBuf, + seedStatus, + ESL_DRBGMODE_HASHDRBG_SHA512); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Generate random number DRBG. */ + retValCv = Crypto_30_LibCv_Local_Generate_NistDrbgHash( + cryptoKeyId, + requestBuffer, + requestLength, + &wsDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + + SchM_Enter_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + /* # Check if rng counter has changed. */ + if ((Crypto_30_LibCv_IsRngCalculationValid(localCount, partitionIdx)) && (retValCv == ESL_ERC_NO_ERROR)) + { + retVal = Crypto_30_LibCv_Local_Get_And_Set_NistDrbgHashState( + cryptoKeyId, + seedStateElementIndex, + seedCounterElementIndex, + &wsDRBG); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + /* break loop */ + break; + } + else + { + retVal = E_NOT_OK; + } + } + SchM_Exit_Crypto_30_LibCv_CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0(); + + if (retVal != E_OK) + { + /* # clear output buffer if request failed. */ + Crypto_30_LibCv_ClearData(requestBuffer, requestLength); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + *persistPtr = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + } + + if ((retValCv != ESL_ERC_NO_ERROR) || (retVal != E_OK)) + { + if (retValCv == ESL_ERC_ENTROPY_EXHAUSTION) + { + retVal = CRYPTO_E_ENTROPY_EXHAUSTION; + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_GetRandomNistDrbgHash() */ +# endif /* (CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_HASH == STD_ON) */ +#endif /* (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) */ + +#if((CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Random_Check_For_Write_Once() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Random_Check_For_Write_Once( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) reseedCtElementIndex) +{ + /* ----- Local Variables ------------------------------------------------ */ + boolean retVal = FALSE; + + /* ----- Implementation ------------------------------------------------- */ + + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER, reseedCtElementIndex) != E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* retVal is already set */ + } + /* #10 Deny service for write once keys. */ + else if (Crypto_30_LibCv_IsKeyElementWriteOnce(*reseedCtElementIndex)) + { + retVal = FALSE; + } + else if (Crypto_30_LibCv_IsKeyElementWriteOnce(seedStateElementIndex)) + { + retVal = FALSE; + } + else + { + retVal = TRUE; + } + + return retVal; +} /* Crypto_30_LibCv_Local_Random_Check_For_Write_Once() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Set_NistDrbgState() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 9 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Set_NistDrbgState( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + eslt_ErrorCode retValCv, + eslt_Length seedLength, + eslt_Length expectedSeedLength, + uint32 reseedCntBuf, + eslt_DRBGSeedStatusType seedStatus) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + + if ((retValCv == ESL_ERC_NO_ERROR) && (seedLength == expectedSeedLength)) + { + Crypto_30_LibCv_SetKeyElementWrittenLength(seedStateElementIndex, seedLength); + + if (seedStatus == ESL_DRBG_SEED_STATUS_UNSEEDED) + { + Crypto_30_LibCv_ClearKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_INV_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + else + { + Crypto_30_LibCv_SetKeyElementStateByMask(seedStateElementIndex, CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK); /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + } + + /* Save reseed counter. */ + Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian(Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(seedCounterElementIndex), reseedCntBuf); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + Crypto_30_LibCv_SetKeyElementWrittenLength(seedCounterElementIndex, CRYPTO_30_LIBCV_RANDOM_RESEED_COUNTER_LEN); + retVal = E_OK; + +# if(CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + /* Call KeyNvStatus KeyChanged transition */ + Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected(cryptoKeyId, seedStateElementIndex); + Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected(cryptoKeyId, seedCounterElementIndex); +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + } + else + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_LibCv_Local_Set_NistDrbgState() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist( + Crypto_30_LibCv_SizeOfKeyElementsType seedStateElementIndex, + Crypto_30_LibCv_SizeOfKeyElementsType seedCounterElementIndex, + P2VAR(boolean, AUTOMATIC, AUTOMATIC) persistPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Implementation ------------------------------------------------- */ +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (Crypto_30_LibCv_IsKeyElementPersist(seedStateElementIndex) || Crypto_30_LibCv_IsKeyElementPersist(seedCounterElementIndex)) + { + *persistPtr = TRUE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } + else +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(seedStateElementIndex); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(seedCounterElementIndex); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + { + *persistPtr = FALSE; /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } +} /* Crypto_30_LibCv_Local_Check_Random_KeyElement_Persist() */ + +#endif /* ((CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_IsRngCalculationValid() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsRngCalculationValid(uint16 localCount, uint32 currentPartitionIdx) +{ + /* ----- Local Variables ------------------------------------------------ */ + boolean validCalculation; + + /* ----- Implementation ------------------------------------------------- */ + /* Check if the Rng Counter is the expected value */ + if (localCount == Crypto_30_LibCv_GetRandomSourceGenerateCount(currentPartitionIdx)) + { + validCalculation = TRUE; + Crypto_30_LibCv_SetRandomSourceGenerateCount((Crypto_30_LibCv_RandomSourceGenerateCountType)(localCount + 1u), currentPartitionIdx); /* SBSW_CRYPTO_30_LIBCV_WRITE_PARTITION_DATA */ + } + else + { + validCalculation = FALSE; + } + +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS < 2u) + CRYPTO_30_LIBCV_DUMMY_STATEMENT(currentPartitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return validCalculation; +} /* Crypto_30_LibCv_IsRngCalculationValid() */ +#endif /* (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyValueChangedCallout() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyValueChangedCallout(uint32 cryptoKeyId) +{ + /* ----- Implementation ------------------------------------------------- */ + /* Call key value changed callout */ + Crypto_30_LibCv_GetKeyValueChangedCalloutFctNameOfConfigurableCallouts()(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE); + Crypto_30_LibCv_GetKeyValueChangedCalloutFctNameOfConfigurableCallouts()(cryptoKeyId, CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER); +} /* Crypto_30_LibCv_KeyValueChangedCallout() */ +#endif /* (CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Fips186() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Fips186( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Distinguish modes. */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + { + retVal = E_OK; + break; + } + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = E_OK; + break; + } + + /* #70 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchRandomFips186Finish(objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Fips186() */ +#endif /* (CRYPTO_30_LIBCV_FIPS186 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYSEEDFIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedFips186() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedFips186( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + boolean writeBlock = FALSE; + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + if (Crypto_30_LibCv_Local_KeyElementSearch(job->cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #10 Call Crypto_30_LibCv_Local_RandomSeed_Fips */ + retVal = Crypto_30_LibCv_Local_RandomSeed_Fips(job->cryptoKeyId, elementIndex, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, &writeBlock); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, writeBlock); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeySeedFips186() */ +#endif /* CRYPTO_30_LIBCV_KEYSEEDFIPS186() */ + +#if (CRYPTO_30_LIBCV_DRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_DRBGAES() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_DRBGAES( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = E_OK; + break; + } + /* #15 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = E_OK; + break; + } + + /* #20 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgAesFinish(objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_DRBGAES() */ +#endif /* (CRYPTO_30_LIBCV_DRBGAES == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYSEEDDRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedDRBGAES() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedDRBGAES( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + boolean writeBlock = FALSE; + eslt_DRBGMode modeDRBG = 0u; + eslt_Length seedLength = 0u; + P2VAR(eslt_WorkSpaceCTRDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + workspace = Crypto_30_LibCv_GetWorkspaceOfKeySeedDRBGAES(Crypto_30_LibCv_GetKeySeedDRBGAESIdxOfObjectInfo(objectId)); + + if (Crypto_30_LibCv_Local_KeyElementSearch(job->cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #10 Set the correct DRBG mode */ + if (Crypto_30_LibCv_RandomNistDrbgAes_Set_Mode_And_SeedLength(job->cryptoKeyId, &modeDRBG, &seedLength) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #20 Call Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws */ + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes_With_Ws(job->cryptoKeyId, elementIndex, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, &writeBlock, modeDRBG, workspace); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + + /* #30 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, writeBlock); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + else + { + retVal = E_NOT_OK; + } + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeySeedDRBGAES() */ +#endif /* CRYPTO_30_LIBCV_KEYSEEDDRBGAES() */ + +#if (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_DRBGHashSha512() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_DRBGHashSha512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* #5 Distinguish modes. */ + switch (mode) + { + /* #10 Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = E_OK; + break; + } + /* #15 Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = E_OK; + break; + } + + /* #20 Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchRandomNistDrbgHashFinish(objectId, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_DRBGHashSha512() */ +#endif /* (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) */ + +#if (CRYPTO_30_LIBCV_KEYSEEDDRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedDRBGHashSha512() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedDRBGHashSha512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + P2VAR(eslt_WorkSpaceHASHDRBG, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfKeySeedDRBGHashSha512(Crypto_30_LibCv_GetKeySeedDRBGHashSha512IdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex; + boolean writeBlock = FALSE; + + /* ----- Implementation ------------------------------------------------- */ + if (mode == CRYPTO_OPERATIONMODE_FINISH) + { + if (Crypto_30_LibCv_Local_KeyElementSearch(job->cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + /* #10 Call Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws */ + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash_With_Ws(job->cryptoKeyId, elementIndex, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, &writeBlock, workspace); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR_AND_MEMBER_OF_JOB_PTR */ + + /* #20 If key was derived successfully, mark it as valid */ + Crypto_30_LibCv_SetProcessJob_Trigger_Write(objectId, writeBlock); /* SBSW_CRYPTO_30_LIBCV_CSL01_OBJECTID */ + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_KeySeedDRBGHashSha512() */ +#endif /* Crypto_30_LibCv_KeySeedDRBGHashSha512() */ + +#if ((CRYPTO_30_LIBCV_FIPS186 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, algorithmElementIndex; + uint32 seedAlgorithmLength = CRYPTO_30_LIBCV_RANDOM_SEED_SIZEOF_ALGORITHM; + Crypto_30_LibCv_SizeOfKeyStorageType seedAlgorithmStorageIndex; + boolean writeBlock = FALSE; + + /* ----- Implementation ------------------------------------------------- */ + /* #10 Check if the seed state key element is available */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_RANDOM_SEED_STATE, &elementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + /* #15 Lock write access for the CryptoKey */ + if (Crypto_30_LibCv_Local_KeyWriteLockGet(cryptoKeyId) != E_OK) + { + retVal = CRYPTO_E_BUSY; + } + else +# endif + { + /* #20 Get Algorithm from the algorithm key element */ + if (Crypto_30_LibCv_Local_KeyElementSearch(cryptoKeyId, CRYPTO_KE_RANDOM_ALGORITHM, &algorithmElementIndex) == E_OK) /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + { + if (Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic(algorithmElementIndex, &seedAlgorithmStorageIndex, (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&seedAlgorithmLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL, CRYPTO_30_LIBCV_SHE_SERVICE_OTHER) == E_OK) /* SBSW_CRYPTO_30_LIBCV_FORWARDING_STACK_BUFFER */ + { +# if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) + /* #25 handle RNG_FIPS_186_2 */ + if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_Fips(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + else +# endif +# if (CRYPTO_30_LIBCV_DRBGAES == STD_ON) + /* #30 handle NIST 800-90A DRBG CTR AES128 */ + if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock, ESL_DRBGMODE_CTRDRBG_AES128_NODF); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + else if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128_DF) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock, ESL_DRBGMODE_CTRDRBG_AES128_DF); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + /* #35 handle NIST 800-90A DRBG CTR AES256 */ + else if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock, ESL_DRBGMODE_CTRDRBG_AES256_NODF); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + else if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES256_DF) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgAes(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock, ESL_DRBGMODE_CTRDRBG_AES256_DF); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + else +# endif +# if (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) + /* #40 handle NIST 800-90A DRBG HASH SHA2-512 */ + if (Crypto_30_LibCv_GetKeyStorage(seedAlgorithmStorageIndex) == CRYPTO_30_LIBCV_RNG_NIST_800_90A_HASH_DRBG_SHA_512) + { + retVal = Crypto_30_LibCv_Local_RandomSeed_NistDrbgHash(cryptoKeyId, elementIndex, entropyPtr, entropyLength, &writeBlock); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_KEYPTR */ + } + else +# endif + { + /* invalid random seed algorithm */ + } + } + } +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) + Crypto_30_LibCv_Local_KeyWriteLockRelease(cryptoKeyId); +# endif +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (writeBlock) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(cryptoKeyId)); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(writeBlock); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + } + } + return retVal; +} /* Crypto_30_LibCv_Local_RandomSeed() */ +#endif /* ((CRYPTO_30_LIBCV_FIPS186 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) +/********************************************************************************************************************** + * esl_getBytesRNG() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +/* PRQA S 6080 3 */ /* MD_MSR_STMIF */ +FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) esl_getBytesRNG( + const eslt_Length targetLength, + P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) target) +{ + eslt_ErrorCode retVal = ESL_ERC_ERROR; + Std_ReturnType rngResult = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + boolean triggerPersist = FALSE; + uint32 partitionIdx = Crypto_30_LibCv_CurrentPartitionIdx(); + +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + if (partitionIdx < Crypto_30_LibCv_GetSizeOfPartitionIdentifiers()) +# endif + { + uint32 defaultRandomKey = Crypto_30_LibCv_GetDefaultRandomKeyOfPartitionInfo(partitionIdx); +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) + if ((Crypto_30_LibCv_IsModulePartitionInitialized(partitionIdx) && Crypto_30_LibCv_IsModuleSharedInitialized()) && (target != NULL_PTR)) +# endif + { +# if(CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_AES == STD_ON) +# if(CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_HASH == STD_ON) + if(Crypto_30_LibCv_IsAesOfPartitionInfo(partitionIdx)) +# endif + { + /* # Generate Drbg Aes Random Number */ + rngResult = Crypto_30_LibCv_GetRandomNistDrbgAes(partitionIdx, defaultRandomKey, target, targetLength, &triggerPersist); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } +# endif +# if(CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_HASH == STD_ON) +# if(CRYPTO_30_LIBCV_RANDOM_SOURCE_DRBG_AES == STD_ON) + if(Crypto_30_LibCv_IsHashOfPartitionInfo(partitionIdx)) +# endif + { + /* # Generate Drbg Hash Random Number */ + rngResult = Crypto_30_LibCv_GetRandomNistDrbgHash(partitionIdx, defaultRandomKey, target, targetLength, &triggerPersist); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + } +# endif + + /* # Persist Key if necessary */ +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) + if (triggerPersist) + { + Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(defaultRandomKey)); + } +# endif + } + + if (rngResult == E_OK) + { + retVal = ESL_ERC_NO_ERROR; +# if(CRYPTO_30_LIBCV_KEYVALUECHANGEDCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + /* Call the callout if the functionality is enabled and trigger that the key value is changed */ + Crypto_30_LibCv_KeyValueChangedCallout(defaultRandomKey); +# endif + /* Call the callout if the functionality is enabled and trigger that the key is set to valid */ +# if(CRYPTO_30_LIBCV_KEYVALIDITYSETCALLOUTFCTNAMEOFCONFIGURABLECALLOUTS == STD_ON) + Crypto_30_LibCv_GetKeyValiditySetCalloutFctNameOfConfigurableCallouts()(defaultRandomKey, TRUE); +# endif + } + else if (rngResult == CRYPTO_E_ENTROPY_EXHAUSTION) + { + errorId = CRYPTO_E_RE_ENTROPY_EXHAUSTED; + } + else + { + errorId = CRYPTO_E_RE_GET_BYTES_RNG_ERROR; + } + } +# if (CRYPTO_30_LIBCV_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + else + { + errorId = CRYPTO_E_RE_GET_BYTES_RNG_ERROR; + } +# endif + + /* ----- Development Error Report --------------------------------------- */ +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) + /* #90 Report error if applicable */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportRuntimeError((uint16)CRYPTO_30_LIBCV_MODULE_ID, + CRYPTO_30_LIBCV_INSTANCE_ID, + CRYPTO_30_LIBCV_SID_ESL_GETBYTESRNG, + errorId); + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + + return retVal; +} /* esl_getBytesRNG() */ +#endif /* (CRYPTO_30_LIBCV_DEFAULT_RANDOM_SOURCE == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Random.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomGenerate.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomGenerate.h new file mode 100644 index 0000000..09d3b54 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomGenerate.h @@ -0,0 +1,135 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_RandomGenerate.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for RANDOM Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_RANDOMGENERATE_H) +# define CRYPTO_30_LIBCV_RANDOMGENERATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_FIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Fips186() + *********************************************************************************************************************/ +/*! \brief Dispatches the RandomFips186 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139102 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Fips186( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_FIPS186 == STD_ON */ + +# if (CRYPTO_30_LIBCV_DRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_DRBGAES() + **********************************************************************************************************************/ +/*! \brief Dispatches the Nist 800-90A DRBG Aes job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_DRBGAES( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_DRBGAES == STD_ON */ + +# if (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_DRBGHashSha512() + **********************************************************************************************************************/ +/*! \brief Dispatches the Nist 800-90A DRBG Hash job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_DRBGHashSha512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_RANDOMGENERATE_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_RandomGenerate.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomSeed.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomSeed.h new file mode 100644 index 0000000..68b173a --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_RandomSeed.h @@ -0,0 +1,153 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_RandomSeed.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for Random Seed Services. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef CRYPTO_30_LIBCV_RANDOMSEED_H +# define CRYPTO_30_LIBCV_RANDOMSEED_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if ((CRYPTO_30_LIBCV_FIPS186 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_RandomSeed() + *********************************************************************************************************************/ +/*! \brief Initialize the seed + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre cryptoKeyId must identify a valid key + * entropyPtr need to be a valid pointer + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) entropyPtr, + uint32 entropyLength); +# endif /* ((CRYPTO_30_LIBCV_FIPS186 == STD_ON) || (CRYPTO_30_LIBCV_DRBGAES == STD_ON) || (CRYPTO_30_LIBCV_DRBGHASHSHA512 == STD_ON)) */ + +# if (CRYPTO_30_LIBCV_KEYSEEDDRBGAES == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedDRBGAES() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeySeedDRBGAES job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedDRBGAES( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* CRYPTO_30_LIBCV_KEYSEEDDRBGAES */ + +# if (CRYPTO_30_LIBCV_KEYSEEDFIPS186 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedFips186() + **********************************************************************************************************************/ +/*! \brief Dispatches the KeySeedFips186 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139102 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedFips186( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif/* CRYPTO_30_LIBCV_KEYSEEDFIPS186 */ + +# if (CRYPTO_30_LIBCV_KEYSEEDDRBGHASHSHA512 == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_KeySeedDRBGHashSha512() + *********************************************************************************************************************/ +/*! \brief Dispatches the KeySeedDRBGHashSha512 job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-149660 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_KeySeedDRBGHashSha512( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* Crypto_30_LibCv_KeySeedDRBGHashSha512 */ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_RANDOMSEED_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_RandomSeed.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Services.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Services.h new file mode 100644 index 0000000..c1f6141 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Services.h @@ -0,0 +1,1723 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Services.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for service dispatch function prototypes + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_SERVICES_H) +# define CRYPTO_30_LIBCV_SERVICES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm_Types.h" +# include "Crypto_30_LibCv_Cfg.h" + +# include "ESLib_version.h" + +# if !defined (CRYPTO_30_LIBCV_LOCAL) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL static +# endif + +# if !defined (CRYPTO_30_LIBCV_LOCAL_INLINE) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_LOCAL_INLINE LOCAL_INLINE +# endif + +# if !defined (CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE) /* COV_CRYPTO_30_LIBCV_LOCAL_DEFINE */ +# define CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE static INLINE /* "static" cannot be removed in this definition */ +# endif + +# if (CRYPTO_30_LIBCV_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +# endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +# if !defined (CRYPTO_30_LIBCV_BYTES_PER_DIGIT) /* COV_CRYPTO_30_LIBCV_BYTES_PER_DIGIT */ +# define CRYPTO_30_LIBCV_BYTES_PER_DIGIT actBN_BYTES_PER_DIGIT +# endif + +/* Masks for KeyElementState */ +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_NORMAL_MASK CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_ALL_MASK +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_CLEAR_ALL_MASK (0x00u) /* clear all flags */ +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_MASK (0x80u) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_WRITTEN_ONCE_INV_MASK (0x7Fu) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_MASK (0x08u) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_SEED_INIT_INV_MASK (0xF7u) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_MASK (0x04u) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALUE_USED_INV_MASK (0xFBu) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK (0x01u) +# define CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_INV_MASK (0xFEu) + +/* Mask for KeyElementExtension */ +# define CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_CLEAR_ALL_MASK (0x00u) /* clear all flags */ +# define CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_KEY_MASK (0x01u) /* she key flags */ +# define CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_PLAIN_KEY_MASK (0x03u) /* she written plain flags */ +# define CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_CLEAR_PLAIN_KEY_MASK (0xFDu) /* clear she written plain flags */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) || (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) +# define CRYPTO_30_LIBCV_RSAGENERATE STD_ON +# else +# define CRYPTO_30_LIBCV_RSAGENERATE STD_OFF +# endif + +# if (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) || (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) +# define CRYPTO_30_LIBCV_RSAVERIFY STD_ON +# else +# define CRYPTO_30_LIBCV_RSAVERIFY STD_OFF +# endif + +/* General Target Key Element -> always id 1 */ +# define CRYPTO_30_LIBCV_KE_TARGET_KEY (1u) + +/* Size definitions */ +# define CRYPTO_30_LIBCV_CMACAES128_KEY_SIZE ESL_SIZEOF_AES128_KEY +# define CRYPTO_30_LIBCV_CMACAES256_KEY_SIZE ESL_SIZEOF_AES256_KEY +# define CRYPTO_30_LIBCV_CMACAES_MAC_SIZE ESL_SIZEOF_AES128_BLOCK +# define CRYPTO_30_LIBCV_AES_BLOCK_SIZE ESL_SIZEOF_AES128_BLOCK +# define CRYPTO_30_LIBCV_AESCCM_SUM_OF_NONCE_LENGTH_AND_L (15u) + +# define CRYPTO_30_LIBCV_KEY_LOCK_READ_MAX (0xFFu) +# define CRYPTO_30_LIBCV_KEY_LOCK_READ_ONE (3u) +# define CRYPTO_30_LIBCV_KEY_LOCK_FREE (2u) +# define CRYPTO_30_LIBCV_KEY_LOCK_WRITE (1u) + +# define CRYPTO_30_LIBCV_LONG_TERM_WS_LOCK_FREE (CRYPTO_30_LIBCV_MAX_LONGTERMWSLOCK) + +# define CRYPTO_30_LIBCV_SIZEOF_UINT32 (4u) + +# define CRYPTO_30_LIBCV_UINT32_MAX (0xFFFFFFFFuL) +# define CRYPTO_30_LIBCV_UINT24_MAX (0xFFFFFFuL) +# define CRYPTO_30_LIBCV_UINT16_MAX (0xFFFFu) + +/* Length Check */ +# define CRYPTO_30_LIBCV_LENGTH_CHECK_NONE (0u) /* length is not checked */ +# define CRYPTO_30_LIBCV_LENGTH_CHECK_MAX (1u) /* length is smaller / equal to key length */ +# define CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL (2u) /* length is equal to key length */ +# define CRYPTO_30_LIBCV_LENGTH_CHECK_MIN (3u) /* length is bigger / equal to key length */ + +/* SHE key usage types */ +# define CRYPTO_30_LIBCV_SHE_SERVICE_ENCRYPT_DECRYPT (0u) +# define CRYPTO_30_LIBCV_SHE_SERVICE_MAC_GENERATE (1u) +# define CRYPTO_30_LIBCV_SHE_SERVICE_MAC_VERIFY (2u) +# define CRYPTO_30_LIBCV_SHE_SERVICE_KEY_SERVICE (3u) +# define CRYPTO_30_LIBCV_SHE_SERVICE_OTHER (4u) +# define CRYPTO_30_LIBCV_SHE_NUM_SERVICES (4u) + +# define CRYPTO_30_LIBCV_BOOT_PROTECTED (0x01u) +# define CRYPTO_30_LIBCV_DEBUGGER_PROTECTED (0x01u) + +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_P (20u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_N (21u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_P (28u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_N (28u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_P (32u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_N (32u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_P (48u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_N (48u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_P (66u) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_N (66u) + +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_SIGNATURE (CRYPTO_30_LIBCV_SIZEOF_ECC_160_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_SIGNATURE (CRYPTO_30_LIBCV_SIZEOF_ECC_224_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_SIGNATURE (CRYPTO_30_LIBCV_SIZEOF_ECC_256_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_SIGNATURE (CRYPTO_30_LIBCV_SIZEOF_ECC_384_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_SIGNATURE (CRYPTO_30_LIBCV_SIZEOF_ECC_521_N) + +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PRIVATE_MIN (CRYPTO_30_LIBCV_SIZEOF_ECC_160_N - 1u) /* Size of private key can have 20 (160 bits) or 21 bytes (161 bit) */ +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PRIVATE (CRYPTO_30_LIBCV_SIZEOF_ECC_160_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE (CRYPTO_30_LIBCV_SIZEOF_ECC_224_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE (CRYPTO_30_LIBCV_SIZEOF_ECC_256_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE (CRYPTO_30_LIBCV_SIZEOF_ECC_384_N) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE (CRYPTO_30_LIBCV_SIZEOF_ECC_521_N) + +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PUBLIC (CRYPTO_30_LIBCV_SIZEOF_ECC_160_P) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC (CRYPTO_30_LIBCV_SIZEOF_ECC_224_P) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC (CRYPTO_30_LIBCV_SIZEOF_ECC_256_P) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PUBLIC (CRYPTO_30_LIBCV_SIZEOF_ECC_384_P) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC (CRYPTO_30_LIBCV_SIZEOF_ECC_521_P) + +# define CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PUBLIC_XY (2u * (CRYPTO_30_LIBCV_SIZEOF_ECC_160_P)) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PUBLIC_XY (2u * (CRYPTO_30_LIBCV_SIZEOF_ECC_224_P)) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PUBLIC_XY (2u * (CRYPTO_30_LIBCV_SIZEOF_ECC_256_P)) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PUBLIC_XY (2u * (CRYPTO_30_LIBCV_SIZEOF_ECC_384_P)) +# define CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PUBLIC_XY (2u * (CRYPTO_30_LIBCV_SIZEOF_ECC_521_P)) + +# if(CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_521_SIGNATURE) +# elif(CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_384_SIGNATURE) +# else +# if(CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) +# define CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_256_SIGNATURE) +# else +/* The signature contains an R and an S component, the length of the R component is always 160 bits and the length of the S component can be 161 bits, + therefore the maximum size is fixed at 161 bits. */ +# define CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY (CRYPTO_30_LIBCV_SIZEOF_ECC_160_SIGNATURE) +# endif +# endif + +/* SM2 length defines */ +# define CRYPTO_30_LIBCV_SM2_SIZEOF_PRIVATE_KEY (32u) +# define CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY (64u) /* Size of the whole public key (X|Y) */ +# define CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY_HALF (CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY / 2u) +# define CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE (64u) /* Size of the whole signature (R|S) */ +# define CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE_HALF (CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE / 2u) +# define CRYPTO_30_LIBCV_SM2_MIN_SIZEOF_ID (1u) /* If an user ID KE is available it must not be empty */ +# define CRYPTO_30_LIBCV_SM2_MAX_SIZEOF_ID (8191u) /* The ID length is given to ESLib as 2byte parameter in bits */ + /* MAX_SIZEOF_ID = 2^16 / 8 - 1 */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +# define Crypto_30_LibCv_NvM_Persist(idx) Crypto_30_LibCv_NvBlock_Write_Req(Crypto_30_LibCv_GetNvBlockIdxOfKey(idx)) + +# define Crypto_30_LibCv_IsLongTermWsLock(id, value) (Crypto_30_LibCv_GetLongTermWsLock((id)) == (value)) + +# define Crypto_30_LibCv_Uint8CheckMask(value, mask) (((value) & (mask)) == (mask)) +# define Crypto_30_LibCv_Uint8SetMask(value, mask) ((value) = (uint8)((value) | (mask))) +# define Crypto_30_LibCv_Uint8ClearMask(value, mask) ((value) = (uint8)((value) & (mask))) + +/* Macros for all elements */ +# define Crypto_30_LibCv_IsKeyElementPartial(Index) (Crypto_30_LibCv_IsPartialOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_IsKeyElementPersist(Index) (Crypto_30_LibCv_IsPersistOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_IsKeyElementWriteOnce(Index) (Crypto_30_LibCv_IsOnceOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_GetKeyElementLength(Index) (Crypto_30_LibCv_GetLengthOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_HasKeyElementInitValue(Index) (Crypto_30_LibCv_IsInitValueUsedOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_GetKeyElementInitValueLength(Index) ((uint16)Crypto_30_LibCv_GetInitValueEndIdxOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements((Index))) - (uint16)Crypto_30_LibCv_GetInitValueStartIdxOfKeyElementInfo(Crypto_30_LibCv_GetKeyElementInfoIdxOfKeyElements(Index))) +# define Crypto_30_LibCv_IsKeyElementValid(Index) ((Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageValidIdxOfKeyElements((Index))) & CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK) == CRYPTO_30_LIBCV_KEYELEMENTSTATE_VALID_MASK) +# define Crypto_30_LibCv_SetKeyElementState(Index, Value) (Crypto_30_LibCv_SetKeyStorage(Crypto_30_LibCv_GetKeyStorageValidIdxOfKeyElements((Index)), (Value))) +# define Crypto_30_LibCv_GetKeyElementState(Index) (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageValidIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_ClearKeyElementStateByMask(Index, Mask) (Crypto_30_LibCv_SetKeyElementState((Index), (uint8)(Crypto_30_LibCv_GetKeyElementState((Index)) & (Mask)))) +# define Crypto_30_LibCv_SetKeyElementStateByMask(Index, Mask) (Crypto_30_LibCv_SetKeyElementState((Index), (uint8)(Crypto_30_LibCv_GetKeyElementState((Index)) | (Mask)))) +# define Crypto_30_LibCv_IsKeyElementStateByMask(Index, Mask) ((Crypto_30_LibCv_GetKeyElementState((Index)) & (uint8)(Mask)) == (Mask)) + +# define Crypto_30_LibCv_GetAddrKeyStorageOfKeyElements(Index) (Crypto_30_LibCv_GetAddrKeyStorage(Crypto_30_LibCv_GetKeyStorageStartIdxOfKeyElements(Index))) + +# define Crypto_30_LibCv_SetKeyElementExtension(Index, Value) (Crypto_30_LibCv_SetKeyStorage(Crypto_30_LibCv_GetKeyStorageExtensionIdxOfKeyElements((Index)), (Value))) +# define Crypto_30_LibCv_GetKeyElementExtension(Index) (Crypto_30_LibCv_GetKeyStorage(Crypto_30_LibCv_GetKeyStorageExtensionIdxOfKeyElements((Index)))) +# define Crypto_30_LibCv_ClearKeyElementExtensionByMask(Index, Mask) (Crypto_30_LibCv_SetKeyElementExtension((Index), (uint8)(Crypto_30_LibCv_GetKeyElementExtension((Index)) & (Mask)))) +# define Crypto_30_LibCv_SetKeyElementExtensionByMask(Index, Mask) (Crypto_30_LibCv_SetKeyElementExtension((Index), (uint8)(Crypto_30_LibCv_GetKeyElementExtension((Index)) | (Mask)))) +# define Crypto_30_LibCv_IsKeyElementExtensionByMask(Index, Mask) ((Crypto_30_LibCv_GetKeyElementExtension((Index)) & (uint8)(Mask)) == (Mask)) + +/* SheKeys */ +# define Crypto_30_LibCv_IsSheKey(Index) (Crypto_30_LibCv_IsKeyElementExtensionByMask((Index), CRYPTO_30_LIBCV_KEYELEMENTSEXTENSION_SHE_KEY_MASK)? TRUE : FALSE) + +/* Job mode macro */ +# define Crypto_30_LibCv_IsJobMode(Job, Mask) ((((Job)->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode) & (Mask)) == (Mask)) + +/* EcP Curves */ +# if ((CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON)) +# define CRYPTO_30_LIBCV_ECPGENERATE STD_ON +# else +# define CRYPTO_30_LIBCV_ECPGENERATE STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON)) +# define CRYPTO_30_LIBCV_ECPVERIFY STD_ON +# else +# define CRYPTO_30_LIBCV_ECPVERIFY STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA1 == STD_ON)||(CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA1 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA1 STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA1 STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_256 == STD_ON)||(CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_256 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_256 STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_256 STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_384 == STD_ON)||(CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_384 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_384 STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_384 STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_512 == STD_ON)||(CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_512 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_512 STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_512 STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA1 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_256 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_384 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_SECFAM_SHA2_512 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA1 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_256 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_384 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_SECFAM_SHA2_512 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA1 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_256 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_384 == STD_ON) || (CRYPTO_30_LIBCV_SIGNATURE_SECFAM_SHA2_512 == STD_ON)) +# define CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH STD_ON +# else +# define CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_KDF_ALGO_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_ANSIP256R1_ENABLED == STD_ON)\ + || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP256R1_ENABLED == STD_ON)) +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_DOMAIN STD_ON +# else +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_DOMAIN STD_OFF +# endif + +# if ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP521R1_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P521R1_ENABLED == STD_ON)) +/* max size of ECC key -> corresponding to curve -> p521r1 = 66Byte */ +# define CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE (CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE) + +# elif ((CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM_SECP384R1_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_NIST_SEC_P384R1_ENABLED == STD_ON)) +/* max size of ECC key -> corresponding to curve -> p384r1 = 48Byte */ +# define CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE (CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE) + +# elif ((CRYPTO_30_LIBCV_KEY_EXCHANGE_P256R1_DOMAIN == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM_ANSI_NIST_SEC_P256R1_ENABLED == STD_ON)) +/* max size of ECC key -> corresponding to curve -> p256r1 = 32Byte */ +# define CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE (CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE) + +# else +/* max size of ECC key -> corresponding to curve -> p224r1 = 28Byte */ +# define CRYPTO_30_LIBCV_ECC_PRIVATE_KEY_MAXSIZE (CRYPTO_30_LIBCV_SIZEOF_ECC_224_KEY_PRIVATE) +# endif + +/* Mathematic Operation Macros */ +# define Crypto_30_LibCv_Math_Mul2(Value) ((Value) << 1u) +# define Crypto_30_LibCv_Math_Div2(Value) ((Value) >> 1u) +# define Crypto_30_LibCv_Math_IsEven(Value) (((Value) & (1u)) == 0u) +# define Crypto_30_LibCv_Math_CalcMiddle(Value1, Value2) (((Value1) + (Value2)) / (uint8)2u) + +# define Crypto_30_LibCv_Byte2Bit(Byte) ((Byte) << 3u) +# define Crypto_30_LibCv_Bit2Byte(Bit) ((Bit) >> 3u) + +# define Crypto_30_LibCv_IsModulePartitionInitialized(partitionIdx) ((Crypto_30_LibCv_GetPartitionInitialized(partitionIdx) & CRYPTO_30_LIBCV_INITIALIZED) == CRYPTO_30_LIBCV_INITIALIZED) +# define Crypto_30_LibCv_IsModulePartitionNotInitialized(partitionIdx) ((Crypto_30_LibCv_GetPartitionInitialized(partitionIdx) & CRYPTO_30_LIBCV_INITIALIZED) != CRYPTO_30_LIBCV_INITIALIZED) +# define Crypto_30_LibCv_IsModuleSharedInitialized() ((Crypto_30_LibCv_ModuleInitialized & CRYPTO_30_LIBCV_INITIALIZED) == CRYPTO_30_LIBCV_INITIALIZED) +# define Crypto_30_LibCv_IsModuleSharedNotInitialized() ((Crypto_30_LibCv_ModuleInitialized & CRYPTO_30_LIBCV_INITIALIZED) != CRYPTO_30_LIBCV_INITIALIZED) +# define Crypto_30_LibCv_IsModuleBootProtected(value) (((value) & CRYPTO_30_LIBCV_BOOT_PROTECTED) == CRYPTO_30_LIBCV_BOOT_PROTECTED) +# define Crypto_30_LibCv_IsModuleDebuggerProtected(value) (((value) & CRYPTO_30_LIBCV_DEBUGGER_PROTECTED) == CRYPTO_30_LIBCV_DEBUGGER_PROTECTED) + +# define Crypto_30_LibCv_IsUint32Overflow(Value1, Value2) (((Value2) > (uint32)(CRYPTO_30_LIBCV_UINT32_MAX - Value1)) ? TRUE:FALSE ) + +/* Redirection */ +# define CRYPTO_30_LIBCV_NUM_OF_REDIRECTION_KEYS (5u) + +/* Key List */ +/* Keys need to be locked + * + * CryptoKey 1x + * TargetKey 1x + * RandomKey 1x + * RedirectionKeys 5x + */ +# if (CRYPTO_30_LIBCV_REDIRECTION == STD_ON) +/* Relevant Keys: CryptoKey, TargetKey, RandomKey, RedirectionKeys */ +/* Worst case number of Keys: 7x (Job target Key is only relevant if not all redirection keys are used)*/ +# define CRYPTO_30_LIBCV_MAX_NUM_OF_USED_KEYS (CRYPTO_30_LIBCV_NUM_OF_REDIRECTION_KEYS + 2u) +# else +/* Relevant Keys: CryptoKey, TargetKey, RandomKey */ +/* Worst case number of Keys: 3x */ +# define CRYPTO_30_LIBCV_MAX_NUM_OF_USED_KEYS (3u) +# endif + +# define CRYPTO_30_LIBCV_KEY_ACCESS_WRITE (1u) +# define CRYPTO_30_LIBCV_KEY_ACCESS_READ (0u) + +/* Multi Partition */ +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) +# define Crypto_30_LibCv_CurrentPartitionIdx() Crypto_30_LibCv_GetPartitionIdx() +# define Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId) Crypto_30_LibCv_GetPartitionIdxOfObjectInfo(objectId) +# else +# define Crypto_30_LibCv_CurrentPartitionIdx() Crypto_30_LibCv_MainPartitionIdx +# define Crypto_30_LibCv_CurrentPartitionIdxViaObject(objectId) Crypto_30_LibCv_MainPartitionIdx +# endif + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +typedef Crypto_30_LibCv_SizeOfKeyStorageType Crypto_30_LibCv_KeyStorageIndexType; + +/* Read multiple key elements type definition */ +typedef struct +{ + uint32 keyElementId; + uint32 keyElementLength; + Crypto_30_LibCv_SizeOfKeyStorageType keyElementIndex; +} Crypto_30_LibCv_KeyElementGetType; + +typedef uint8 Crypto_30_LibCv_KeyElementGetSizeType; + +/* Length Check */ +typedef uint8 Crypto_30_LibCv_LengthCheckType; + +/* Service Check */ +typedef uint8 Crypto_30_LibCv_ServiceType; + +/* Key List */ +typedef struct +{ + uint32 keyId; + uint8 keyAccess; +} Crypto_30_LibCv_KeyLockKeyType; + +typedef struct +{ + Crypto_30_LibCv_KeyLockKeyType keyLockList[CRYPTO_30_LIBCV_MAX_NUM_OF_USED_KEYS]; + uint8 numKeys; +} Crypto_30_LibCv_KeyLockListType; + +# define CRYPTO_30_LIBCV_START_SEC_VAR_ZERO_INIT_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_DEV_ERROR_DETECT == STD_ON) +/*! Initialization state of the module */ +extern VAR(uint8, CRYPTO_30_LIBCV_VAR_ZERO_INIT) Crypto_30_LibCv_ModuleInitialized; +# endif + +# define CRYPTO_30_LIBCV_STOP_SEC_VAR_ZERO_INIT_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_LIBCV_START_SEC_VAR_NOINIT_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +# if (CRYPTO_30_LIBCV_SHE_DEBUG_CMD == STD_ON) +/* It is only allowed to access this data if the SheInfoKey is locked */ +extern VAR(boolean, CRYPTO_30_LIBCV_VAR_NOINIT) Crypto_30_LibCv_She_Debug_Cmd_ChallengeFlag; +# endif +# endif + +# define CRYPTO_30_LIBCV_STOP_SEC_VAR_NOINIT_8BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_LIBCV_START_SEC_VAR_NOINIT_16BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_LIBCV_STOP_SEC_VAR_NOINIT_16BIT +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_Key() + *********************************************************************************************************************/ +/*! \brief Initializes the key element. + * \details - + * \param[in] elementIndex Holds the pointer to the found key element index. + * \param[in] initAllBytes Decide if all data bytes shall be init. + * \pre Key is locked for write operations. + * Element index need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_Key( + Crypto_30_LibCv_KeyElementsIterType elementIndex, + boolean initAllBytes); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_KeySimple() + *********************************************************************************************************************/ +/*! \brief Initializes the key element. + * \details Initialize only written length, extension and status. + * \param[in] elementIndex Holds the pointer to the found key element index. + * \pre Key is locked for write operations. + * Element index need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_KeySimple( + Crypto_30_LibCv_KeyElementsIterType elementIndex); + +# if (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Init_KeySheAdditional() + *********************************************************************************************************************/ +/*! \brief Initializes the She key element. + * \details This function initializes additional fields for she keys. + * \param[in] elementIndex Holds the pointer to the found key element index. + * \pre Key is locked for write operations. + * Crypto_30_LibCv_Init_Key need to be called for complete key element initialization. + * Element index need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \note Specification of module initialization + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Init_KeySheAdditional( + Crypto_30_LibCv_KeyElementsIterType elementIndex); +# endif /* (CRYPTO_30_LIBCV_SHEKEYS == STD_ON) */ + +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_State_Init() + *********************************************************************************************************************/ +/*! \brief Init Nv State + * \details Init Nv state for the given block. + * \param[in] blockIdx idx of the block. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_State_Init( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_MainFunction() + *********************************************************************************************************************/ +/*! \brief Nv main function of the module. + * \details This interface process the provided asynchronous NvBlock request / triggers write block. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_MainFunction(void); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_ReadFromBlock() + **********************************************************************************************************************/ +/*!\brief Read from Block callback routine. + * \details Block specific callback routine which is called by NvM in order to let the Crypto driver copy data from + * NvM RAM mirror to Crypto RAM block. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] NvMBuffer RAM mirror where Ram block data can be read from. + * \return E_OK Data was copied from buffer. + * \return E_NOT_OK Data was not copied. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_ReadFromBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2CONST(void, AUTOMATIC, CRYPTO_30_LIBCV_APPL_DATA) NvMBuffer); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_WriteToBlock() + **********************************************************************************************************************/ +/*!\brief Write to Block callback routine. + * \details Block specific callback routine which is called by NvM in order to let the Crypto driver copy data from + * RAM block to NvM RAM mirror. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[out] NvMBuffer RAM mirror where Ram block data shall be written to. + * \return E_OK Data was copied to buffer. + * \return E_NOT_OK No data was copied. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_WriteToBlock( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + P2VAR(void, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) NvMBuffer); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Init() + **********************************************************************************************************************/ +/*!\brief Init Block callback routine. + * \details Block specific callback routine which is called by NvM in order to let the Crypto driver copy default + * data to a RAM block. + * \param[in] blockIdx The internal identifier of the NvM block. + * \return E_OK Data initialized. + * E_NOT_OK Any error occurred. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Init( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Callback() + **********************************************************************************************************************/ +/*!\brief Request finished Block callback routine. + * \details Block specific callback routine which is called by NvM in order to notify the Crypto driver that an + * asynchronous single block request has been finished. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] ServiceId The service identifier of the completed request. + * \param[in] JobResult Result of the single block job. + * \return E_OK Callback function has been processed successfully. + * \return E_NOT_OK Callback function has not been processed successfully. + * \pre blockIdx need to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Callback( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx, + uint8 ServiceId, + NvM_RequestResultType JobResult); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_InitKey() + **********************************************************************************************************************/ +/*!\brief InitKey transition of KeyNvStatus. + * \details This transition is called if the module is initialized and sets the given key to state NOT_NV. + * \param[in] cryptoKeyId The identifier of the crypto key being initialized. + * \pre cryptoKeyId needs to be valid. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_InitKey(uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_ReadFromBlock() + **********************************************************************************************************************/ +/*!\brief ReadFromBlock transition of KeyNvStatus. + * \details This transition is called if a NvBlock has been read and sets all persistent keys of this block to + * state NV_SYNC. + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx needs to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_ReadFromBlock(Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected() + **********************************************************************************************************************/ +/*!\brief KeyChanged transition of KeyNvStatus. + * \details If the changed key element is persistent, the key's state is set to KEY_CHANGED. + * This function shall only be called if EXCLUSIVE_AREA_0 has already been entered. + * \param[in] cryptoKeyId The identifier of the crypto key holding the changed key element. + * \param[in] elementIdx The identifier of the changed key element. + * \pre cryptoKeyId and elementIdx need to be valid. + * EXCLUSIVE_AREA_0 has been entered. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_KeyChanged_Unprotected(uint32 cryptoKeyId, Crypto_30_LibCv_SizeOfKeyElementsType elementIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_KeyChanged() + **********************************************************************************************************************/ +/*!\brief KeyChanged transition of KeyNvStatus. + * \details This transition is called if a key element was changed in validity or its data. It enters + * EXCLUSIVE_AREA_0 and calls the actual implementation of the transition. + * \param[in] cryptoKeyId The identifier of the crypto key holding the changed key element. + * \param[in] elementIdx The identifier of the changed key element. + * \pre cryptoKeyId and elementIdx need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_KeyChanged(uint32 cryptoKeyId, Crypto_30_LibCv_SizeOfKeyElementsType elementIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvWriteReq() + **********************************************************************************************************************/ +/*!\brief NvWriteReq transition of KeyNvStatus. + * \details This transition is called if a NvBlock was requested to write. All persistent and changed keys of + * this block are set to state NV_WRITE_REQ. + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx needs to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvWriteReq(Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvCopied() + **********************************************************************************************************************/ +/*!\brief NvCopied transition of KeyNvStatus. + * \details This transition is called if the keys were copied to the NvM buffer. All persistent keys of this block + * which are of state NV_WRITE_REQ, are set to KEY_COPIED. + * \param[in] blockIdx The internal identifier of the NvM block. + * \pre blockIdx needs to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvCopied(Crypto_30_LibCv_SizeOfNvBlockType blockIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyNvStatus_NvBlockCallback() + **********************************************************************************************************************/ +/*!\brief NvBlockCallback transition of KeyNvStatus. + * \details This transition is called if the keys were written to the NvM buffer. All persistent keys of this block + * which are of state KEY_COPIED, are set to NV_WRITE_REQ. If the write process was not successful the + * keys are set to WRITE_FAILED. + * \param[in] blockIdx The internal identifier of the NvM block. + * \param[in] jobResult The result of the callback. + * \pre blockIdx and jobResult need to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyNvStatus_NvBlockCallback(Crypto_30_LibCv_SizeOfNvBlockType blockIdx, NvM_RequestResultType jobResult); + +# endif /* (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) */ + +# if (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_OFF) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_CopyData_Implementation() + *********************************************************************************************************************/ +/*! \brief Copies data from source to destination. + * \details Copies data from source to destination for the given length. Exemplary implementation. + * \param[out] targetData Pointer to buffer where the data shall be copied to + * \param[in] sourceData Pointer to data which shall be copied + * \param[in] dataLength Number of bytes which shall be copied + * \pre Length of the buffer provided by targetDataBuf can hold at least the number of bytes given in dataLength. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_CopyData_Implementation( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) sourceData, + uint32 dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_SetData_Implementation() + *********************************************************************************************************************/ +/*! \brief Sets data buffer. + * \details Sets data buffer for the given length with pattern value. Exemplary implementation. + * \param[out] dataBuf Pointer to data which shall be set. + * \param[in] pattern Holds the value which shall be set. + * \param[in] dataLength Number of bytes which shall be set. + * \pre Length of the buffer provided by targetDataBuf can hold at least the number of bytes given in dataLength. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_SetData_Implementation( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataBuf, + uint8 pattern, + uint32 dataLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ClearData_Implementation() + *********************************************************************************************************************/ +/*! \brief Clears data buffer. + * \details Clears data buffer for the given length (overwrite with 0x00). Exemplary implementation. + * \param[out] dataBuf Pointer to data which shall be cleared + * \param[in] dataLength Number of bytes which shall be cleared + * \pre Length of the buffer provided by targetDataBuf can hold at least the number of bytes given in dataLength + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ClearData_Implementation( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) dataBuf, + uint32 dataLength); +# endif /* # (CRYPTO_30_LIBCV_USE_VSTD_LIB == STD_OFF) */ + +# if ((CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_CompareData_IsSmaller() + *********************************************************************************************************************/ +/*! \brief Check if the target value is smaller than the reference value + * \details Compare data big-endian bytewise and check if the target value is smaller than the reference value. + * \param[in] targetData target value array in bigEndian format + * \param[in] referenceData reference value array in bigEndian format + * \param[in] dataLength compare length + * \return E_OK Target data is smaller. + * E_NOT_OK Target data is not smaller. + * \pre targetData has to be a valid array with the given dataLength. + * \pre referenceData has to be a valid array with the given dataLength. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_CompareData_IsSmaller( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) referenceData, + uint32 dataLength); +# endif /* ((CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_CERTIFICATE_HANDLING_ENABLED == STD_ON) || (CRYPTO_30_LIBCV_KDF_ALGO_ISO_15118_20_CERTIFICATE_HANDLING_ENABLED == STD_ON)) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies data from source to destination. + * \details Copies data from source to destination from uint32 to uint8 array big endian. + * \param[out] targetData Pointer to buffer where the data shall be copied to + * \param[in] sourceData Data which shall be copied + * \pre All pointers need to be valid. + * targetData need to have at least byte size of unit32. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian( + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + uint32 sourceData); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian() + *********************************************************************************************************************/ +/*! \brief Copies data from source to destination. + * \details Copies data from source to destination from uint8 array to uint32 big endian. + * \param[out] targetData Pointer to buffer where the data shall be copied to + * \param[in] sourceData Pointer to data which shall be copied + * \pre All pointers need to be valid. + * sourceData need to have at least byte size of unit32. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian( + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) sourceData); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListAddKey() + **********************************************************************************************************************/ +/*! \brief Add Key to key list. + * \details Add key to keyList if the key is not in keyList. If the Key is in KeyList update keyAccess. + * \param[in,out] keyList Pointer to the keyList. + * \param[in] cryptoKeyId KeyId of the key which shall be add. + * \param[in] keyAccess Key access right of the key which shall be add. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListAddKey( + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList, + uint32 cryptoKeyId, + uint8 keyAccess); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyList() + **********************************************************************************************************************/ +/*! \brief Create list of keys. + * \details A key is only referenced once in the list with the highest access. + * \param[in] job Pointer to the job which shall checked. + * \param[in,out] keyList Pointer to the keyList. + * \pre job has to be a valid job object. + * keyList has to be a valid keyList object with at least 6 elements if redirection is used, otherwise 1. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyList( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetKeyListAndDet() + **********************************************************************************************************************/ +/*! \brief Create list of keys and check if key exist. + * \details A key is only referenced once in the list with the highest access. + * \param[in] job Pointer to the job which shall checked. + * \param[in,out] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key id is not valid. + * \pre job has to be a valid job object. + * keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetKeyListAndDet( + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPreLockKeys() + **********************************************************************************************************************/ +/*! \brief Lock keys in key list. + * \details Lock keys in key list according to their read/write access. + * This access is not protected by a exclusive area. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is already locked. + * \pre keyList has to be a valid keyList object. + * The caller must ensure that this call is protected by a exclusive area. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPreLockKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPostFreeKeys() + **********************************************************************************************************************/ +/*! \brief Free keys in key list. + * \details Free keys in key list according to their read/write access. + * This access is not protected by a exclusive area. + * \param[in] keyList Pointer to the keyList. + * \pre keyList has to be a valid keyList object. + * The caller must ensure that this call is protected by a exclusive area. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPostFreeKeys( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPreLockKeysProtected() + **********************************************************************************************************************/ +/*! \brief Lock keys in key list. + * \details Lock keys in key list according to their read/write access. + * \param[in] keyList Pointer to the keyList. + * \return E_OK Request success. + * E_NOT_OK Request failed, since key is already locked. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPreLockKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected() + **********************************************************************************************************************/ +/*! \brief Free keys in key list. + * \details Free keys in key list according to their read/write access. + * \param[in] keyList Pointer to the keyList. + * \pre keyList has to be a valid keyList object. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyListPostFreeKeysProtected( + P2CONST(Crypto_30_LibCv_KeyLockListType, AUTOMATIC, AUTOMATIC) keyList); +# endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSearch() + *********************************************************************************************************************/ +/*! \brief Searches the key elementIndex. + * \details Searches the key elementIndex of the given keyElementId in the given cryptoKeyId. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[out] elementIndex Holds the pointer to the found key element index. + * \return E_OK Request successful. + * E_NOT_OK Request failed, key element not found. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * elementIndex has to be a valid element index Ptr. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSearch( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyElementsType, AUTOMATIC, AUTOMATIC) elementIndex); + +# if ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSet() + *********************************************************************************************************************/ +/*! \brief Sets a key element. This Api is only for internal usage. + * \details Sets the given key element bytes to the key identified by cryptoKeyId. + * If keyLength is zero the old value is deleted. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for write access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); +# endif /* ((CRYPTO_30_LIBCV_KEY_DERIVE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_EXCHANGE_ALGORITHM == STD_ON) || (CRYPTO_30_LIBCV_KEY_GENERATE_ALGORITHM == STD_ON)) */ + +# if (CRYPTO_30_LIBCV_NVBLOCK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_NvBlock_Write_Req() + **********************************************************************************************************************/ +/*! \brief Set write request. + * \details Set request wo write block. + * \param[in] blockIdx Holds the identifier of the nv block. + * \pre blockIdx has to be a valid identifier. + * \context TASK + * \reentrant TRUE, for different blocks. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_NvBlock_Write_Req( + Crypto_30_LibCv_SizeOfNvBlockType blockIdx); +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndex() + *********************************************************************************************************************/ +/*! \brief The key element can be provided for all read access rights values. + * \details This interface shall be used internal to get a key element of the key identified by the cryptoKeyId and store + * the key element in the memory location pointed to by the result pointer. + * \param[in] cryptoKeyId Holds the identifier of the key element storage index. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in,out] resultIndexPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndex( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_GetElementsIndexJob() + *********************************************************************************************************************/ +/*! \brief Get the key element storage index for all key elements in the list used for Job Processing. + * \details The function will provide the storage index of all required key elements. + * The function return values can be passed to process job. + * If the request fails the function return the first error also if there are several. + * \param[in] cryptoKeyId Holds the identifier of the key element storage index. + * \param[in,out] keyElements Holds the pointer to the key elements structure. + * \param[in] numberOfElements Holds the total number of key elements contained in keyElements. + * \param[in] lengthCheck Length check mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * keyElements has to be a valid ptr with the number of numberOfElements elements. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_GetElementsIndexJob( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType numberOfElements, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ElementGetterSetId() + **********************************************************************************************************************/ +/*! \brief Set key element id in keyElements structure. + * \details - + * \param[in,out] keyElements Holds the pointer to the key elements structure. + * \param[in] elementNumber Holds the total number of the key element which shall be accessed. + * \param[in] keyElementId Holds the key element id which shall be set. + * \pre keyElements has to be a valid ptr with at least the length of elementNumber elements. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ElementGetterSetId( + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType elementNumber, + uint32 keyElementId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_ElementGetterSetIdAndLength() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +/*! \brief Set key element id and expected length in keyElements structure. + * \details - + * \param[in,out] keyElements Holds the pointer to the key elements structure. + * \param[in] elementNumber Holds the total number of the key element which shall be accessed. + * \param[in] keyElementId Holds the key element id which shall be set. + * \param[in] keyLength Holds the key element expected length which shall be set. + * \pre keyElements has to be a valid ptr with at least the length of elementNumber elements. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_ElementGetterSetIdAndLength( + P2VAR(Crypto_30_LibCv_KeyElementGetType, AUTOMATIC, AUTOMATIC) keyElements, + Crypto_30_LibCv_KeyElementGetSizeType elementNumber, + uint32 keyElementId, + uint32 keyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional() + *********************************************************************************************************************/ +/*! \brief Get the key element storage index for an optional key element used for Job Processing. + * \details The function will provide the storage index of the required key element. + * The function return values can be passed to process job expect CRYPTO_E_KEY_NOT_AVAILABLE. + * \param[in] cryptoKeyId Holds the identifier of the key element storage index. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in,out] resultIndexPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob() + *********************************************************************************************************************/ +/*! \brief Get the key element storage index for a key element used for Job Processing. + * \details The function will provide the storage index of the required key element. + * The function return values can be passed to process job. + * \param[in] cryptoKeyId Holds the identifier of the key element storage index. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in,out] resultIndexPtr Holds the pointer to the key data which shall be set as key element. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended() + *********************************************************************************************************************/ +/*! \brief The key element storage index can be provided for all read access rights values. + * \details This interface shall be used internal to get a key element of the key identified by the + * cryptoKeyId and store the key element in the memory location pointed to by the result pointer. + * The key element will be searched and checked vor validity. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be provided. + * \param[in] keyElementId Holds the Id of the key element which shall be provided. + * \param[in,out] resultIndexPtr Holds the pointer to the storage index which shall be provided. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \param[in] serviceType SHE service Type. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexExtended( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic() + *********************************************************************************************************************/ +/*! \brief The key element storage index can be provided for all read access rights values. + * \details This interface shall be used internal to get a key element of the key identified by the + * cryptoKeyId and store the key element in the memory location pointed to by the result pointer. + * The key element will not be checked for validity. + * \param[in] elementIndex Holds the index of the key element which shall be provided. + * \param[in,out] resultIndexPtr Holds the pointer to the storage index which shall be provided. + * \param[in,out] resultLengthPtr Contains the length of the key element in bytes. + * \param[in] lengthCheck Length check mode. + * \param[in] serviceType SHE service Type. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre elementIndex has to be a valid identifier to a key in the keyStorage. + * The crypto key has to be locked for read access. + * resultIndexPtr has to be a valid ptr. + * resultLengthPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys. + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementGetStorageIndexBasic( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) resultIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) resultLengthPtr, + Crypto_30_LibCv_LengthCheckType lengthCheck, + Crypto_30_LibCv_ServiceType serviceType); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyElementSetInternal() + *********************************************************************************************************************/ +/*! \brief Sets a key element. This Api is only for internal usage. + * \details Sets the given key element bytes to the key identified by cryptoKeyId. + * If keyLength is zero the old value is deleted. + * \param[in] cryptoKeyId Holds the identifier of the key storage index. + * \param[in] elementIndex Holds the index of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \param[in] writeAccess Hold the max write access right which could be accessed. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * elementIndex has to be a valid identifier to a keyElement in the keyStorage. + * The crypto key has to be locked for write access. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyElementSetInternal( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength, + Crypto_30_LibCv_WriteOfKeyElementInfoType writeAccess); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSetInternalStandard() + *********************************************************************************************************************/ +/*! \brief Copies data to key storage. + * \details Copies data of the keyPtr to the internal key storage identified by the elementIndex. + * If keyLength is zero the old value is deleted. + * \param[in] elementIndex Holds the identifier of the keyElement in the keyStorage. + * \param[in] keyPtr Holds the data which shall be copied to the key storage + * \param[in] keyLength Specifies the number of bytes which shall be copied. + * \return E_OK Request successful. + * E_NOT_OK Request failed, keyElement was written, but connected key not found. + * \pre elementIndex has to be a valid identifier to a keyElement in the keyStorage. + * keyLength has to be smaller or equal in length to available key storage space. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSetInternalStandard( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId() + *********************************************************************************************************************/ +/*! \brief Copies data to key storage. + * \details Copies data of the keyPtr to the internal key storage identified by the elementIndex. + * If keyLength is zero the old value is deleted. + * \param[in] cryptoKeyId Holds the identifier of the key storage index. + * \param[in] elementIndex Holds the identifier of the keyElement in the keyStorage. + * \param[in] keyPtr Holds the data which shall be copied to the key storage + * \param[in] keyLength Specifies the number of bytes which shall be copied. + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * elementIndex has to be a valid identifier to a keyElement in the keyStorage. + * keyPtr has to be a valid ptr. + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_KeyElementSetInternalStandardWithCryptoKeyId( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLength() + *********************************************************************************************************************/ +/*! \brief Sets the key element written length. + * \details Sets the written length of a key element in the key storage. + * Note: This function does not track the key change regarding KeyNvStatus and the key changed callout. Use + * Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId instead or call the + * KeyChanged transition of the CryptoKey and the callout manually. + * \param[in] keyElementIndex Holds the index of the key element whose written length shall be set. + * \param[in] keyElementLength Written length of the key element + * \pre keyElementId has to hold a valid identifier of the key element + * \note This function does not call the callout for the key value changed + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLength( + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch() + *********************************************************************************************************************/ +/*! \brief Sets the key element written length. + * \details Sets the written length of a key element in the keystore and searches the crypto key ID + * to call the callout to change the key value. + * \param[in] keyElementIndex Holds the index of the key element whose written length shall be set. + * \param[in] keyElementLength Written length of the key element + * \return E_OK Request successful. + * E_NOT_OK Request failed, key not found. + * \pre keyElementId has to hold a valid identifier of the key element + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyIdSearch( + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId() + *********************************************************************************************************************/ +/*! \brief Sets the key element written length. + * \details Sets the written length of a key element in the key storage. + * \param[in] cryptoKeyId Holds the id of the key. + * \param[in] keyElementIndex Holds the index of the key element whose written length shall be set. + * \param[in] keyElementLength Written length of the key element + * \pre cryptoKeyId has to be a valid identifier to a key in the keyStorage. + * keyElementId has to hold a valid identifier of the key element + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SetKeyElementWrittenLengthWithCryptoKeyId( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfKeyElementsType keyElementIndex, + uint32 keyElementLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_SetKeyElementStateWritten() + **********************************************************************************************************************/ +/*! \brief Sets the key element state for a written key element. + * \details Sets the state to invalid and write once if required. + * \param[in] elementIndex Holds the index of the key element whose written length shall be set. + * \pre keyElementId has to hold a valid identifier of the key element + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_SetKeyElementStateWritten( + Crypto_30_LibCv_SizeOfKeyElementsType elementIndex); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Internal_KeySetValid() + *********************************************************************************************************************/ +/*! \brief Sets the state of a key. + * \details The function the key states of all associated key elements of the given key to valid. + * \param[in] cryptoKeyId Holds the identifier of the key. + * \return TRUE Request NvM Write. + * FALSE No writing necessary. + * \pre cryptoKeyId has to hold a valid identifier of a key + * \context TASK + * \reentrant TRUE, for different cryptoKeyIds + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Internal_KeySetValid( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Internal_KeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Sets the given key invalid. + * \details The function the key states of all associated key elements of the given key to invalid. + * \param[in] cryptoKeyId Holds the identifier of the key. + * \return TRUE Request NvM Write. + * FALSE No writing necessary. + * \pre cryptoKeyId has to hold a valid identifier of a key + * \context TASK + * \reentrant TRUE, for different cryptoKeyIds + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Internal_KeySetInvalid( + uint32 cryptoKeyId); + +# if (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockGet() + *********************************************************************************************************************/ +/*! + * \brief Try to get key read lock. + * \details Try to get a key read lock. Increment the key read lock, if there is no write lock. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key read access success. + * E_NOT_OK Lock key read access failed. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockGet( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockRelease() + *********************************************************************************************************************/ +/*! + * \brief Release key read lock. + * \details Release key read lock. Decrement the key read lock. + * \param[in] cryptoKeyId Id of the crypto key. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * The caller has to ensure that the key is locked for read access. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockRelease( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockGetNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Try to get key read lock. + * \details This access is not protected by a exclusive area. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key read access success. + * E_NOT_OK Lock key read access failed. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * The caller has to ensure that this call is protected by a exclusive area. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockGetNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Release key read lock. + * \details This access is not protected by a exclusive area. + * \param[in] cryptoKeyId Id of the crypto key. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * The caller has to ensure that this call is protected by a exclusive area. + * The caller has to ensure that the key is locked for read access. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyReadLockReleaseNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockGet() + *********************************************************************************************************************/ +/*! + * \brief Try to get key write lock. + * \details Try to get key write lock. Only one write lock can be allocated, if there is no read lock. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key write access success. + * E_NOT_OK Lock key write access failed. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockGet( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockRelease() + *********************************************************************************************************************/ +/*! + * \brief Release key write lock. + * \details Release key write lock. Only one write lock can be allocated. + * \param[in] cryptoKeyId Id of the crypto key. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * The caller has to ensure that the key is locked for write access. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockRelease( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Try to get key write lock. + * \details Try to get key write lock. Only one write lock can be allocated, if there is no read lock. + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Lock key write access success. + * E_NOT_OK Lock key write access failed. + * The caller has to ensure that this call is protected by a exclusive area. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockGetNotProtected( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected() + *********************************************************************************************************************/ +/*! + * \brief Release key write lock. + * \details Release key write lock. Only one write lock can be allocated. + * \param[in] cryptoKeyId Id of the crypto key. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * The caller has to ensure that this call is protected by a exclusive area. + * The caller has to ensure that the key is locked for write access. + * \context TASK + * \reentrant TRUE, for different keys + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_KeyWriteLockReleaseNotProtected( + uint32 cryptoKeyId); +# endif /* (CRYPTO_30_LIBCV_ENABLE_KEY_LOCKING == STD_ON) */ + +# if (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsLockGet() + **********************************************************************************************************************/ +/*! \brief Try to obtain long term workspace lock. + * \details This function tries to lock the long term workspace and determines the workspace idx. + * \param[in] cryptoKeyId Holds the key id which will lock the workspace + * \param[out] longWsIdxPtr Provided long term workspace idx. + * \return E_OK Lock is obtained or was already obtained. + * E_NOT_OK Request Failed + * \pre longWsIdxPtr has to be a valid pointer. + * \note Is a lock is already occupied for the key id the service will return this Idx. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsLockGet( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsIsLock() + **********************************************************************************************************************/ +/*! \brief Check if long term workspace is locked. + * \details This function checks if the long term workspace is locked and provides the workspace idx. + * \param[in] cryptoKeyId Holds the key id which will lock the workspace + * \param[out] longWsIdxPtr Provided long term workspace idx. + * \return E_OK Lock is obtained or was already obtained. + * E_NOT_OK Request Failed + * \pre longWsIdxPtr has to be a valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsIsLock( + uint32 cryptoKeyId, + P2VAR(Crypto_30_LibCv_SizeOfLongTermWsLockType, AUTOMATIC, AUTOMATIC) longWsIdxPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_LongWsLockRelease() + **********************************************************************************************************************/ +/*! \brief Release long term workspace lock. + * \details - + * \param[in] cryptoKeyId Holds the key id which will lock the workspace + * \param[in] longWsIdx Holds the long term workspace idx. + * \pre longWsIdx has to be a valid index. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_LongWsLockRelease( + uint32 cryptoKeyId, + Crypto_30_LibCv_SizeOfLongTermWsLockType longWsIdx); +# endif /* (CRYPTO_30_LIBCV_LONGTERMWS == STD_ON) */ + +# if (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_ObjectWorkspaceHasChanged() + *********************************************************************************************************************/ +/*! \brief Check if the driver object workspace type has changed. + * \details - + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in] job Pointer to the job which shall be dispatched. + * \return TRUE The object workspace has changed. + * FALSE The object workspace is the same as in the last job. + * \pre objectId has to be a valid driver object handle. + * job has to be a valid job object handle. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(boolean, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ObjectWorkspaceHasChanged( + uint32 objectId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey() + *********************************************************************************************************************/ +/*! \brief Clear the last driver object workspace type for all driver objects which the given key was used. + * \details - + * \param[in] cryptoKeyId Id of the crypto key. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre cryptoKeyId Has to hold a valid identifier of a key. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_ClearObjectWorkspaceForChangedKey( + uint32 cryptoKeyId); +# endif /* (CRYPTO_30_LIBCV_CMAC_AES_ROUNDKEY_REUSE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_NUMBER_OF_PARTITIONS > 1u) +/********************************************************************************************************************** + * Crypto_30_LibCv_GetPartitionIdx() + *********************************************************************************************************************/ +/*! \brief Returns the current active partition idx. + * \details - + * \return Current partition idx if called by configured application, + * Size of known partitions if called by unknown application + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(uint32, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_GetPartitionIdx(void); +# endif + +/********************************************************************************************************************** + * Crypto_30_LibCv_MainFunctionHandler() + *********************************************************************************************************************/ +/*! + * \brief Handles the MainFunctions for the different partitions. + * \details Is called cyclically and handles asynchronous jobs from the queue. + * \param[in] partitionIdx Valid partitionIdx + * \pre - + * \context TASK + * \reentrant TRUE for different partitionIdx + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_MainFunctionHandler(uint32 partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_InitMemoryHandler() + *********************************************************************************************************************/ +/*! \brief The function initializes variables, which cannot be initialized with the startup code. + * \details Initialize component variables at power up. + * It should be called once from each partition where the module is used. + * \param[in] partitionIdx Valid partitionIdx + * \pre Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_InitMemoryHandler(uint32 partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Uint32ToUint8ArrayBigEndian( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219 */ + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + uint32 sourceData) +{ + targetData[0] = (uint8)(((sourceData)& 0xff000000u) >> 24); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + targetData[1] = (uint8)(((sourceData)& 0x00ff0000u) >> 16); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + targetData[2] = (uint8)(((sourceData)& 0x0000ff00u) >> 8); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ + targetData[3] = (uint8)(((sourceData)& 0x000000ffu)); /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ +} + +/********************************************************************************************************************** + * Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_ALWAYS_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Local_Uint8ArrayToUint32BigEndian( /* PRQA S 3219 */ /* MD_CRYPTO_30_LIBCV_3219 */ + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) targetData, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) sourceData) +{ + *targetData = ((((uint32)sourceData[0]) & 0x000000FFu) << 24) | ((((uint32)sourceData[1]) & 0x000000FFu) << 16) | ((((uint32)sourceData[2]) & 0x000000FFu) << 8) | (((uint32)sourceData[3]) & 0x000000FFu); /* PRQA S 2985 */ /* MD_CRYPTO_30_LIBCV_2985 */ /* SBSW_CRYPTO_30_LIBCV_API_CHECKED_SIZE_ACCESS */ +} + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* CRYPTO_30_LIBCV_SERVICES_H */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Services.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Signature.c b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Signature.c new file mode 100644 index 0000000..57ad5ae --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_Signature.c @@ -0,0 +1,6445 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_Signature.c + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Implementation for SIGNATURE Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_SIGNATURE_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_LibCv.h" +#include "Crypto_30_LibCv_Services.h" +#include "Crypto_30_LibCv_Curve.h" +#include "Crypto_30_LibCv_SignatureGenerate.h" +#include "Crypto_30_LibCv_SignatureVerify.h" +#include "Crypto_30_LibCv_Hash.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* RSA */ +#define CRYPTO_30_LIBCV_RSA_SALT_LENGTH_SIZE (2u) +#define CRYPTO_30_LIBCV_SIGNATURE_RSA_PSS_SALT_SIZE_AUTO_CALC (-1) + +/* Pre-Hash */ +#define CRYPTO_30_LIBCV_PREHASH_DIGEST_MAXSIZE ESL_SIZEOF_SHA512_DIGEST +#define CRYPTO_30_LIBCV_VSECPRIM_HASH_ALGO_INVALID (0xFFu) + +#define CRYPTO_E_PARAM_HANDLE_CUSTOM (0x0Fu) + +#define Crypto_30_LibCv_GetUint16(hiByte, loByte) ((uint16)((((uint16)(hiByte)) << 8) | ((uint16)(loByte)))) + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_LIBCV_START_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if ((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) +# if (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashStart() + *********************************************************************************************************************/ +/*! + * \brief pre-hashing start mode. + * \details This function dispatches and executes the pre-hashing for the required job. + * \param[in,out] wsHash Pointer to the vSecPrim hash workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a pointer to a valid job object. + * wsHash has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashStart( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashUpdate() + *********************************************************************************************************************/ +/*! + * \brief pre-hashing update mode. + * \details This function dispatches and executes the pre-hashing for the required job. + * \param[in,out] wsHash Pointer to the vSecPrim hash workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a pointer to a valid job object. + * wsHash has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashUpdate( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashFinish() + *********************************************************************************************************************/ +/*! + * \brief pre-hashing finish mode. + * \details This function dispatches and executes the pre-hashing for the required job. If no pre-hashing + * is required the input data is copied to the hashPtr. + * \param[in,out] wsHash Pointer to the vSecPrim hash workspace. + * \param[out] hashPtr Pointer to the hash. + * \param[in,out] hashLengthPtr Pointer to the hash length. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a pointer to a valid job object. + * wsHash has to be valid. + * hashPtr has to be valid pointer with the length of the hashLengthPtr value. + * hashLengthPtr has to be valid pointer. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashFinish( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) hashPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) hashLengthPtr); +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON) */ +#endif /* ((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job in start mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job in update mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a job object handle. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature_SignData() + *********************************************************************************************************************/ +/*! + * \brief Calls the lower layer to compute the signature based on the provided domain parameters. + * \details This function retrieves the private key and passes the domain parameters, the key + * and the message to the crypto library to compute the ECDSA signature. + * \param[in,out] job Pointer to the job which is dispatched. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] EcDomainPtr Pointer to the curve domain parameters + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters + * \param[in] EcSpeedUpExtPtr Pointer to the curve speed up extension parameters + * \param[in] expectedKeyLength Expected length of the private key for signature generation + * \param[in] messagePtr Pointer to the plain message. + * \param[in] messageLength Length of the plain message. + * \return E_OK Signature computation was successful. + * E_NOT_OK Signature computation failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * messagePtr has to be valid ptr with the length messageLength. + * All other provided pointers have to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature_SignData( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr, + uint32 expectedKeyLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer() + *********************************************************************************************************************/ +/*! + * \brief Processes the signature output of the lower layer. + * \details This function processes the signature output of the crypto library and writes the signature parts + * to the job's output parameter. + * \param[in,out] job Pointer to the job which is dispatched. + * \param[in] sigLength Maximum length of one signature component. + * \param[in] doubleSigLength Twice the maximum length of one signature component. + * \param[in] sigLengthR Length of signature component r. + * \param[in] sigLengthS Length of signature component s. + * \param[in] expectedKeyLength Expected length of the private key for signature generation + * \param[in] signatureR Pointer to the buffer storing the r component of the signature. + * \param[in] signatureS Pointer to the buffer storing the s component of the signature. + * \return E_OK Signature post-processing was successful. + * E_NOT_OK Signature post-processing failed. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * messagePtr has to be valid ptr with the length messageLength. + * All other provided pointers have to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + eslt_Length sigLength, + eslt_Length doubleSigLength, + eslt_Length sigLengthR, + eslt_Length sigLengthS, + uint32 expectedKeyLength, + P2CONST(eslt_Byte, AUTOMATIC, AUTOMATIC) signatureR, + P2CONST(eslt_Byte, AUTOMATIC, AUTOMATIC) signatureS); + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job in finish mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] messagePtr Pointer to the plain message. + * \param[in] messageLength Length of the plain message. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * messagePtr has to be valid ptr with the length messageLength. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job in finish mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job in start mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workSpace has to be valid. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job in update mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation() + *********************************************************************************************************************/ +/*! + * \brief Calls the lower layer to verify the signature based on the provided domain parameters. + * \details This function retrieves the public key for signature verification and passes the + * domain parameters and the message to the crypto library to verify the ECDSA signature. + * \param[in,out] job Pointer to the job which is dispatched. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in] EcDomainPtr Pointer to the curve domain parameters + * \param[in] EcDomainExtPtr Pointer to the curve domain extension parameters + * \param[in] messagePtr Pointer to the plain message. + * \param[in] messageLength Length of the plain message. + * \return E_OK Signature verification was successful. + * E_NOT_OK Signature verification failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * messagePtr has to be valid ptr with the length messageLength. + * All other provided pointers have to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job in finish mode to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workSpace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre job has to be a pointer to a valid job object. + * workSpace has to be valid. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_RSAVERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureVerifyResult() + *********************************************************************************************************************/ +/*! + * \brief Dispatch the return value of the verification function. + * \details This functions handles the return value of the verification function and set the result to the corresponding result ptr. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] retValCv Return value of the verification function. + * \param[in] signatureInvalidValue Expected value for a invalid signature. + * \return ESL_ERC_ERROR Dispatching was successful and verification failed. + * ESL_ERC_NO_ERROR Dispatching was successful and verification successful. + * \pre job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureVerifyResult( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + eslt_ErrorCode retValCv, + eslt_ErrorCode signatureInvalidValue); +#endif /* ((CRYPTO_30_LIBCV_RSAVERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceRSAsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateStart( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for RSA PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSAsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateUpdate( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for RSA PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSAsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateFinish( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA PKCS1 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceRSAver handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyStart( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for RSA PKCS1 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSAver handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyUpdate( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for RSA PKCS1 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSAver handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyFinish( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA PSS signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceRSAPSSsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateStart( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for RSA PSS signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceRSAPSSsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateUpdate( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for RSA PSS signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceRSAPSSsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateFinish( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements() + *********************************************************************************************************************/ +/*! + * \brief Load all required key elements and handle return values for RSA Pss verify. + * \details This function load the required key elements and handles the return values. + * \param[in] cryptoKeyId Id of the crypto key. + * \param[out] saltLengthPtr Pointer to where the salt length should be stored. + * \param[out] SigExponentIndexPtr Holds the index to the key data which shall be set as key element. + * \param[in,out] SigExponentLength Contains the length of the key element in bytes. + * \param[out] SigModulusIndexPtr Holds the index to the key data which shall be set as key element. + * \param[in,out] SigModulusLength Contains the length of the key element in bytes. + * \return E_OK Read key elements success. + * E_NOT_OK Read key elements failed. + * \pre objectId has to be a valid driver object handle. + * SigExponentIndexPtr has to be a valid ptr. + * sigExponentLength has to be a valid ptr. + * SigModulusIndexPtr has to be a valid ptr. + * sigModulusLength has to be a valid ptr. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) saltLengthPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) SigExponentIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) SigExponentLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) SigModulusIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) SigModulusLength); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA PSS signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid Crypto_30_LibCv_WorkSpaceRsaPssVer handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyStart( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for RSA PSS signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid Crypto_30_LibCv_WorkSpaceRsaPssVer handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for RSA PSS signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid Crypto_30_LibCv_WorkSpaceRsaPssVer handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA CRT PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSACRTsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateStart( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA CRT PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSACRTsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for RSA CRT PKCS1 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceRSACRTsig handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519GenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for Ed25519 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519GenerateStart( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for Ed25519 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519VerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for Ed25519 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519VerifyStart( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for Ed25519 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON || CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode() + *********************************************************************************************************************/ +/*! \brief Handle the deprecated version of ED25519 in START operation mode. + * \details This function sets the ESL_INSTANCE identifier based on the secondary algorithm family. + * \param[in] secAlgoFam Secondary algorithm family identifier. + * \param[out] eslInstancePtr Pointer to where the eslInstance should be stored. + * \pre Secondary algorithm family has to be CRYPTO_ALGOFAM_NOT_SET or CRYPTO_ALGOFAM_SHA2_512. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode( + Crypto_AlgorithmSecondaryFamilyType secAlgoFam, + P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) eslInstancePtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode() + *********************************************************************************************************************/ +/*! \brief Handle the deprecated version of ED25519 in UPDATE operation mode. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode() + *********************************************************************************************************************/ +/*! \brief Handle the deprecated version of ED25519 in FINISH operation mode. + * \details This function sets the inputLength based on the secondary algorithm family. + * \param[in] jobInputLength Input Length of used job. + * \param[in] secAlgoFam Secondary algorithm family identifier. + * \param[out] inputLengthPtr Pointer to where the inputLength should be stored + * \pre Secondary algorithm family has to be CRYPTO_ALGOFAM_NOT_SET or CRYPTO_ALGOFAM_SHA2_512. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode( + uint32 jobInputLength, + Crypto_AlgorithmSecondaryFamilyType secAlgoFam, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inputLengthPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Update() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for Ed25519 signature generate and verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEd25519 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Update( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON || CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448GenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for Ed448 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448GenerateStart( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448GenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for Ed448 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448GenerateFinish( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448VerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for Ed448 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448VerifyStart( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448VerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for Ed448 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448VerifyFinish( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON || CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Update() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for Ed448 signature generate and verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Update( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON || CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON || CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo() + *********************************************************************************************************************/ +/*! \brief Calculate SM2 user info. + * \details This function reads the public key and the optional user id and provides them to the lower layer + * crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \param[in] publicKeyElementId Key element ID of public key. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 publicKeyElementId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Update() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for SM2 signature generate and verify. + * \details This function provides the message data to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Update( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON || CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2GenerateStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for SM2 signature generate. + * \details This function initializes the SM2 algorithm of lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2GenerateStart( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2GenerateFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for SM2 signature generate. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2GenerateFinish( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2VerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for SM2 signature verify. + * \details This function initializes the SM2 algorithm of lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2VerifyStart( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2VerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for SM2 signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceSM2 handle. + * job has to be a pointer to a valid job object. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2VerifyFinish( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); +#endif /* (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode start for SLH-DSA signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the vSecPrim workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] version Version of the algorithm. + * \param[in] hashId ID of the hash function used by the algorithm. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid vSecPrimType_WorkSpaceVerifySLHDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + vSecPrim_SLHDSA_Version version, vSecPrim_SLHDSA_HashAlgorithm hashId); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode update for SLH-DSA signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the vSecPrim workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid vSecPrimType_WorkSpaceVerifySLHDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish() + *********************************************************************************************************************/ +/*! \brief Handle Operation mode finish for SLH-DSA signature verify. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the vSecPrim workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] publicKeyLength Length of the byte-array publicKey. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre workspace has to be a valid vSecPrimType_WorkSpaceVerifySLHDSA handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 publicKeyLength); +#endif /* (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_IsPublicKeyOnCurveEcc() + *********************************************************************************************************************/ +/*! \brief Check if a public key is on elliptic curve and write result into the job's resultPtr. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] EcDomainPtr Pointer to domain parameter structure. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEcPKeyCheck handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-CRYPTO-ISPUBLICKEYONCURVE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsPublicKeyOnCurveEcc( + P2CONST(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_IsPrivateKeyOnCurveEcc() + *********************************************************************************************************************/ +/*! \brief Check if a private key is on elliptic curve and write result into the job's resultPtr. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] EcDomainPtr Pointer to domain parameter structure. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEcPKeyCheck handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-CRYPTO-ISPRIVATEKEYONCURVE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsPrivateKeyOnCurveEcc( + P2CONST(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr); + +/********************************************************************************************************************** + * Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType() + *********************************************************************************************************************/ +/*! \brief Distinguish between checking a private or a public key based on secondary algorithm family. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] EcDomainPtr Pointer to domain parameter structure. + * \param[in] EcDomainExtPtr Pointer to domain parameter extension structure. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEcPKeyCheck handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType( + P2VAR(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr); +#endif /* (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) */ + +#if (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType() + *********************************************************************************************************************/ +/*! \brief Distinguish between checking a private or a public key based on secondary algorithm family. + * \details This function dispatches the provided job to the lower layer crypto library. + * \param[in,out] workspace Pointer to the esl workspace. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] curve Curve to be used (ESL_CURVE25519 or ESL_CURVE448). + * \param[in] expectedKeyLength Used to check the key element length. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre workspace has to be a valid eslt_WorkSpaceEdKeyCheck handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType( + P2VAR(eslt_WorkSpaceEdKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + const eslt_Size16 curve, + const uint32 expectedKeyLength); +#endif /* (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ +#if ((CRYPTO_30_LIBCV_RSAVERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureVerifyResult() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureVerifyResult( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ + eslt_ErrorCode retValCv, + eslt_ErrorCode signatureInvalidValue) +{ + eslt_ErrorCode retVal = ESL_ERC_ERROR; + /* # Handle Signature Verify Return Value. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Verification Passed */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = ESL_ERC_NO_ERROR; + } + else + { + /* # Verification Failed */ + if ((retValCv == signatureInvalidValue) || (retValCv == ESL_ERC_SIGNATURE_INVALID) +# if CRYPTO_30_LIBCV_RSAVERIFY + /* Special cases for RSA Verify */ + || (retValCv == ESL_ERC_RSA_SIGNATURE_OUT_OF_RANGE) || (retValCv == ESL_ERC_RSA_ENCODING_INVALID) || (retValCv == ESL_ERC_RSA_MODULE_OUT_OF_RANGE) +# endif + ) + { + retVal = ESL_ERC_NO_ERROR; + } + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureVerifyResult() */ +#endif /* ((CRYPTO_30_LIBCV_RSAVERIFY == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateStart( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_SIG, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* # Initialize algorithm based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initSignRSASHA1_V15(workspace, + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex), + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initSignRSASHA256_V15(workspace, + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex), + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1GenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateUpdate( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Update algorithm based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_updateSignRSASHA1_V15(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_updateSignRSASHA256_V15(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1GenerateUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1GenerateFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1GenerateFinish( + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + eslt_Length outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + /* # Generate Signature based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_finalizeSignRSASHA1_V15(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + &outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_finalizeSignRSASHA256_V15(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + &outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (uint32)outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1GenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyStart( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_VER, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* # Initialize algorithm based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initVerifyRSASHA1_V15(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initVerifyRSASHA256_V15(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1VerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyUpdate( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Update algorithm based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_updateVerifyRSASHA1_V15(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_updateVerifyRSASHA256_V15(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1VerifyUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1VerifyFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1VerifyFinish( + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Verify Signature based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_finalizeVerifyRSASHA1_V15(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_RSA_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_finalizeVerifyRSASHA256_V15(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_RSA_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PKCS1_v1_5_SHA2_256 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1VerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateStart( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_PSS_SIG, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* # Initialize algorithm based on secondary algorithm family. */ + + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initSignRSASHA1_PSS(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initSignRSASHA256_PSS(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_initSignRSASHA384_PSS(workspace, + (eslt_Length)keyElements[0].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), + (eslt_Length)keyElements[1].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + } + } + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPssGenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateUpdate( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Update algorithm based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_updateSignRSASHA1_PSS(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_updateSignRSASHA256_PSS(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_updateSignRSASHA384_PSS(workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPssGenerateUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssGenerateFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssGenerateFinish( + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Load salt key element. */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_SALT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + eslt_Length outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_NOT_OK; + + /* # Generate Signature based on secondary algorithm family. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_finalizeSignRSASHA1_PSS(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_finalizeSignRSASHA256_PSS(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_finalizeSignRSASHA384_PSS(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_RsaPssGenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 8 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) saltLengthPtr, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) SigExponentIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) SigExponentLength, + P2VAR(Crypto_30_LibCv_SizeOfKeyStorageType, AUTOMATIC, AUTOMATIC) SigModulusIndexPtr, + P2VAR(uint32, AUTOMATIC, AUTOMATIC) SigModulusLength) +{ + Std_ReturnType retVal; + Std_ReturnType retValRequired, retValOptional; + + Crypto_30_LibCv_KeyElementGetType keyElements[2]; + + Crypto_30_LibCv_SizeOfKeyStorageType SignatureSaltLengthIndex; + uint32 SignatureSaltLengthSize = CRYPTO_30_LIBCV_RSA_SALT_LENGTH_SIZE; + + /* Check if key element is accessible */ + /* # Read required key elements */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_MODULUS); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + retValRequired = Crypto_30_LibCv_Local_GetElementsIndexJob(cryptoKeyId, keyElements, 2u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retValOptional = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(cryptoKeyId, CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH, &SignatureSaltLengthIndex, &SignatureSaltLengthSize, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # check results */ + if (retValRequired == E_OK) + { + *SigExponentIndexPtr = keyElements[0u].keyElementIndex; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + *SigExponentLength = keyElements[0u].keyElementLength; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + *SigModulusIndexPtr = keyElements[1u].keyElementIndex; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + *SigModulusLength = keyElements[1u].keyElementLength; /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + /* # check if the salt length key element is available. */ + if (retValOptional == E_OK) + { + *saltLengthPtr = (uint32)Crypto_30_LibCv_GetUint16(Crypto_30_LibCv_GetKeyStorage(SignatureSaltLengthIndex), Crypto_30_LibCv_GetKeyStorage(SignatureSaltLengthIndex + 1u)); /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retVal = E_OK; + } + else if (retValOptional == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* # if the salt length key element is not available use specific value to auto calculate salt length. */ + *saltLengthPtr = (uint32)(eslt_Length)CRYPTO_30_LIBCV_SIGNATURE_RSA_PSS_SALT_SIZE_AUTO_CALC; /* PRQA S 2890, 2895 */ /* MD_CRYPTO_30_LIBCV_3.1, MD_CRYPTO_30_LIBCV_3.1 */ /* SBSW_CRYPTO_30_LIBCV_WORKSPACE_MEMBER_ACCESS */ + retVal = E_OK; + } + else + { + /* invalid salt length */ + retVal = retValOptional; + } + } + else + { + retVal = retValRequired; + } + return retVal; +} /* Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyStart( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + Crypto_30_LibCv_SizeOfKeyStorageType SigExponentIndex; + uint32 SigExponentLength; + Crypto_30_LibCv_SizeOfKeyStorageType SigModulusIndex; + uint32 SigModulusLength; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->wsRsa.header), ESL_MAXSIZEOF_WS_RSA_PSS_VER, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_SignatureRsaPssVerifyGetKeyElements(job->cryptoKeyId, &workspace->saltLength, &SigExponentIndex, &SigExponentLength, &SigModulusIndex, &SigModulusLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + + /* # Initialize algorithm based on secondary algorithm family. */ + switch (secAlgoFam) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_initVerifyRSASHA1_PSS(&(workspace->wsRsa), + (eslt_Length)SigModulusLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigModulusIndex), + (eslt_Length)SigExponentLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigExponentIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_initVerifyRSASHA256_PSS(&(workspace->wsRsa), + (eslt_Length)SigModulusLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigModulusIndex), + (eslt_Length)SigExponentLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigExponentIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_initVerifyRSASHA384_PSS(&(workspace->wsRsa), + (eslt_Length)SigModulusLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigModulusIndex), + (eslt_Length)SigExponentLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR)) Crypto_30_LibCv_GetAddrKeyStorage(SigExponentIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_RsaPssVerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + /* # Update algorithm based on secondary algorithm family. */ + switch (secAlgoFam) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_updateVerifyRSASHA1_PSS(&(workspace->wsRsa), + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_updateVerifyRSASHA256_PSS(&(workspace->wsRsa), + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_updateVerifyRSASHA384_PSS(&(workspace->wsRsa), + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retValCv remains on ESL_ERC_ERROR and retVal on E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPssVerifyUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPssVerifyFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPssVerifyFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + Crypto_AlgorithmSecondaryFamilyType secAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Verify Signature based on secondary algorithm family. */ + switch (secAlgoFam) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) + case CRYPTO_ALGOFAM_SHA1: + { + retValCv = esl_finalizeVerifyRSASHA1_PSS(&(workspace->wsRsa), /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)workspace->saltLength, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_RSA_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_256: + { + retValCv = esl_finalizeVerifyRSASHA256_PSS(&(workspace->wsRsa), /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)workspace->saltLength, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_RSA_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_256 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) + case CRYPTO_ALGOFAM_SHA2_384: + { + retValCv = esl_finalizeVerifyRSASHA384_PSS(&(workspace->wsRsa), /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (eslt_Length)workspace->saltLength, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_RSA_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + break; + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_RSA_RSASSA_PSS_SHA2_384 == STD_ON) */ + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* unsupported mode - retVal has already been set to E_NOT_OK */ + break; + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPssVerifyFinish() */ + +#endif /* (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) */ + +#if ((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) +# if (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashStart( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* Dispatch secondary algorithm for pre-hashing. */ + if(job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) + { + /* Without pre-hashing */ + retVal = E_OK; + } + else + { + /* With pre-hashing */ + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeStart(wsHash, job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily); /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_WORKSPACE */ + } + + return retVal; +} /* Crypto_30_LibCv_PreHashStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashUpdate( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* Dispatch secondary algorithm for pre-hashing. */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) + { + /* without pre hashing */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength != 0u) && (!Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH))) + { + retVal = E_NOT_OK; + } + else + { + retVal = E_OK; + } + } + else + { + /* With pre hashing */ + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeUpdate(wsHash, job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); + } + + return retVal; +} /* Crypto_30_LibCv_PreHashUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_PreHashFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_PreHashFinish( + P2VAR(vSecPrimType_WorkSpaceHash, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) wsHash, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) hashPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) hashLengthPtr) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + /* Dispatch secondary algorithm for pre-hashing. */ + retVal = Crypto_30_LibCv_Dispatch_Hash_ModeFinish(wsHash, hashLengthPtr, hashPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_OF_WORKSPACE */ + + return retVal; +} /* Crypto_30_LibCv_PreHashFinish() */ +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_PRE_HASH == STD_ON) */ +#endif /* ((CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) || (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON)) */ + +#if (CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ + +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON) + /* # Handle pre-hashing start. */ + retVal = Crypto_30_LibCv_PreHashStart(&(workSpace->wsPreHash), job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(workSpace); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON) + /* # Handle pre-hashing update. */ + retVal = Crypto_30_LibCv_PreHashUpdate(&(workSpace->wsPreHash), job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(workSpace); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature_SignData() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +/* PRQA S 6050, 6060, 6080 10 */ /* MD_MSR_STCAL, MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature_SignData( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr, + uint32 expectedKeyLength, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + eslt_Length sigLength = 0u, doubleSigLength = 0u, sigLengthR = 0u, sigLengthS = 0u; + uint32 sigKeyLength = 0u; + + eslt_Byte signatureR[CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY] = {0u}; + eslt_Byte signatureS[CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY] = {0u}; + + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) privateKeyElementPtr; +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) + eslt_Byte privateKeyElementBuffer[CRYPTO_30_LIBCV_MAX_SIZEOF_SIGNATURE_GENERATE_ECC_KEY] = { 0u }; +# endif + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* ----- Implementation ------------------------------------------------- */ + /* # Get private key for signature generation. */ + sigKeyLength = (uint32)(esl_getLengthOfEcPprivateKey(EcDomainPtr)); /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, sigKeyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize ECC workspace header. */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workSpace->wsEcP.header), ESL_MAXSIZEOF_WS_ECP, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* # Check if key element for private key is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (keyElements[0].keyElementLength < expectedKeyLength) + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + + if (retVal == E_OK) + { + retVal = E_NOT_OK; + if (esl_initSignDSAEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workSpace->wsEcP), EcDomainPtr, EcDomainExtPtr, EcSpeedUpExtPtr) == ESL_ERC_NO_ERROR) /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + { +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) + if (sigKeyLength == (keyElements[0].keyElementLength + 1u)) + { + privateKeyElementBuffer[0] = 0u; /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_ACCESS_WITH_SIZE */ + Crypto_30_LibCv_CopyData(&privateKeyElementBuffer[1u], Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), (keyElements[0].keyElementLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + privateKeyElementPtr = privateKeyElementBuffer; + } + else +# endif /* (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) */ + { + privateKeyElementPtr = Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex); + } + + /* # Calculate signature. */ + /* # get esl size of signature length for r and s (signature = [signature_r|signature_s]) */ + sigLength = esl_getLengthOfEcPsignature_comp(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + doubleSigLength = (eslt_Length)Crypto_30_LibCv_Math_Mul2(sigLength); + if (*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) >= doubleSigLength) + { + sigLengthS = sigLength; + sigLengthR = sigLength; + + /* # Finalize and store output. */ + retValCv = esl_signDSAEcP_prim(&(workSpace->wsEcP), /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (eslt_Length)messageLength, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))messagePtr, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))privateKeyElementPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&sigLengthR, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))signatureR, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&sigLengthS, (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))signatureS); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer(job, sigLength, doubleSigLength, sigLengthR, sigLengthS, expectedKeyLength, signatureR, signatureS); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR_AND_MEMBER_OF_JOB_PTR */ + } + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_EccPrimeGenerateSignature_SignData() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6060 10 */ /* MD_CRYPTO_30_LIBCV_STPAR */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ + eslt_Length sigLength, + eslt_Length doubleSigLength, + eslt_Length sigLengthR, + eslt_Length sigLengthS, + uint32 expectedKeyLength, + P2CONST(eslt_Byte, AUTOMATIC, AUTOMATIC) signatureR, + P2CONST(eslt_Byte, AUTOMATIC, AUTOMATIC) signatureS) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) + boolean outputIsSet = FALSE; /* PRQA S 2981 */ /* MD_MSR_RetVal */ +# endif + + /* ----- Implementation ------------------------------------------------- */ + if ((sigLengthR == sigLength) && (sigLengthS == sigLength)) + { +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) + /* # Check if the return length is one greater than expected, the SECp160r1 can return 161 bits. */ + if (sigLength == (expectedKeyLength + 1u)) + { + /* # Check the first bytes and delete the zero padding. */ + if ((signatureR[0] == 0u) && (signatureS[0] == 0u)) + { + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, &signatureR[1u], (eslt_Length)(sigLengthR - 1u)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CopyData(&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[sigLengthR - 1u], &signatureS[1u], (eslt_Length)(sigLengthS - 1u)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = (eslt_Length)(doubleSigLength - 2u); /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + outputIsSet = TRUE; + } + else + { + outputIsSet = FALSE; + } + } + else + { + outputIsSet = FALSE; + } + + /* # If the first bytes are not equal zero, copy the signature to the output ptr. */ + if (outputIsSet == FALSE) +# else /* !(CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(expectedKeyLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +# endif + { + Crypto_30_LibCv_CopyData(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, signatureR, (sigLengthR)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + Crypto_30_LibCv_CopyData(&job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr[sigLengthR], signatureS, (sigLengthS)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = doubleSigLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_EccPrimeGenerateSignature_ConvertSignatureForOutputBuffer() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_EccPrimeGenerateSignature() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EccPrimeGenerateSignature( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, retValDispatching = E_NOT_OK; + uint32 expectedKeyLength = 0u; + uint32 messageLengthCut = 0u; + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + P2CONST(eslt_EccSpeedUpExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcSpeedUpExtPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + + /* ----- Implementation ------------------------------------------------- */ + /* # Choose domain parameters according to configured primitive. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P160R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveSecP160R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveSecP160R1DomainExt; + EcSpeedUpExtPtr = Crypto_30_LibCv_EccCurveSecP160R1SpeedUpExt; + expectedKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PRIVATE - 1u; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P256R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt; + EcSpeedUpExtPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1SpeedUpExt; + expectedKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_256_KEY_PRIVATE; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P384R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP384R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt; + EcSpeedUpExtPtr = Crypto_30_LibCv_EccCurveNistSecP384R1SpeedUpExt; + expectedKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_384_KEY_PRIVATE; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P521R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP521R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt; + EcSpeedUpExtPtr = Crypto_30_LibCv_EccCurveNistSecP521R1SpeedUpExt; + expectedKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_521_KEY_PRIVATE; + retValDispatching = E_OK; + break; +# endif /* (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) */ + + default: + /* not reachable, misra only. */ + break; + } + + if (retValDispatching == E_OK) + { + /* # Adapt message length according to maximum length. */ + messageLengthCut = messageLength; +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON) + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily != CRYPTO_ALGOFAM_NOT_SET) /* COV_CRYPTO_30_LIBCV_ECDSA_PREHASHING_ENABLED */ + { + if (messageLength > esl_getMaxLengthOfEcPmessage(EcDomainPtr)) /* COV_CRYPTO_30_LIBCV_ECDSA_CONFIGURATION */ /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + { + messageLengthCut = esl_getMaxLengthOfEcPmessage(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + } + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON) */ + + /* # # Call ECC algorithm. */ + retVal = Crypto_30_LibCv_EccPrimeGenerateSignature_SignData(job, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + workSpace, + EcDomainPtr, + EcDomainExtPtr, + EcSpeedUpExtPtr, + expectedKeyLength, + messagePtr, + messageLengthCut); + } + + return retVal; +} /* Crypto_30_LibCv_EccPrimeGenerateSignature() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal; + uint32 messageLength; + const uint8 *messagePtr; + +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON)) + uint8 messageBuf[CRYPTO_30_LIBCV_PREHASH_DIGEST_MAXSIZE]; + Std_ReturnType localRetVal; +# endif + + /* ----- Implementation ------------------------------------------------- */ + /* # Handle pre-hashing finish. */ +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON)) + retVal = E_NOT_OK; + messageLength = CRYPTO_30_LIBCV_PREHASH_DIGEST_MAXSIZE; + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) /* COV_CRYPTO_30_LIBCV_ECDSA_PREHASHING_ENABLED */ + { +# endif + /* without pre hashing */ + messagePtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr; + messageLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; +# if ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON)) + localRetVal = E_OK; + } + else + { + localRetVal = Crypto_30_LibCv_PreHashFinish(&(workSpace->wsPreHash), messageBuf, &messageLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + messagePtr = messageBuf; + } + + if (localRetVal == E_OK) +# endif /* ((CRYPTO_30_LIBCV_SIGNATURE_GENERATE_PRE_HASH == STD_ON)) */ + { + /* # Pass on potentially pre-hashed message for signature computation. */ + retVal = Crypto_30_LibCv_EccPrimeGenerateSignature(workSpace, job, messagePtr, messageLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_ECPGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + /* # Handle pre-hashing start. */ + retVal = Crypto_30_LibCv_PreHashStart(&(workSpace->wsPreHash), job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(workSpace); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_2 */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ------------------------------------------------- */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + /* # Handle pre-hashing update. */ + retVal = Crypto_30_LibCv_PreHashUpdate(&(workSpace->wsPreHash), job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(workSpace); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6060, 6080 8 */ /* MD_CRYPTO_30_LIBCV_STPAR, MD_MSR_STMIF */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation( + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) messagePtr, + uint32 messageLength) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + uint32 sigKeyLength = 0u; + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* ----- Implementation ------------------------------------------------- */ + /* # Retrieve the public key. */ + /* get esl size of key length for x and y component of the public key (key = [key_x|key_y]) */ + sigKeyLength = (uint32)(Crypto_30_LibCv_Math_Mul2((uint32)esl_getLengthOfEcPpublicKey_comp(EcDomainPtr))); /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, sigKeyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize ECC workspace header. */ + if (esl_initWorkSpaceHeader((P2VAR(eslt_WorkSpaceHeader, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workSpace->wsEcP.header), ESL_MAXSIZEOF_WS_ECP, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Initialize ECC algorithm. */ + retVal = E_NOT_OK; + retValCv = esl_initVerifyDSAEcP_prim((P2VAR(eslt_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(workSpace->wsEcP), EcDomainPtr, EcDomainExtPtr); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Check if value is even */ + if (Crypto_30_LibCv_Math_IsEven(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength)) + { + /* # Calculate and verify signature. */ + retValCv = esl_verifyDSAEcP_prim(&(workSpace->wsEcP), (eslt_Length)messageLength, (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))messagePtr, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex + Crypto_30_LibCv_Math_Div2(sigKeyLength)), + (eslt_Length)Crypto_30_LibCv_Math_Div2(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength), (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)Crypto_30_LibCv_Math_Div2(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength), (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr[(eslt_Length)Crypto_30_LibCv_Math_Div2(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength)])); + + retValCv = Crypto_30_LibCv_DispatchSignatureVerifyResult(job, retValCv, ESL_ERC_ECC_SIGNATURE_INVALID); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_JOB_PTR */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish( + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workSpace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK, retValDispatching = E_NOT_OK; + uint32 messageLength; + const uint8* messagePtr; + +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + Std_ReturnType localRetVal; +# endif + + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + uint8 messageBuf[CRYPTO_30_LIBCV_PREHASH_DIGEST_MAXSIZE]; +# endif + + /* ----- Implementation ------------------------------------------------- */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + +# if (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P160R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveSecP160R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveSecP160R1DomainExt; + retValDispatching = E_OK; + break; +# endif + +# if (CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P256R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt; + retValDispatching = E_OK; + break; +# endif + +# if (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P384R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP384R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt; + retValDispatching = E_OK; + break; +# endif + +# if (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON) + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P521R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP521R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt; + retValDispatching = E_OK; + break; +# endif + + default: + /* not reachable, misra only. */ + break; + } + + if (retValDispatching == E_OK) + { + /* # Handle pre-hashing finish. */ +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + messageLength = CRYPTO_30_LIBCV_PREHASH_DIGEST_MAXSIZE; + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) /* COV_CRYPTO_30_LIBCV_ECDSA_PREHASHING_ENABLED */ +# endif + { + /* without pre hashing */ + messagePtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr; + messageLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + localRetVal = E_OK; +# endif + } +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) + else + { + localRetVal = Crypto_30_LibCv_PreHashFinish(&(workSpace->wsPreHash), messageBuf, &messageLength); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + messagePtr = messageBuf; + } + /* # Adapt message length according to maximum length. */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily != CRYPTO_ALGOFAM_NOT_SET) /* COV_CRYPTO_30_LIBCV_ECDSA_PREHASHING_ENABLED */ + { + if (messageLength > esl_getMaxLengthOfEcPmessage(EcDomainPtr)) /* COV_CRYPTO_30_LIBCV_ECDSA_CONFIGURATION */ /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + { + messageLength = esl_getMaxLengthOfEcPmessage(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CONST_WORKSPACE */ + } + } + + if (localRetVal == E_OK) +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_PRE_HASH == STD_ON) */ + { + /* # Call ECC algorithm. */ + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish_CvOperation(job, workSpace, /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + EcDomainPtr, EcDomainExtPtr, + messagePtr, messageLength); + } + } + + return retVal; +} /* Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_ECPVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateStart() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateStart( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[5]; + + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 0u, CRYPTO_KE_CUSTOM_RSA_PRIME_P); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 1u, CRYPTO_KE_CUSTOM_RSA_PRIME_Q); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 2u, CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 3u, CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetId(keyElements, 4u, CRYPTO_KE_CUSTOM_RSA_INVERSE_QI); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), ESL_MAXSIZEOF_WS_RSA_CRT_SIG, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* Check if key element is accessible */ + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 5u, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* # Initialize algorithm based on secondary algorithm family. */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_SHA1) +# endif + { + retValCv = esl_initSignRSACRTSHA1_V15( + workspace, + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex), + (eslt_Length)keyElements[2u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[2u].keyElementIndex), + (eslt_Length)keyElements[3u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[3u].keyElementIndex), + (eslt_Length)keyElements[4u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[4u].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) + else +# endif + { + retValCv = esl_initSignRSACRTSHA256_V15( + workspace, + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[1u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[1u].keyElementIndex), + (eslt_Length)keyElements[2u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[2u].keyElementIndex), + (eslt_Length)keyElements[3u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[3u].keyElementIndex), + (eslt_Length)keyElements[4u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[4u].keyElementIndex)); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) */ + } + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1CrtGenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + /* # Update algorithm based on secondary algorithm family. */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_SHA1) +# endif + { + retValCv = esl_updateSignRSACRTSHA1_V15( + workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) + else +# endif + { + retValCv = esl_updateSignRSACRTSHA256_V15( + workspace, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish( + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv; + + eslt_Length outputLength; + outputLength = (eslt_Length)(*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Generate Signature based on secondary algorithm family. */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_SHA1) +# endif + { + retValCv = esl_finalizeSignRSACRTSHA1_V15( + workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) */ +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA1 == STD_ON) + else +# endif + { + retValCv = esl_finalizeSignRSACRTSHA256_V15( + workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFER_AND_STACK_BUFFER */ + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr); + } +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_GENERATE_RSA_CUSTOM_RSASSA_PKCS1_v1_5_CRT_SHA2_256 == STD_ON) */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + return retVal; +} /* Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519GenerateStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519GenerateStart( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_Ed25519, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) contextPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType contextIndex = 0u; + uint32 contextLength = 0u; + + /* # Read key element to get context. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_EDDSA_CONTEXT, &contextIndex, &contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + contextPtr = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* Key has no context key element. */ + /* ContextPtr remains NULL_PTR and length remains zero. */ + retVal = E_OK; + } + else + { + /* retVal remains. */ + } + + if (retVal == E_OK) + { + eslt_Byte eslInstance = 0xFFu; /* Init as invalid value. */ + + /* # Determine eslInstance based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_NOT_SET: + /* # If AlgoMode is not set use deprecated Ed25519 function. */ + Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode( /* PRQA S 0310 */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR)) &eslInstance); + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PURE: + eslInstance = ESL_INSTANCE_Ed25519; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_CTX: + eslInstance = ESL_INSTANCE_Ed25519CTX; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PH: + eslInstance = ESL_INSTANCE_Ed25519PH; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Init EdDSA algorithm with determined eslInstance. */ + retValCv = esl_initSignEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + ESL_CURVE25519, + eslInstance, + contextPtr, + (eslt_Length)contextLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519GenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, ESL_SIZEOF_Ed25519_SECRET_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Check if key element is accessible. */ + /* # Read key element to get secret key. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + uint32 inputLength = 0u; + /* Get outputLength in local variable to omit type mismatches */ + eslt_Length outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Determine inputLength based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_NOT_SET: + /* # If AlgoMode is not set use deprecated Ed25519 function. */ + Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode( /* PRQA S 0310 */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, + (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&inputLength); + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PURE: + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_CTX: + inputLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PH: + /* inputLength remains 0. */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Generate signature with determined inputLength. */ + retValCv = esl_signEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))NULL_PTR, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519VerifyStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519VerifyStart( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_Ed25519, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) contextPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType contextIndex = 0u; + uint32 contextLength = 0u; + + /* # Read key element to get context. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_EDDSA_CONTEXT, &contextIndex, &contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + contextPtr = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* Key has no context key element. */ + /* ContextPtr remains NULL_PTR and length remains zero. */ + retVal = E_OK; + } + else + { + /* retVal remains. */ + } + + if (retVal == E_OK) + { + eslt_Byte eslInstance = 0xFFu; /* Init as invalid value. */ + + /* # Determine eslInstance based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_NOT_SET: + /* # If AlgoMode is not set use deprecated Ed25519 function. */ + Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode( /* PRQA S 0310 */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&eslInstance); + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PURE: + eslInstance = ESL_INSTANCE_Ed25519; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_CTX: + eslInstance = ESL_INSTANCE_Ed25519CTX; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PH: + eslInstance = ESL_INSTANCE_Ed25519PH; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Init EdDSA algorithm with determined eslInstance. */ + retValCv = esl_initVerifyEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + ESL_CURVE25519, + eslInstance, + contextPtr, + (eslt_Length)contextLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519VerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Check if key element is accessible. */ + /* # Read key elements to get public key. */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, ESL_SIZEOF_Ed25519_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + uint32 inputLength = 0u; + + /* # Determine inputLength based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_NOT_SET: + /* # If AlgoMode is not set use deprecated Ed25519 function. */ + Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode( /* PRQA S 0310 */ /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength), + job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, + (P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR))&inputLength); + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PURE: + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_CTX: + inputLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PH: + /* inputLength remains 0 */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Verify signature with determined inputLength. */ + retValCv = esl_verifyEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + + /* # Write result in verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else + { + if (retValCv == ESL_ERC_SIGNATURE_INVALID) + { + retValCv = ESL_ERC_NO_ERROR; + } + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON || CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode( + Crypto_AlgorithmSecondaryFamilyType secAlgoFam, + P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) eslInstancePtr) +{ + if (secAlgoFam == CRYPTO_ALGOFAM_SHA2_512) + { + /* # If secondary algorithm family is set, use Ed25519ph as eslInstance. */ + *eslInstancePtr = ESL_INSTANCE_Ed25519ph; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + } + else /* CRYPTO_ALGOFAM_NOT_SET */ + { + /* # Else set eslInstance to Ed25519 */ + *eslInstancePtr = ESL_INSTANCE_Ed25519; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + } +} /* Crypto_30_LibCv_Ed25519_getEslInstanceofDeprecatedAlgoMode() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(eslt_ErrorCode, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Calculate Prehash if necessary based on secondary algorithm family. */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_SHA2_512) + { + /* Calculate Prehash. */ + retValCv = esl_updateEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); + } + else + { + /* No input data in update is allowed because it can't be processed. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == 0u) || (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH))) + { + /* Nothing to do if no prehashing is used. */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + retValCv = ESL_ERC_ERROR; + } + } + return retValCv; +} /* Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(void, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode( + uint32 jobInputLength, + Crypto_AlgorithmSecondaryFamilyType secAlgoFam, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) inputLengthPtr) +{ + if (secAlgoFam == CRYPTO_ALGOFAM_SHA2_512) + { + /* # If secondary algorithm family is set, use inputLength 0 because the input has been preHashed. */ + *inputLengthPtr = 0u; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + } + else /* CRYPTO_ALGOFAM_NOT_SET */ + { + /* # Else use the job's inputLength. */ + *inputLengthPtr = jobInputLength; /* SBSW_CRYPTO_30_LIBCV_VARIABLE_ACCESS_PTR_FROM_STACK */ + } +} /* Crypto_30_LibCv_Ed25519_getFinishInputLengthOfDeprecatedAlgoMode() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Update( + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Distinguish mode based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_NOT_SET: + /* # If AlgoMode is not set use deprecated Ed25519 function. */ + retValCv = Crypto_30_LibCv_Ed25519_Update_deprecatedAlgoMode(workspace, job); /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PURE: + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_CTX: + /* If pure or context mode is set, no input data in update is allowed because it can't be processed. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == 0u) || (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH))) + { + /* Nothing to do if no prehashing is used. */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + retValCv = ESL_ERC_ERROR; + } + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED25519_PH: + /* # Process prehashing if necessary. */ + retValCv = esl_updateEdDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519Update() */ +#endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON || CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448GenerateStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448GenerateStart( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_EDDSA, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) contextPtr = NULL_PTR; + uint32 contextLength = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType contextIndex = 0u; + + /* # Read key element to get context. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_EDDSA_CONTEXT, &contextIndex, &contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + contextPtr = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* Key has no context key element. */ + /* ContextPtr remains NULL_PTR and length remains zero. */ + retVal = E_OK; + } + else + { + /* retVal remains. */ + } + + if (retVal == E_OK) + { + eslt_Byte eslInstance = 0xFFu; /* Init as invalid value. */ + + /* # Determine eslInstance based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PURE: + eslInstance = ESL_INSTANCE_Ed448; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PH: + eslInstance = ESL_INSTANCE_Ed448PH; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Init EdwardsDsa algorithm with determined eslInstance. */ + retValCv = esl_initSignEdwardsDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + ESL_CURVE448, + eslInstance, + contextPtr, + (eslt_Length)contextLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448GenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448GenerateFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448GenerateFinish( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, ESL_SIZEOF_Ed448_SECRET_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* Check if key element is accessible. */ + /* # Read key elements to get secret key. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + uint32 inputLength = 0u; + /* Get outputLength in local variable to omit type mismatches */ + eslt_Length outputLength = (eslt_Length)*(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr); + + /* # Determine inputLength based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PURE: + /* Use the job's inputLength. */ + inputLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PH: + /* inputLength remains 0. */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Generate signature with determined inputLength. */ + retValCv = esl_signEdwardsDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))NULL_PTR, + (eslt_Length)0u, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&outputLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = outputLength; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448GenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448VerifyStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448VerifyStart( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_EDDSA, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) contextPtr = NULL_PTR; + uint32 contextLength = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType contextIndex = 0u; + + /* # Read key element to get context. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_EDDSA_CONTEXT, &contextIndex, &contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + contextPtr = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); + } + else if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* Key has no context key element. */ + /* ContextPtr remains NULL_PTR and length remains zero. */ + retVal = E_OK; + } + else + { + /* retVal remains. */ + } + + if (retVal == E_OK) + { + eslt_Byte eslInstance = 0xFFu; /* Init as invalid value. */ + + /* # Determine eslInstance based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PURE: + eslInstance = ESL_INSTANCE_Ed448; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PH: + eslInstance = ESL_INSTANCE_Ed448PH; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Init EdwardsDSA algorithm with determined eslInstance. */ + retValCv = esl_initVerifyEdwardsDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + ESL_CURVE448, + eslInstance, + contextPtr, + (eslt_Length)contextLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448VerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448VerifyFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448VerifyFinish( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Check if key element is accessible. */ + /* # Read key elements to get public key. */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, ESL_SIZEOF_Ed448_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + uint32 inputLength = 0u; + + /* # Determine inputLength based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PURE: + /* Use the job's inputLength. */ + inputLength = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PH: + /* inputLength remains 0. */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + /* # Verify signature with determined inputLength. */ + retValCv = esl_verifyEdwardsDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + + /* # Write result in verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else + { + if (retValCv == ESL_ERC_SIGNATURE_INVALID) + { + retValCv = ESL_ERC_NO_ERROR; + } + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448VerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON || CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Update( + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PURE: + /* # If pure mode is set, no input data in update is allowed because it can't be processed. */ + if ((job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength == 0u) || (Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_FINISH))) + { + /* Nothing to do if no prehashing is used. */ + retValCv = ESL_ERC_NO_ERROR; + } + else + { + retValCv = ESL_ERC_ERROR; + } + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_ED448_PH: + /* Process prehashing if necessary. */ + retValCv = esl_updateEdwardsDSA(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + break; /* Unsupported mode */ + } + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448Update() */ +#endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON || CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON || CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 publicKeyElementId) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) publicKeyPtr = NULL_PTR; + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) userIdPtr = NULL_PTR; + + uint32 publicKeyLengthHalf = 0u; + uint32 publicKeyLength = CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY; + uint32 userIdLength = CRYPTO_30_LIBCV_SM2_MAX_SIZEOF_ID; + + Crypto_30_LibCv_SizeOfKeyStorageType publicKeyIndex = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType userIdIndex = 0u; + + /* # Get public key (X|Y). */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, publicKeyElementId, &publicKeyIndex, &publicKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + publicKeyPtr = Crypto_30_LibCv_GetAddrKeyStorage(publicKeyIndex); + publicKeyLengthHalf = Crypto_30_LibCv_Math_Div2(publicKeyLength); + + /* # Try to get user ID. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_SM2_ID, &userIdIndex, &userIdLength, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == CRYPTO_E_KEY_NOT_AVAILABLE) + { + /* # If KE is not available use NULL_PTR for user ID with length 0 since it's optional. */ + userIdPtr = NULL_PTR; + userIdLength = 0; + retVal = E_OK; + } + else if ((retVal == E_OK) && (userIdLength < CRYPTO_30_LIBCV_SM2_MIN_SIZEOF_ID)) + { + /* # If KE is empty return CRYPTO_E_KEY_SIZE_MISMATCH */ + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + else if (retVal == E_OK) + { + /* # If KE is available (and not empty), get its pointer from index. */ + userIdPtr = Crypto_30_LibCv_GetAddrKeyStorage(userIdIndex); + } + else + { + /* # Else retVal remains on error code from KeyElementGetStorageIndexJobOptional. */ + } + + if (retVal == E_OK) + { + /* # Calculate User Info (ESLib expects user ID length in bits). */ + retValCv = esl_addUserInfoSM2_ECP(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_NULL_PTR */ /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_KEYPTR_AND_LENGTH */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))NULL_PTR, + (eslt_Length)0u, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))userIdPtr, + (eslt_Length)Crypto_30_LibCv_Byte2Bit(userIdLength), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicKeyPtr, + (eslt_Length)publicKeyLengthHalf, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&publicKeyPtr[publicKeyLengthHalf], + (eslt_Length)publicKeyLengthHalf); + + if (retValCv != ESL_ERC_NO_ERROR) + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Update() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Update( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Add message data to SM2 signature algorithm */ + retValCv = esl_updateMessageSM2_ECP(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2Update() */ +#endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON || CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2GenerateStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2GenerateStart( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Init workspace header. */ + if ((esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_SM2, CRYPTO_30_LIBCV_WATCHDOG_PTR)) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* # Init SM2 algorithm with SM2P256V1 curve. */ + retValCv = esl_initSignSM2_ECP(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveSm2P256v1Domain, + Crypto_30_LibCv_EccCurveSm2P256v1DomainExt, + Crypto_30_LibCv_EccCurveSm2P256v1SpeedUpExt); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Calculate User Info. */ + retVal = Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo(workspace, job, CRYPTO_KE_CUSTOM_SM2_GENERATE_PUBLIC_KEY); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2GenerateStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2GenerateFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2GenerateFinish( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + uint32 privateKeyLength = CRYPTO_30_LIBCV_SM2_SIZEOF_PRIVATE_KEY; + Crypto_30_LibCv_SizeOfKeyStorageType privateKeyIndex = 0u; + + /* # Get private key. */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_SIGNATURE_KEY, &privateKeyIndex, &privateKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* # Check if output buffer is large enough to write the signature (R|S) into it. */ + if (*job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr < CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE) + { + retVal = CRYPTO_E_SMALL_BUFFER; + } + else + { + /* # Get outputLengths in local variables to omit type mismatches. */ + eslt_Length signatureLengthR = CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE_HALF; + eslt_Length signatureLengthS = CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE_HALF; + + P2VAR(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) signaturePtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr; + + /* # Generate signature (R|S) with SM2 algorithm. */ + retValCv = esl_signSM2_ECP(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_KEYPTR_AND_LENGTH */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(privateKeyIndex), + (eslt_Length)privateKeyLength, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))signaturePtr, + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&signatureLengthR, + (P2VAR(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&signaturePtr[signatureLengthR], + (P2VAR(eslt_Length, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&signatureLengthS); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Summarize output lengths of concatenated signature (R|S). */ + *(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) = (uint32)signatureLengthR + (uint32)signatureLengthS; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2GenerateFinish() */ +#endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2VerifyStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2VerifyStart( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Init workspace header. */ + if ((esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_SM2, CRYPTO_30_LIBCV_WATCHDOG_PTR)) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { + /* # Init SM2 algorithm with SM2P256V1 curve. */ + retValCv = esl_initVerifySM2_ECP(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + Crypto_30_LibCv_EccCurveSm2P256v1Domain, /* SBSW_CRYPTO_30_LIBCV_DOMAIN_PTR */ + Crypto_30_LibCv_EccCurveSm2P256v1DomainExt); + + if (retValCv == ESL_ERC_NO_ERROR) + { + /* # Calculate User Info. */ + retVal = Crypto_30_LibCv_Dispatch_Sm2_CalcUserInfo(workspace, job, CRYPTO_KE_SIGNATURE_KEY); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2VerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2VerifyFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2VerifyFinish( + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + uint32 publicKeyLength = CRYPTO_30_LIBCV_SM2_SIZEOF_PUBLIC_KEY; + Crypto_30_LibCv_SizeOfKeyStorageType publicKeyIndex = 0u; + + /* Init verifyPtr to CRYPTO_E_VER_NOT_OK. */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* Get public key (X|Y). */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_SIGNATURE_KEY, &publicKeyIndex, &publicKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + retVal = E_NOT_OK; + /* Check signature for correct size before dividing by two */ + if (job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength == CRYPTO_30_LIBCV_SM2_SIZEOF_SIGNATURE) + { + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) publicKeyPtr = Crypto_30_LibCv_GetAddrKeyStorage(publicKeyIndex); + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) signaturePtr = job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr; + uint32 publicKeyLengthHalf = Crypto_30_LibCv_Math_Div2(publicKeyLength); + uint32 signatureLengthHalf = Crypto_30_LibCv_Math_Div2(job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + + /* Verify signature with SM2 algorithm. */ + retValCv = esl_verifySM2_ECP(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ /* SBSW_CRYPTO_30_LIBCV_CALL_WITH_KEYPTR_AND_LENGTH */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicKeyPtr, + (eslt_Length)publicKeyLengthHalf, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&publicKeyPtr[publicKeyLengthHalf], + (eslt_Length)publicKeyLengthHalf, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))signaturePtr, + (eslt_Length)signatureLengthHalf, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))&signaturePtr[signatureLengthHalf], + (eslt_Length)signatureLengthHalf); + + /* Write result in verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else if (retValCv == ESL_ERC_ECC_SIGNATURE_INVALID) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2VerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + vSecPrim_SLHDSA_Version version, vSecPrim_SLHDSA_HashAlgorithm hashId) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Initialize workspace header. */ + if (esl_initWorkSpaceHeader(&(workspace->header), VSECPRIM_SIZEOF_WS_SLHDSA, CRYPTO_30_LIBCV_WATCHDOG_PTR) == ESL_ERC_NO_ERROR) /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) + /* differentiate between pure and pre-hash mode - when mode is pre-hash, a hash function is set as a secondary family */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) +# endif + { + retValCv = vSecPrim_initVerifySLHDSA_pure(workspace, /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + (vSecPrim_SLHDSA_Version)version, + (vSecPrim_SLHDSA_HashAlgorithm)hashId); + } +# endif +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) + /* differentiate between pure and pre-hash mode*/ + else +# endif + { + Crypto_AlgorithmFamilyType hashAlgoFam = job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily; + + if (hashAlgoFam < Crypto_30_LibCv_GetSizeOfFamilyToHashMapping()) + { + retValCv = vSecPrim_initVerifySLHDSA_preHash(workspace, /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + (vSecPrim_SLHDSA_Version)version, + (vSecPrim_SLHDSA_PreHashAlgorithm)Crypto_30_LibCv_GetFamilyToHashMapping(hashAlgoFam), + (vSecPrim_SLHDSA_HashAlgorithm)hashId); + } + else + { + /* hashAlgoFam not valid */ + /* retValCv = ESL_ERC_ERROR has already been set */ + } + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job) +{ + Std_ReturnType retVal = E_NOT_OK; + +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) + /* differentiate between pure and pre-hash mode - when mode is pre-hash, a hash function is set as a secondary family */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) +# endif + { + /* Nothing to do in pure update step */ + retVal = E_OK; + } +# endif +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) + /* differentiate between pure and pre-hash mode */ + else +# endif + { + eslt_ErrorCode retValCv = vSecPrim_updateVerifySLHDSA_preHash(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength); + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = E_OK; + } + } +# else + CRYPTO_30_LIBCV_DUMMY_STATEMENT(workspace); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CRYPTO_30_LIBCV_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish( + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + uint32 publicKeyLength) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + P2CONST(uint8, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) publicKey = NULL_PTR; + P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) contextPtr = NULL_PTR; + Crypto_30_LibCv_SizeOfKeyStorageType publicKeyIndex = 0u; + Crypto_30_LibCv_SizeOfKeyStorageType contextIndex = 0u; + uint32 contextLength = 0u; + + /* Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJob(job->cryptoKeyId, CRYPTO_KE_SIGNATURE_KEY, &publicKeyIndex, &publicKeyLength, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* Get publicKey pointer from key element index. */ + publicKey = Crypto_30_LibCv_GetAddrKeyStorage(publicKeyIndex); + + /* context size is checked by vSecPrim */ + retVal = Crypto_30_LibCv_Local_KeyElementGetStorageIndexJobOptional(job->cryptoKeyId, CRYPTO_KE_CUSTOM_SLHDSA_CONTEXT, &contextIndex, &contextLength, CRYPTO_30_LIBCV_LENGTH_CHECK_NONE); /* SBSW_CRYPTO_30_LIBCV_STACK_VARIABLE_AS_PTR */ + + /* check if context is available */ + switch (retVal) + { + case E_OK: + { + contextPtr = Crypto_30_LibCv_GetAddrKeyStorage(contextIndex); + break; + } + case CRYPTO_E_KEY_NOT_AVAILABLE: + { + /* Key has no context key element. */ + /* ContextPtr remains NULL_PTR and length remains zero. */ + retVal = E_OK; + break; + } + default: + { + /* retVal remains */ + break; + } + } + } + + if (retVal == E_OK) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) + /* differentiate between pure and pre-hash mode - when mode is pre-hash, a hash function is set as a secondary family */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) +# endif + { + /* pure mode */ + retValCv = vSecPrim_finalizeVerifySLHDSA_pure(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + contextPtr, (eslt_Length)contextLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicKey, + (eslt_Length)publicKeyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } +# endif +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) + /* differentiate between pure and pre-hash mode */ + else +# endif + { + /* pre-hash mode */ + retValCv = vSecPrim_finalizeVerifySLHDSA_preHash(workspace, /* PRQA S 0310 */ /* MD_CRYPTO_30_LIBCV_0310 */ /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_CONST_BUFFER */ + contextPtr, (eslt_Length)contextLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))publicKey, + (eslt_Length)publicKeyLength, + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + (eslt_Length)job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength); + } +# endif + + /* # Write result into verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else if (retValCv == ESL_ERC_SIGNATURE_INVALID) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish() */ +#endif /* (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_IsPublicKeyOnCurveEcc() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsPublicKeyOnCurveEcc( + P2CONST(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + uint32 keyLength = 0u; + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Retrieve the public key. */ + /* Get esl size of key length for x and y component of the public key (key = [key_x|key_y]). */ + keyLength = (uint32)(Crypto_30_LibCv_Math_Mul2((uint32)esl_getLengthOfEcPpublicKey_comp(EcDomainPtr))); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, keyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Check key on curve. */ + retValCv = esl_publicKeyCheckEcP_prim(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)Crypto_30_LibCv_Math_Div2(keyLength), + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex + Crypto_30_LibCv_Math_Div2(keyLength)), + (eslt_Length)Crypto_30_LibCv_Math_Div2(keyLength)); + + /* # Write result in verification pointer */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else if (retValCv == ESL_ERC_KEY_INVALID) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_IsPublicKeyOnCurveEcc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_IsPrivateKeyOnCurveEcc() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_IsPrivateKeyOnCurveEcc( + P2CONST(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_3 */ + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + uint32 keyLength = 0u; + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Retrieve the private key. */ + keyLength = (uint32)esl_getLengthOfEcPprivateKey(EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_PTR */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, keyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Handle the specials case that the private key of P160R1 can have a length of 20 or 21 Bytes. */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode == CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P160R1) + { + uint32 minKeyLength = CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PRIVATE_MIN; + + /* Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_MAX); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + if (retVal == E_OK) + { + /* Check if key is long enough. */ + if (keyElements[0].keyElementLength < minKeyLength) + { + retVal = CRYPTO_E_KEY_SIZE_MISMATCH; + } + else if (keyElements[0].keyElementLength == minKeyLength) + { + /* Enlarge private key to get required size (21 Bytes): key = [0x00 | privateKey] */ + eslt_Byte privateKeyElementBuffer[CRYPTO_30_LIBCV_SIZEOF_ECC_160_KEY_PRIVATE] = { 0u }; + Crypto_30_LibCv_CopyData(&privateKeyElementBuffer[1u], Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), (keyElements[0].keyElementLength)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_LIBCV_CSL02_KEY_STORAGE_VIA_KEY_ELEMENT */ + /* Check key on curve. */ + retValCv = esl_privateKeyCheckEcP_prim(workspace, privateKeyElementBuffer, (eslt_Length)sizeof(privateKeyElementBuffer)); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + else + { + /* Check key on curve. */ + retValCv = esl_privateKeyCheckEcP_prim(workspace, Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), (eslt_Length)(keyElements[0].keyElementLength)); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_STACK_BUFFER */ + } + } + } + else + { + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Check key on curve. */ + retValCv = esl_privateKeyCheckEcP_prim(workspace, Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0].keyElementIndex), (eslt_Length)(keyElements[0].keyElementLength)); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + } + } + + if (retVal == E_OK) + { + /* # Write result in verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else if (retValCv == ESL_ERC_KEY_INVALID) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + } + else + { + retVal = E_NOT_OK; + } + } + return retVal; +} /* Crypto_30_LibCv_IsPrivateKeyOnCurveEcc() */ + +/********************************************************************************************************************** + * Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType( + P2VAR(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr, + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Init keyCheck algorithm. */ + if (esl_initKeyCheckEcP_prim(workspace, EcDomainPtr, EcDomainExtPtr) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + { + /* # Distinguish between checking a private or a public key based on secondary algorithm family.*/ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { + case CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_ISPUBLICKEYONCURVE: + retVal = Crypto_30_LibCv_IsPublicKeyOnCurveEcc(workspace, job, EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + + case CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_ISPRIVATEKEYONCURVE: + retVal = Crypto_30_LibCv_IsPrivateKeyOnCurveEcc(workspace, job, EcDomainPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType() */ +#endif /* (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) */ + +#if (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_LIBCV_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType( + P2VAR(eslt_WorkSpaceEdKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) workspace, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + const eslt_Size16 curve, + const uint32 expectedKeyLength) + { + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + + /* # Init verifyPtr to CRYPTO_E_VER_NOT_OK */ + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + + /* # Init keyCheck algorithm. */ + if (esl_initKeyCheckEdwards(workspace, curve) == ESL_ERC_NO_ERROR) /* SBSW_CRYPTO_30_LIBCV_ESL_PARAMETER_WORKSPACE */ + { + Crypto_30_LibCv_KeyElementGetType keyElements[1]; + + /* # Retrieve the public or private key. */ + Crypto_30_LibCv_Local_ElementGetterSetIdAndLength(keyElements, 0u, CRYPTO_KE_SIGNATURE_KEY, expectedKeyLength); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + + /* # Read key elements. */ + retVal = Crypto_30_LibCv_Local_GetElementsIndexJob(job->cryptoKeyId, keyElements, 1u, CRYPTO_30_LIBCV_LENGTH_CHECK_EQUAL); /* SBSW_CRYPTO_30_LIBCV_STACK_ARRAY_VARIABLE_AS_PTR */ + if (retVal == E_OK) + { + /* # Distinguish between checking a private or a public key based on secondary algorithm family.*/ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily) + { + case CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_ISPUBLICKEYONCURVE: + /* # Check public key on curve. */ + retValCv = esl_publicKeyCheckEdwards(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength); + break; + + case CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_ISPRIVATEKEYONCURVE: + /* # Check private key on curve. */ + retValCv = esl_privateKeyCheckEdwards(workspace, /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_KEY_PTR */ + (P2CONST(eslt_Byte, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR))Crypto_30_LibCv_GetAddrKeyStorage(keyElements[0u].keyElementIndex), + (eslt_Length)keyElements[0u].keyElementLength); + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + + /* # Write result in verification pointer. */ + if (retValCv == ESL_ERC_NO_ERROR) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else if (retValCv == ESL_ERC_KEY_INVALID) + { + *job->CRYPTO_30_LIBCV_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = CRYPTO_E_VER_NOT_OK; /* SBSW_CRYPTO_30_LIBCV_WRITE_ACCESS_TO_JOBPRIMITIVE_INPUTOUTPUT_PTR */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + } + } + + return retVal; +} /* Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType() */ +#endif /* (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfEd25519Generate(Crypto_30_LibCv_GetEd25519GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEd25519)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519GenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519GenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed25519Generate() */ + +#endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Verify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceEd25519, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfEd25519Verify(Crypto_30_LibCv_GetEd25519VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEd25519)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519VerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Ed25519VerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + retVal = E_NOT_OK; /* Unsupported State */ + break; + } + } + + return retVal; + +} /* Crypto_30_LibCv_Dispatch_Ed25519Verify() */ +#endif /* (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfEd448Generate(Crypto_30_LibCv_GetEd448GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEdDSA)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448GenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448GenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Ed448Generate() */ + +#endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Verify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceEdDSA, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfEd448Verify(Crypto_30_LibCv_GetEd448VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEdDSA)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448VerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Ed448VerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + retVal = E_NOT_OK; /* Unsupported State */ + break; + } + } + + return retVal; + +} /* Crypto_30_LibCv_Dispatch_Ed448Verify() */ +#endif /* (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Generate() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSm2Generate(Crypto_30_LibCv_GetSm2GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSM2)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2GenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2GenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_Sm2Generate() */ + +#endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Verify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceSM2, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSm2Verify(Crypto_30_LibCv_GetSm2VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceSM2)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2VerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2Update(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_Sm2VerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + retVal = E_NOT_OK; /* Unsupported State */ + break; + } + } + + return retVal; + +} /* Crypto_30_LibCv_Dispatch_Sm2Verify() */ +#endif /* (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerify() + **********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + uint32 publicKeyLength = 0u; + vSecPrim_SLHDSA_Version version = 0xFFu; /* Init an invalid value. */ + vSecPrim_SLHDSA_HashAlgorithm hashId = 0xFFu; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(vSecPrimType_WorkSpaceVerifySLHDSA, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfSlhDsaVerify(Crypto_30_LibCv_GetSlhDsaVerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceVerifySLHDSA)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* Determine SLH-DSA version and hash ID based on job algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_SHA2_128S: + { + publicKeyLength = VSECPRIM_SLHDSA_PK_LENGTH_128S; + version = VSECPRIM_SLHDSA_VERSION_128S; + hashId = VSECPRIM_SLHDSA_HASH_ID_SHA2_256; + retVal = E_OK; + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + retVal = E_NOT_OK; /* retVal has been set before, set it here anyways */ + break; /* Unsupported mode */ + } + } + + if (retVal == E_OK) + { +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) +# if (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) + /* Determine if SLHDSA should be executed in pure mode */ + if (job->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily == CRYPTO_ALGOFAM_NOT_SET) +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PREHASH == STD_ON) */ + { + /* no secondary algorithm family is given, therefore the algorithm shall be executed in pure mode + * this is only applicable if the job mode is single call */ + if (!Crypto_30_LibCv_IsJobMode(job, CRYPTO_OPERATIONMODE_SINGLECALL)) + { + retVal = E_NOT_OK; + } + } + + if (retVal == E_OK) +# endif /* (CRYPTO_30_LIBCV_SIGNATURE_VERIFY_CUSTOM_SLH_DSA_PURE == STD_ON) */ + { + /* Distinguish operation modes. */ + switch (mode) + { + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_Dispatch_SlhDsaVerifyStart(workspace, job, version, hashId); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_Dispatch_SlhDsaVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_Dispatch_SlhDsaVerifyFinish(workspace, job, publicKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_SlhDsaVerify() */ +#endif /* (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Generate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceRSAsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPkcs1Generate(Crypto_30_LibCv_GetRsaPkcs1GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAsig)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_RsaPkcs1GenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_RsaPkcs1GenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_RsaPkcs1GenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Generate() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceRSAver, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPkcs1Verify(Crypto_30_LibCv_GetRsaPkcs1VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAver)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_RsaPkcs1VerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_RsaPkcs1VerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_RsaPkcs1VerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1Verify() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPssGenerate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPssGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + + P2VAR(eslt_WorkSpaceRSAPSSsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPssGenerate(Crypto_30_LibCv_GetRsaPssGenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSAPSSsig)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_RsaPssGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_RsaPssGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_RsaPssGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPssGenerate() */ +#endif /* (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPssVerify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6050, 6080 4 */ /* MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPssVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(Crypto_30_LibCv_WorkSpaceRsaPssVer, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPssVerify(Crypto_30_LibCv_GetRsaPssVerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(Crypto_30_LibCv_WorkSpaceRsaPssVer)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_RsaPssVerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_RsaPssVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_RsaPssVerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPssVerify() */ +#endif /* (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1CrtGenerate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1CrtGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + + /* ----- Implementation ------------------------------------------------- */ + P2VAR(eslt_WorkSpaceRSACRTsig, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace = Crypto_30_LibCv_GetWorkspaceOfRsaPkcs1CrtGenerate(Crypto_30_LibCv_GetRsaPkcs1CrtGenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceRSACRTsig)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + retVal = Crypto_30_LibCv_RsaPkcs1CrtGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + retVal = Crypto_30_LibCv_RsaPkcs1CrtGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + retVal = Crypto_30_LibCv_RsaPkcs1CrtGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported State */ + break; + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_RsaPkcs1CrtGenerate() */ +#endif /* (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP160Generate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP160Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP160Generate(Crypto_30_LibCv_GetEcP160GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP160Generate() */ +#endif /* (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP160Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP160Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP160Verify(Crypto_30_LibCv_GetEcP160VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP160Verify() */ +#endif /* (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP256Generate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP256Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP256Generate(Crypto_30_LibCv_GetEcP256GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP256Generate() */ +#endif /* (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP256Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP256Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + /* NISTp256r1 = ANSIp256r1 = SECp256r1 */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP256Verify(Crypto_30_LibCv_GetEcP256VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP256Verify() */ +#endif /* (CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP384Generate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP384Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + /* NISTp384r1 = SECp384r1 */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP384Generate(Crypto_30_LibCv_GetEcP384GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP384Generate() */ +#endif /* (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP384Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP384Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + /* NISTp384r1 = SECp384r1 */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP384Verify(Crypto_30_LibCv_GetEcP384VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP384Verify() */ +#endif /* (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP521Generate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP521Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP521Generate(Crypto_30_LibCv_GetEcP521GenerateIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeGenerateFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP521Generate() */ +#endif /* (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP521Verify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP521Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + P2VAR(Crypto_30_LibCv_WorkSpaceEcP, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcP521Verify(Crypto_30_LibCv_GetEcP521VerifyIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(vSecPrimType_WorkSpaceHash)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operationmode START. */ + case CRYPTO_OPERATIONMODE_START: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyStart(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + /* # Handle operationmode UPDATE. */ + case CRYPTO_OPERATIONMODE_UPDATE: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyUpdate(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + retVal = Crypto_30_LibCv_DispatchSignatureEccPrimeVerifyFinish(workspace, job); /* SBSW_CRYPTO_30_LIBCV_ESL_CALL_WITH_WORKSPACE_AND_BUFFERS */ + break; + } + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + { + /* Not supported State */ + break; + } + } + + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcP521Verify() */ +#endif /* (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON) */ + +#if (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcPKeyCheck() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcPKeyCheck( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + P2VAR(eslt_WorkSpaceEcPKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + P2CONST(eslt_EccDomain, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + P2CONST(eslt_EccDomainExt, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) EcDomainExtPtr = Crypto_30_LibCv_EccCurveEmptyDomain; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEcPKeyCheck(Crypto_30_LibCv_GetEcPKeyCheckIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEcPKeyCheck)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operation mode START and UPDATE. */ + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Nothing to do. */ + retVal = E_OK; + break; + } + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* # Determine curve domain based on algorithm mode. */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.mode) + { + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P160R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveSecP160R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveSecP160R1DomainExt; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P256R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistAnsiSecP256R1DomainExt; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P384R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP384R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP384R1DomainExt; + break; + + case CRYPTO_ALGOMODE_CUSTOM_CRYPTO_30_LIBCV_P521R1: + EcDomainPtr = Crypto_30_LibCv_EccCurveNistSecP521R1Domain; + EcDomainExtPtr = Crypto_30_LibCv_EccCurveNistSecP521R1DomainExt; + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_ECP_KEY_CHECK, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = Crypto_30_LibCv_EcPKeyCheck_DispatchByKeyType(workspace, job, EcDomainPtr, EcDomainExtPtr); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + } + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_EcPKeyCheck() */ +#endif /* (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) */ + +#if (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EdKeyCheck() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EdKeyCheck( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, /* PRQA S 3673 */ /* MD_CRYPTO_30_LIBCV_3673_1 */ + Crypto_OperationModeType mode) +{ + /* ----- Local Variables ------------------------------------------------ */ + Std_ReturnType retVal = E_NOT_OK; + eslt_ErrorCode retValCv = ESL_ERC_ERROR; + P2VAR(eslt_WorkSpaceEdKeyCheck, AUTOMATIC, CRYPTO_30_LIBCV_CRYPTOCV_APPL_VAR) workspace; + eslt_Size16 curve = 0u; + uint32 expectedKeyLength = 0u; + + /* ----- Implementation ------------------------------------------------- */ + workspace = Crypto_30_LibCv_GetWorkspaceOfEdKeyCheck(Crypto_30_LibCv_GetEdKeyCheckIdxOfObjectInfo(objectId)); + Crypto_30_LibCv_SetLengthOfSaveAndRestoreWorkspace(objectId, sizeof(eslt_WorkSpaceEdKeyCheck)); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_SIZEOFWORKSPACELENGTH */ + + /* # Distinguish modes. */ + switch (mode) + { + /* # Handle operation mode START and UPDATE. */ + case CRYPTO_OPERATIONMODE_START: + case CRYPTO_OPERATIONMODE_UPDATE: + { + /* Nothing to do. */ + retVal = E_OK; + break; + } + /* # Handle operationmode FINISH. */ + case CRYPTO_OPERATIONMODE_FINISH: + { + /* # Determine curve based on algorithm family */ + switch (job->jobPrimitiveInfo->primitiveInfo->algorithm.family) + { + case CRYPTO_ALGOFAM_ED25519: + curve = ESL_CURVE25519; + expectedKeyLength = ESL_SIZEOF_Ed25519_KEY; /* Same size for private and public key */ + break; + + case CRYPTO_ALGOFAM_CUSTOM_CRYPTO_30_LIBCV_ED448: + curve = ESL_CURVE448; + expectedKeyLength = ESL_SIZEOF_Ed448_KEY; /* Same size for private and public key */ + break; + + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + + /* # Initialize workspace header. */ + retValCv = esl_initWorkSpaceHeader(&(workspace->header), ESL_SIZEOF_WS_EDKEYCHECK, CRYPTO_30_LIBCV_WATCHDOG_PTR); /* PRQA S 3395 */ /* MD_CRYPTO_30_LIBCV_3395 */ /* SBSW_CRYPTO_30_LIBCV_INIT_ESL_WORKSPACE */ + + if (retValCv == ESL_ERC_NO_ERROR) + { + retVal = Crypto_30_LibCv_EdKeyCheck_DispatchByKeyType(workspace, job, curve, expectedKeyLength); /* SBSW_CRYPTO_30_LIBCV_FORWARDING_OF_WORKSPACE_AND_JOB_PTR */ + } + break; + } + default: /* COV_CRYPTO_30_LIBCV_MISRA_ADDITIONAL_STATEMENT */ + /* Not supported mode */ + break; + } + return retVal; +} /* Crypto_30_LibCv_Dispatch_EdKeyCheck() */ +#endif /* (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) */ + +#define CRYPTO_30_LIBCV_STOP_SEC_CODE +#include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_Signature.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureGenerate.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureGenerate.h new file mode 100644 index 0000000..879f8ce --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureGenerate.h @@ -0,0 +1,334 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_SignatureGenerate.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for SIGNATURE Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_SIGNATUREGENERATE_H) +# define CRYPTO_30_LIBCV_SIGNATUREGENERATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature Ed25519 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137758 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ED25519GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature Ed448 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Ed448Generate + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ED448GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature Sm2 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Sm2Generate + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SM2GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Generate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature RSA PKCS1 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137967 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPKCS1GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPssGenerate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature RSA PSS generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137761 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPssGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPSSGENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1CrtGenerate() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature RSA CRT PKCS1 generate job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-149659 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1CrtGenerate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPKCS1CRTGENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP160Generate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job based on curve SECP160 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-244684 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP160Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP160GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP256Generate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job based on curve SECP256 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139645, CREQ-141041, CREQ-141043 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP256Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP256GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP384Generate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job based on curve SECP384 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-158943, CREQ-158945 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP384Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP384GENERATE == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP521Generate() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime generate job based on curve SECP521 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-313250, CREQ-322902 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP521Generate( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP521GENERATE == STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_LIBCV_SIGNATUREGENERATE_H) */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_SignatureGenerate.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureVerify.h b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureVerify.h new file mode 100644 index 0000000..96b46b1 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Implementation/Crypto_30_LibCv_SignatureVerify.h @@ -0,0 +1,389 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_LibCv_SignatureVerify.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Dispatcher for SIGNATURE Services + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_LIBCV_SIGNATUREVERIFY_H) +# define CRYPTO_30_LIBCV_SIGNATUREVERIFY_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_LibCv_Cfg.h" + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_START_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed25519Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature Ed25519 verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137762 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed25519Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ED25519VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Ed448Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature Ed448 verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Ed448Verify + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Ed448Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ED448VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_Sm2Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature SM2 verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-Sm2Verify + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_Sm2Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SM2VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_SlhDsaVerify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature SLH-DSA verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-SlhDsaVerify + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_SlhDsaVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_SLHDSAVERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPkcs1Verify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature RSA PKCS1 verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137763 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPkcs1Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPKCS1VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_RsaPssVerify() + *********************************************************************************************************************/ +/*! \brief Dispatches the signature RSA PSS verify job to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-137966 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_RsaPssVerify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_RSAPSSVERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP160Verify() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job based on curve SECP160 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-244685 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP160Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP160VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP256Verify() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job based on curve SECP256 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-139644, CREQ-141042, CREQ-141044 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP256Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP256VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP384Verify() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job based on curve SECP384 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-158944 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP384Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP384VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcP521Verify() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the signature Ecc prime verify job based on curve SECP521 to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-313251, CREQ-322901 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcP521Verify( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif /* (CRYPTO_30_LIBCV_ECP521VERIFY == STD_ON) */ + +# if (CRYPTO_30_LIBCV_ECPKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EcPKeyCheck() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the IsKeyOnCurve job based on EC curves to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-CRYPTO-ISPUBLICKEYONCURVE, CREQ-CRYPTO-ISPRIVATEKEYONCURVE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EcPKeyCheck( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif + +# if (CRYPTO_30_LIBCV_EDKEYCHECK == STD_ON) +/********************************************************************************************************************** + * Crypto_30_LibCv_Dispatch_EdKeyCheck() + *********************************************************************************************************************/ +/*! + * \brief Dispatches the IsKeyOnCurve job based on Ed curves to the lower layer. + * \details This function dispatches the provided job to the lower layer crypto library. Based on the jobs + * operation mode, it triggers different stages of the service. + * \param[in] objectId Holds the identifier of the Crypto Driver Object. + * \param[in,out] job Pointer to the job which shall be dispatched. + * \param[in] mode Operation mode in which the job currently is. + * \return E_OK Dispatching was successful. + * E_NOT_OK Dispatching failed. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre objectId has to be a valid driver object handle. + * job has to be a pointer to a valid job object. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-CRYPTO-ISPUBLICKEYONCURVE, CREQ-CRYPTO-ISPRIVATEKEYONCURVE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_LIBCV_CODE) Crypto_30_LibCv_Dispatch_EdKeyCheck( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_LIBCV_APPL_VAR) job, + Crypto_OperationModeType mode); +# endif + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +# define CRYPTO_30_LIBCV_STOP_SEC_CODE +# include "Crypto_30_LibCv_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_LIBCV_SIGNATUREVERIFY_H) */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_LibCv_SignatureVerify.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_cfg.mak b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_cfg.mak new file mode 100644 index 0000000..24baadf --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_cfg.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Crypto_30_LibCv_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_LibCv_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefor the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +#_CONFIG_PATH = + + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + +#_DRIVER_MODE = singlechannel + + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_check.mak b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_check.mak new file mode 100644 index 0000000..b162b41 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : Crypto_30_LibCv_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_LibCv_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_defs.mak b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_defs.mak new file mode 100644 index 0000000..13a5621 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_defs.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Crypto_30_LibCv_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_LibCv_rules.mak file. +############################################################################### + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... +CRYPTO_30_LIBCV_CORE_PATH = +# e.g.: CAN_OUTPUT_PATH = $(GENDATA_DIR) +CRYPTO_30_LIBCV_OUTPUT_PATH = $(GENDATA_DIR) + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: can_DEPENDENT_PLUGINS = +CRYPTO_30_LIBCV_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += Crypto_30_LibCv$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_rules.mak b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_rules.mak new file mode 100644 index 0000000..01cdb17 --- /dev/null +++ b/Source/bsw/Crypto_30_LibCv/Make/Crypto_30_LibCv_rules.mak @@ -0,0 +1,105 @@ +############################################################################### +# File Name : Crypto_30_LibCv_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2016-11-24 vismss Creation for ASR 4.3 +# 1.01.00 2019-02-06 vircbl Added support of component-based SIP structure +# 1.02.00 2020-02-07 vistof Add Crypto_30_LibCv_KeyDerive.c and Crypto_30_LibCv_KeyEchange.c +# 1.03.00 2020-04-27 visenc Add Crypto_30_LibCv_KeyGenerate.c +# 13.01.00 2023-06-29 viskju Add Crypto_30_LibCv_Curve.c +# main-1 2024-03-25 coechsler Change history is maintained in the global +# ChangeHistory.txt file starting with this release. +#------------------------------------------------------------------------------ +# TemplateVersion = 1.03 +############################################################################### + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += $(LIB_OUPUT_PATH)\vendorx_canlib1.$(LIB_FILE_SUFFIX) +LIBRARIES_TO_BUILD += Crypto_30_LibCv +Crypto_30_LibCv_FILES = Crypto_30_LibCv$(BSW_SRC_DIR)\Crypto_30_LibCv*.c + +# e.g.: CC_FILES_TO_BUILD += drv\can_drv.c +CC_FILES_TO_BUILD += Crypto_30_LibCv$(BSW_SRC_DIR)\Crypto_30_LibCv*.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\Crypto_30_LibCv_Cfg.c + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: + #$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.c b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.c new file mode 100644 index 0000000..e399cb2 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.c @@ -0,0 +1,1806 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm.c + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Core of the Vector Hardware Security Module Firmware driver. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_vHsm.h" +#include "Crypto_30_vHsm_Ipc.h" +#include "Crypto_30_vHsm_Jobs.h" +#include "Crypto_30_vHsm_Private.h" +#include "SchM_Crypto_30_vHsm.h" +#include "vstdlib.h" +#include "CryIf_Cbk.h" + +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + + /* Check the version of CRYPTO header file */ +#if ( (CRYPTO_30_VHSM_MAJOR_VERSION != (4u)) \ + || (CRYPTO_30_VHSM_MINOR_VERSION != (1u)) \ + || (CRYPTO_30_VHSM_PATCH_VERSION != (2u)) ) +# error "Vendor specific version numbers of Crypto_30_vHsm.c and Crypto_30_vHsm.h are inconsistent" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ +#if !defined (CRYPTO_30_VHSM_LOCAL) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL static +#endif + +#if !defined (CRYPTO_30_VHSM_LOCAL_INLINE) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL_INLINE LOCAL_INLINE +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_IsCryptoJobAccepted() + *********************************************************************************************************************/ +/*! + * + * \brief Check if the job can be accepted + * \details When a job is not finished, only the same jobId will be forwarded. All other jobs will be blocked. + * \param[in] jobRequestId Valid driver object ID which shall be checked + * \param[in] jobId JobId which shall be checked for acceptance + * \param[in] ignoreRequestLock Determines if the lock on the jobRequest should be ignored. + * Lock can only be ignored if driver object lock is set accordingly. + * \return E_OK if the job is accepted, otherwise E_NOT_OK + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_IsCryptoJobAccepted( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 jobId, + boolean ignoreRequestLock); + +/********************************************************************************************************************** + * Crypto_30_vHsm_FinalizeSyncCryptoJob() + *********************************************************************************************************************/ + /*! + * + * \brief Finalize a synchronous crypto job. + * \details Frees the locks if suitable. + * \param[in] jobRequestId Valid jobRequestId of the job to be concluded + * \param[in] job Valid pointer to the job structure + * \param[in] cancel Indicates if this was a cancel request + * \return Return of the job + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_FinalizeSyncCryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job, + boolean cancel); + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessCryptoJob() + *********************************************************************************************************************/ +/*! + * + * \brief Process a crypto job + * \details Putting the job request into the IPC and send the request to the vHsm + * \param[in] jobRequestId Valid jobRequestId which shall be used to process the job + * \param[in] job Valid pointer to the job structure + * \param[in] cancel Indicates if this is a cancel request + * \param[in] ignoreRequestLock Determines if the lock on the jobRequest should be ignored. + * Lock can only be ignored if driver object lock is set accordingly. + * \return Return of the job + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE or FALSE depending on the job + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessCryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job, + boolean cancel, + boolean ignoreRequestLock); + +/********************************************************************************************************************** + * Crypto_30_vHsm_TransmitRequest() + *********************************************************************************************************************/ +/*! + * + * \brief Use the Ipc to transmit a job request + * \details - + * \param[in] jobRequestId Valid Id of the job request + * \param[out] channel Valid pointer to the memory location which will contain the channel + * \return Return of the job request + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_TransmitRequest( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_30_vHsm_ChannelIdType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) channel); + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForSynchJobResponse() + *********************************************************************************************************************/ +/*! \brief Waits for a synchronous job response. + * \details - + * \param[in] jobRequestId Valid Id of the job request (in range of Crypto_30_vHsm_GetSizeOfJobRequest()) + * \param[in] partitionIdx Valid identifier of the partition. + * \param[in] rxChannelId Rx channel to poll. + * \pre jobRequestId < Crypto_30_vHsm_GetSizeOfJobRequest() + * \context TASK + * \reentrant FALSE + * \synchronous TRUE Sync + * \trace CREQ-Crypto-WaitLoopCallout, CREQ-Crypto-AsyncCallout + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForSynchJobResponse( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId); + +#define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_IsCryptoJobAccepted() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_IsCryptoJobAccepted( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 jobId, + boolean ignoreRequestLock) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + + uint32 acceptedCryptoJobId; + + /* ----- Implementation ----------------------------------------------- */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + + acceptedCryptoJobId = Crypto_30_vHsm_GetDriverObjectLock(jobRequestId); + + /* #10 Check if the driver object accepts all jobs */ + if (acceptedCryptoJobId == CRYPTO_30_VHSM_ACCEPT_ANY_JOBID) + { + /* #11 Check if the jobRequestId is free */ + if (Crypto_30_vHsm_IsLockOfJobRequest(jobRequestId) == FALSE) /* currently needed as driver object is released before this lock */ + { + /* #12 Lock the jobRequestId */ + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, jobId); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #13 Prevent the access of the driver object from other other jobs */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, TRUE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + retVal = E_OK; + } + } + /* #20 Check if the given JobId can be accepted for this driver object */ + else if (acceptedCryptoJobId == jobId) + { +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (ignoreRequestLock == TRUE) + { + /* #21 If the job request lock should be ignored, accept the crypto job */ + retVal = E_OK; + } + else +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + /* Driver object is already acquired by this job - Check if there is an former update pending or if we can start with this one */ + /* #22 Otherwise check if the jobRequestId is free */ + if (Crypto_30_vHsm_IsLockOfJobRequest(jobRequestId) == FALSE) + { + /* #23 Lock the jobRequestId */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, TRUE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + retVal = E_OK; + } + else + { + /* Do nothing. retVal already set. */ + } + } + else + { + /* driver object is is use - retval already set */ + } + + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_OFF) + CRYPTO_30_VHSM_DUMMY_STATEMENT(ignoreRequestLock); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_IsCryptoJobAccepted() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_FinalizeSyncCryptoJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_FinalizeSyncCryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job, + boolean cancel) +{ + Std_ReturnType retVal; + + /* #10 Obtain state and return value of synchronous crypto job. */ + job->CRYPTO_30_VHSM_JOB_STATE_MEMBER = Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + retVal = (Std_ReturnType)Crypto_30_vHsm_GetResultOfJobRequest(jobRequestId); + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + /* #11 Only free locks if job was not timeouted */ + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT) +#endif + { + /* #20 Free the job request lock */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #21 Check if the mode was finish or error or cancel */ + if ((retVal != E_OK) + || ((job->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_FINISH) == CRYPTO_OPERATIONMODE_FINISH) + || cancel) + { + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + /* #30 Remove the lock from the driver object to accept new jobs */ + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + } + } + + return retVal; +} /* Crypto_30_vHsm_ProcessCryptoJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessCryptoJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessCryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job, + boolean cancel, + boolean ignoreRequestLock) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check if the request is accepted by the crypto driver object and can be allocated inside the IPC */ + if (Crypto_30_vHsm_IsCryptoJobAccepted(jobRequestId, job->jobInfo->jobId, ignoreRequestLock) == E_OK) /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + { +#if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) + /* #20 Set the parameters of the job request */ + if( (job->jobPrimitiveInfo->primitiveInfo->service) == CRYPTO_MACVERIFY) + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_CRYPTO_MACVER_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else if ((job->jobPrimitiveInfo->primitiveInfo->service) == CRYPTO_MACGENERATE) + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_CRYPTO_MACGEN_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else +#endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) */ +#if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) + if ((job->jobPrimitiveInfo->primitiveInfo->service) == CRYPTO_KEYDERIVE) + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_KEYMANAGEMENT_KEYDERIVEJOB_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else +#endif + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_CRYPTO_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + + Crypto_30_vHsm_SetCryptoJobOfJobRequest(jobRequestId, job); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetCancelOfJobRequest(jobRequestId, cancel); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_SetContextClassOfJobRequest(jobRequestId, CRYPTO_30_VHSM_CALLOUT_CRYPTOJOB); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetContextIdOfJobRequest(jobRequestId, Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId)->jobInfo->jobId); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif + + if (cancel == TRUE) + { +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (Crypto_30_vHsm_GetTimeoutRecoveryStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_TIMEOUT_RECOVERY_PENDING) + { + /* If the original job was timeouted, we try to asynchronously cancel the job. */ + Crypto_30_vHsm_SetProcessingTypeOfJobRequest(jobRequestId, CRYPTO_PROCESSING_ASYNC); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + { + Crypto_30_vHsm_SetProcessingTypeOfJobRequest(jobRequestId, CRYPTO_PROCESSING_SYNC); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + } + else + { + Crypto_30_vHsm_SetProcessingTypeOfJobRequest(jobRequestId, job->jobPrimitiveInfo->processingType); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + + /* 21 Save job state and set it to processing */ + Crypto_30_vHsm_SetJobStateOfJobRequest(jobRequestId, job->CRYPTO_30_VHSM_JOB_STATE_MEMBER); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + job->CRYPTO_30_VHSM_JOB_STATE_MEMBER = CRYPTO_JOBSTATE_PROGRESSING; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + + /* #30 Process crypto job request. */ + retVal = Crypto_30_vHsm_ProcessJobRequest(jobRequestId, Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(jobRequestId)); + + /* #40 Check if the job request has been correctly issued */ + if (retVal == E_OK) + { + /* #50 If the job is synchronous: */ + if (Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) == CRYPTO_PROCESSING_SYNC) + { + /* #51 Finalize synchronous job */ + retVal = Crypto_30_vHsm_FinalizeSyncCryptoJob(jobRequestId, job, cancel); /* SBSW_CRYPTO_30_VHSM_PROCESS_CRYPTO_JOB */ + } + /* #60 ELSE: If the job is asynchronous return E_OK */ + } + /* #70 If job could not be issued correctly: */ + else + { + /* #71 Restore job state and free the job request lock */ + job->CRYPTO_30_VHSM_JOB_STATE_MEMBER = Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + /* #72 Remove the lock from the driver object to accept new jobs */ + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + } + } + else + { + /* #80 If the job request could not be allocated because the IPC was full return BUSY */ + retVal = CRYPTO_E_BUSY; + } + + return retVal; +} /* Crypto_30_vHsm_ProcessCryptoJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_TransmitRequest() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_TransmitRequest( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2VAR(Crypto_30_vHsm_ChannelIdType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) channel) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + Crypto_30_vHsm_ChannelIdType txChannelIdTmp; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(jobRequestId); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Get the TxChannel */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + for (txChannelIdTmp = 0u; txChannelIdTmp < Crypto_30_vHsm_GetSizeOfChannelState(partitionIdx); txChannelIdTmp++) + { + if (Crypto_30_vHsm_GetChannelState(txChannelIdTmp, partitionIdx) == CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE) + { + *channel = txChannelIdTmp; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + Crypto_30_vHsm_SetChannelState(txChannelIdTmp, (Crypto_30_vHsm_ChannelStateType)(Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) + 1u), partitionIdx); /* SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE */ + break; + } + } + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + + if (txChannelIdTmp >= Crypto_30_vHsm_GetSizeOfChannelState(partitionIdx)) + { + retVal = CRYPTO_E_BUSY; + } + else + { + /* #30 Transmit the job request */ + retVal = Crypto_30_vHsm_Ipc_TransmitRequest(*channel, jobRequestId); + } + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_TransmitRequest() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForSynchJobResponse() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForSynchJobResponse( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId) +{ +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Start_Callout( /* PRQA S 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ + CRYPTO_30_VHSM_CALLOUT_JOBREQUEST, + Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId), + Crypto_30_vHsm_GetContextClassOfJobRequest(jobRequestId), + Crypto_30_vHsm_GetContextIdOfJobRequest(jobRequestId)); +#endif + /* #10 Wait until job response is available */ + /* The Flag will be set in the interrupt triggered by the vHsm */ + while (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_PROCESSING) /* FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT */ + { + /* #20 Process the job response available in the IPC if interrupt mode is disabled */ + Crypto_30_vHsm_Ipc_ReceiveResponse(partitionIdx, rxChannelId); + +#if (CRYPTO_30_VHSM_WAIT_LOOP_CALLOUT_ENABLED == STD_ON) + Crypto_30_vHsm_GetWaitLoopCallout()(); +#endif +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Loop_Callout( /* PRQA S 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ + CRYPTO_30_VHSM_CALLOUT_JOBREQUEST, + Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId), + Crypto_30_vHsm_GetContextClassOfJobRequest(jobRequestId), + Crypto_30_vHsm_GetContextIdOfJobRequest(jobRequestId)); +#endif + } + +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( /* PRQA S 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ + CRYPTO_30_VHSM_CALLOUT_JOBREQUEST, + Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId), + Crypto_30_vHsm_GetContextClassOfJobRequest(jobRequestId), + Crypto_30_vHsm_GetContextIdOfJobRequest(jobRequestId)); +#endif + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT) + { + /* Save the used channelId of the job request to be able to check for a response */ + Crypto_30_vHsm_SetChannelOfJobRequest(jobRequestId, rxChannelId); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + { + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + + /* #21 Check if a Det error has been reported */ + Crypto_30_vHsm_Ipc_HandleDet(partitionIdx); /* PRQA S 2987 */ /* MD_CRYPTO_30_VHSM_2987_HANDLEDET */ +} /* Crypto_30_vHsm_WaitForSynchJobResponse() */ + +#define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Init() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Init(void) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_ChannelStateIterType txChannel; + Crypto_30_vHsm_ObjectInfoIterType objectInfo; + + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Check initialization state of the component for the partition */ + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) == (uint8)CRYPTO_30_VHSM_INITIALIZED) + { + errorId = CRYPTO_E_INIT_FAILED; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #20 Initialize the IPC */ +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx] = &Crypto_30_vHsm_GetIpcMemoryPtr(partitionIdx)[0U]; /* SBSW_CRYPTO_30_VHSM_IPC_MEMORY_PTR_ARRAY */ +#else + Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx] = &Crypto_30_vHsm_Ipc_Memory[0U]; /* SBSW_CRYPTO_30_VHSM_IPC_MEMORY_PTR_ARRAY */ +#endif + +#if (CRYPTO_30_VHSM_IPC_INITIALIZATION == STD_ON) + /* Check if Ipc has already been initialized before */ +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + if ((*(volatile uint32*)CRYPTO_30_VHSM_HOST2_HSM_ADDRESS & ((uint32)1u << (uint32)Crypto_30_vHsm_GetIpcInstanceId(partitionIdx))) != ((uint32)1u << (uint32)Crypto_30_vHsm_GetIpcInstanceId(partitionIdx))) /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ +# else + if (Crypto_30_vHsm_IsIpcNotInitialized()) /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ +# endif + { + /* Initialize IPC */ + VStdLib_MemClr(Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx], (uint32)CRYPTO_30_VHSM_IPC_MEMORY_SIZE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_INIT_IPC_MEMORY */ + } +#endif /* (CRYPTO_30_VHSM_IPC_INITIALIZATION == STD_ON) */ + + for (txChannel = 0u; txChannel < Crypto_30_vHsm_GetSizeOfChannelState(partitionIdx); txChannel++) + { + Crypto_30_vHsm_SetChannelState(txChannel, CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE, partitionIdx); /* SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE */ + } + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Ipc_DriverProtocolVersion(partitionIdx) = CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ +#endif + + /* #30 Reset job request states */ + for (objectInfo = 0u; objectInfo < Crypto_30_vHsm_GetSizeOfObjectInfo(); objectInfo++) + { +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + /* Initialize only the objects mapped to the current partition */ + if (Crypto_30_vHsm_GetPartitionIdxOfObjectInfo(objectInfo) == partitionIdx) +#endif + { + Crypto_30_vHsm_SetDriverObjectLock(objectInfo, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetLockOfJobRequest(objectInfo, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetStateOfJobRequest(objectInfo, CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetCounterOfJobRequest(objectInfo, 0u); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + Crypto_30_vHsm_SetTimeoutRecoveryStateOfJobRequest(objectInfo, CRYPTO_30_VHSM_TIMEOUT_RECOVERY_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif + } + } + +#if (CRYPTO_30_VHSM_IPC_INITIALIZATION == STD_ON) + /* Indicate that IPC has been initialized. HSM will now be able to use the IPC. */ + Crypto_30_vHsm_IndicateInitializedIpcOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + + Crypto_30_vHsm_TriggerInterruptOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_TRIGGER_INTERRUPT */ +#endif + + /* #40 Set module state to initialized for the partition */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + Crypto_30_vHsm_SetPartitionInitialized(CRYPTO_30_VHSM_INITIALIZED, partitionIdx); /* SBSW_CRYPTO_30_VHSM_WRITE_PARTITION_DATA */ +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + /* #100 Call Det if error occurred */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_INIT, errorId); + } +#else + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ +} /* Crypto_30_vHsm_Init() */ + +#if (CRYPTO_30_VHSM_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_GetVersionInfo() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetVersionInfo( + P2VAR(Std_VersionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) versioninfo +) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Check if provided pointer is valid */ + if (versioninfo == NULL_PTR) + { + /* [SWS_Crypto_00042] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else +# endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #20 Copy the version info to the provided buffer */ + versioninfo->vendorID = (uint16)CRYPTO_30_VHSM_VENDOR_ID; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + versioninfo->moduleID = (uint8)CRYPTO_30_VHSM_MODULE_ID; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + versioninfo->sw_major_version = (uint8)CRYPTO_30_VHSM_MAJOR_VERSION; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + versioninfo->sw_minor_version = (uint8)CRYPTO_30_VHSM_MINOR_VERSION; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + versioninfo->sw_patch_version = (uint8)CRYPTO_30_VHSM_PATCH_VERSION; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + /* #30 Call Det if pointer was invalid */ + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + (uint8)CRYPTO_30_VHSM_SID_GET_VERSION_INFO, + errorId); + } +# else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* Crypto_30_vHsm_GetVersionInfo() */ +#endif /* (CRYPTO_30_VHSM_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #9 Check plausibility of input parameters */ + /* [SWS_Crypto_00058] Check if driver object is valid */ + if (objectId >= Crypto_30_vHsm_GetSizeOfObjMap()) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + /* [SWS_Crypto_00059] Check if job is a null pointer */ + else if ( job == NULL_PTR ) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #10 Get internal handle */ + if (Crypto_30_vHsm_IsObjectInfoUsedOfObjMap(objectId) == FALSE) /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00058] Check if object id is out of range */ + errorId = CRYPTO_E_PARAM_HANDLE; + } +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #11 Check initialization state of the component */ + else if(Crypto_30_vHsm_GetPartitionInitialized(Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(Crypto_30_vHsm_GetObjectInfoIdxOfObjMap(objectId))) == (uint8)CRYPTO_30_VHSM_UNINIT) + { + /* [SWS_Crypto_00057] Check initialization state of the component */ + errorId = CRYPTO_E_UNINIT; + } +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + else + { + errorId = CRYPTO_E_NO_ERROR; + + /* #12 Process the job */ + retVal = Crypto_30_vHsm_ProcessCryptoJob(Crypto_30_vHsm_GetObjectInfoIdxOfObjMap(objectId), job, FALSE, FALSE); /* SBSW_CRYPTO_30_VHSM_PROCESS_CRYPTO_JOB */ + } + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + /* #100 Call Det if error occurred */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_PROCESS_JOB, errorId); + } +#else + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +} /* Crypto_30_vHsm_ProcessJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_CancelJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CancelJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + uint8 errorId; + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #9 Check plausibility of input parameters */ + /* [SWS_Crypto_00124] Check if driver object is valid */ + if (objectId >= Crypto_30_vHsm_GetSizeOfObjMap()) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + /* [SWS_Crypto_00125] Check if job is a null pointer */ + else if (job == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + + /* #10 Get internal handle */ + if (Crypto_30_vHsm_IsObjectInfoUsedOfObjMap(objectId) == FALSE) /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + { + /* [SWS_Crypto_00124] Check if object id is out of range */ + errorId = CRYPTO_E_PARAM_HANDLE; + } +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #11 Check if module is initialized */ + /* [SWS_Crypto_00057] Check initialization state of the component */ + else if (Crypto_30_vHsm_GetPartitionInitialized(Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(Crypto_30_vHsm_GetObjectInfoIdxOfObjMap(objectId))) == (uint8)CRYPTO_30_VHSM_UNINIT) + { + errorId = CRYPTO_E_UNINIT; + } +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + else + { + errorId = CRYPTO_E_NO_ERROR; + + /* #12 Process the job */ + retVal = Crypto_30_vHsm_ProcessCryptoJob(Crypto_30_vHsm_GetObjectInfoIdxOfObjMap(objectId), job, TRUE, FALSE); /* SBSW_CRYPTO_30_VHSM_PROCESS_CRYPTO_JOB */ + + if ( (retVal == E_OK) + && (job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_ASYNC)) + { + CryIf_CallbackNotification(job, CRYPTO_E_JOB_CANCELED); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + } + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + /* #100 Call Det if error occurred */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_CANCEL_JOB, errorId); + } +#else + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint !e438 */ +#endif /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + + if (retVal != E_OK) + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_vHsm_CancelJob() */ + +#if (CRYPTO_30_VHSM_NUMBER_OF_PARTITIONS > 1u) +/********************************************************************************************************************** + * Crypto_30_vHsm_GetPartitionIdx() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Crypto_30_vHsm_PartitionIdentifiersIterType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetPartitionIdx(void) +{ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = 0u; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdentifierIdx = 0u; + ApplicationType applicationId = GetApplicationID(); + + for (partitionIdentifierIdx = 0u; partitionIdentifierIdx < Crypto_30_vHsm_GetSizeOfPartitionIdentifiers(); partitionIdentifierIdx++) + { + if (applicationId == Crypto_30_vHsm_GetPartitionSNVOfPartitionIdentifiers(partitionIdentifierIdx)) + { + partitionIdx = Crypto_30_vHsm_GetPCPartitionConfigIdxOfPartitionIdentifiers(partitionIdentifierIdx); + break; + } + } + return partitionIdx; +} /* Crypto_30_vHsm_GetPartitionIdx() */ +#endif /* (CRYPTO_30_VHSM_NUMBER_OF_PARTITIONS > 1u) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_TriggerInterruptOfPartition() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_TriggerInterruptOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ +#if (CRYPTO_30_VHSM_FLAG_SETTING_CHECK_NEEDED == STD_ON) + /* #10 Check if the interrupt triggering for the partition is enabled */ + if (Crypto_30_vHsm_GetFlagSetting(partitionIdx) == 1u) +#endif + { +#if (CRYPTO_30_VHSM_INTERRUPT_SETTING_AVAILABLE ==STD_ON) +# if (CRYPTO_30_VHSM_IS_VTT == STD_OFF) /* COV_CRYPTO_30_VHSM_VTT */ + /* #20 Check how the interrupt shall be triggered for RealTarget */ + switch (Crypto_30_vHsm_GetFlagSetHandling(partitionIdx)) + { +# if (CRYPTO_30_VHSM_INTERRUPT_SET_INCLUSIVE_OR_ASSIGNMENT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_SET_INCLUSIVE_OR_ASSIGNMENT: + (*(volatile uint32*)((uint32)Crypto_30_vHsm_GetFlagSetAddress(partitionIdx))) |= Crypto_30_vHsm_GetFlagSetMask(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + break; +# endif +# if (CRYPTO_30_VHSM_INTERRUPT_SET_CALLOUT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_SET_CALLOUT: + Crypto_30_vHsm_RequestInterruptSet_Callout(Crypto_30_vHsm_GetFlagSetAddress(partitionIdx), Crypto_30_vHsm_GetFlagSetMask(partitionIdx)); /* SBSW_CRYPTO_30_VHSM_HANDLE_INTERRUPT */ + break; +# endif +# if (CRYPTO_30_VHSM_INTERRUPT_SET_ONLY_ASSIGNMENT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_SET_ONLY_ASSIGNMENT: + (*(volatile uint32*)((uint32)Crypto_30_vHsm_GetFlagSetAddress(partitionIdx))) = Crypto_30_vHsm_GetFlagSetMask(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + break; +# endif + default: /* COV_CRYPTO_30_VHSM_MISRA_ADDITIONAL_STATEMENT */ /* PRQA S 2016 */ /* MD_MSR_EmptyClause */ + break; + } +# else /* !(CRYPTO_30_VHSM_IS_VTT == STD_OFF) */ + /* #30 Call the helper function for VTT */ + Ht2Hsmf(); +# endif +#endif /* (CRYPTO_30_VHSM_INTERRUPT_SETTING_AVAILABLE ==STD_ON) */ + } + + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Crypto_30_vHsm_TriggerInterruptOfPartition() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ClearInterruptOfPartition() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ClearInterruptOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ +#if (CRYPTO_30_VHSM_FLAG_CLEARING_CHECK_NEEDED == STD_ON) + /* #10 Check if the interrupt clearing for the partition is enabled */ + if (Crypto_30_vHsm_GetFlagClearing(partitionIdx) == 1u) /*lint !e506 */ +#endif + { +#if (CRYPTO_30_VHSM_INTERRUPT_CLEARING_AVAILABLE ==STD_ON) +# if (CRYPTO_30_VHSM_IS_VTT == STD_OFF) /* COV_CRYPTO_30_VHSM_VTT */ + /* #20 Check how the interrupt shall be cleared */ + switch (Crypto_30_vHsm_GetFlagClearHandling(partitionIdx)) + { +# if (CRYPTO_30_VHSM_INTERRUPT_CLEAR_INCLUSIVE_AND_NOT_ASSIGNMENT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_CLEAR_INCLUSIVE_AND_NOT_ASSIGNMENT: + (*(volatile uint32*)((uint32)Crypto_30_vHsm_GetFlagClearAddress(partitionIdx))) &= ~((uint32)Crypto_30_vHsm_GetFlagClearMask(partitionIdx)); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + break; +# endif +# if (CRYPTO_30_VHSM_INTERRUPT_CLEAR_INCLUSIVE_OR_ASSIGNMENT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_CLEAR_INCLUSIVE_OR_ASSIGNMENT: + (*(volatile uint32*)((uint32)Crypto_30_vHsm_GetFlagClearAddress(partitionIdx))) |= Crypto_30_vHsm_GetFlagClearMask(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + break; +# endif +# if (CRYPTO_30_VHSM_INTERRUPT_CLEAR_CALLOUT_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_CLEAR_CALLOUT: + Crypto_30_vHsm_ResponseInterruptClear_Callout(Crypto_30_vHsm_GetFlagClearAddress(partitionIdx), Crypto_30_vHsm_GetFlagClearMask(partitionIdx), Crypto_30_vHsm_GetFlagClearValue(partitionIdx)); /* SBSW_CRYPTO_30_VHSM_HANDLE_INTERRUPT */ + break; +# endif +# if (CRYPTO_30_VHSM_INTERRUPT_CLEAR_ONLY_READ_AVAILABLE == STD_ON) + case CRYPTO_30_VHSM_CLEAR_ONLY_READ: + { + volatile uint32 dummy = (*(volatile uint32*)(uint32)Crypto_30_vHsm_GetFlagClearAddress(partitionIdx)); /* PRQA S 3205, 0303 */ /* MD_CRYPTO_30_VHSM_3205_DUMMY_READ */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(dummy); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + } + break; +# endif /* (CRYPTO_30_VHSM_INTERRUPT_CLEAR_ONLY_READ_AVAILABLE == STD_ON) */ + default: /* COV_CRYPTO_30_VHSM_MISRA_ADDITIONAL_STATEMENT */ /* PRQA S 2016 */ /* MD_MSR_EmptyClause */ + break; + } +# endif /* (CRYPTO_30_VHSM_IS_VTT == STD_OFF) */ +#endif /* (CRYPTO_30_VHSM_INTERRUPT_CLEARING_AVAILABLE ==STD_ON) */ + } + + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Crypto_30_vHsm_ClearInterruptOfPartition() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_IndicateInitializedIpcOfPartition() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_IndicateInitializedIpcOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES>1) + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_4(); + *(volatile uint32*)CRYPTO_30_VHSM_HOST2_HSM_ADDRESS |= (uint32)((uint32)1u << (uint32)Crypto_30_vHsm_GetIpcInstanceId(partitionIdx)); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_4(); +#else + Crypto_30_vHsm_IndicateInitializedIpc(); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES>1) */ +} /* Crypto_30_vHsm_IndicateInitializedIpcOfPartition() */ + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_PerformTimeout() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_PerformTimeout(uint32 objectId) +{ + Std_ReturnType retVal = E_NOT_OK; + if (objectId >= Crypto_30_vHsm_GetSizeOfObjMap()) + { + retVal = E_NOT_OK; + } + else if (Crypto_30_vHsm_IsObjectInfoUsedOfObjMap(objectId) == FALSE) + { + retVal = E_NOT_OK; + } + else + { + Crypto_30_vHsm_JobRequestIterType jobRequestId = Crypto_30_vHsm_GetObjectInfoIdxOfObjMap(objectId); + + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + if(Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_PROCESSING) + { + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, E_NOT_OK); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + retVal = E_OK; + } + else + { + retVal = E_NOT_OK; + } + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + } + + return retVal; +} + +/********************************************************************************************************************** + * Crypto_30_vHsm_HandleTimeout() + *********************************************************************************************************************/ + /*! + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_HandleTimeout(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + Crypto_30_vHsm_JobRequestIterType jobRequestId; + + /* ----- Implementation ----------------------------------------------- */ + /* Iterate over all job request slots */ + for (jobRequestId = 0u; jobRequestId < Crypto_30_vHsm_GetSizeOfJobRequest(); jobRequestId++) + { +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + /* Check if the jobRequestId mapped to the current partition */ + if (Crypto_30_vHsm_GetPartitionIdxOfObjectInfo(jobRequestId) == partitionIdx) +# endif + { + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT) + { + Crypto_30_vHsm_Ipc_ReceiveResponse(partitionIdx, (Crypto_30_vHsm_ChannelIdType)Crypto_30_vHsm_GetChannelOfJobRequest(jobRequestId)); + } + + if (Crypto_30_vHsm_GetTimeoutRecoveryStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_TIMEOUT_RECOVERY_PENDING) + { + /* Queue asynchronous cancel job */ + if (Crypto_30_vHsm_ProcessCryptoJob(jobRequestId, Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId), TRUE, TRUE) == E_OK) /* SBSW_CRYPTO_30_VHSM_PROCESS_CRYPTO_JOB */ + { + Crypto_30_vHsm_SetTimeoutRecoveryStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_TIMEOUT_RECOVERY_TRIGGERED); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + } + } + } +} + +/********************************************************************************************************************** + * Crypto_30_vHsm_RecoverFromTimeout() + *********************************************************************************************************************/ + /*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_RecoverFromTimeout( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 writeIdx, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +# endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer) +{ + /* Deserialize job state */ +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId) = (Crypto_JobStateType)Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER */ +# else + Crypto_30_vHsm_SetJobStateOfJobRequest(jobRequestId, (uint8)(jobResponseData >> CRYPTO_30_VHSM_JOBRESPONSE_STATE_BITPOSITION)); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + CRYPTO_30_VHSM_DUMMY_STATEMENT_CONST(jobResponseBuffer); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + /* Remove the old response from the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, Crypto_30_vHsm_GetChannelOfJobRequest(jobRequestId)) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + + /* Indicate that the channel can now be used by other jobs */ + Crypto_30_vHsm_SetChannelState(Crypto_30_vHsm_GetChannelOfJobRequest(jobRequestId), CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE, partitionIdx); /* SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE */ + + Crypto_30_vHsm_JobKindType jobResponseKind = Crypto_30_vHsm_GetKindOfJobRequest(jobRequestId); + + /* Check if the job is still active in Hsm */ + if ((jobResponseKind != CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND) + && (jobResponseKind != CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND) + && (Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId) != CRYPTO_JOBSTATE_IDLE)) /* PRQA S 3415 */ /* MD_CRYPTO_30_VHSM_3415_LOGICAL_OPERATOR */ + { + /* Hsm is not yet finished with the job -> needs cancellation. */ + Crypto_30_vHsm_SetTimeoutRecoveryStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_TIMEOUT_RECOVERY_PENDING); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + /* Hsm is finished with the job -> job request can be freed. */ + /* State processing of job request is done and result is ignored */ + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* job request can be used by other jobs */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + /* any job can use the driver object again */ + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + + /* Call timeout recovered callout */ + Crypto_30_vHsm_TimeoutRecovered_Callout(Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId)); + } + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif +} +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessJobRequest() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessJobRequest( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + Crypto_30_vHsm_ChannelIdType channel = Crypto_30_vHsm_GetIpcChannelsOfvHsm(partitionIdx); + + /* ----- Implementation ----------------------------------------------- */ +#if (CRYPTO_30_VHSM_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + /* Check if the driver object is used by the correct partition */ + if (Crypto_30_vHsm_GetApplicationIdOfObjectInfo(jobRequestId) != GetApplicationID()) + { +# if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_PROCESS_JOB_REQUEST, CRYPTO_E_PARAM_HANDLE); +# endif + retVal = E_NOT_OK; + } + else +#endif /* (CRYPTO_30_VHSM_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) */ + if (Crypto_30_vHsm_Ipc_IsRamExec(partitionIdx) == TRUE) /* PRQA S 0310, 3305, 4340 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + { + retVal = CRYPTO_E_BUSY; + } + else + { + /* #10 Set the state of the request to processing */ + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_PROCESSING); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #20 Transmit the job request to the IPC */ + retVal = Crypto_30_vHsm_TransmitRequest(jobRequestId, &channel); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + + /* #21 Check if the job request was transmitted correctly */ + if (retVal == E_OK) + { +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + /* #22 If it is an asynchronous job, call the timeout detect start callout */ + if (Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) == CRYPTO_PROCESSING_ASYNC) + { + Crypto_30_vHsm_TimeoutDetect_Start_Callout( /* PRQA S 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ + CRYPTO_30_VHSM_CALLOUT_ASYNC, + Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId), + Crypto_30_vHsm_GetContextClassOfJobRequest(jobRequestId), + Crypto_30_vHsm_GetContextIdOfJobRequest(jobRequestId)); + } +#endif /* (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) */ + + /* #23 Mark transmitted job as ready so that vHSM can start execution */ + /* Note: This will make the new job request immediately visible from vHsm. */ + Crypto_30_vHsm_Ipc_GetTxChannelWriteIdx(partitionIdx, channel) += 1u; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + + Crypto_30_vHsm_TriggerInterruptOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_TRIGGER_INTERRUPT */ /*lint !e522 */ + + /* #30 Check if it is a synchronous job */ + if (Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) == CRYPTO_PROCESSING_SYNC) + { + /* #31 Wait for job response */ + Crypto_30_vHsm_WaitForSynchJobResponse(jobRequestId, partitionIdx, channel); + } + } + else + { + /* #40 Clear state if job could not be transmitted */ + if (channel < Crypto_30_vHsm_GetSizeOfChannelState(partitionIdx)) + { + Crypto_30_vHsm_SetChannelState(channel, CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE, partitionIdx); /* SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE */ + } + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + } + + return retVal; +} /* Crypto_30_vHsm_ProcessJobRequest() */ + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForHsmRam() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForHsmRam(void) +{ + /* #10 Call partition handler function with default partition */ + Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition(Crypto_30_vHsm_GetCurrentPartitionIdx()); +} /* Crypto_30_vHsm_WaitForHsmRam() */ + +#else /* !(CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) */ +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForHsmRamForApplication() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForHsmRamForApplication(ApplicationType applicationId) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdentifierIdx = 0u; + + for (partitionIdentifierIdx = 0u; partitionIdentifierIdx < Crypto_30_vHsm_GetSizeOfPartitionIdentifiers(); partitionIdentifierIdx++) + { + if (applicationId == Crypto_30_vHsm_GetPartitionSNVOfPartitionIdentifiers(partitionIdentifierIdx)) + { + /* #10 Call partition handler function with partition of the passed application if a matching one is found */ + Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition(Crypto_30_vHsm_GetPCPartitionConfigIdxOfPartitionIdentifiers(partitionIdentifierIdx)); + retVal = E_OK; + break; + } + } + return retVal; +} /* Crypto_30_vHsm_WaitForHsmRamForApplication() */ + +#endif /* !(CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) */ + +#define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Module specific MISRA deviations + *********************************************************************************************************************/ +/* Module specific MISRA deviations: + +MD_CRYPTO_30_VHSM_0306_CHECK_MEMORY_LAYOUT: +Reason: Cast needed to evaluate if the pointer address is located in a specific memory region. +Risk: Size of pointer type is hardware specific - not compatible between platforms. Invalid memory access. +Prevention: vHsm for specific hardware(32 - Bit platforms) (pointer size type can not differ). Valid memory access ensured by code review and test + +MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO: +Reason: Cast needed in order to have a platform independent IPC on shared memory for different architectures +Risk: Writing or reading of invalid memory +Prevention: Covered by code review and tests. + +MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO: +Reason: Cast needed in order to have a platform independent IPC on shared memory. Ptr needs to be transferred by their address. +Risk: Size of pointer type is hardware specific - not compatible between platforms. Invalid memory access. +Prevention: vHsm for specific hardware(32 - Bit platforms) (pointer size type can not differ). Valid memory access ensured by code review and test + +MD_CRYPTO_30_VHSM_0310_KEYELEMENT_CONTENT: +Reason: The content of a key element which is an uint8 array has to be copied to e.g. a uint32 value. +Risk: Wrong interpretation of the data. +Prevention: Covered by code review and tests on hardware. + +MD_CRYPTO_30_VHSM_IPC_MACRO +Reason: Cast needed in order to have a platform independent IPC on shared memory for different architectures +Risk: Writing or reading of invalid memory +Prevention: Covered by code review and tests. + +MD_CRYPTO_30_VHSM_3453_IPC_MACRO +Reason: Macro used because macros are faster than functions and IPC is performance critical +Risk: Macros don't evaluate types. Can cause invalid memory access +Prevention: Covered by code review and tests. + +MD_CRYPTO_30_VHSM_3673_API_SPECIFIC +Reason: Parameter cannot be set to const since it is passed as var parameter to lower layer library. +Risk: - +Prevention: - + +MD_CRYPTO_30_VHSM_2822_DEREFERENCING_NULLPTR +Reason: Parameter my be NULL_PTR which will then be dereferenced. +Risk: Undefined or unspecified behaviour +Prevention: On hardware platforms, NULL_PTR may be a valid address. Covered by code review and tests. + +MD_CRYPTO_30_VHSM_2987_HANDLEDET +Reason: Function is detected without side effects even if it clears a variable in the IPC +Risk: - +Prevention: - + +MD_CRYPTO_30_VHSM_UNUSED_PARAMETER +Reason: The API is designed to be the same for multiple sub components. Some implementations don't use a parameter. +Risk: Unused parameter may be less efficient +Prevention: Code review, tests + +MD_CRYPTO_30_VHSM_REGISTER_ACCESS +Reason: Register access +Risk: Access to invalid memory +Prevention: The user has to make sure that only the correct register address is configured to access the hardware register. The register is hardware dependant. + +MD_CRYPTO_30_VHSM_TRIGGER_INTERRUPT +Reason: Register access +Risk: Access to invalid memory +Prevention: The user has to make sure that only the correct register address is configured to trigger the interrupt. The register is hardware dependant. + +MD_CRYPTO_30_VHSM_2985_REDUNDANT_OP_WHEN_NO_REDIRECTION +Reason: This operation is redundant. The value of the result is always that of the left-hand operand when redirection is disabled +Risk: Not needed operation +Prevention: Code review, tests + +MD_CRYPTO_30_VHSM_3679_JOB_POINTER_AS_VAR +Reason: The object referenced by the pointer is not modified through it, so the object could be declared with type 'objectType const*'. However the referenced data inside the struct is modified, therefore P2VAR. +Risk: - +Prevention: Code review, tests + +MD_CRYPTO_30_VHSM_0404_VOLATILE_READ +Reason: Volatile reads could have side-effects. More than 1 volatile read is done at a sequence point, so the order of the read cannot be guaranteed. +Risk: None, as no registers with side-effects are read. +Prevention: Covered by code review. + +MD_CRYPTO_30_VHSM_3415_LOGICAL_OPERATOR +Reason: Volatile reads could have side-effects. The right side of the logical operator may not get evaluated and therefore doesn't produce the side-effect. +Risk: None, as no registers with side-effects are read or access is enclosed via exclusive areas +Prevention: Covered by code review. + +MD_CRYPTO_30_VHSM_3205_DUMMY_READ +Reason: Read to a dummy variable needs to be performed to clear interrupts. The read value will not be used. +Risk: None, as reading the register to clear interrupt flags is required by the hardware. +Prevention: Covered by code review. + +MD_CRYPTO_30_VHSM_3206_SINGLE_PARTITION_IPC_ACCESS +Reason: A parameter for the partition is passed and is not used when only a single partition is configured. The parameter will be replaced via a macro by the constant 0u due to performance reasons. +Risk: None, as variable is not read in a specific configuration +Prevention: Covered by code review. + + */ + +/* +\CM CM_CRYPTO_30_VHSM_IPC_SERIALIZE The total size of the serialized data per job is fixed. Before serialization, a runtime check is performed if the section in the ipc is big enough to hold the serialized job. + */ + +/* SBSW_JUSTIFICATION_BEGIN + +\ID SBSW_CRYPTO_30_VHSM_FORWARDING_PTR +\DESCRIPTION The caller forwards as parameter one or more pointer. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR +\DESCRIPTION A variable located on the stack is given as parameter pointer to a function. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + +\ID SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER +\DESCRIPTION A variable located on the stack is given as parameter pointer to a function. Also a pointer to a buffer is passed which is used to read a value from the IPC. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. The buffer always points to the valid IPC memory area which is always available. + +\ID SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC +\DESCRIPTION A variable located in the ipc memory is written. +\COUNTERMEASURE \N The memory area in the IPC is assumed to be valid. The offset is static and depending on the IPC protocol version + +\ID SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 +\DESCRIPTION A variable is serialized to the IPC. An offset is used to determine the destination in the IPC memory +\COUNTERMEASURE \R [CM_CRYPTO_30_VHSM_IPC_SERIALIZE] + +\ID SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR +\DESCRIPTION A pointer is serialized to the IPC. An offset is used to determine the destination in the IPC memory +\COUNTERMEASURE \R [CM_CRYPTO_30_VHSM_IPC_SERIALIZE] + +\ID SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO +\DESCRIPTION Access of ObjectInfo + DriverObjectLock, + OutputLengthPtrDataBuffer + SecondaryOutputLengthPtrDataBuffer + VerifyPtrDataBuffer + LockOfJobRequest, StateOfJobRequest, ProcessingTypeOfJobRequest, KindOfJobRequest, CryptoJobOfJobRequest, + KeyMJobOfJobRequest, ResultOfJobRequest, CancelOfJobRequest, JobStateOfJobRequest, OutputOffsetOfJobRequest, + SecondaryOutputOffsetOfJobRequest, UsedBufferOfJobRequest, TrimmedOutputBufferOfJobRequest, ObjectIdOfJobRequest, + ContextClassOfJobRequest, ContextIdOfJobRequest + with same index using ComStackLib +\COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib. + +\ID SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO_JOB_PTR +\DESCRIPTION Access of CryptoJobOfJobRequest (via indirection over ObjectInfo) using ComStackLib. +\COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib. Additionally the pointers inside the job are assumed to be valid. The caller of Crypto_30_vHsm_CancelJob or Crypto_30_vHsm_ProcessJob must ensure the validity of the pointers inside the job structure. + +\ID SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE +\DESCRIPTION Access of ChannelState using ComStackLib. The GetSizeOf-check is performed in Crypto_30_vHsm_TransmitRequest(). +\COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib. + +\ID SBSW_CRYPTO_30_VHSM_PROCESS_CRYPTO_JOB +\DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been checked before for validity. + Access to JobRequest via indirection over ObjMap. ObjectId has been checked for validity beforehand. +\COUNTERMEASURE \N Pointer to job and objectId is checked for validity before usage + and Qualified use-case CSL03 of ComStackLib for JobRequestId. + +\ID SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK +\DESCRIPTION Write access to a pointer. +\COUNTERMEASURE \R The pointer is checked for validity before. + +\ID SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK +\DESCRIPTION The value of a pointer to a variable located on the stack is written. +\COUNTERMEASURE \N The function call is synchronous and there is no array access. + +\ID SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL +\DESCRIPTION The value of a pointer to a global variable of the CSL is written. +\COUNTERMEASURE \N The function call is synchronous and there is no array access. + +\ID SBSW_CRYPTO_30_VHSM_FORWARDING_STACK_VARIABLE_PTR +\DESCRIPTION The function is called with pointers pointing to stack variables. +\COUNTERMEASURE \N The pointer is forwarded and assumed to be valid + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SendRequestToIpc +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to Crypto_30_vHsm_SendRequestToIpc. + The function is specified to only write a maximum of CRYPTO_30_VHSM_IPC_TX_CHANNEL_MEMORY_SIZE bytes to the pointer which is the size of the allocated array in the IPC. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (CRYPTO_30_VHSM_IPC_TX_CHANNEL_MEMORY_SIZE), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_Inputs +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs. + The function is specified to only write a maximum of 24 bytes to the pointer which is smaller than the size of the allocated array in the IPC. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (24), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_Outputs +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs. + The function is specified to only write a maximum of 16 bytes to the pointer which is smaller than the size of the allocated array in the IPC. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (16), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_CryptoJob. + The function is specified to only write a maximum of 80 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (80), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_KeyMJob. + The function is specified to only write a maximum of 36 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (36), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob_CopyPartial +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial. + The function is specified to only write a maximum of 32 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (32), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob_KeyDerive +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_KeyMJob_KeyDerive. + The function is specified to only write a maximum of 36 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (36), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_MacGen +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen. + The function is specified to only write a maximum of 44 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (44), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_MacVer +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer. + The function is specified to only write a maximum of 48 bytes to the pointer which is smaller than the size of the allocated array in the IPC minus the already written header data. +\COUNTERMEASURE \N The function call is synchronous and the function only serializes a known maximum number of bytes (48), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_ReceiveResponse_KeyMJob +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_ReceiveResponse_KeyMJob. + The function is specified to only read a maximum of CRYPTO_30_VHSM_KEYM_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE bytes from the pointer which is in the range of the buffer allocated in the IPC minus the already processed header data. +\COUNTERMEASURE \N The function call is synchronous and the function only deserializes a known maximum number of bytes (CRYPTO_30_VHSM_KEYM_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_ReceiveResponse_CryptoJob +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_ReceiveResponse_CryptoJob. + The function is specified to only read a maximum of CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE bytes from the pointer which is in the range of the buffer allocated in the IPC minus the already processed header data. +\COUNTERMEASURE \N The function call is synchronous and the function only deserializes a known maximum number of bytes (CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE), + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_RecoverFromTimeout +\DESCRIPTION A pointer to an array located in the global ipc memory is given as parameter to a Crypto_30_vHsm_RecoverFromTimeout. + The function is specified to only read the JobState from the pointer which is in the range of the buffer allocated in the IPC minus the already processed header data. +\COUNTERMEASURE \N The function call is synchronous and the function only accesses a known offset, + therefore the array in the IPC is valid for the function call. + +\ID SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS +\DESCRIPTION The function is called with pointers to the global buffer and parameters containing the key and element id. +\COUNTERMEASURE \N The pointer to the global buffer is assumed to be valid. + +\ID SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS +\DESCRIPTION The function is called with pointers to the global buffer and the original ptr which shall be serialized. +\COUNTERMEASURE \N The pointer to the global buffer is assumed to be valid. + +\ID SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE +\DESCRIPTION The function is called with a pointer to a job which has been checked, the pointer to the memory area in the IPC where the job shall be serialized and a pointer to a local variable on the stack (offset). +\COUNTERMEASURE \N The pointer to the job has been checked in Crypto_30_vHsm_ProcessJob or Crypto_30_vHsm_CancelJob or is a local variable on the stack in a synchronous call in case of a KeyM job. The buffer has a static size in the IPC memory and is always available and the offset is a local variable on the stack. + +\ID SBSW_CRYPTO_30_VHSM_MEMORY_VALID_CHECK +\DESCRIPTION The caller forwards as parameter one pointers. The data can be NULL_PTR. +\COUNTERMEASURE \N The pointer is forwarded and is allowed to be NULL_PTR. Depending on the length, the function will return an error. + +\ID SBSW_CRYPTO_30_VHSM_COPY_TO_DESTINATION_FROM_GLOBAL_BUFFER +\DESCRIPTION The original pointers in the job are used as destination for the data in the global buffer which is always available because the caller always passes a valid job. +\COUNTERMEASURE \N The pointers in the job are assumed to be valid. The pointer to the global buffer is assumed to be valid or have a size of 0. The destination pointer and length have been checked against NULL_PTR. + The length is checked, that it is not bigger than the original provided buffer. + The vHsm Firmware can therefore not trigger any memory corruption via the driver when providing a bigger output buffer size than the size of the buffer in the job pointer. + +\ID SBSW_CRYPTO_30_VHSM_COPY_TO_GLOBAL_BUFFER_FROM_SOURCE +\DESCRIPTION The original pointers in the job are used as source for the data in the global buffer which is always available because the caller always passes a valid job. +\COUNTERMEASURE \N The pointers in the job are assumed to be valid. The pointer to the global buffer is assumed to be valid or have a size of 0. The source pointer has been checked against NULL_PTR. + The length is checked, that it is not bigger than the original provided buffer. + +\ID SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS +\DESCRIPTION An address is accessed as uint32 to access a hardware register +\COUNTERMEASURE \S The address, mask and value is configured by the user and is platform dependant. The user must make sure to only provide a valid address. [SMI-427853] + +\ID SBSW_CRYPTO_30_VHSM_HANDLE_INTERRUPT +\DESCRIPTION An address is accessed as uint32 to trigger the interrupt or clear the interrupt flag +\COUNTERMEASURE \S The address, mask and value is configured by the user and is platform dependant. The user must make sure to only provide a valid address. [SMI-427853] + +\ID SBSW_CRYPTO_30_VHSM_INIT_IPC_MEMORY +\DESCRIPTION The function is called with the ipc memory which is always available and a known size. +\COUNTERMEASURE \N The array is always available and the size is known. + +\ID SBSW_CRYPTO_30_VHSM_IPC_MEMORY_PTR_ARRAY +\DESCRIPTION The array is accessed with an always valid partition index. + The array is not generated via CSL via partition indirection because of performance reasons during access of the IPC in the multi partition use-case. +\COUNTERMEASURE \N The partition index is either 0 or a valid one is returned from Crypto_30_vHsm_GetCurrentPartitionIdx() which searches via CSL for a matching one. + Validations are in place that there will always be a match. + +\ID SBSW_CRYPTO_30_VHSM_WRITE_PARTITION_DATA +\DESCRIPTION Write of Partition specific data using ComStackLib. +\COUNTERMEASURE \N The index for the Partition specific data is either fixed (for single partition usecase) or provided by searching the current application id + in the PartitionIdentifiers and using its corresponding partitionIdx or passed as parameter (Qualified use-case CSL05 of ComStackLib). + Therefore it is guaranteed to be in the acceptable range. + +SBSW_JUSTIFICATION_END */ + +/* COV_JUSTIFICATION_BEGIN + + \ID COV_CRYPTO_30_VHSM_LOCAL_DEFINE + \ACCEPT TX + \ACCEPT XF + \REASON CRYPTO_30_VHSM_LOCAL is always defined externally. + + \ID COV_CRYPTO_30_VHSM_CSM_DEFINES + \ACCEPT XF + \ACCEPT TX + \REASON This defines could be defined in other crypto drivers as well. In order to increase flexibility, defines are defined in crypto driver if not provided yet. + + \ID COV_CRYPTO_30_VHSM_MISRA_ADDITIONAL_STATEMENT + \ACCEPT X + \REASON This else/default statements are required by misra but cannot be reached in code. The statement is captured by upper Api. + + \ID COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS + \ACCEPT TX + \REASON The Crypto needs custom key elements, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE + \ACCEPT TX + \REASON The Crypto needs custom key elements, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_VHSM_KEY_ELEMENTS_RIGHTS + \ACCEPT TX + \REASON The Crypto provides key elements rights which can be defined in upper layer. + + \ID COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM + \ACCEPT TX + \REASON The Crypto needs custom algorithm and algorithm mode defines, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM + \ACCEPT TX + \REASON The Crypto needs custom key algorithm, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_VHSM_CUSTOM_KDF + \ACCEPT TX + \REASON The Crypto needs custom key algorithm, which could be defined in other modules as well. + + \ID COV_CRYPTO_30_VHSM_DOUBLE_CHECK + \ACCEPT TX + \REASON To avoid unnecessary entering of exclusive areas, rare occurring events are checked twice: Outside of an exclusive area before entering it + and again inside the area to make sure that it is not already handled meanwhile. + + \ID COV_CRYPTO_30_VHSM_COMMENT + \ACCEPT TX + \ACCEPT XF + \REASON - + + \ID COV_CRYPTO_30_VHSM_DATABUFFER + \ACCEPT TX + \REASON A Configuration without a configured data buffer for inputPtr, secondaryInputPtr or outputPtr is not really usable. + + \ID COV_CRYPTO_30_VHSM_IPC_BUFFER_SIZE_CHECK + \REASON The buffer size is defined in a lookup table and can not be altered from outside. Due to defensive coding the check is done nevertheless. + + \ID COV_CRYPTO_30_VHSM_ROBUST_POINTER_CHECK + \ACCEPT TF tf tx + \ACCEPT XF xf xx + \REASON There are more checks for the pointers as needed to improve the robustness on different platforms. + + \ID COV_CRYPTO_30_VHSM_MEMMAP_EXAMPLE + \ACCEPT TX xf tx tx tx + \ACCEPT TX xf tx + \ACCEPT TX + \REASON Examples for different compilers are given in the MemMap file. Project is only compiled with one compiler in all configs. + + \ID COV_CRYPTO_30_VHSM_ASR_COMPATIBILITY + \ACCEPT XF + \ACCEPT TX + \REASON The Crypto_JobType differs between the different ASR version to support ASR 4.3.0 the defines ca be overwritten. Standard is ASR 4.3.1. + + \ID COV_CRYPTO_30_VHSM_VTT + \ACCEPT TX + \REASON The feature is only active for VTT and not supported in SafeBSW. As the VTT product is always not SafeBsw, + there is no extra MSSV Plugin enforcing that the feature is not active. + + \ID COV_CRYPTO_30_VHSM_READWRITE_AVAILABLE + \ACCEPT XF + \REASON COV_MSR_UNSUPPORTED + + \ID COV_CRYPTO_30_VHSM_NOBUFFERING_ENABLED + \ACCEPT XF + \REASON COV_MSR_UNSUPPORTED + +COV_JUSTIFICATION_END */ + +/* FETA_JUSTIFICATION_BEGIN + + \ID FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT + \DESCRIPTION The loop waits for an action done by the HSM core. This action could possibly never occur. + \COUNTERMEASURE \N The loop can be terminated by using a callout which has to be implemented by the user. + + \ID FETA_CRYPTO_30_VHSM_MONOTONIC_LOOP_UP_WITH_UNCHANGED_BOUNDS_STATIC_GENDATA + \DESCRIPTION Loop bounds are determined by static GenData which is accessed via ComStackLib. + \COUNTERMEASURE \N The here applied loop uses variables as lower and upper bound which are set via a ComStackLib macro + and remain unchanged during loop execution. The lower bound variable is guaranteed to be less + than or equal to the upper bound variable. The loop's type of the counter variable is appropriate + for the loop's type of lower and upper bound determining variables as it is an iteration type suitable for the + used CSL indirection. The counter variable is increased once within each single loop iteration (strictly monotonically increasing) + until it reaches a value that makes the loop stop without any occurrences of overflows. This + is done by a comparison used as loop termination condition that considers the amount of the + increment that is applied within each single loop. + + FETA_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.h new file mode 100644 index 0000000..589b60d --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm.h @@ -0,0 +1,628 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm.h + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Core of the Vector Hardware Security Module Firmware driver. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2017-06-23 vistof - Initial creation for ASR 4.3 + * vismsl Concept Work + * 01.01.00 2018-01-09 vistof STORYC-4214 Feature Completion: + * Fixed handling code flash write access. + * Added Det forwarding from vHsm + * Added support for key element deletion + * Removed not needed DET checks for cryptoKeyId + * Fixed serialization of secondaryInputLength during MacVerify + * Fixed Addresses of memory sections to support more derivatives. + * Added support for cancel + * Added Address of global structure is now configurable + * Added asynchronous job processing + * Fixed global RAM buffer handling. Each object has now its own buffer. + * Added option to use vHsm without interrupts + * visfpt Added padding modes (PKCS7, None, Zero) for hardware AES. + * vismsl Rework of Ipc + * 01.02.00 2018-05-04 visfpt STORYC-5257 Release of Component + * vistof ESCAN00099366 Fixed: Missing compiler abstractions + * 01.03.00 2018-06-20 visjhi STORYC-5741 Added Hardware independent memory area configuration + * 02.00.00 2018-08-21 vistof STORYC-6297 Requests will immediately return CRYPTO_E_BUSY when vHsm Firmware is in RAM loop. + * STORYC-6296 Added check if provided output buffer is too big to be buffered to the shared RAM. + * STORYC-6295 Ensure alignment of driver object buffers + * STORYC-6294 Add callout during waiting loops + * ESCAN00100450 Blocking of driver object for other jobs when job is canceled. + * 2018-09-13 visrpp STORYC-6521 MISRA-C:2012 Compliance + * ESCAN00100842 Fixed: Possibility of an endless loop in polling mode + * 02.01.00 2018-12-19 vistof STORYC-7341 Support fast MAC Verify/Generate processing + * STORYC-7143 Support redirection of input/output buffers from/to key elements + * STORYC-7339 Support partial key element copy + * ESCAN00101843 Compiler option -Ospeed does not work in interrupt mode because + * Crypto_30_vHsm_JobRequest is not volatile + * 02.01.01 2019-05-09 visjhi STORYC-8370 Remove VTT switches + * ESCAN00103101 MacVerify: NULL_PTR as verifyPtr not accepted in START/UPDATE mode (streaming) + * 02.02.00 2019-08-06 vistof ESCAN00103942 Fixed: Det error CRYPTO_E_PARAM_POINTER during Fast MAC Generation + * HSM-432 Added DET when configured global ram buffer is too small + * HSM-432 Rework buffer handling + * 02.02.01 2020-01-28 vistof ESCAN00105494 Compiler error: unresolved external symbol Det_ReportError + * when DEV_ERROR_REPORT and DEV_ERROR_DETECT have different values + * 02.03.00 2020-01-30 vistof HSM-629 Trigger Host to HSM ISR + * HSM-619 Asynchronous Key Handling + * HSM-160 Make DET errors from vHsm distinguishable from application core DET errors + * HSM-699 Initialize IPC and inform vHsm + * 02.03.01 2020-07-14 vistof ESCAN00106838 Execution of a job switches from E_OK to continuously returning E_NOT_OK + * ESCAN00106857 Async jobs may return wrong values in polling mode + * 02.04.00 2020-08-07 vistof HSM-984 Harmonize Crypto_JobType according to different ASR version + * 02.05.00 2020-10-02 vistof HSM-1193 Allow parallel Key Management operations + * HSM-1190 Improve Exclusive area design + * HSM-1225 Discard job inputs/outputs which are not relevant for the service + * 02.05.01 2020-10-27 vistof ESCAN00107729 Compiler error: CRYPTO_KEYSETVALID not defined + * when Csm according to ASR 4.3 instead of ASR 4.4 is used + * ESCAN00107730 Undefined behaviour when calling key management APIs + * 02.06.00 2021-01-05 vistof HSM-1296 Support NoBuffering driver objects + * ESCAN00108351 Use interrupts only for async jobs + * 03.00.00 2021-01-25 vistof ESCAN00108526 Race condition in IPC processing leads to undefined behaviour + * ESCAN00108682 Cancel for async jobs is processed async and retVal of Callback is E_OK instead of CRYPTO_E_CANCELED + * HSM-1324 Add support for IPCv3, Remove support for IPCv1 + * HSM-943 Improve IPCv3 via shifts + * HSM-1318 Improve IPCv3 via exchanging pointers with values + * visrpp HSM-270 Custom Modes according ASR 20-11 + * 03.00.01 2021-03-15 vistof ESCAN00108847 Buffer inside GlobalRamBuffer is not allocated correctly during runtime + * HSM-1608 Remove not needed global variables + * 03.01.00 2021-07-26 visebj HSM-1595 Introduce access to HSM2HOST and HOST2HSM registers via KeyElement APIs + * HSM-1785 Support save/restore context + * HSM-1833 Indicate initialized IPC via interrupt + * 03.02.00 2022-07-07 vistof HSM-2091 Usage of _MemMap.h + * ESCAN00112312 Driver object is still locked after vHsm has returned an error during processing of a crypto job + * 03.03.00 2022-10-24 vistof HSM-3092 Support for special Interrupt handling + * 03.04.00 2023-02-13 viskju HSM-3377 FETA analysis, Rework loop callout + * 04.00.00 2023-04-14 vistof HSM-3734 Support Multi Partition Use-Case + * ESCAN00114445 Save/Restore Context only works for services which have both input and output pointers + * ESCAN00114875 Fix Compiler warning: Not initialized variable is mapped to ZERO_INIT section + * 04.00.01 2023-06-06 vistof ESCAN00114796 Compiler warning: unreferenced formal parameter 'partitionIdx' + * ESCAN00114814 IpcInstance has wrong mapping to partitions + * ESCAN00114934 Runtime exception for Vtt Use-Case during triggering and clearing an interrupt + * HSM-4392 Rework InitMemory for Multicore + * 04.01.00 2024-07-01 viskju HSM-3833 Create API which can be called as a reaction to timeouts + * ESCAN00117786 Fix that IPC channel stays locked after error is detected + * HSM-5340 Support KeySetInvalid and KeyGetStatus + * 04.01.01 2024-08-22 viskju ESCAN00118087 Fix Validation error for primitive service CRYPTO_KEYSETINVALID + * 04.01.02 2025-02-13 vistof ESCAN00118425 Wrong response handling during Key Derive Job + * viskju ESCAN00118923 TimeoutDetect callouts for asynchronous jobs can occur in wrong order + * ESCAN00119461 Unexpected overwriting of data in outputPtr or secondaryOutputPtr using SaveContext or RestoreContext functionality + * ESCAN00119487 Unexpected overwriting of data in outputPtr or secondaryOutputPtr using CancelJob functionality + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_H) +# define CRYPTO_30_VHSM_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_vHsm_Types.h" +# include "Crypto_30_vHsm_Cfg.h" +# include "Crypto_30_vHsm_KeyManagement.h" +# include "Crypto_30_vHsm_Custom.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Vendor and module identification */ +# define CRYPTO_30_VHSM_VENDOR_ID (30u) +# define CRYPTO_30_VHSM_MODULE_ID (114u) +# define CRYPTO_30_VHSM_INSTANCE_ID (0u) + +/* AUTOSAR Software specification version information */ +# define CRYPTO_30_VHSM_AR_RELEASE_MAJOR_VERSION (0x04u) +# define CRYPTO_30_VHSM_AR_RELEASE_MINOR_VERSION (0x03u) +# define CRYPTO_30_VHSM_AR_RELEASE_REVISION_VERSION (0x01u) + +/* ----- Component version information (decimal version of ALM implementation package) ----- */ +# define CRYPTO_30_VHSM_MAJOR_VERSION (4u) +# define CRYPTO_30_VHSM_MINOR_VERSION (1u) +# define CRYPTO_30_VHSM_PATCH_VERSION (2u) + +/* ----- API service IDs ----- */ +# define CRYPTO_30_VHSM_SID_INIT (0x00u) /*!< Service ID: Crypto_30_vHsm_Init() */ +# define CRYPTO_30_VHSM_SID_GET_VERSION_INFO (0x01u) /*!< Service ID: Crypto_30_vHsm_GetVersionInfo() */ +# define CRYPTO_30_VHSM_SID_PROCESS_JOB (0x03u) /*!< Service ID: Crypto_30_vHsm_ProcessJob() */ +# define CRYPTO_30_VHSM_SID_KEY_ELEMENT_SET (0x04u) /*!< Service ID: Crypto_30_vHsm_KeyElementSet() */ +# define CRYPTO_30_VHSM_SID_KEY_VALID_SET (0x05u) /*!< Service ID: Crypto_30_vHsm_KeyValidSet() */ +# define CRYPTO_30_VHSM_SID_KEY_ELEMENT_GET (0x06u) /*!< Service ID: Crypto_30_vHsm_KeyElementGet() */ +# define CRYPTO_30_VHSM_SID_KEY_GENERATE (0x07u) /*!< Service ID: Crypto_30_vHsm_KeyGenerate() */ +# define CRYPTO_30_VHSM_SID_KEY_DERIVE (0x08u) /*!< Service ID: Crypto_30_vHsm_KeyDerive() */ +# define CRYPTO_30_VHSM_SID_KEY_EXCHANGE_CALC_PUB_VAL (0x09u) /*!< Service ID: Crypto_30_vHsm_KeyExchangeCalcPubVal() */ +# define CRYPTO_30_VHSM_SID_KEY_EXCHANGE_CALC_SECRET (0x0Au) /*!< Service ID: Crypto_30_vHsm_KeyExchangeCalcSecret() */ +# define CRYPTO_30_VHSM_SID_CERTIFICATE_PARSE (0x0Bu) /*!< Service ID: Crypto_30_vHsm_CertificateParse() */ +# define CRYPTO_30_VHSM_SID_MAIN_FUNCTION (0x0Cu) /*!< Service ID: Crypto_30_vHsm_MainFunction() */ +# define CRYPTO_30_VHSM_SID_RANDOM_SEED (0x0Du) /*!< Service ID: Crypto_30_vHsm_RandomSeed() */ +# define CRYPTO_30_VHSM_SID_CANCEL_JOB (0x0Eu) /*!< Service ID: Crypto_30_vHsm_CancelJob() */ +# define CRYPTO_30_VHSM_SID_KEY_ELEMENT_COPY (0x0Fu) /*!< Service ID: Crypto_30_vHsm_KeyElementCopy() */ +# define CRYPTO_30_VHSM_SID_KEY_COPY (0x10u) /*!< Service ID: Crypto_30_vHsm_KeyCopy() */ +# define CRYPTO_30_VHSM_SID_KEY_ELEMENT_IDS_GET (0x11u) /*!< Service ID: Crypto_30_vHsm_KeyElementIdsGet() */ +# define CRYPTO_30_VHSM_SID_CERTIFICATE_VERIFY (0x12u) /*!< Service ID: Crypto_30_vHsm_CertificateVerify() */ +# define CRYPTO_30_VHSM_SID_KEY_ELEMENT_COPY_PARTIAL (0x13u) /*!< Service ID: Crypto_30_vHsm_KeyElementCopyPartial() */ +# define CRYPTO_30_VHSM_SID_KEY_SET_INVALID (0x14u) /*!< Service ID: Crypto_30_vHsm_KeySetInvalid() */ +# define CRYPTO_30_VHSM_SID_KEY_GET_STATUS (0x15u) /*!< Service ID: Crypto_30_vHsm_KeyGetStatus() */ +# define CRYPTO_30_VHSM_SID_COPYJOBREQUESTTXDATA (0x20u) /*!< Service ID: Crypto_30_vHsm_CopyJobRequestTxData() */ +# define CRYPTO_30_VHSM_SID_COPYJOBRESPONSERXDATA (0x21u) /*!< Service ID: Crypto_30_vHsm_GetResponseFromIpc() */ +# define CRYPTO_30_VHSM_SID_PROCESS_JOB_REQUEST (0x22u) /*!< Service ID: Crypto_30_vHsm_ProcessJobRequest() */ + +/* ----- Module States ----- */ +/* State: Module is uninitialized */ +# define CRYPTO_30_VHSM_UNINIT (0x00u) +/* State: Module is initialized */ +# define CRYPTO_30_VHSM_INITIALIZED (0x01u) + +/* Development Error Types [SWS_Crypto_00040] */ +# if !defined (CRYPTO_E_NO_ERROR) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_NO_ERROR (255u) +# endif +# if !defined (CRYPTO_E_UNINIT) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_UNINIT (0u) +# endif +# if !defined (CRYPTO_E_INIT_FAILED) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_INIT_FAILED (1u) +# endif +# if !defined (CRYPTO_E_PARAM_POINTER) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_PARAM_POINTER (2u) +# endif +# if !defined (CRYPTO_E_PARAM_HANDLE) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_PARAM_HANDLE (4u) +# endif +# if !defined (CRYPTO_E_PARAM_VALUE) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_PARAM_VALUE (5u) +# endif +# if !defined (CRYPTO_E_GLOBAL_BUFFER_TOO_SMALL) /* COV_CRYPTO_30_VHSM_CSM_DEFINES */ +# define CRYPTO_E_GLOBAL_BUFFER_TOO_SMALL (100u) +# endif + +# define CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE (0x00u) +# define CRYPTO_30_VHSM_JOBREQUEST_STATE_PROCESSING (0x01u) +# define CRYPTO_30_VHSM_JOBREQUEST_STATE_RESULT_AVAILABLE (0x02u) +# define CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT (0x03u) + +# define CRYPTO_30_VHSM_HSM2HOST_ACTIVE (0u) +# define CRYPTO_30_VHSM_HSM2HOST_READY (1u) +# define CRYPTO_30_VHSM_HSM2HOST_UPDATERRUNNING (15u) + +/* Macros for Job access */ +# if !defined (CRYPTO_30_VHSM_JOB_STATE_MEMBER) /* COV_CRYPTO_30_VHSM_ASR_COMPATIBILITY */ +# define CRYPTO_30_VHSM_JOB_STATE_MEMBER jobState +# endif + +# if !defined (CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER) /* COV_CRYPTO_30_VHSM_ASR_COMPATIBILITY */ +# define CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER jobPrimitiveInputOutput +# endif + +/* Multi Partition */ +# if (CRYPTO_30_VHSM_NUMBER_OF_PARTITIONS > 1u) +# define Crypto_30_vHsm_GetCurrentPartitionIdx() Crypto_30_vHsm_GetPartitionIdx() +# define Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(objectId) Crypto_30_vHsm_GetPartitionIdxOfObjectInfo(objectId) +# else +# define Crypto_30_vHsm_GetCurrentPartitionIdx() 0u +# define Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(objectId) 0u +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Init() + *********************************************************************************************************************/ +/*! \brief Initializes the Crypto Driver + * \details This function initializes the module Crypto_30_vHsm. It initializes all variables and sets the + * module state to initialized. + * \pre Interrupts are disabled. + * Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Specification of module initialization + * \trace CREQ-131331 + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Init(void); + +# if (CRYPTO_30_VHSM_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_GetVersionInfo() + *********************************************************************************************************************/ +/*! \brief Returns the version information + * \details Function returns version information, vendor ID and AUTOSAR module ID of the component. + * \param[out] versioninfo Valid pointer to where to store the version information. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \config CRYPTO_30_VHSM_VERSION_INFO_API == STD_ON + * \trace CREQ-131329 + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetVersionInfo( + P2VAR(Std_VersionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) versioninfo); +# endif /* (CRYPTO_30_VHSM_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessJob() + *********************************************************************************************************************/ +/*! \brief Processes the received job + * \details Performs the crypto primitive, that is configured in the job parameter. + * \param[in] objectId Valid Id of the Crypto Driver Object. + * \param[in,out] job Valid pointer to the configuration of the job. Contains structures with job and + * primitive relevant information but also pointer to result buffers. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_NOT_VALID Request failed, the key is not valid. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, a key element has the wrong size. + * CRYPTO_E_QUEUE_FULL Request failed, the queue is full. + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, the entropy is exhausted + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * CRYPTO_E_COUNTER_OVERFLOW The counter is overflowed. + * CRYPTO_E_JOB_CANCELED The service request failed because the synchronous Job has been canceled. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE|FALSE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job); + +/********************************************************************************************************************** + * Crypto_30_vHsm_CancelJob() + *********************************************************************************************************************/ +/*! \brief Cancels the received job + * \details This interface removes the provided job from the queue and cancels the processing of the job if possible. + * \param[in] objectId Valid identifier of the Crypto Driver Object. + * \param[in,out] job Valid pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \return E_OK Request successful, job has been removed. + * E_NOT_OK Request failed, job could not be removed. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CancelJob( + uint32 objectId, + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) job); + +# if (CRYPTO_30_VHSM_NUMBER_OF_PARTITIONS > 1u) +/********************************************************************************************************************** + * Crypto_30_vHsm_GetPartitionIdx() + *********************************************************************************************************************/ +/*! \brief Returns the current active partition idx. + * \details - + * \return Current partition idx + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Crypto_30_vHsm_PartitionIdentifiersIterType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetPartitionIdx(void); +# endif /* (CRYPTO_30_VHSM_NUMBER_OF_PARTITIONS > 1u) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_TriggerInterruptOfPartition() + *********************************************************************************************************************/ +/*! \brief Trigger an interrupt to the HSM + * \details - + * \param[in] partitionIdx Valid identifier of the partition. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_TriggerInterruptOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_ClearInterruptOfPartition() + *********************************************************************************************************************/ +/*! \brief Clear the response interrupt flag + * \details - + * \param[in] partitionIdx Valid identifier of the partition. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ClearInterruptOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_IndicateInitializedIpcOfPartition() + *********************************************************************************************************************/ +/*! \brief Indicate that the IPC has been initialized to the HSM + * \details For multi partition use-case, a spinlock is needed to synchronize the access to the HOST2HSM register when IPC initialization shall be done by the driver. + * \param[in] partitionIdx Valid identifier of the partition. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_IndicateInitializedIpcOfPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +# if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_PerformTimeout() + *********************************************************************************************************************/ + /*! + * \brief Performs a timeout on the stuck driver object and stops the active waiting for an answer of the Hsm. + * \details Can be called from the timeout detect callout when a timeout is detected. + * \param[in] objectId The driver object which is stuck and should be timeouted. + * \return E_OK Timeout successfully set. + * E_NOT_OK Timeout failed. + * \pre Only to be called by Crypto_30_vHsm_TimeoutDetect_Loop_Callout(). + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_PerformTimeout(uint32 objectId); +# endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessJobRequest() + *********************************************************************************************************************/ +/*! \brief Process the job request + * \details - + * \param[in] jobRequestId Valid Id of the job request (in range of Crypto_30_vHsm_GetSizeOfJobRequest()) + * \param[in] partitionIdx Valid identifier of the partition. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre jobRequestId < Crypto_30_vHsm_GetSizeOfJobRequest() + * \context TASK + * \reentrant FALSE + * \synchronous TRUE|FALSE Sync or Async, depends on the job configuration + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessJobRequest( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForHsmRam() + *********************************************************************************************************************/ +/*! + * \brief Waits in the RAM for the vHsm Ready flag. + * \details This is only needed because the vHsm has no control over the application core startup when a debugger is attached. + * When a debugger is attached, all cores will startup immediately. + * \pre - + * \context * + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-WaitLoopCallout + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForHsmRam(void); +# else /* !(CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) */ +/********************************************************************************************************************** + * Crypto_30_vHsm_WaitForHsmRamForApplication() + *********************************************************************************************************************/ +/*! + * \brief Waits in the RAM for the vHsm Ready flag. + * \details This is only needed because the vHsm has no control over the application core startup when a debugger is attached. + * When a debugger is attached, all cores will startup immediately. + * \param[in] applicationId Valid ApplicationId + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * \pre - + * \context * + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-WaitLoopCallout + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_WaitForHsmRamForApplication(ApplicationType applicationId); +# endif /* !(CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) */ + +# define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_APPL_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ + +# if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_TimeoutDetect_Start_Callout() + *********************************************************************************************************************/ +/*! \brief Notification just before waiting for a response from the vHsm Firmware. + * \details Implementation has to be done in the application. + * \param[in] calloutId Identifies the loop. + * \param[in] objectId Id of the Crypto Driver Object of the current context. This is only relevant if calloutId is + * CRYPTO_30_VHSM_CALLOUT_JOBREQUEST or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextClass Type of the current context. Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST + * or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextId If contextClass is CRYPTO_30_VHSM_CALLOUT_CRYPTOJOB, this parameter is the crypto job id, + * if contextClass is CRYPTO_30_VHSM_CALLOUT_KEYMJOB, this parameter is the key id. + * Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_TimeoutDetect_Start_Callout(Crypto_30_vHsm_CalloutIdType calloutId, + uint32 objectId, Crypto_30_vHsm_CalloutContextClassType contextClass, uint32 contextId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_TimeoutDetect_Loop_Callout() + *********************************************************************************************************************/ +/*! \brief Notification about ongoing waiting for a response from the vHsm Firmware. + * \details Implementation has to be done in the application. + * \param[in] calloutId Identifies the loop. + * \param[in] objectId Id of the Crypto Driver Object of the current context. This is only relevant if calloutId is + * CRYPTO_30_VHSM_CALLOUT_JOBREQUEST or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextClass Type of the current context. Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST + * or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextId If contextClass is CRYPTO_30_VHSM_CALLOUT_CRYPTOJOB, this parameter is the crypto job id, + * if contextClass is CRYPTO_30_VHSM_CALLOUT_KEYMJOB, this parameter is the key id. + * Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_TimeoutDetect_Loop_Callout(Crypto_30_vHsm_CalloutIdType calloutId, + uint32 objectId, Crypto_30_vHsm_CalloutContextClassType contextClass, uint32 contextId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_TimeoutDetect_End_Callout() + *********************************************************************************************************************/ +/*! \brief Notification just after waiting for a response from the vHsm Firmware. + * \details Implementation has to be done in the application. + * \param[in] calloutId Identifies the loop. + * \param[in] objectId Id of the Crypto Driver Object of the current context. This is only relevant if calloutId is + * CRYPTO_30_VHSM_CALLOUT_JOBREQUEST or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextClass Type of the current context. Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST + * or CRYPTO_30_VHSM_CALLOUT_ASYNC. + * \param[in] contextId If contextClass is CRYPTO_30_VHSM_CALLOUT_CRYPTOJOB, this parameter is the crypto job id, + * if contextClass is CRYPTO_30_VHSM_CALLOUT_KEYMJOB, this parameter is the key id. + * Only relevant if calloutId is CRYPTO_30_VHSM_CALLOUT_JOBREQUEST. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_TimeoutDetect_End_Callout(Crypto_30_vHsm_CalloutIdType calloutId, + uint32 objectId, Crypto_30_vHsm_CalloutContextClassType contextClass, uint32 contextId); +# endif /* (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) */ + +# if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_TimeoutRecovered_Callout() + *********************************************************************************************************************/ + /*! \brief Notification about a recovered driver object after a timeout was detected. + * \details Implementation has to be done in the application. + * \param[in] objectId Id of the recovered Crypto Driver Object of the current context. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_TimeoutRecovered_Callout(uint32 objectId); +# endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + +# if (CRYPTO_30_VHSM_INTERRUPT_SET_CALLOUT_AVAILABLE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_RequestInterruptSet_Callout() + *********************************************************************************************************************/ +/*! \brief Function which is called to set the request interrupt flag. + * \details Usually the driver provides the capability to handle setting the interrupt flag by itself. However new + * platforms or use-cases may require more specific handling which can be implemented in this callout. + * \param[in] address Address configured in the Cfg5 for the response interrupt clearing + * \param[in] mask Mask configured in the Cfg5 for the response interrupt clearing + * \param[in] value Value configured in the Cfg5 for the response interrupt clearing + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_RequestInterruptSet_Callout(uint32 address, uint32 mask); +# endif /* (CRYPTO_30_VHSM_INTERRUPT_SET_CALLOUT_AVAILABLE == STD_ON) */ + +# if (CRYPTO_30_VHSM_INTERRUPT_CLEAR_CALLOUT_AVAILABLE == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_ResponseInterruptClear_Callout() + *********************************************************************************************************************/ +/*! \brief Function which is called to clear the response interrupt flag. + * \details Usually the driver provides the capability to handle clearing the interrupt flag by itself. However new + * platforms or use-cases may require more specific handling which can be implemented in this callout. + * \param[in] address Address configured in the Cfg5 for the response interrupt clearing + * \param[in] mask Mask configured in the Cfg5 for the response interrupt clearing + * \param[in] value Value configured in the Cfg5 for the response interrupt clearing + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_APPL_CODE) Crypto_30_vHsm_ResponseInterruptClear_Callout(uint32 address, uint32 mask, uint32 value); +# endif /* (CRYPTO_30_VHSM_INTERRUPT_CLEAR_CALLOUT_AVAILABLE == STD_ON) */ + +# define CRYPTO_30_VHSM_STOP_SEC_APPL_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ + +#endif /* !defined (CRYPTO_30_VHSM_H) */ + +/*! + * \exclusivearea CRYPTO_30_VHSM_EXCLUSIVE_AREA_0 + * Protects global data from inconsistencies + * \protects Crypto_30_vHsm_JobRequestMap, Crypto_30_vHsm_DriverObjectList, Crypto_30_vHsm_JobRequestList + * \usedin Crypto_30_vHsm_ProcessJob, Crypto_30_vHsm_CancelJob, Crypto_30_vHsm_CertificateParse, + * Crypto_30_vHsm_CertificateVerify, Crypto_30_vHsm_KeyCopy, Crypto_30_vHsm_KeyDerive, Crypto_30_vHsm_KeyElementCopy, + * Crypto_30_vHsm_KeyElementGet, Crypto_30_vHsm_KeyElementIdsGet, Crypto_30_vHsm_KeyElementSet, + * Crypto_30_vHsm_KeyExchangeCalcPubVal, Crypto_30_vHsm_KeyExchangeCalcSecret, Crypto_30_vHsm_KeyGenerate, + * Crypto_30_vHsm_KeyValidSet Crypto_30_vHsm_RandomSeed + * \exclude All functions provided by Crypto. + * \length SHORT The access to the protected variables is kept short + * \endexclusivearea + */ + +/*! + * \exclusivearea CRYPTO_30_VHSM_EXCLUSIVE_AREA_1 + * Protects that a forwarded DET from the vHsm to be processed only once. (Flag is located in the IPC memory) + * \protects The IPC memory referenced by Crypto_30_vHsm_Ipc_MemoryPtr + * \usedin Crypto_30_vHsm_ProcessJobRequest, Crypto_30_vHsm_MainFunction + * \exclude Crypto_30_vhsm_GetVersionInfo + * \length SHORT The access to the protected variables is kept short + * \endexclusivearea + */ + +/*! + * \exclusivearea CRYPTO_30_VHSM_EXCLUSIVE_AREA_2 + * Protects workspace locking resources when it can not be ensured that uint32 write access is atomic. + * If atomic uint32 write access can be guaranteed, this critical section can be empty. + * \protects Crypto_30_vHsm_DriverObjectLock + * \usedin Crypto_30_vHsm_ProcessCryptoJob + * \exclude All functions provided by Crypto. + * \length SHORT The access to the protected variables is kept short and is only a uint32 write operation. + * \endexclusivearea + */ + +/*! + * \exclusivearea CRYPTO_30_VHSM_EXCLUSIVE_AREA_3 + * Protects workspace locking resources when it can not be ensured that uint32 write access is atomic. + * If atomic uint32 write access can be guaranteed, this critical section can be empty. + * If interrupt mode of driver is used and ISRs can't be interrupted by the same interrupt, this critical section does not need to be protected. + * \protects Crypto_30_vHsm_DriverObjectLock + * \usedin Crypto_30_vHsm_Ipc_ProcessCallbacks + * \exclude All functions provided by Crypto. + * \length SHORT The access to the protected variables is kept short and is only a uint32 write operation. + * \endexclusivearea + */ + +/*! + * \exclusivearea CRYPTO_30_VHSM_EXCLUSIVE_AREA_4 + * Protects HOST2HSM register if multiple partitions are configured because multiple cores need to write to the register. + * This needs to be a spinlock for multi core configurations + * \protects HOST2HSM register + * \usedin Crypto_30_vHsm_IndicateInitializedIpcOfPartition + * \exclude All functions provided by Crypto. + * \length SHORT The access to the protected variables is kept short and is only a uint32 write operation. + * \endexclusivearea + */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Custom.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Custom.h new file mode 100644 index 0000000..c89c9d2 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Custom.h @@ -0,0 +1,425 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_Custom.h + * \brief MICROSAR Crypto Driver (Crypto) + * + * \details Internal header file for custom algorithms + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_CUSTOM_H) +# define CRYPTO_30_VHSM_CUSTOM_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Crypto_30_vHsm_Custom_Generated.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* ----- Additional Key Element defines ---------------------------------------------- */ + +/* AES MAC */ +# if !defined (CRYPTO_KE_CUSTOM_MAC_AES_ROUNDKEY) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_MAC_AES_ROUNDKEY (129u) +# endif + +/* Key Derive */ +# if !defined (CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYDERIVATION_LABEL (130u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYDERIVATION_ADDITIONAL_INFO (131u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_ADDITIONAL_INFO) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_ADDITIONAL_INFO (131u) +# endif + +/* RSA */ +# if !defined (CRYPTO_KE_CUSTOM_RSA_MODULUS) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_MODULUS (160u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PUBLIC_EXPONENT (161u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIVATE_EXPONENT (162u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_SALT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_SALT (163u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_SALT_LENGTH (164u) +# endif + +/* TLS */ +# if !defined (CRYPTO_KE_CUSTOM_TLS_CLIENT_HELLO_RANDOM) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_CLIENT_HELLO_RANDOM (3000u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_TLS_SERVER_HELLO_RANDOM) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_SERVER_HELLO_RANDOM (3001u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_TLS_HMAC_KEY_SIZE) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_TLS_HMAC_KEY_SIZE (3002u) +# endif + +/* Key Exchange */ +# if !defined (CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_KEYEXCHANGE_PARTNER_PUB_KEY (3003u) +# endif + +/* Smart Charge Communication */ +# if !defined (CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SCC_CONTRACT_PUBLIC_KEY (3013u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SCC_IV_AND_ENCRYPTED_PRIVATE_KEY (3014u) +# endif + +/* Random Number Generation */ +# if !defined (CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_PERSONALIZATION_STRING (3015u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_ADDITIONAL_INPUT (3016u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RANDOM_NONCE) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_NONCE (3017u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RANDOM_RESEED_COUNTER (3018u) +# endif + +/* SHE Key Update */ +# if !defined (CRYPTO_KE_CUSTOM_SHE_COUNTER) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_COUNTER (3019u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_SHE_UID) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_UID (3021u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_BOOT_PROTECTION (3056u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_DEBUGGER_PROTECTION (3057u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_SHE_DEBUG_CMD (3059u) +# endif + +/* RSA CRT */ +# if !defined (CRYPTO_KE_CUSTOM_RSA_PRIME_P) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIME_P (3051u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_PRIME_Q) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_PRIME_Q (3052u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_EXPONENT_DP (3053u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_EXPONENT_DQ (3054u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_RSA_INVERSE_QI) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_RSA_INVERSE_QI (3055u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_LABEL) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_LABEL (3058u) +# endif + +/* Spake2+ */ +# if !defined (CRYPTO_KE_CUSTOM_W0) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_W0 (3084u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_W1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_W1 (3085u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_L) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_L (3086u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_VERIFICATION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VERIFICATION (3087u) +# endif + +# if !defined (CRYPTO_KE_CUSTOM_VERIFICATION_RESULT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VERIFICATION_RESULT (3088u) +# endif + +/* ----- Custom Algorithm Mode Defines ---------------------------------------------- */ +/* ECC curve p256r1 */ +# if !defined (CRYPTO_ALGOMODE_CUSTOM_P256R1) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P256R1 (128u) +# endif + +/* RSA CRT */ +# if !defined (CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT (129u) +# endif + +# if !defined (CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT (132u) +# endif + +/* Use Derivation function e.g. for NIST DRBG AES128 */ +# if !defined (CRYPTO_ALGOMODE_CUSTOM_USE_DF) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_USE_DF (130u) +# endif + +/* ECC curve p384r1 */ +# if !defined (CRYPTO_ALGOMODE_CUSTOM_P384R1) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOMODE_CUSTOM_P384R1 (131u) +# endif + +/* ----- Custom Algorithm Family Defines ---------------------------------------------- */ +/* Ecc-ANSI conform */ +# if !defined (CRYPTO_ALGOFAM_CUSTOM_ECCANSI) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ECCANSI (129u) +# endif +/* Ecc-SEC conform */ +# if !defined (CRYPTO_ALGOFAM_CUSTOM_ECCSEC) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_ECCSEC (130u) +# endif +/* NIST 800-90A DRBG conform */ +# if !defined (CRYPTO_ALGOFAM_CUSTOM_DRBG) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_DRBG (131u) +# endif +/* FIPS 186.2 conform */ +# if !defined (CRYPTO_ALGOFAM_CUSTOM_FIPS186) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_FIPS186 (132u) +# endif +/* Padding PKCS7 */ +# if !defined (CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 (133u) +# endif + +/* ----- Custom Key Exchange Algorithm Defines ---------------------------------------------- */ +/* Exchange algorithm x25519 */ +# if !defined (CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_X25519 (0u) +# endif +/* Exchange algorithm ANSI p256r1 */ +# if !defined (CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_ANSIP256R1 (1u) +# endif + +/* Exchange algorithm SEC p256r1 */ +# if !defined (CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP256R1 (2u) +# endif +/* Exchange algorithm SEC p384r1 */ +# if !defined (CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KEY_EXCHANGE_SECP384R1 (4u) +# endif + +/* ----- Custom Key Derivation Algorithm Defines ---------------------------------------------- */ +/* KDF_NIST_800-108 'KDF in Counter Mode' with SHA-256 as PRF */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_SYM_NIST_800_108_CNT_MODE_SHA256 (1u) +# endif + +/* NIST.FIPS.186-4 'Key Pair Generation Using Extra Random Bits' with 'KDF in Counter Mode' as RBG */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_ASYM_NIST_FIPS_186_4_ERB (2u) +# endif + +/* NIST.SP.800-56A Single-Step KDF with Option 1: H(x) = hash(x) */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_NIST_800_56_A_ONE_PASS_C1E1S_SINGLE_STEP_KDF_SHA256 (3u) +# endif + +/* ISO 15118 install and update certificate. */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_ISO_15118_CERTIFICATE_HANDLING (4u) +# endif + +/* KDF X9.63 SHA 1 */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA1 (5u) +# endif + +/* KDF X9.63 SHA 256 */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA256 (6u) +# endif + +/* KDF X9.63 SHA 512 */ +# if !defined (CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_KDF_ALGO_KDF_X963_SHA512 (7u) +# endif + +/* ----- Custom Random Seed Algorithm Defines ---------------------------------------------- */ +/* Random Seed according to FIPS 186-2 SHA1 */ +# if !defined (CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_FIPS_186_2_SHA1 (0u) +# endif +/* Random Seed according to NIST 800-90A CTR_DRBG with AES-128 */ +# if !defined (CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ALGORITHM */ +# define CRYPTO_30_LIBCV_RNG_NIST_800_90A_CTR_DRBG_AES128 (1u) +# endif + +# if !defined (CRYPTO_ALGOFAM_CUSTOM_SECURE_BOOT) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_SECURE_BOOT (160u) /* This define is deprecated */ +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM_VHSM_SECURE_BOOT) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_VHSM_SECURE_BOOT (160u) +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM_SOFTWARE_DOWNLOAD) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_SOFTWARE_DOWNLOAD (161u) /* This define is deprecated */ +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM_VHSM_SOFTWARE_DOWNLOAD) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_VHSM_SOFTWARE_DOWNLOAD (161u) +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM_VHSM_FIRMWARE_UPDATE) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_VHSM_FIRMWARE_UPDATE (163u) +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM_VHSM_BOOT_UPDATE) /* COV_CRYPTO_30_VHSM_CUSTOM_ALGORITHM */ +# define CRYPTO_ALGOFAM_CUSTOM_VHSM_BOOT_UPDATE (164u) +# endif + +/* vHsm Core */ +# if !defined (CRYPTO_KE_CUSTOM_VHSM_VERSION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_VERSION (3020u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_UID) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_UID (3021u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_PERFORM_PERSISTING) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_PERFORM_PERSISTING (3022u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_ERRORLOG) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_ERRORLOG (3023u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_ADDRESS) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_ADDRESS (3024u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_SIZE) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_SIZE (3025u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_CMAC) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_CMAC (3026u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_SANCTION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_SANCTION (3027u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_END) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_END (3028u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_RESULT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_RESULT (3037u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_FIRMWARE_UPDATE_START_UPDATER) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_FIRMWARE_UPDATE_START_UPDATER (3038u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_PERFORM_REPERSISTING) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_PERFORM_REPERSISTING (3036u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_KEY) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_SECURE_BOOT_SLOT_KEY (1u) +# endif + +/* vHsm Custom */ +# if !defined (CRYPTO_KE_CUSTOM_VHSM_BUNDLING_REQ) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_BUNDLING_REQ (3029u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_BUNDLING_RESP) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_BUNDLING_RESP (3030u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_BUNDLING_COUNTER) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_BUNDLING_COUNTER (3031u) +# endif + +/* vHsm Hal */ +# if !defined (CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION (3032u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_RESET_VECTORS) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_RESET_VECTORS (3033u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_OPTION_BYTES) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_OPTION_BYTES (3034u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_UPGP) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_UPGP (3035u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_STATUS_HSM2HOST) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_STATUS_HSM2HOST (3090u) +# endif +# if !defined (CRYPTO_KE_CUSTOM_VHSM_STATUS_HOST2HSM) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENTS */ +# define CRYPTO_KE_CUSTOM_VHSM_STATUS_HOST2HSM (3091u) +# endif + +# if !defined (CRYPTO_30_VHSM_DATAFLASH_START) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_DATAFLASH_START (0u) +# endif +# if !defined (CRYPTO_30_VHSM_DATAFLASH_STOP) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_DATAFLASH_STOP (1u) +# endif +# if !defined (CRYPTO_30_VHSM_CODEFLASH_START) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_CODEFLASH_START (2u) +# endif +# if !defined (CRYPTO_30_VHSM_CODEFLASH_STOP) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_CODEFLASH_STOP (3u) +# endif + +# if !defined (CRYPTO_30_VHSM_SANCTION_NONE) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_SANCTION_NONE (0u) +# endif +# if !defined (CRYPTO_30_VHSM_SANCTION_RESET) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_SANCTION_RESET (1u) +# endif +# if !defined (CRYPTO_30_VHSM_SANCTION_CUSTOM) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_SANCTION_CUSTOM (2u) +# endif +# if !defined (CRYPTO_30_VHSM_SANCTION_HALT) /* COV_CRYPTO_30_VHSM_CUSTOM_KEY_ELEMENT_VALUE */ +# define CRYPTO_30_VHSM_SANCTION_HALT (3u) +# endif + +#endif /* !defined (CRYPTO_30_VHSM_CUSTOM_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Custom.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.c b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.c new file mode 100644 index 0000000..6bb66ea --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.c @@ -0,0 +1,989 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_30_vHsm_Ipc.c + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Inter-processor communication between Host and Vector Hardware Security Module Firmware. + * + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_IPC_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_vHsm.h" +#include "Crypto_30_vHsm_Ipc.h" +#include "Crypto_30_vHsm_Jobs.h" +#include "Crypto_30_vHsm_Private.h" +#include "CryIf_Cbk.h" +#include "SchM_Crypto_30_vHsm.h" +#include "vstdlib.h" + +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ +#if !defined (CRYPTO_30_VHSM_LOCAL) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL static +#endif + +#if !defined (CRYPTO_30_VHSM_LOCAL_INLINE) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL_INLINE LOCAL_INLINE +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_VAR_NOINIT_32BIT +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*! Pointer to the IPC memory */ +P2VAR(uint32, CRYPTO_30_VHSM_VAR_NOINIT, CRYPTO_30_VHSM_VAR_NOINIT) Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES]; + +#define CRYPTO_30_VHSM_STOP_SEC_VAR_NOINIT_32BIT +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SendRequestToIpc() + *********************************************************************************************************************/ +/*! + * \brief Serialize the jobrequest + * \details - + * \param[in] jobRequestId Valid Id of the jobrequest + * \param[in] jobRequestBuffer Valid buffer pointer where the job shall be serialized. + * Must at least be of size CRYPTO_30_VHSM_IPC_TX_CHANNEL_MEMORY_SIZE. + * \return TRUE if the job request was correctly serialized, otherwise E_NOT_OK + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SendRequestToIpc( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_JobRequestBufferPtrType jobRequestBuffer); + +/********************************************************************************************************************** + * Crypto_30_vHsm_GetResponseFromIpc() + *********************************************************************************************************************/ +/*! + * \brief Deserialize the job response + * \details - + * \param[in] partitionIdx Valid partition index + * \param[in] rxChannelId Valid Channel where the response is allocated + * \param[in] writeIdx WriteIdx of the channel which will be used to acknowledge the response in the IPC. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetResponseFromIpc( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId, + uint32 writeIdx); + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SendRequestToIpc() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SendRequestToIpc( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Crypto_30_vHsm_JobRequestBufferPtrType jobRequestBuffer) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_vHsm_JobKindType jobRequestKind; +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + Crypto_JobRedirectionInfoType Crypto_JobRedirectionInfoDummy; + P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) Crypto_JobRedirectionInfoPtr; + boolean isCryptoJob = FALSE; +#endif + uint32 jobInformation; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Get the kind of the job request */ + jobRequestKind = Crypto_30_vHsm_GetKindOfJobRequest(jobRequestId); + + if ((jobRequestKind == CRYPTO_30_VHSM_CRYPTO_JOBKIND) +#if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) + || (jobRequestKind == CRYPTO_30_VHSM_CRYPTO_MACGEN_JOBKIND) + || (jobRequestKind == CRYPTO_30_VHSM_CRYPTO_MACVER_JOBKIND) +#endif + ) + { +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + isCryptoJob = TRUE; +#endif + } + /* #21 Add job request header. */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + Crypto_30_vHsm_SetCounterOfJobRequest(jobRequestId, (Crypto_30_vHsm_CounterOfJobRequestType)(Crypto_30_vHsm_GetCounterOfJobRequest(jobRequestId) + 1u)); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + /* still some free flags... redirection flags are only 5 bit currently */ + jobInformation = (((uint32)(Crypto_30_vHsm_GetCounterOfJobRequest(jobRequestId)) << CRYPTO_30_VHSM_JOBREQUEST_COUNTER_BITPOSITION) + | ((uint32)(Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId)) << CRYPTO_30_VHSM_JOBREQUEST_OBJECTID_BITPOSITION) + | jobRequestId); +#else + jobInformation = ((((uint32)(Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId)) << CRYPTO_30_VHSM_JOBREQUEST_OBJECTID_BITPOSITION)) | jobRequestId); +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((isCryptoJob == TRUE) + && (Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId)->jobRedirectionInfoRef != NULL_PTR)) /* PRQA S 3415 */ /* MD_CRYPTO_30_VHSM_3415_LOGICAL_OPERATOR */ + { + jobInformation |= (((uint32)Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId)->jobRedirectionInfoRef->redirectionConfig) << CRYPTO_30_VHSM_JOBREQUEST_REDIRECTION_BITPOSITION); + Crypto_JobRedirectionInfoPtr = Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId)->jobRedirectionInfoRef; + } + else + { + Crypto_JobRedirectionInfoDummy.redirectionConfig = 0u; + Crypto_JobRedirectionInfoPtr = &Crypto_JobRedirectionInfoDummy; + } +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + /* Buffer size */ + Crypto_30_vHsm_Serialize_Uint32(CRYPTO_30_VHSM_IPC_TX_CHANNEL_ENTRY_MEMORY_SIZE, jobRequestBuffer); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + /* Header */ + Crypto_30_vHsm_Serialize_Uint32(jobInformation, &jobRequestBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(jobRequestKind, &jobRequestBuffer[8]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32((uint32)Crypto_30_vHsm_IsCancelOfJobRequest(jobRequestId), &jobRequestBuffer[12]); /* PRQA S 0310, 3305, 4304 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#else /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + /* Header */ + Crypto_30_vHsm_Serialize_Uint32(jobInformation, &jobRequestBuffer[0]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(jobRequestKind, &jobRequestBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif + + /* Set init values inside jobRequest */ + Crypto_30_vHsm_SetUsedBufferOfJobRequest(jobRequestId, 0u); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + Crypto_30_vHsm_SetTrimmedOutputBufferOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif + + /* #22 Call job request transmission function. */ + switch (jobRequestKind) + { +#if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) + case CRYPTO_30_VHSM_CRYPTO_MACVER_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_MacVer */ + jobRequestId, + Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId), + &jobRequestBuffer[16] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , Crypto_JobRedirectionInfoPtr +# endif + ); + break; + case CRYPTO_30_VHSM_CRYPTO_MACGEN_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_MacGen */ + jobRequestId, + Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId), + &jobRequestBuffer[16] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , Crypto_JobRedirectionInfoPtr +# endif + ); + break; +#endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) +# if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) + case CRYPTO_30_VHSM_KEYMANAGEMENT_KEYDERIVEJOB_JOBKIND: +# endif +#endif + case CRYPTO_30_VHSM_CRYPTO_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_CryptoJob( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob */ + jobRequestId, + Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId), +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + &jobRequestBuffer[8] +#else + &jobRequestBuffer[16] +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , Crypto_JobRedirectionInfoPtr +#endif + ); + break; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + case CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND: +#endif + case CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_KeyMJob( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob */ + jobRequestId, + Crypto_30_vHsm_GetKeyMJobOfJobRequest(jobRequestId), +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + &jobRequestBuffer[8] +#else + &jobRequestBuffer[16] +#endif + ); + break; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + case CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob_CopyPartial */ + jobRequestId, + Crypto_30_vHsm_GetKeyMJobOfJobRequest(jobRequestId), + &jobRequestBuffer[16]); + break; +# if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) + case CRYPTO_30_VHSM_KEYMANAGEMENT_KEYDERIVEJOB_JOBKIND: + retVal = Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_KeyMJob_KeyDerive */ + jobRequestId, + Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId), + &jobRequestBuffer[16]); + break; +# endif /* (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) */ +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + default: /* COV_CRYPTO_30_VHSM_MISRA_ADDITIONAL_STATEMENT */ /* PRQA S 2016 */ /* MD_MSR_EmptyClause */ + break; + } + + return retVal; +} /* Crypto_30_vHsm_SendRequestToIpc() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_GetResponseFromIpc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_GetResponseFromIpc( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId, + uint32 writeIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_PARAM_VALUE; + + Crypto_30_vHsm_JobRequestIterType jobRequestId; + uint32 jobResponseData; + Crypto_30_vHsm_JobKindType jobResponseKind; + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer = (Crypto_30_vHsm_JobResponseBufferPtrType)Crypto_30_vHsm_Ipc_GetRxChannelBuffer(partitionIdx, rxChannelId); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + + /* #20 Parse and remove job response header. */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + jobResponseData = Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER */ + jobResponseKind = (Crypto_30_vHsm_JobKindType)Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[8]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER */ +#else + jobResponseData = Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[0]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER */ +#endif + jobRequestId = jobResponseData & CRYPTO_30_VHSM_JOBRESPONSE_ID_MASK; + + /* #30 Check if jobRequestKind is valid. */ + if ((jobRequestId >= Crypto_30_vHsm_GetSizeOfJobRequest())) + { + /* Remove the invalid response from the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + } +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + /* Check if the received job belongs to the correct partition */ + else if (partitionIdx != Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(jobRequestId)) + { + /* Remove the invalid response from the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + } +#endif /* (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + /* Check if this is the response we expect */ + else if (((Crypto_30_vHsm_CounterOfJobRequestType)((jobResponseData & CRYPTO_30_VHSM_JOBRESPONSE_COUNTER_MASK) >> CRYPTO_30_VHSM_JOBRESPONSE_COUNTER_BITPOSITION) != Crypto_30_vHsm_GetCounterOfJobRequest(jobRequestId))) + { + /* Remove the invalid response from the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + } +#else /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + /* Check if the jobRequestKind inside the request is the same as in the jobRequestList */ + else if (Crypto_30_vHsm_GetKindOfJobRequest(jobRequestId) != jobResponseKind) + { + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + } +#endif + /* check if jobrequest still waits for an answer */ + else if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_JOBREQUEST_STATE_PROCESSING) + { +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT) + { + Crypto_30_vHsm_RecoverFromTimeout(partitionIdx, jobRequestId, writeIdx, /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_RecoverFromTimeout */ +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + jobResponseData, + &jobResponseBuffer[4]); +# else + &jobResponseBuffer[12]); +# endif + errorId = CRYPTO_E_NO_ERROR; + } + else +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + { + /* Remove the invalid response from the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + } + } + else + { + jobResponseKind = Crypto_30_vHsm_GetKindOfJobRequest(jobRequestId); + /* #50 Call job response receive function for processing. */ + if ((jobResponseKind == CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND) + || (jobResponseKind == CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND)) + { + Crypto_30_vHsm_ReceiveResponse_KeyMJob( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_ReceiveResponse_KeyMJob */ + jobRequestId, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + jobResponseData, + &jobResponseBuffer[4]); +#else + &jobResponseBuffer[12]); +#endif + } + else + { + Crypto_30_vHsm_ReceiveResponse_CryptoJob( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_ReceiveResponse_CryptoJob */ + jobRequestId, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + jobResponseData, + &jobResponseBuffer[4]); +#else + &jobResponseBuffer[12]); +#endif + } + + /* #61 Commit the reception of the job response to the IPC */ + Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) = writeIdx; /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + + /* #62 Indicate that the channel can now be used by other jobs */ + Crypto_30_vHsm_SetChannelState(rxChannelId, CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE, partitionIdx); /* SBSW_CRYPTO_30_VHSM_CSL01_CHANNELSTATE */ + + /* #63 State processing of job request is done and job results are available. */ + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_RESULT_AVAILABLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + errorId = CRYPTO_E_NO_ERROR; +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + /* #100 Call Det if error occurred */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_COPYJOBRESPONSERXDATA, errorId); + } +#else + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + +} /* Crypto_30_vHsm_GetResponseFromIpc() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_TransmitRequest() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_TransmitRequest( + Crypto_30_vHsm_ChannelIdType txChannelId, + Crypto_30_vHsm_JobRequestIterType jobRequestId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + uint8 errorId = CRYPTO_30_VHSM_IPC_E_NO_ERROR; + uint32 readIdx; + uint32 writeIdx; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(jobRequestId); + + /* Use local copy of read index to prevent concurrency issues. */ + readIdx = Crypto_30_vHsm_Ipc_GetTxChannelReadIdx(partitionIdx, txChannelId); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + writeIdx = Crypto_30_vHsm_Ipc_GetTxChannelWriteIdx(partitionIdx, txChannelId); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + + /* ----- Implementation ----------------------------------------------- */ + + /* #10 Return BUSY when channel is full. */ + if ((writeIdx - readIdx) > 0u) + { + /* Error: Tx Channel is full. */ + retVal = CRYPTO_E_BUSY; +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* Error: Cannot allocate enough space for job request in Tx channel. */ + errorId = CRYPTO_30_VHSM_IPC_E_CANNOT_ALLOCATE_JOBREQUEST_BUFFER; +#endif + } + else /* (writeIdx - readIdx) < CRYPTO_30_VHSM_IPC_CHANNEL_SIZE */ + { + /* #30 Copy job request data from driver into Tx channel for transmission to vHsm. */ + retVal = Crypto_30_vHsm_SendRequestToIpc(jobRequestId, (Crypto_30_vHsm_JobRequestBufferPtrType)Crypto_30_vHsm_Ipc_GetTxChannelBuffer(partitionIdx, txChannelId)); /* PRQA S 0310 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SendRequestToIpc */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (E_OK != retVal) + { + /* Error: Copying job request data for transmission failed. */ + errorId = CRYPTO_30_VHSM_IPC_E_CANNOT_COPY_JOBREQUEST_DATA; + } +#endif + } + + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_30_VHSM_IPC_E_NO_ERROR) + { + /* #100 Report Det if error occurred */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_IPC_SID_TRANSMITJOBREQUEST, errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_Ipc_TransmitRequest() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_ReceiveResponse() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ReceiveResponse( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32 readIdx; + uint32 writeIdx; + + /* ----- Implementation ----------------------------------------------- */ + readIdx = Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + /* Use local copy of write index to prevent concurrency issues. */ + writeIdx = Crypto_30_vHsm_Ipc_GetRxChannelWriteIdx(partitionIdx, rxChannelId); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + + /* #10 Receive job responses from Rx channel if present. */ + if (readIdx != writeIdx) + { + /* #40 Copy job response data to driver for processing. */ + /* When a job response was invalid it is marked as read and will be discared! */ + Crypto_30_vHsm_GetResponseFromIpc(partitionIdx, rxChannelId, writeIdx); + } +} /* Crypto_30_vHsm_Ipc_ReceiveResponse() */ + +#define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_GetDet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_GetDet( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + P2VAR(uint16, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) moduleId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) instanceId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) apiId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) errorId) +{ + /* ----- Local Variables ---------------------------------------------- */ + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Get the values of the Det stored inside the Ipc */ + /* PRQA S 0310, 3305 4 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + *moduleId = Crypto_30_vHsm_Ipc_GetDetModuleId(partitionIdx); /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + *instanceId = Crypto_30_vHsm_Ipc_GetDetInstanceId(partitionIdx); /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + *apiId = Crypto_30_vHsm_Ipc_GetDetApiId(partitionIdx); /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + *errorId = Crypto_30_vHsm_Ipc_GetDetErrorId(partitionIdx); /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + +} /* Crypto_30_vHsm_Ipc_GetDet() */ +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + +/********************************************************************************************************************* + * Crypto_30_vHsm_Ipc_ProcessChannels() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ProcessChannels(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* ----- Implementation ----------------------------------------------- */ + Crypto_30_vHsm_ChannelStateIterType rxChannel; + + /* #10 Process the job response available in the IPC */ + for (rxChannel = 0u; rxChannel < Crypto_30_vHsm_GetSizeOfChannelState(partitionIdx); rxChannel ++) + { + if (Crypto_30_vHsm_GetChannelState(rxChannel, partitionIdx) == CRYPTO_30_VHSM_IPC_CHANNELSTATE_ASYNC) + { + Crypto_30_vHsm_Ipc_ReceiveResponse(partitionIdx, (Crypto_30_vHsm_ChannelIdType)rxChannel); + } + } +} /* Crypto_30_vHsm_Ipc_ProcessChannels() */ + +/********************************************************************************************************************* + * Crypto_30_vHsm_Ipc_ProcessCallbacks() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ProcessCallbacks(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Crypto_30_vHsm_JobRequestIterType jobRequestId; + Std_ReturnType jobRetVal; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Iterate over job request slots */ + for (jobRequestId = 0u; jobRequestId < Crypto_30_vHsm_GetSizeOfJobRequest(); jobRequestId++) + { +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + /* #11 Check if the jobRequestId mapped to the current partition */ + if (Crypto_30_vHsm_GetPartitionIdxOfObjectInfo(jobRequestId) == partitionIdx) +#endif + { + /* #21 Check if the job is an async job */ + if (Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) == CRYPTO_PROCESSING_ASYNC) + { + /* #22 Check if the job request lock is still set */ + if (Crypto_30_vHsm_IsLockOfJobRequest(jobRequestId)) + { + /* #23 Check if the job request is finished */ + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_JOBREQUEST_STATE_RESULT_AVAILABLE) + { + /* #30 Get the corresponding job */ + P2VAR(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) tmpJob = Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId); + + /* #40 Set the state of the job */ + tmpJob->CRYPTO_30_VHSM_JOB_STATE_MEMBER = Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO_JOB_PTR */ + + jobRetVal = (Std_ReturnType)Crypto_30_vHsm_GetResultOfJobRequest(jobRequestId); + Crypto_30_vHsm_SetStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_JOBREQUEST_STATE_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( /* PRQA S 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ + CRYPTO_30_VHSM_CALLOUT_ASYNC, + Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId), + Crypto_30_vHsm_GetContextClassOfJobRequest(jobRequestId), + Crypto_30_vHsm_GetContextIdOfJobRequest(jobRequestId)); +#endif + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (Crypto_30_vHsm_GetTimeoutRecoveryStateOfJobRequest(jobRequestId) == CRYPTO_30_VHSM_TIMEOUT_RECOVERY_TRIGGERED) + { + /* This is the response to the cancel job of the timeout recovery. */ + if(jobRetVal == E_OK) + { + /* Cancel was successful. Recovery was successful! */ + + /* Free the job request lock */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* Free the object lock */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_3(); + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_3(); + + /* Set recovery state to idle */ + Crypto_30_vHsm_SetTimeoutRecoveryStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_TIMEOUT_RECOVERY_IDLE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* Call timeout recovered callout */ + Crypto_30_vHsm_TimeoutRecovered_Callout(Crypto_30_vHsm_GetHsmObjIdOfObjectInfo(jobRequestId)); + } + else + { + /* Cancel did not work. Set state to pending to try again. */ + Crypto_30_vHsm_SetTimeoutRecoveryStateOfJobRequest(jobRequestId, CRYPTO_30_VHSM_TIMEOUT_RECOVERY_PENDING); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + } + else +#endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + { + /* #50 Free the job request lock */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #60 Check if the mode was finish */ + if ((jobRetVal != E_OK) + || ((tmpJob->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode & CRYPTO_OPERATIONMODE_FINISH) == CRYPTO_OPERATIONMODE_FINISH)) + { + /* #70 Remove the lock from the driver object to accept new jobs */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_3(); + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_3(); + } + + /* #80 Call the CryIf callback */ + CryIf_CallbackNotification( + tmpJob, /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + jobRetVal); + } + } + } + } + } + } + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + +} /* Crypto_30_vHsm_Ipc_ProcessCallbacks() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_MainFunctionHandler() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_MainFunctionHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ +#if (CRYPTO_30_VHSM_INTERRUPT_MODE == STD_OFF) + /* #10 Process the job response available in the IPC */ + Crypto_30_vHsm_Ipc_ProcessChannels(partitionIdx); + + /* #20 Process the callbacks of async jobs */ + Crypto_30_vHsm_Ipc_ProcessCallbacks(partitionIdx); +#endif + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + Crypto_30_vHsm_HandleTimeout(partitionIdx); +#endif + + /* #30 Check Det if error occurred */ + Crypto_30_vHsm_Ipc_HandleDet(partitionIdx); /* PRQA S 2987 */ /* MD_CRYPTO_30_VHSM_2987_HANDLEDET */ +} /* Crypto_30_vHsm_MainFunctionHandler() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_InitMemoryHandler() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_InitMemoryHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #10 Set the mode to uninitialized */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + Crypto_30_vHsm_SetPartitionInitialized((uint8)CRYPTO_30_VHSM_UNINIT, partitionIdx); /* SBSW_CRYPTO_30_VHSM_WRITE_PARTITION_DATA */ +#endif + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Crypto_30_vHsm_InitMemoryHandler() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_HandleDet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_HandleDet(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) /* PRQA S 3206 */ /* MD_CRYPTO_30_VHSM_3206_SINGLE_PARTITION_IPC_ACCESS */ +{ + if (Crypto_30_vHsm_Ipc_GetDetReportFlag(partitionIdx) == TRUE) /* PRQA S 0310, 3305, 4340 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ + { +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + /* #10 Check if a Det error has been reported */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_1(); + if (Crypto_30_vHsm_Ipc_GetDetReportFlag(partitionIdx) == TRUE) /* PRQA S 0310, 3305, 4340 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* COV_CRYPTO_30_VHSM_DOUBLE_CHECK */ + { + uint16 moduleId; + uint8 instanceId, apiId, errorId; + + /* #20 Get the Det parameters */ + Crypto_30_vHsm_Ipc_GetDet(partitionIdx, &moduleId, &instanceId, &apiId, &errorId); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + + /* #30 Acknowledge the forwarding of the Det Error */ + Crypto_30_vHsm_Ipc_SetDetReportFlag(partitionIdx, FALSE); /* PRQA S 0310, 3305, 4404 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_1(); + +# if (CRYPTO_30_VHSM_DET_INSTANCE_MASK != 0) + /* #35 Modify the InstanceId of the Det to distinguish between DET from vHsm and DET from application core */ + instanceId |= CRYPTO_30_VHSM_DET_INSTANCE_MASK; +# endif + + /* #40 Call the Det */ + (void)Det_ReportError(moduleId, instanceId, apiId, errorId); + } + else + { + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_1(); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + /* #50 Acknowledge the forwarding of the Det Error */ + Crypto_30_vHsm_Ipc_SetDetReportFlag(partitionIdx, FALSE); /* PRQA S 0310, 3305, 4404 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ +#endif + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + } +} /* Crypto_30_vHsm_Ipc_HandleDet() */ + +/********************************************************************************************************************* + * Crypto_30_vHsm_Ipc_ResponseIsrHandler() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ResponseIsrHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) /* PRQA S 3206 */ /* MD_CRYPTO_30_VHSM_3206_SINGLE_PARTITION_IPC_ACCESS */ +{ + /* ----- Implementation ----------------------------------------------- */ + + /* #10 Clear interrupt flag if not already done by OS */ + Crypto_30_vHsm_ClearInterruptOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ /*lint !e522 */ + +#if (CRYPTO_30_VHSM_INTERRUPT_MODE == STD_ON) + /* #20 Process the job response available in the IPC */ + Crypto_30_vHsm_Ipc_ProcessChannels(partitionIdx); + + /* #30 Process the callbacks of async jobs */ + Crypto_30_vHsm_Ipc_ProcessCallbacks(partitionIdx); +#endif +} /* Crypto_30_vHsm_Ipc_ResponseIsrHandler() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define CRYPTO_30_VHSM_START_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* #10 Get the offset of the ready flag */ + volatile uint32 readyFlagOffsetTmp = Crypto_30_vHsm_Ipc_MemoryLayout.readyFlagOffset; + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx] = &Crypto_30_vHsm_GetIpcMemoryPtr(partitionIdx)[0U]; /* SBSW_CRYPTO_30_VHSM_IPC_MEMORY_PTR_ARRAY */ +#else + Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx] = &Crypto_30_vHsm_Ipc_Memory[0U]; /* SBSW_CRYPTO_30_VHSM_IPC_MEMORY_PTR_ARRAY */ +#endif + +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Start_Callout( + CRYPTO_30_VHSM_CALLOUT_HSMREADY, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +#endif +#if (CRYPTO_30_VHSM_IS_VTT==STD_OFF) /* COV_CRYPTO_30_VHSM_VTT */ + /* #20 Wait until the ready flag has been set by the vHsm */ + while (Crypto_30_vHsm_CheckForHsmReady()) /* PRQA S 0303, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT */ + { +# if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Loop_Callout( + CRYPTO_30_VHSM_CALLOUT_HSMREADY, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +# endif + } +#endif /* (CRYPTO_30_VHSM_IS_VTT==STD_OFF) */ + +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( + CRYPTO_30_VHSM_CALLOUT_HSMREADY, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +#endif + +#if (CRYPTO_30_VHSM_IPC_INITIALIZATION == STD_ON) + /* Check if Ipc has already been initialized before */ +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + if ((*(volatile uint32*)CRYPTO_30_VHSM_HOST2_HSM_ADDRESS & ((uint32)1u << (uint32)Crypto_30_vHsm_GetIpcInstanceId(partitionIdx))) != ((uint32)1u << (uint32)Crypto_30_vHsm_GetIpcInstanceId(partitionIdx))) /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ +# else + if (Crypto_30_vHsm_IsIpcNotInitialized()) /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ +# endif + { + /* Initialize IPC */ + VStdLib_MemClr(Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[partitionIdx], (uint32)CRYPTO_30_VHSM_IPC_MEMORY_SIZE); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_INIT_IPC_MEMORY */ + + /* Indicate that IPC has been initialized. HSM will now be able to use the IPC. */ + Crypto_30_vHsm_IndicateInitializedIpcOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + Crypto_30_vHsm_TriggerInterruptOfPartition(partitionIdx); /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_TRIGGER_INTERRUPT */ /* SBSW_CRYPTO_30_VHSM_TRIGGER_INTERRUPT */ /*lint !e522 */ + } +#endif /* (CRYPTO_30_VHSM_IPC_INITIALIZATION == STD_ON) */ +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Start_Callout( + CRYPTO_30_VHSM_CALLOUT_IPCINIT, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +#endif + while ((Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, readyFlagOffsetTmp)) != 0xDEADBEEFu) /* PRQA S 0310, 3305, 0404 */ /* MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ /* FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT */ + { +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Loop_Callout( + CRYPTO_30_VHSM_CALLOUT_IPCINIT, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +#endif + } +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( + CRYPTO_30_VHSM_CALLOUT_IPCINIT, + 0u, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED, + 0u); +#endif +} /* Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition() */ + +#define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Ipc.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.h new file mode 100644 index 0000000..dc1bbcd --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc.h @@ -0,0 +1,377 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_30_vHsm_Ipc.h + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Inter-processor communication between Host and Vector Hardware Security Module Firmware. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_IPC_H) +# define CRYPTO_30_VHSM_IPC_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_vHsm_Cfg.h" +# include "Crypto_30_vHsm_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* API services IDs */ +# define CRYPTO_30_VHSM_IPC_SID_TRANSMITJOBREQUEST (0x80u) +# define CRYPTO_30_VHSM_IPC_SID_RECEIVEJOBRESPONSES (0x81u) + +/* Development error types */ +# define CRYPTO_30_VHSM_IPC_E_NO_ERROR (0xFFu) +# define CRYPTO_30_VHSM_IPC_E_PARAM_POINTER (0x81u) +# define CRYPTO_30_VHSM_IPC_E_INVALID_CHANNEL (0x82u) +# define CRYPTO_30_VHSM_IPC_E_CANNOT_ALLOCATE_JOBREQUEST_BUFFER (0x83u) +# define CRYPTO_30_VHSM_IPC_E_CANNOT_COPY_JOBREQUEST_DATA (0x84u) + +# define CRYPTO_30_VHSM_MANAGEMENT_JOBREQUEST_ID Crypto_30_vHsm_GetManagementDriverObjectOfvHsm() +# define CRYPTO_30_VHSM_ACCEPT_ANY_JOBID (0xFFFFFFFFu) + +# define CRYPTO_30_VHSM_JOBREQUEST_ID_BITPOSITION (0u) +# define CRYPTO_30_VHSM_JOBREQUEST_OBJECTID_BITPOSITION (8u) +# define CRYPTO_30_VHSM_JOBREQUEST_REDIRECTION_BITPOSITION (16u) +# define CRYPTO_30_VHSM_JOBREQUEST_COUNTER_BITPOSITION (24u) + +# define CRYPTO_30_VHSM_JOBRESPONSE_ID_BITPOSITION (0u) +# define CRYPTO_30_VHSM_JOBRESPONSE_STATE_BITPOSITION (8u) +# define CRYPTO_30_VHSM_JOBRESPONSE_RESULT_BITPOSITION (16u) +# define CRYPTO_30_VHSM_JOBRESPONSE_COUNTER_BITPOSITION (24u) + +# define CRYPTO_30_VHSM_JOBRESPONSE_ID_MASK (0x000000FFu) +# define CRYPTO_30_VHSM_JOBRESPONSE_COUNTER_MASK (0xFF000000u) + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/* IPC */ +/* PRQA S 3453 IpcMacros3543 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ +# define Crypto_30_vHsm_Ipc_IsHsmReady(partitionIdx) (Crypto_30_vHsm_Ipc_GetReadyFlag(partitionIdx) == 0xdeadbeefu) +# define Crypto_30_vHsm_Ipc_EndRamExec(partitionIdx) Crypto_30_vHsm_Ipc_SetEndRamExecFlag(partitionIdx, TRUE) +# define Crypto_30_vHsm_Ipc_IsRamExec(partitionIdx) Crypto_30_vHsm_Ipc_GetRamExecFlag(partitionIdx) +# define Crypto_30_vHsm_Ipc_IsDetReported(partitionIdx) Crypto_30_vHsm_Ipc_GetDetReportFlag(partitionIdx) + +# if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES<2) +# define Crypto_30_vHsm_GetPartitionIdxOptimized(partitionIdx) 0u +# else +# define Crypto_30_vHsm_GetPartitionIdxOptimized(partitionIdx) (partitionIdx) +# endif + +# define Crypto_30_vHsm_Ipc_GetMemoryPtr8(partitionIdx, offset) (&(((P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[Crypto_30_vHsm_GetPartitionIdxOptimized(partitionIdx)])[offset])) +# define Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, offset) (*(volatile uint32*)&(((P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[Crypto_30_vHsm_GetPartitionIdxOptimized(partitionIdx)])[offset])) + +# define Crypto_30_vHsm_Ipc_GetTxChannelBuffer(partitionIdx, txChannelId) (Crypto_30_vHsm_Ipc_GetMemoryPtr8(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.txChannelMemoryLayout[txChannelId].bufferOffset)) + +# define Crypto_30_vHsm_Ipc_GetTxChannelWriteIdx(partitionIdx, txChannelId) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.txChannelMemoryLayout[txChannelId].writeIdxOffset)) + +# define Crypto_30_vHsm_Ipc_GetTxChannelReadIdx(partitionIdx, txChannelId) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.txChannelMemoryLayout[txChannelId].readIdxOffset)) + +# define Crypto_30_vHsm_Ipc_GetRxChannelBuffer(partitionIdx, rxChannelId) (Crypto_30_vHsm_Ipc_GetMemoryPtr8(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.rxChannelMemoryLayout[rxChannelId].bufferOffset)) + +# define Crypto_30_vHsm_Ipc_GetRxChannelWriteIdx(partitionIdx, rxChannelId) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.rxChannelMemoryLayout[rxChannelId].writeIdxOffset)) + +# define Crypto_30_vHsm_Ipc_GetRxChannelReadIdx(partitionIdx, rxChannelId) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.rxChannelMemoryLayout[rxChannelId].readIdxOffset)) + +# define Crypto_30_vHsm_Ipc_GetRamExecFlag(partitionIdx) ((boolean)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.ramExecFlagOffset)) +# define Crypto_30_vHsm_Ipc_SetEndRamExecFlag(partitionIdx, value) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.endRamExecFlagOffset) = (value)) + +# define Crypto_30_vHsm_Ipc_GetReadyFlag(partitionIdx) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.readyFlagOffset)) + +# define Crypto_30_vHsm_Ipc_GetDetReportFlag(partitionIdx) ((boolean)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detReportFlagOffset)) +# define Crypto_30_vHsm_Ipc_SetDetReportFlag(partitionIdx, value) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detReportFlagOffset) = (value)) +# define Crypto_30_vHsm_Ipc_GetDetModuleId(partitionIdx) ((uint16)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detModuleIdOffset)) +# define Crypto_30_vHsm_Ipc_GetDetInstanceId(partitionIdx) ((uint8)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detInstanceIdOffset)) +# define Crypto_30_vHsm_Ipc_GetDetApiId(partitionIdx) ((uint8)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detApiIdOffset)) +# define Crypto_30_vHsm_Ipc_GetDetErrorId(partitionIdx) ((uint8)Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.detErrorIdOffset)) + +# define Crypto_30_vHsm_Ipc_vHsmProtocolVersion(partitionIdx) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.protocolInfoOffset)) +# define Crypto_30_vHsm_Ipc_DriverProtocolVersion(partitionIdx) (Crypto_30_vHsm_Ipc_GetMemoryValue32(partitionIdx, Crypto_30_vHsm_Ipc_MemoryLayout.protocolInfoOffset+4u)) + +/* PRQA L:IpcMacros3543 */ + +# define CRYPTO_30_VHSM_IPC_CHANNELSTATE_FREE (0x00u) +# define CRYPTO_30_VHSM_IPC_CHANNELSTATE_ASYNC (CRYPTO_PROCESSING_ASYNC + 1u) +# define CRYPTO_30_VHSM_IPC_CHANNELSTATE_SYNC (CRYPTO_PROCESSING_SYNC + 1u) + +/*! Serialize a uint32 to the IPC buffer with the offset and increment the offset by 4 afterwards */ +# define Crypto_30_vHsm_Serialize_Uint32(value, bufferPtr) (*(P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))(bufferPtr)) = (uint32)(value) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +/*! Serialize a pointer to the IPC buffer with the offset and increment the offset by 4 afterwards */ +# define Crypto_30_vHsm_Serialize_Ptr32(value, bufferPtr) (*(P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))(bufferPtr)) = (uint32)(value) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +/*! Deserialize a uint32 to the IPC buffer with the offset and increment the offset by 4 afterwards */ +# define Crypto_30_vHsm_Deserialize_Uint32(bufferPtr) (*(P2CONST(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))(bufferPtr)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +typedef struct Crypto_30_vHsm_Ipc_Channel_MemoryLayoutTypeStruct +{ + uint32 writeIdxOffset; /*!< Shared memory offset to buffer reserved for write index (value equals index of next free entry) of channel. */ + uint32 readIdxOffset; /*!< Shared memory offset to buffer reserved for read index (value equals index of next pending entry) of channel. */ + uint32 bufferOffset; /*!< Shared memory offset to buffer reserved for all channel entries. */ +} Crypto_30_vHsm_Ipc_Channel_MemoryLayoutType; + +typedef struct Crypto_30_vHsm_Ipc_MemoryLayoutTypeStruct +{ + uint32 protocolInfoOffset; /*!< Shared memory offsets to buffers reserved for vHSM protocol info. */ + Crypto_30_vHsm_Ipc_Channel_MemoryLayoutType txChannelMemoryLayout[CRYPTO_30_VHSM_IPC_CHANNELS]; /*!< Describes the memory layout of all TX channels. */ + Crypto_30_vHsm_Ipc_Channel_MemoryLayoutType rxChannelMemoryLayout[CRYPTO_30_VHSM_IPC_CHANNELS]; /*!< Describes the memory layout of all RX channels. */ + uint32 stackProtectionCanaryPE1Offset; /*!< Shared memory offsets to buffers reserved for vHSM stack protection canary Appl Core 1. */ + uint32 stackProtectionCanaryPE2Offset; /*!< Shared memory offsets to buffers reserved for vHSM stack protection canary Appl Core 2. */ + uint32 seedOffset; /*!< Shared memory offset to buffer reserved for vHSM random seed. */ + uint32 detModuleIdOffset; /*!< Shared memory offsets to buffers reserved for vHSM development error detection (DET module). */ + uint32 detInstanceIdOffset; /*!< Shared memory offsets to buffers reserved for vHSM development error detection (DET instance id). */ + uint32 detApiIdOffset; /*!< Shared memory offsets to buffers reserved for vHSM development error detection (DET api id). */ + uint32 detErrorIdOffset; /*!< Shared memory offsets to buffers reserved for vHSM development error detection (DET error id). */ + uint32 readyFlagOffset; /*!< Shared memory offset to buffer reserved for vHSM Ready flag. */ + uint32 endRamExecFlagOffset; /*!< Shared memory offset to buffer reserved for vHSM End-RAM-Execution flag. */ + uint32 ramExecFlagOffset; /*!< Shared memory offset to buffer reserved for vHSM Is-RAM-Execution flag. */ + uint32 detReportFlagOffset; /*!< Shared memory offset to buffer reserved for vHSM Det-Report flag. */ + +} Crypto_30_vHsm_Ipc_MemoryLayoutType; + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_VHSM_START_SEC_IPC_MEMORY_VAR_NOINIT_32BIT +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_STOP_SEC_IPC_MEMORY_VAR_NOINIT_32BIT +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_VAR_NOINIT_32BIT +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*! Pointer to the IPC memory */ +extern P2VAR(uint32, CRYPTO_30_VHSM_VAR_NOINIT, CRYPTO_30_VHSM_VAR_NOINIT) Crypto_30_vHsm_Ipc_MemoryPtrOfPartition[CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES]; + +# define CRYPTO_30_VHSM_STOP_SEC_VAR_NOINIT_32BIT +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_CONST_UNSPECIFIED +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*! Layout of the IPC memory */ +extern CONST(Crypto_30_vHsm_Ipc_MemoryLayoutType, CRYPTO_30_VHSM_CONST) Crypto_30_vHsm_Ipc_MemoryLayout; + +# define CRYPTO_30_VHSM_STOP_SEC_CONST_UNSPECIFIED +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_TransmitRequest() + *********************************************************************************************************************/ +/*! + * \brief Transmit job request + * \details - + * \param[in] txChannelId Valid TX channel Id + * \param[in] jobRequestId Valid job request Id + * \return TRUE if the job request was correctly transmitted, otherwise E_NOT_OK + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_TransmitRequest( + Crypto_30_vHsm_ChannelIdType txChannelId, + Crypto_30_vHsm_JobRequestIterType jobRequestId); + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_ReceiveResponse() + *********************************************************************************************************************/ +/*! + * \brief Receive job responses + * \details - + * \param[in] partitionIdx Valid partition index + * \param[in] rxChannelId Valid RX channel Id + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ReceiveResponse( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_ChannelIdType rxChannelId); + +# define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_GetDet() + *********************************************************************************************************************/ +/*! + * \brief Get DET error + * \details - + * \param[in] partitionIdx Valid partitionIdx + * \param[out] moduleId Valid pointer to hold module ID + * \param[out] instanceId Valid pointer to hold instance ID + * \param[out] apiId Valid pointer to hold API ID + * \param[out] errorId Valid pointer to hold error ID + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_GetDet( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + P2VAR(uint16, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) moduleId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) instanceId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) apiId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) errorId); +# endif /* (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_ProcessChannels() + *********************************************************************************************************************/ +/*! + * \brief Process IPC channels + * \details - + * \param[in] partitionIdx Valid partition index + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ProcessChannels(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_ProcessCallbacks() + *********************************************************************************************************************/ +/*! + * \brief Process IPC callbacks + * \details - + * \param[in] partitionIdx Valid partitionIdx + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + * \trace CREQ-Crypto-AsyncCallout + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ProcessCallbacks(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_HandleDet() + *********************************************************************************************************************/ +/*! + * \brief Checks if vHSM invokes a DET error and forwards it to Det module + * \details Gets parameters from IPC, acknowledges the handling and calls Det_ReportError + * \param[in] partitionIdx Valid partitionIdx + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_HandleDet(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_MainFunctionHandler() + *********************************************************************************************************************/ +/*! + * \brief Main function handling the IPC + * \details - + * \param[in] partitionIdx Valid partitionIdx + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_MainFunctionHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_InitMemoryHandler() + *********************************************************************************************************************/ +/*! \brief The function initializes partition specific variables, which cannot be initialized with the startup code. + * \details Initialize component variables at power up. + * \param[in] partitionIdx Valid identifier of the partition. + * \pre Module is uninitialized. + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_InitMemoryHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_ResponseIsrHandler() + *********************************************************************************************************************/ +/*! + * \brief Response isr handler called by the ISR + * \details - + * \param[in] partitionIdx Valid partitionIdx + * \pre - + * \context ISR2 + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_ResponseIsrHandler(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define CRYPTO_30_VHSM_START_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition() + *********************************************************************************************************************/ +/*! + * \brief Waits in the RAM for the vHsm Ready flag. + * \details This is only needed because the vHsm has no control over the application core startup when a debugger is attached. + * When a debugger is attached, all cores will startup immediately. + * \param[in] partitionIdx Valid Partition Index + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-WaitLoopCallout + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_Ipc_WaitForHsmRamForPartition(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +# define CRYPTO_30_VHSM_STOP_SEC_RAMCODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_VHSM_IPC_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Ipc.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc_Types.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc_Types.h new file mode 100644 index 0000000..697615c --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Ipc_Types.h @@ -0,0 +1,66 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_Ipc_Types.h + * \brief Vector Hardware Security Module Firmware Ipc Types + * + * \details Declares data structures required for interaction with Vector Hardware Security Module Firmware. + * + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_IPC_TYPES_H) +# define CRYPTO_30_VHSM_IPC_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_vHsm_Ipc.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ +# define Crypto_30_vHsm_Ipc_GetTxChannelMemoryOffset(txChannelId) CRYPTO_30_VHSM_IPC_PROTOCOL_INFO_SIZE + CRYPTO_30_VHSM_IPC_GLOBALINFO_MEMORY_SIZE + \ + ((txChannelId) * (CRYPTO_30_VHSM_IPC_TX_CHANNEL_MEMORY_SIZE)) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetRxChannelMemoryOffset(rxChannelId) (Crypto_30_vHsm_Ipc_GetTxChannelMemoryOffset(CRYPTO_30_VHSM_IPC_CHANNELS) + \ + ((rxChannelId) * (CRYPTO_30_VHSM_IPC_RX_CHANNEL_MEMORY_SIZE))) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetTxChannelWriteIndexOffset(txChannelId) Crypto_30_vHsm_Ipc_GetTxChannelMemoryOffset(txChannelId) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetRxChannelWriteIndexOffset(rxChannelId) Crypto_30_vHsm_Ipc_GetRxChannelMemoryOffset(rxChannelId) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetTxChannelReadIndexOffset(txChannelId) (Crypto_30_vHsm_Ipc_GetTxChannelMemoryOffset(txChannelId) + CRYPTO_30_VHSM_IPC_CHANNEL_WRITE_INDEX_MEMORY_SIZE) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetRxChannelReadIndexOffset(rxChannelId) (Crypto_30_vHsm_Ipc_GetRxChannelMemoryOffset(rxChannelId) + CRYPTO_30_VHSM_IPC_CHANNEL_WRITE_INDEX_MEMORY_SIZE) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetTxChannelBufferOffset(txChannelId) (Crypto_30_vHsm_Ipc_GetTxChannelMemoryOffset(txChannelId) + CRYPTO_30_VHSM_IPC_CHANNEL_HEADER_MEMORY_SIZE) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetRxChannelBufferOffset(rxChannelId) (Crypto_30_vHsm_Ipc_GetRxChannelMemoryOffset(rxChannelId) + CRYPTO_30_VHSM_IPC_CHANNEL_HEADER_MEMORY_SIZE) /* PRQA S 3453 */ /* MD_CRYPTO_30_VHSM_3453_IPC_MACRO */ + +# define Crypto_30_vHsm_Ipc_GetGlobalInfoOffset() CRYPTO_30_VHSM_IPC_PROTOCOL_INFO_SIZE + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#endif /* !defined (CRYPTO_30_VHSM_IPC_TYPES_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Ipc_Types.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.c b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.c new file mode 100644 index 0000000..0184829 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.c @@ -0,0 +1,2204 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_Jobs.c + * \brief Vector Hardware Security Module Firmware Jobs + * + * \details Implementation of the Vector Hardware Security Module Firmware Jobs + * + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_JOBS_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_vHsm_Jobs.h" +#include "Crypto_30_vHsm_Ipc.h" + +#include "vstdlib.h" +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) +# define CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE (8u) +# define CRYPTO_30_VHSM_KEYM_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE (4u) +#else +# define CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE (12u) +# define CRYPTO_30_VHSM_KEYM_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE (4u) +#endif + +#define CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED (0xFFFFFFFFuL) + +#define CRYPTO_30_VHSM_IO_NONE (0u) +#define CRYPTO_30_VHSM_IO_INPUT (1u) +#define CRYPTO_30_VHSM_IO_SECONDARYINPUT (2u) +#define CRYPTO_30_VHSM_IO_TERTIARYINPUT (4u) +#define CRYPTO_30_VHSM_IO_OUTPUT (8u) +#define CRYPTO_30_VHSM_IO_SECONDARYOUTPUT (16u) +#define CRYPTO_30_VHSM_IO_VERIFYRESULT (32u) +#define CRYPTO_30_VHSM_IO_SECONDARYKEY (64u) +#define CRYPTO_30_VHSM_IO_COPYPARTIAL (128u) + +#define CRYPTO_30_VHSM_INVALID_SERVICES (0x15u) /* CRYPTO_KEYSETINVALID + 1u */ + +#define CRYPTO_30_VHSM_PTRMSK_INPUTS (24u) +#define CRYPTO_30_VHSM_PTRMSK_OUTPUTS (16u) +#define CRYPTO_30_VHSM_PTRMSK_KEYS ( 8u) + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ +#if !defined (CRYPTO_30_VHSM_LOCAL) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL static +#endif + +#if !defined (CRYPTO_30_VHSM_LOCAL_INLINE) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL_INLINE LOCAL_INLINE +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CONST_UNSPECIFIED +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +CRYPTO_30_VHSM_LOCAL CONST(uint8, CRYPTO_30_VHSM_CONST) Crypto_30_vHsm_JobIOAvailable[CRYPTO_30_VHSM_INVALID_SERVICES] = +{ + /* CRYPTO_HASH */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_MACGENERATE */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_MACVERIFY */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_SECONDARYINPUT | CRYPTO_30_VHSM_IO_VERIFYRESULT, + /* CRYPTO_ENCRYPT */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_DECRYPT */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_AEADENCRYPT */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_SECONDARYINPUT | CRYPTO_30_VHSM_IO_OUTPUT | CRYPTO_30_VHSM_IO_SECONDARYOUTPUT, + /* CRYPTO_AEADDECRYPT */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_SECONDARYINPUT | CRYPTO_30_VHSM_IO_TERTIARYINPUT | CRYPTO_30_VHSM_IO_OUTPUT | CRYPTO_30_VHSM_IO_VERIFYRESULT, + /* CRYPTO_SIGNATUREGENERATE */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_SIGNATUREVERIFY */ CRYPTO_30_VHSM_IO_INPUT | CRYPTO_30_VHSM_IO_SECONDARYINPUT | CRYPTO_30_VHSM_IO_VERIFYRESULT, + /* CRYPTO_SECCOUNTERINCREMENT */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_SECCOUNTERREAD */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_RANDOMGENERATE */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_RANDOMSEED */ CRYPTO_30_VHSM_IO_INPUT, + /* CRYPTO_KEYGENERATE */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_KEYDERIVE */ CRYPTO_30_VHSM_IO_NONE | CRYPTO_30_VHSM_IO_SECONDARYKEY, + /* CRYPTO_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_KEYEXCHANGECALCSECRET */ CRYPTO_30_VHSM_IO_INPUT, + /* CRYPTO_CERTIFICATEPARSE */ CRYPTO_30_VHSM_IO_NONE, /* Not supported by stack */ + /* CRYPTO_CERTIFICATEVERIFY */ CRYPTO_30_VHSM_IO_NONE, /* Not supported by stack */ + /* CRYPTO_KEYSETVALID */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_KEYSETINVALID */ CRYPTO_30_VHSM_IO_NONE +}; + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) +CRYPTO_30_VHSM_LOCAL CONST(uint8, CRYPTO_30_VHSM_CONST) Crypto_30_vHsm_KeyMIOAvailable[CRYPTO_30_VHSM_NR_OF_KEYM_ACTION] = +{ + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTSET */ CRYPTO_30_VHSM_IO_INPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTGET */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPY */ CRYPTO_30_VHSM_IO_NONE | CRYPTO_30_VHSM_IO_SECONDARYKEY , + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYCOPY */ CRYPTO_30_VHSM_IO_NONE | CRYPTO_30_VHSM_IO_SECONDARYKEY, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYDERIVE */ CRYPTO_30_VHSM_IO_NONE | CRYPTO_30_VHSM_IO_SECONDARYKEY, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYGENERATE */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYVALIDSET */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_30_VHSM_KEYM_ACTION_RANDOMSEED */ CRYPTO_30_VHSM_IO_INPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEPARSE */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEVERIFY */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCPUBVAL */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCSECRET */ CRYPTO_30_VHSM_IO_INPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTIDSGET */ CRYPTO_30_VHSM_IO_OUTPUT, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPYPARTIAL */ CRYPTO_30_VHSM_IO_NONE | CRYPTO_30_VHSM_IO_SECONDARYKEY | CRYPTO_30_VHSM_IO_COPYPARTIAL, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYSETINVALID */ CRYPTO_30_VHSM_IO_NONE, + /* CRYPTO_30_VHSM_KEYM_ACTION_KEYGETSTATUS */ CRYPTO_30_VHSM_IO_OUTPUT +}; +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + +#define CRYPTO_30_VHSM_STOP_SEC_CONST_UNSPECIFIED +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_IsMemoryValid() + *********************************************************************************************************************/ +/*! + * \brief Check if a pointer points to valid memory. + * \details - + * \param[in] ptr Pointer to memory + * \param[in] length Length of memory region in byte + * \param[in] isInput ptr is input or output + * \return TRUE if memory is valid, otherwise FALSE. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(boolean, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_IsMemoryValid( + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) ptr, + uint32 length, + boolean isInput); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutputPtr() + *********************************************************************************************************************/ +/*! + * \brief Serialize an output to the Ipc buffer + * \details - + * \param[in] jobRequestId Valid JobRequestId + * \param[in] outputPtr Output pointer which shall be serialized + * \param[in] outputLengthPtr Size of the data which shall be serialized + * \param[in,out] dataBufferLengthPtr Valid size of the dataBufferPtr + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[out] outputOffset Offset of the output inside the shared buffer + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutputPtr( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) outputPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) outputLengthPtr, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) dataBufferLengthPtr, +#endif + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf, + P2VAR(volatile uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) outputOffset); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInputPtr() + *********************************************************************************************************************/ +/*! + * \brief Serialize an input to the Ipc buffer + * \details If possible and needed, the input data located at an invalid memory area (e.g. local application + * core RAM) will be automatically copied to a valid buffer. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] inputPtr Input pointer which shall be serialized + * \param[in] inputLength Size of the data which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in] interpretLengthInBits If TRUE the input size shall be interpreted as bits, otherwise as bytes. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInputPtr( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf, + boolean interpretLengthInBits); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInput() + *********************************************************************************************************************/ +/*! + * \brief Serialize the input or a redirection to the Ipc buffer + * \details The function decides if the input shall be serialized or a redirection is made. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] cryptoJobPtr Valid pointer to the job which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif +); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeSecondaryInput() + *********************************************************************************************************************/ +/*! + * \brief Serialize the secondary input or a redirection to the Ipc buffer + * \details The function decides if the input shall be serialized or a redirection is made. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] cryptoJobPtr Valid pointer to the job which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeSecondaryInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif +); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeTertiaryInput() + *********************************************************************************************************************/ +/*! + * \brief Serialize the tertiary input or a redirection to the Ipc buffer + * \details The function decides if the input shall be serialized or a redirection is made. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] cryptoJobPtr Valid pointer to the job which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeTertiaryInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif +); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutput() + *********************************************************************************************************************/ +/*! + * \brief Serialize the output or a redirection to the Ipc buffer + * \details The function decides if the input shall be serialized or a redirection is made. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] cryptoJobPtr Valid pointer to the job which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif +); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeSecondaryOutput() + *********************************************************************************************************************/ +/*! + * \brief Serialize the secondary output or a redirection to the Ipc buffer + * \details The function decides if the input shall be serialized or a redirection is made. + * \param[in] jobRequestId Valid JobRequestId + * \param[in] cryptoJobPtr Valid pointer to the job which shall be serialized + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if the input has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeSecondaryOutput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif + ); + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInputRedirection() + *********************************************************************************************************************/ +/*! + * \brief Serialize an input redirection to the Ipc buffer + * \details - + * \param[in] jobRequestId Valid JobRequestId + * \param[in] keyId Valid key which shall be used as destination for the redirection + * \param[in] keyElementId Valid keyElement which shall be used as destination for the redirection + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \return E_OK if the input redirection has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInputRedirection( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutputRedirection() + *********************************************************************************************************************/ +/*! + * \brief Serialize an output redirection to the Ipc buffer + * \details - + * \param[in] jobRequestId Valid JobRequestId + * \param[in] keyId Valid key which shall be used source for the redirection + * \param[in] keyElementId Valid keyElement which shall be used as source for the redirection + * \param[in,out] dataBufferLengthPtr Valid pointer to length of the dataBufferPtr + * \param[in,out] ptrBuf Valid pointer to the memory where the pointer shall be serialized. + * Must at least provide 8 byte of storage after the offset. + * \return E_OK if the output redirection has been correctly serialized, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutputRedirection( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 keyId, + uint32 keyElementId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) dataBufferLengthPtr, +# endif + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf); +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_CheckBufferReplacementError() + *********************************************************************************************************************/ +/*! + * \brief Check if an error occurred due to a previously performed buffer replacement + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] jobResult result of the job + * \param[in] notAllowedJobResult Result which will generate a DET if replacement has been performed before + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CheckBufferReplacementError( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Std_ReturnType jobResult, + Std_ReturnType notAllowedJobResult); +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_AddUsedBuffer() + *********************************************************************************************************************/ +/*! + * \brief Increment the used buffer size in at least 4 byte steps + * \details This function ensures that following buffers start at an aligned address to have better performance because uint32 memory access can be used. + * \param[in] jobRequestId Valid jobRequest + * \param[in] value Value which shall be added to the usedBuffer + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_AddUsedBuffer( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 value); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a crypto job inputs + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 24. + * \param[in,out] offsetPtr Offset where the data shall be serialized. Contains the offset which needs to be used to serialize the rest of the data. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) +, P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) offsetPtr +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif + ); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a crypto job outputs + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 16. + * \param[in,out] offsetPtr Offset where the data shall be serialized. Contains the offset which needs to be used to serialize the rest of the data. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK, ISR2 + * \reentrant TRUE + * \synchronous TRUE + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) +, P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) offsetPtr +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +#endif + ); + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_CheckBufferReplacementError() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CheckBufferReplacementError( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + Std_ReturnType jobResult, + Std_ReturnType notAllowedJobResult) +{ + /* #10 Check if the buffer size has been replaced by the driver prior to sending the request to the vHsm */ + if (Crypto_30_vHsm_IsTrimmedOutputBufferOfJobRequest(jobRequestId) == FALSE) + { + /* Do nothing. */ + } + /* #11 Check if the error indicating a too small buffer has been issued */ + else if (jobResult != notAllowedJobResult) + { + /* Do nothing */ + } + else + { +# if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + /* #12 Issue DET because the buffer provided by the driver was too small */ + /* If a buffer provided to the driver is not in a valid memory area, the driver provides an own buffer to the vHsm. + This buffer may be smaller than the buffer originally provided by the application. + Upon receiving the response, the driver checks if a buffer replacement has taken place an will issue a DET if the vHsm complains about a too small buffer, because a bigger configured buffer will solve the issue. + If the following DET is triggered, either increase the buffer size of of the driver object with /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptovHsmBuffer + or directly provide a buffer which is located in a usable memory area so that buffering by the driver is not needed. */ + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_PROCESS_JOB, CRYPTO_E_GLOBAL_BUFFER_TOO_SMALL); +# endif /* (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + } +} /* Crypto_30_vHsm_CheckBufferReplacementError() */ +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_IsMemoryValid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CRYPTO_30_VHSM_LOCAL FUNC( boolean, CRYPTO_30_VHSM_CODE ) Crypto_30_vHsm_IsMemoryValid( + P2CONST( uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) ptr, + uint32 length, + boolean isInput ) +{ + boolean retVal = FALSE; + + if ( (NULL_PTR == ptr) + && (0u == length) ) /* COV_CRYPTO_30_VHSM_ROBUST_POINTER_CHECK */ + { + retVal = TRUE; + } +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_OFF) + else if (length == 0u) + { + retVal = FALSE; + } +#endif + /* Check for overflow */ + else if (&ptr[length] < ptr) /*lint !e613 */ /* PRQA S 2822 */ /* MD_CRYPTO_30_VHSM_2822_DEREFERENCING_NULLPTR */ + { + retVal = FALSE; + } + else + { +#if (CRYPTO_30_VHSM_MEMORYAREA == STD_ON) + Crypto_30_vHsm_MemoryAreaIterType memAreaIdx; + P2CONST( uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) startAddress; + P2CONST( uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) stopAddress; + /* #10 For all memory areas: */ + for (memAreaIdx = 0u; memAreaIdx < Crypto_30_vHsm_GetSizeOfMemoryArea(); memAreaIdx++) + { + /* #20 Check if this is the area we are looking for */ + if ( (isInput == TRUE) +# if (CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) /* COV_CRYPTO_30_VHSM_READWRITE_AVAILABLE */ + || (Crypto_30_vHsm_GetAreaTypeOfMemoryArea( memAreaIdx ) == CRYPTO_30_VHSM_AREA_HSM_READWRITE_ACCESS) +# endif + ) + { + /* #30 Get the start and stop address */ + startAddress = (P2CONST( uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))(uint32)Crypto_30_vHsm_GetAreaStartOfMemoryArea( memAreaIdx ); /* PRQA S 0306 */ /* MD_CRYPTO_30_VHSM_0306_CHECK_MEMORY_LAYOUT */ + stopAddress = (P2CONST( uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))(uint32)Crypto_30_vHsm_GetAreaStopOfMemoryArea( memAreaIdx ); /* PRQA S 0306 */ /* MD_CRYPTO_30_VHSM_0306_CHECK_MEMORY_LAYOUT */ + + /* #40 Check if the pointer and its length are inside the current memory area */ + if ( (&ptr[0] >= startAddress) /*lint !e613 */ /* PRQA S 2822 */ /* MD_CRYPTO_30_VHSM_2822_DEREFERENCING_NULLPTR */ + && (&ptr[length - 1u] <= stopAddress) ) /*lint !e613 */ /* PRQA S 2822 */ /* MD_CRYPTO_30_VHSM_2822_DEREFERENCING_NULLPTR */ + { + retVal = TRUE; + break; + } + } + } +#else /* !(CRYPTO_30_VHSM_MEMORYAREA == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(isInput); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + } + + return retVal; +} /* Crypto_30_vHsm_IsMemoryValid() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_AddUsedBuffer() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_AddUsedBuffer( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 value) +{ + /* #10 Check if new value is not a multiple of 4 bytes */ + if ((value & 0x3uL) != 0u) + { + /* #11 Set the value to the next value which is a multiple of 4 */ + Crypto_30_vHsm_SetUsedBufferOfJobRequest(jobRequestId, Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId) + (value & 0xFFFFFFFCuL) + 4u); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + /* #12 Set the value because it is a multiple of 4 bytes */ + Crypto_30_vHsm_SetUsedBufferOfJobRequest(jobRequestId, Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId) + value); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } +} /* Crypto_30_vHsm_AddUsedBuffer() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutputPtr() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6060 1 */ /* MD_MSR_STPAR */ +CRYPTO_30_VHSM_LOCAL FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutputPtr( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) outputPtr, + P2CONST(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) outputLengthPtr, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) dataBufferLengthPtr, +#endif + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf, + P2VAR(volatile uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) outputOffset) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + /* Get information from the jobRequest */ + uint32 usedBuffer = Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId); +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 dataBufferLength; +#endif + + /* #10 Check if outputLengthPtr is not a NULL_PTR */ + if (outputLengthPtr != NULL_PTR) + { + /* #20 Check if NoBuffering shall be applied */ +#if (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) /* COV_CRYPTO_30_VHSM_NOBUFFERING_ENABLED */ + if (Crypto_30_vHsm_IsBufferUsedOfObjectInfo(jobRequestId) == FALSE) + { + /* Set the length to the given value */ +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + dataBufferLength = *outputLengthPtr; +# else + *dataBufferLengthPtr = *outputLengthPtr; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ +# endif + + /* Provide the original pointer to the vHsm */ + Crypto_30_vHsm_Serialize_Ptr32(outputPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* Indicate that the shared output buffer was not used for this output */ + *outputOffset = CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + } + else +#endif /* (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) */ + /* #30 ELSE Check if it is shared ram: */ + if (Crypto_30_vHsm_IsMemoryValid(outputPtr, *outputLengthPtr, FALSE) == TRUE) /* SBSW_CRYPTO_30_VHSM_MEMORY_VALID_CHECK */ + { + /* Set the length to the given value */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + dataBufferLength = *outputLengthPtr; +#else + *dataBufferLengthPtr = *outputLengthPtr; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ +#endif + + /* Provide the original pointer to the vHsm */ + Crypto_30_vHsm_Serialize_Ptr32(outputPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* Indicate that the shared output buffer was not used for this output */ + *outputOffset = CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + } + else + { + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) dataBufferPtr = Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, usedBuffer); +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + dataBufferLength = Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer; +#else + *dataBufferLengthPtr = Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ +#endif + + /* Make sure that the provided buffer size is the maximum, if the global buffer is smaller, use it's size instead. */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + if (*outputLengthPtr < dataBufferLength) + { + dataBufferLength = *outputLengthPtr; + } +#else + if (*outputLengthPtr < *dataBufferLengthPtr) + { + *dataBufferLengthPtr = *outputLengthPtr; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + } +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + else + { +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* Store the information, that the buffer has been trimmed */ + /* The provided buffer to the vHsm will be smaller than the buffer provided by the application. This may lead to CRYPTO_E_SMALL_BUFFER or CRYPTO_E_KEY_SIZE_MISMATCH although the application has provided a big enough buffer to the driver. + In this case a DET will be triggered and the buffer needs to be increased in the configuration */ + Crypto_30_vHsm_SetTrimmedOutputBufferOfJobRequest(jobRequestId, TRUE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif + } + + /* Store the offset to the memory where the output will be redirected */ + *outputOffset = usedBuffer; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + + /* Add the size of the current output buffer to the fill level of the shared buffer of this driver object */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + Crypto_30_vHsm_AddUsedBuffer(jobRequestId, dataBufferLength); +#else + Crypto_30_vHsm_AddUsedBuffer(jobRequestId, *dataBufferLengthPtr); +#endif + + /* Provide the pointer to a shared buffer to the vHsm */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + } + } + else + { + /* set the value to default 0 */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + dataBufferLength = 0u; +#else + *dataBufferLengthPtr = 0u; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ +#endif + + *outputOffset = usedBuffer; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + + /* #70 Provide NULL_PTR to the vHsm */ + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, ptrBuf); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + } + + /* #80 Serialize the outputLengthPtr */ + /* #90 Serialize the value */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + Crypto_30_vHsm_Serialize_Uint32(dataBufferLength, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#else + Crypto_30_vHsm_Serialize_Ptr32(dataBufferLengthPtr, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#endif + +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_OFF) + CRYPTO_30_VHSM_DUMMY_STATEMENT(jobRequestId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif +} /* Crypto_30_vHsm_SerializeOutputPtr() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInputPtr() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInputPtr( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) inputPtr, + uint32 inputLength, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf, + boolean interpretLengthInBits) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + Std_ReturnType retVal = E_OK; + + /* Get information from the jobRequest */ + uint32 usedBuffer = Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId); + + uint32 inputLengthInBytes = inputLength; + + if (interpretLengthInBits == TRUE) + { + inputLengthInBytes /= 8u; + if ((inputLength % 8u) != 0u) + { + inputLengthInBytes += 1u; + } + } + + /* #10 Serialization of inputPtr */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_OFF) + if ((inputLength != 0u) + && (inputPtr == NULL_PTR)) + { + /* #20 Serialize the inputPtr */ + Crypto_30_vHsm_Serialize_Ptr32(inputPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* #30 NULL_PTR as input is not allowed when length is not zero */ + retVal = E_NOT_OK; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_OFF) */ + { + /* #40 Check if NoBuffering shall be applied */ +#if (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) /* COV_CRYPTO_30_VHSM_NOBUFFERING_ENABLED */ + if (Crypto_30_vHsm_IsBufferUsedOfObjectInfo(jobRequestId) == FALSE) + { + /* Serialize the inputPtr */ + Crypto_30_vHsm_Serialize_Ptr32(inputPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + } + else +#endif /* (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) */ + /* #41 ELSE Check if it is accessible memory */ + if (Crypto_30_vHsm_IsMemoryValid(inputPtr, inputLengthInBytes, TRUE) == TRUE) /* SBSW_CRYPTO_30_VHSM_MEMORY_VALID_CHECK */ + { + /* Serialize the inputPtr */ + Crypto_30_vHsm_Serialize_Ptr32(inputPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + } + else + { + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) dataBufferPtr = Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, usedBuffer); + uint32 dataBufferLength = Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer; + + /* Check if the provided input data can be buffered to the global RAM buffer. */ + if (dataBufferLength >= inputLengthInBytes) + { + /* Copy the input data to a memory location which can be read by the vHsm */ + VStdLib_MemCpy(dataBufferPtr, inputPtr, inputLengthInBytes); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_COPY_TO_GLOBAL_BUFFER_FROM_SOURCE */ + + /* Serialize the pointer to the buffer. */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_AddUsedBuffer(jobRequestId, inputLengthInBytes); + } + else + { + /* There is not enough space in the buffer to store the input data. */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_PROCESS_JOB, CRYPTO_E_GLOBAL_BUFFER_TOO_SMALL); +#endif + retVal = E_NOT_OK; + } + } + } + + /* #100 Serialization of inputLength */ + Crypto_30_vHsm_Serialize_Uint32(inputLength, &ptrBuf[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + return retVal; +} /* Crypto_30_vHsm_SerializeInputPtr() */ + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInputRedirection() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInputRedirection( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + Std_ReturnType retVal = E_OK; + + /* Get information from the jobRequest */ + uint32 usedBuffer = Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId); + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) dataBufferPtr = Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, usedBuffer); + uint32 dataBufferLength = Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer; + + /* #10 Check if provided buffer is big enough */ + if (dataBufferLength < 8u) + { + /* The provided buffer is not big enough */ + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, ptrBuf); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + retVal = E_NOT_OK; + } + else + { + /* #20 Store keyId and keyElementId to the global RAM buffer */ + Crypto_30_vHsm_Serialize_Uint32(keyId, dataBufferPtr); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyElementId, &dataBufferPtr[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + /* #30 Serialize the data Buffer to the IPC */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* #40 Serialize length to the IPC */ + Crypto_30_vHsm_Serialize_Uint32(8u, &ptrBuf[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_SetUsedBufferOfJobRequest(jobRequestId, usedBuffer + 8u); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + + return retVal; +} /* Crypto_30_vHsm_SerializeInputRedirection() */ +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutputRedirection() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutputRedirection( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 keyId, + uint32 keyElementId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) dataBufferLengthPtr, +# endif + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + Std_ReturnType retVal = E_OK; + + /* Get information from the jobRequest */ + uint32 usedBuffer = Crypto_30_vHsm_GetUsedBufferOfJobRequest(jobRequestId); + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) dataBufferPtr = Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, usedBuffer); +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + *dataBufferLengthPtr = (Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer); /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ +# else + uint32 dataBufferLength = Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(jobRequestId) - usedBuffer; +# endif + /* #10 Check if provided buffer is big enough */ +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + if (*dataBufferLengthPtr < 8u) + { + /* The provided buffer is not big enough */ + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, ptrBuf); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + *dataBufferLengthPtr = 0u; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + Crypto_30_vHsm_Serialize_Uint32(dataBufferLengthPtr, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + retVal = E_NOT_OK; + } +# else /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + if (dataBufferLength < 8u) + { + /* The provided buffer is not big enough */ + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, ptrBuf); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + retVal = E_NOT_OK; + } +# endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + else + { + /* #20 Store keyId and keyElementId to the global RAM buffer */ + Crypto_30_vHsm_Serialize_Uint32(keyId, dataBufferPtr); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyElementId, &dataBufferPtr[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + /* #30 Serialize the data Buffer to the IPC */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferPtr, ptrBuf); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* #40 Serialize length to the IPC */ +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + *dataBufferLengthPtr = 8u; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_CSL */ + Crypto_30_vHsm_Serialize_Ptr32(dataBufferLengthPtr, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +# else + Crypto_30_vHsm_Serialize_Ptr32(8u, &ptrBuf[4]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +# endif + Crypto_30_vHsm_SetUsedBufferOfJobRequest(jobRequestId, usedBuffer + 8u); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + + return retVal; +} /* Crypto_30_vHsm_SerializeOutputRedirection() */ +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeInput() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((jobRedirectionInfoPtr->redirectionConfig & CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT) == CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT) + { + /* #10 Serialization of redirection for inputPtr */ + retVal = Crypto_30_vHsm_SerializeInputRedirection( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS */ + jobRequestId, + jobRedirectionInfoPtr->inputKeyId, + jobRedirectionInfoPtr->inputKeyElementId, + ptrBuf); + } + else +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + { + /* #20 Serialization of inputPtr */ + retVal = Crypto_30_vHsm_SerializeInputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS */ + jobRequestId, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputPtr, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.inputLength, + ptrBuf, + FALSE); + } + + return retVal; +} /* Crypto_30_vHsm_SerializeInput() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeSecondaryInput() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeSecondaryInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((jobRedirectionInfoPtr->redirectionConfig & CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT) == CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT) + { + /* #10 Serialization of redirection for secondaryInputPtr */ + retVal = Crypto_30_vHsm_SerializeInputRedirection( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS */ + jobRequestId, + jobRedirectionInfoPtr->secondaryInputKeyId, + jobRedirectionInfoPtr->secondaryInputKeyElementId, + ptrBuf); + } + else +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + { + /* #20 Serialization of secondaryInputPtr */ + retVal = Crypto_30_vHsm_SerializeInputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS */ + jobRequestId, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputPtr, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryInputLength, + ptrBuf, + (cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service == CRYPTO_MACVERIFY)); + } + + return retVal; +} /* Crypto_30_vHsm_SerializeSecondaryInput() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeTertiaryInput() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeTertiaryInput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((jobRedirectionInfoPtr->redirectionConfig & CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT) == CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT) + { + /* #10 Serialization of redirection for tertiaryInputPtr */ + retVal = Crypto_30_vHsm_SerializeInputRedirection( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS */ + jobRequestId, + jobRedirectionInfoPtr->tertiaryInputKeyId, + jobRedirectionInfoPtr->tertiaryInputKeyElementId, + ptrBuf); + } + else +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + { + /* #20 Serialization of tertiaryInputPtr */ + retVal = Crypto_30_vHsm_SerializeInputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS */ + jobRequestId, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputPtr, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.tertiaryInputLength, + ptrBuf, + FALSE); + } + return retVal; +} /* Crypto_30_vHsm_SerializeTertiaryInput() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeOutput() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeOutput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal = E_OK; + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((jobRedirectionInfoPtr->redirectionConfig & CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT) == CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT) + { + /* #10 Serialization of redirection for outputPtr */ + retVal = Crypto_30_vHsm_SerializeOutputRedirection( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS */ + jobRequestId, + jobRedirectionInfoPtr->outputKeyId, + jobRedirectionInfoPtr->outputKeyElementId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId), +# endif + ptrBuf); + } + else +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + { + /* #20 Serialization of outputPtr */ + Crypto_30_vHsm_SerializeOutputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS */ + jobRequestId, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId), +#endif + ptrBuf, + &Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId)); + } + + return retVal; +} /* Crypto_30_vHsm_SerializeOutput() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeSecondaryOutput() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeSecondaryOutput( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal = E_OK; + +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + if ((jobRedirectionInfoPtr->redirectionConfig & CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT) == CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT) + { + /* #10 Serialization of redirection for secondaryOutputPtr */ + retVal = Crypto_30_vHsm_SerializeOutputRedirection( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_REDIRECTION_WITH_GLOBAL_BUFFERS */ + jobRequestId, + jobRedirectionInfoPtr->secondaryOutputKeyId, + jobRedirectionInfoPtr->secondaryOutputKeyElementId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId), +# endif + ptrBuf); + } + else +#endif /* (CRYPTO_30_VHSM_REDIRECTION == STD_ON) */ + { + /* #20 Serialization of secondaryOutputPtr */ + Crypto_30_vHsm_SerializeOutputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE_PTR_WITH_GLOBAL_BUFFERS */ + jobRequestId, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, + cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId), +#endif + ptrBuf, + &Crypto_30_vHsm_GetSecondaryOutputOffsetOfJobRequest(jobRequestId)); + } + return retVal; +} /* Crypto_30_vHsm_SerializeSecondaryOutput() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + , P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) offsetPtr +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 offset = *offsetPtr; +#else + uint32 offset = 4; +#endif + + /* #10 Serialization of Input */ + if ((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_INPUT) == CRYPTO_30_VHSM_IO_INPUT) + { + retVal = Crypto_30_vHsm_SerializeInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[offset] +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); + offset += 8u; + /* #20 Serialization of Secondary Input */ + if ((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_SECONDARYINPUT) == CRYPTO_30_VHSM_IO_SECONDARYINPUT) + { + retVal |= Crypto_30_vHsm_SerializeSecondaryInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[offset] +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); + offset += 8u; + /* #30 Serialization of Tertiary Input */ + if ((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_TERTIARYINPUT) == CRYPTO_30_VHSM_IO_TERTIARYINPUT) + { + retVal |= Crypto_30_vHsm_SerializeTertiaryInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[offset] +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + offset += 8u; +#endif + } + else + { +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[20]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[24]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif + } + } + else + { +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[12]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[16]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[20]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[24]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif + } + } + else + { +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[4]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[8]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[12]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[16]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[20]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Uint32(0u, &ptrBuf[24]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + + retVal = E_OK; + } + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + *offsetPtr = offset; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ +#endif + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + , P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) offsetPtr +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 offset = *offsetPtr; +#else + uint32 offset = 28u; +#endif + /* #40 Serialization of Output */ + if (((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_OUTPUT) == CRYPTO_30_VHSM_IO_OUTPUT) +#if (CRYPTO_30_VHSM_SUPPORT_SAVE_RESTORE_CONTEXT == STD_ON) + || ((cryptoJobPtr->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_SAVE_CONTEXT) == CRYPTO_OPERATIONMODE_SAVE_CONTEXT)) +#else + ) +#endif + { + retVal = Crypto_30_vHsm_SerializeOutput( /* PRQA S 2985 */ /* MD_CRYPTO_30_VHSM_2985_REDUNDANT_OP_WHEN_NO_REDIRECTION */ /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[offset] +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); + offset += 8u; + /* #50 Serialization of Secondary Output */ + if ((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_SECONDARYOUTPUT) == CRYPTO_30_VHSM_IO_SECONDARYOUTPUT) + { + retVal |= Crypto_30_vHsm_SerializeSecondaryOutput( /* PRQA S 2985 */ /* MD_CRYPTO_30_VHSM_2985_REDUNDANT_OP_WHEN_NO_REDIRECTION */ /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[offset] +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); + /* this addition to the offset is only needed if we are IPCv3 */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + offset+=8u; +#endif + } + else + { + *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[36]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Ptr32(Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId), &ptrBuf[40]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#endif + } + } + else + { + *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[28]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Ptr32(Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId), &ptrBuf[32]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#endif + + *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Ptr32(NULL_PTR, &ptrBuf[36]); /* PRQA S 0306, 0310, 0326, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + Crypto_30_vHsm_Serialize_Ptr32(Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId), &ptrBuf[40]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ +#endif + + retVal = E_OK; + } + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + *offsetPtr = offset; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ +#endif + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +#endif + ) +{ + Std_ReturnType retVal; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 offset = 8u; + uint8 numOfInputs; + uint32 inputOffset; + uint8 numOfOutputs; + uint8 numOfConstData = 3u; + uint8 numOfCryptoKeyIds = 0u; + uint32 numOfInOutKeyConst; +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + /* ----- Implementation ----------------------------------------------- */ + /* #05 Check if the request can be serialized to the provided buffer */ + if (cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service < CRYPTO_30_VHSM_INVALID_SERVICES) + { +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId), ptrBuf); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif + + /* #10 Serialization of Inputs */ + retVal = Crypto_30_vHsm_SerializeRequest_CryptoJob_Inputs( /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_Inputs */ + jobRequestId, + cryptoJobPtr, + ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + , &offset +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + inputOffset = offset; +#endif + /* #40 Serialization of Outputs */ + retVal |= Crypto_30_vHsm_SerializeRequest_CryptoJob_Outputs( /* PRQA S 2985 */ /* MD_CRYPTO_30_VHSM_2985_REDUNDANT_OP_WHEN_NO_REDIRECTION */ /* SBSW_CRYPTO_30_VHSM_ForwardingIpcBufferAsPtr_SerializeRequest_CryptoJob_Outputs */ + jobRequestId, + cryptoJobPtr, + ptrBuf +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + , &offset +#endif +#if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +#endif + ); +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + /* Calculate num of input and outputs properly */ + + numOfOutputs = (uint8)(offset-inputOffset) / 8u; + numOfInputs = (uint8)(inputOffset - 4u) / 8u; + + /* Serialize all keyIds, since we have only one here it does not need to be refactored to subfunction */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->cryptoKeyId, &ptrBuf[offset]);/* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + offset += 4u; + numOfCryptoKeyIds++; +# if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) + if ((Crypto_30_vHsm_JobIOAvailable[cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_SECONDARYKEY) == CRYPTO_30_VHSM_IO_SECONDARYKEY) + { + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->targetCryptoKeyId, &ptrBuf[offset]);/* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + offset += 4u; + numOfCryptoKeyIds++; + } +# endif /* (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) */ + + /* Serialize constData */ + /* SHIFT multiple values into one uint32 in IPC to improve performance */ + Crypto_30_vHsm_Serialize_Uint32( /* PRQA S 0310, 3305, 4304, 0404 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO, MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO, MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO, MD_CRYPTO_30_VHSM_0404_VOLATILE_READ */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + ( ((uint32)cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.family) + | ((uint32)cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.mode << 8u) + | ((uint32)cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily << 16u) + | ((uint32)Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId) << 24u) + | ((uint32)Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId) << 25u) + | ((uint32)Crypto_30_vHsm_IsCancelOfJobRequest(jobRequestId) << 28u) + | ((uint32)cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode << 29u)), + &ptrBuf[offset]); + + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.keyLength, &ptrBuf[offset + 4u]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobInfo->jobId, &ptrBuf[offset + 8u]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +# if (CRYPTO_30_VHSM_SUPPORT_SAVE_RESTORE_CONTEXT == STD_ON) + Crypto_30_vHsm_Serialize_Uint32(((uint32)cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode), &ptrBuf[offset + 12u]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + numOfConstData++; +# endif + numOfInOutKeyConst = ((uint32)numOfInputs << 24u) | ((uint32)numOfOutputs << 16u) | ((uint32)numOfCryptoKeyIds << 8u) | ((uint32)numOfConstData); + Crypto_30_vHsm_Serialize_Uint32(numOfInOutKeyConst, ptrBuf); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service, &ptrBuf[4u]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#else /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + /* #60 Prepare verifyPtr */ + *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) = 0xFEu; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + /* #62 Serialize verifyPtr */ + Crypto_30_vHsm_Serialize_Ptr32(Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId), &ptrBuf[44]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* #70 Serialization of everything else */ + /* PRQA S 0310, 3305 8 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode, &ptrBuf[48]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->service, &ptrBuf[52]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.family, &ptrBuf[56]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.mode, &ptrBuf[60]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, &ptrBuf[64]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId), &ptrBuf[68]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobInfo->jobId, &ptrBuf[72]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->cryptoKeyId, &ptrBuf[76]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + } + else + { + retVal = E_NOT_OK; + } + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob() */ + +#if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +# endif +) +{ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId), ptrBuf); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + /* #10 Serialization of Input */ + retVal = Crypto_30_vHsm_SerializeInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[4] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +# endif + ); + + /* #40 Serialization of Output */ + retVal |= Crypto_30_vHsm_SerializeOutput( /* PRQA S 2985 */ /* MD_CRYPTO_30_VHSM_2985_REDUNDANT_OP_WHEN_NO_REDIRECTION */ /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[12] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +# endif + ); + + /* #60 Prepare verifyPtr */ + *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) = 0xFEu; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #70 Serialization of everything else */ + /* PRQA S 0310, 3305 6 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode, &ptrBuf[20]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.family, &ptrBuf[24]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.mode, &ptrBuf[28]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId), &ptrBuf[32]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobInfo->jobId, &ptrBuf[36]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->cryptoKeyId, &ptrBuf[40]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen() */ +#endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) */ + +#if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION== STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +# endif +) +{ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId), ptrBuf); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + /* #10 Serialization of Input */ + retVal = Crypto_30_vHsm_SerializeInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[4] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +# endif + ); + + /* #20 Serialization of Secondary Input */ + retVal |= Crypto_30_vHsm_SerializeSecondaryInput( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + cryptoJobPtr, + &ptrBuf[12] +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) + , jobRedirectionInfoPtr +# endif + ); + + /* #60 Prepare verifyPtr */ + *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) = 0xFEu; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + /* #62 Serialize verifyPtr */ + Crypto_30_vHsm_Serialize_Ptr32(Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId), &ptrBuf[20]); /* PRQA S 0306, 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_PTR_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_PTR */ + + /* #70 Serialization of everything else */ + /* PRQA S 0310, 3305 6 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode, &ptrBuf[24]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.family, &ptrBuf[28]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.mode, &ptrBuf[32]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId), &ptrBuf[36]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobInfo->jobId, &ptrBuf[40]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->cryptoKeyId, &ptrBuf[44]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer() */ +#endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION== STD_ON) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_KeyMJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_KeyMJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyMJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf) +{ + Std_ReturnType retVal; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 ptrMask = 0u; + uint8 numOfKeys = 1u; + uint8 numOfConst; + uint32 offset = 8u; +#else + uint32 offset = 20u; +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + + /* ----- Implementation ----------------------------------------------- */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + retVal = E_OK; +#else + /* PRQA S 0310, 3305 5 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->action, ptrBuf); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->cryptoKeyId, &ptrBuf[4]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryCryptoKeyId, &ptrBuf[8]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->keyElementId, &ptrBuf[12]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryKeyElementId, &ptrBuf[16]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + /* PRQA S 0310, 3305 5 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + if ((Crypto_30_vHsm_KeyMIOAvailable[keyMJobPtr->action] & CRYPTO_30_VHSM_IO_INPUT) == CRYPTO_30_VHSM_IO_INPUT) + { + ptrMask = ((uint32)1u << CRYPTO_30_VHSM_PTRMSK_INPUTS); +#endif + + /* #10 Serialization of inputPtr */ + retVal = Crypto_30_vHsm_SerializeInputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + keyMJobPtr->inputOutput.inputPtr, + keyMJobPtr->inputOutput.inputLength, + &ptrBuf[offset], + FALSE); + offset += 8u; + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + } + + if ((Crypto_30_vHsm_KeyMIOAvailable[keyMJobPtr->action] & CRYPTO_30_VHSM_IO_OUTPUT) == CRYPTO_30_VHSM_IO_OUTPUT) + { + ptrMask |= ((uint32)1u << CRYPTO_30_VHSM_PTRMSK_OUTPUTS); +#endif + /* #20 Serialization of outputPtr */ + Crypto_30_vHsm_SerializeOutputPtr( /* SBSW_CRYPTO_30_VHSM_CALL_SERIALIZE */ + jobRequestId, + keyMJobPtr->inputOutput.outputPtr, + keyMJobPtr->inputOutput.outputLengthPtr, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId), +#endif + &ptrBuf[offset], + &Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId)); +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + offset += 8u; + } +#endif + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->cryptoKeyId, &ptrBuf[offset]);/* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + offset += 4u; + if ((Crypto_30_vHsm_KeyMIOAvailable[keyMJobPtr->action] & CRYPTO_30_VHSM_IO_SECONDARYKEY) == CRYPTO_30_VHSM_IO_SECONDARYKEY) + { + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryCryptoKeyId, &ptrBuf[offset]);/* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + offset += 4u; + numOfKeys++; + } + + /* PRQA S 0310, 3305 2 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->action, &ptrBuf[offset]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->keyElementId, &ptrBuf[offset + 4u]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryKeyElementId, &ptrBuf[offset + 8u]);/* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + numOfConst = 3; + if ((Crypto_30_vHsm_KeyMIOAvailable[keyMJobPtr->action] & CRYPTO_30_VHSM_IO_COPYPARTIAL) == CRYPTO_30_VHSM_IO_COPYPARTIAL) + { + /* PRQA S 0310, 3305 3 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementSourceOffset, &ptrBuf[offset + 12u]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementTargetOffset, &ptrBuf[offset + 16u]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementCopyLength, &ptrBuf[offset + 20u]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + numOfConst = 6; + } + + ptrMask |= ((uint32)numOfKeys << CRYPTO_30_VHSM_PTRMSK_KEYS) | numOfConst; + + Crypto_30_vHsm_Serialize_Uint32(ptrMask, &ptrBuf[0]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + /* Serialize invalid service pattern */ + Crypto_30_vHsm_Serialize_Uint32(0xFFFFFFFFuL, &ptrBuf[4u]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) */ + + /* + * Hint: If one of the above functions return E_NOT_OK, it is presumably the case that the provided key data is to big to be buffered. + * Try increasing the buffer size of CryptoDriverObjects/Crypto_30_vHsm_KeyM/CryptovHsmBuffer/CryptoInputBufferSize + */ + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_KeyMJob() */ + +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial( + Crypto_30_vHsm_JobRequestIterType jobRequestId, /* PRQA S 3206 */ /* MD_CRYPTO_30_VHSM_UNUSED_PARAMETER */ + P2CONST(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyMJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf) +{ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + /* PRQA S 0310, 3305 8 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->action, ptrBuf); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->cryptoKeyId, &ptrBuf[4]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryCryptoKeyId, &ptrBuf[8]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->keyElementId, &ptrBuf[12]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->secondaryKeyElementId, &ptrBuf[16]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementSourceOffset, &ptrBuf[20]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementTargetOffset, &ptrBuf[24]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(keyMJobPtr->inputOutput.keyElementCopyLength, &ptrBuf[28]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + retVal = E_OK; + + CRYPTO_30_VHSM_DUMMY_STATEMENT(jobRequestId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial() */ + +# if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive( + Crypto_30_vHsm_JobRequestIterType jobRequestId, /* PRQA S 3206 */ /* MD_CRYPTO_30_VHSM_UNUSED_PARAMETER */ + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf) +{ + Std_ReturnType retVal; + + /* ----- Implementation ----------------------------------------------- */ + /* #05 Prepare verifyPtr */ + *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) = 0xFEu; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId), ptrBuf); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + /* #10 Serialization of key derive job */ + /* PRQA S 0310, 3305 8 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.mode, &ptrBuf[4]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.family, &ptrBuf[8]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.mode, &ptrBuf[12]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobPrimitiveInfo->primitiveInfo->algorithm.secondaryFamily, &ptrBuf[16]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(Crypto_30_vHsm_GetProcessingTypeOfJobRequest(jobRequestId), &ptrBuf[20]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->jobInfo->jobId, &ptrBuf[24]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->targetCryptoKeyId, &ptrBuf[28]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + Crypto_30_vHsm_Serialize_Uint32(cryptoJobPtr->cryptoKeyId, &ptrBuf[32]); /* SBSW_CRYPTO_30_VHSM_IPC_SERIALIZE_UINT32 */ + + retVal = E_OK; + + return retVal; +} /* Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive() */ +# endif /* (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) */ +#endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReceiveResponse_CryptoJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6030, 6080 1 */ /* MD_MSR_STMIF, MD_MSR_STCYC */ +FUNC( void, CRYPTO_30_VHSM_CODE ) Crypto_30_vHsm_ReceiveResponse_CryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +#endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + /* ----- Local Variables ---------------------------------------------- */ + Crypto_30_vHsm_CryptoJobPtr jobTmp; /* PRQA S 3679 */ /* MD_CRYPTO_30_VHSM_3679_JOB_POINTER_AS_VAR */ + Std_ReturnType jobResult; + + /* ----- Implementation ----------------------------------------------- */ + jobTmp = Crypto_30_vHsm_GetCryptoJobOfJobRequest(jobRequestId); + + /* #20 Deserialize job request */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + Crypto_30_vHsm_GetJobStateOfJobRequest(jobRequestId) = (Crypto_JobStateType)Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR_WITH_BUFFER */ + jobResult = (uint8)Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[8]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, jobResult); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#else + *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) = Crypto_30_vHsm_Deserialize_Uint32(jobResponseBuffer); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId) = Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[4]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) = (Crypto_VerifyResultType)Crypto_30_vHsm_Deserialize_Uint32(&jobResponseBuffer[8]); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetJobStateOfJobRequest(jobRequestId, (uint8)(jobResponseData >> CRYPTO_30_VHSM_JOBRESPONSE_STATE_BITPOSITION)); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + jobResult = (uint8)(jobResponseData >> CRYPTO_30_VHSM_JOBRESPONSE_RESULT_BITPOSITION); + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, jobResult); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + + /* #30 Get result of job request */ + /* Info: If the job result was CRYPTO_E_SMALL_BUFFER although a big enough buffer has been provided by the application, make sure that the shared buffer of the driver object is configured big enough. + * It may have been the case that the application provided a buffer not readable by the vHsm. The CRYPTO driver then provides a valid buffer which may be smaller than the original one to the vHsm. + */ + if (E_OK == jobResult) + { + /* Check if the job contains an output */ + if (((((Crypto_30_vHsm_JobIOAvailable[jobTmp->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_OUTPUT) == CRYPTO_30_VHSM_IO_OUTPUT) +#if (CRYPTO_30_VHSM_SUPPORT_SAVE_RESTORE_CONTEXT == STD_ON) + || ((jobTmp->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_SAVE_CONTEXT) == CRYPTO_OPERATIONMODE_SAVE_CONTEXT)) +#else + ) +#endif + && (Crypto_30_vHsm_IsCancelOfJobRequest(jobRequestId) == FALSE)) /* PRQA S 3415 */ /* MD_CRYPTO_30_VHSM_3415_LOGICAL_OPERATOR */ +#if (CRYPTO_30_VHSM_SUPPORT_SAVE_RESTORE_CONTEXT == STD_ON) + && ((jobTmp->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_RESTORE_CONTEXT) != CRYPTO_OPERATIONMODE_RESTORE_CONTEXT)) +#else + ) +#endif + { + if ((jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr != NULL_PTR) + && (jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr != NULL_PTR)) + { +#if (CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) /* COV_CRYPTO_30_VHSM_READWRITE_AVAILABLE */ + /* Check if the vHsm has written the output to the buffer instead of the original pointer provided within the job */ + if (Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED) +#else +# if (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) /* COV_CRYPTO_30_VHSM_NOBUFFERING_ENABLED */ + if (Crypto_30_vHsm_IsBufferUsedOfObjectInfo(jobRequestId) == TRUE) +# endif +#endif /* !(CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) */ + { + /* Check if the vHsm produced a bigger result than the buffer provided by the application */ + if (*Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) > *jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr) + { + /* Set the length to a safe value to avoid memory corruptions. This should never happen and indicates a wrong behaviour of the vHsm Firmware. */ + *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, E_NOT_OK); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + /* #40 Copy output to local job object (only if available for service, not for cancel or restore context) */ + VStdLib_MemCpy(jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputPtr, Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId)), *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_COPY_TO_DESTINATION_FROM_GLOBAL_BUFFER */ + } + } + /* Copy the length value to the original destination provided within the job */ + *jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.outputLengthPtr = *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + + /* Check if the job contains a secondary output */ + /* This will only be the case when a primary output is available. There are no jobs with a secondary output but no primary output. */ + if ((((Crypto_30_vHsm_JobIOAvailable[jobTmp->jobPrimitiveInfo->primitiveInfo->service] & CRYPTO_30_VHSM_IO_SECONDARYOUTPUT) == CRYPTO_30_VHSM_IO_SECONDARYOUTPUT) + && (jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr != NULL_PTR) + && (jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr != NULL_PTR)) +#if (CRYPTO_30_VHSM_SUPPORT_SAVE_RESTORE_CONTEXT == STD_ON) + && ((jobTmp->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_SAVE_CONTEXT) != CRYPTO_OPERATIONMODE_SAVE_CONTEXT)) +#else + ) +#endif + { +#if (CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) /* COV_CRYPTO_30_VHSM_READWRITE_AVAILABLE */ + /* Check if the vHsm has written the output to the buffer instead of the original pointer provided within the job */ + if (Crypto_30_vHsm_GetSecondaryOutputOffsetOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED) +#else +# if (CRYPTO_30_VHSM_NOBUFFERING_ENABLED == STD_ON) /* COV_CRYPTO_30_VHSM_NOBUFFERING_ENABLED */ + if (Crypto_30_vHsm_IsBufferUsedOfObjectInfo(jobRequestId) == TRUE) +# endif +#endif /* !(CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) */ + { + /* Check if the vHsm produced a bigger result than the buffer provided by the application */ + if (*Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId) > *jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr) + { + /* Set the length to a safe value to avoid memory corruptions. This should never happen and indicates a wrong behaviour of the vHsm Firmware. */ + *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, E_NOT_OK); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + /* #50 Copy secondary output to local job object (only if available for service, not for cancel or save or restore context) */ + VStdLib_MemCpy(jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputPtr, Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, Crypto_30_vHsm_GetSecondaryOutputOffsetOfJobRequest(jobRequestId)), *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_COPY_TO_DESTINATION_FROM_GLOBAL_BUFFER */ + } + } + /* Copy the length value to the original destination provided within the job */ + *jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.secondaryOutputLengthPtr = *Crypto_30_vHsm_GetAddrSecondaryOutputLengthPtrDataBuffer(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + } + + /* Check if the default value has been overwritten which would indicate that the received value must be written to the provided verifyPtr */ + if (*Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId) != 0xFEu) + { + if (jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr != NULL_PTR) + { + /* #60 Copy verification pointer to local job object */ + *jobTmp->CRYPTO_30_VHSM_JOB_PRIMITIVE_INPUT_OUTPUT_MEMBER.verifyPtr = *Crypto_30_vHsm_GetAddrVerifyPtrDataBuffer(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + else + { + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, E_NOT_OK); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportError(CRYPTO_30_VHSM_MODULE_ID, CRYPTO_30_VHSM_INSTANCE_ID, CRYPTO_30_VHSM_SID_PROCESS_JOB, CRYPTO_E_PARAM_POINTER); +#endif + } + } + } +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + else + { + /* #70 Check for buffer replacement error */ + Crypto_30_vHsm_CheckBufferReplacementError(jobRequestId, jobResult, CRYPTO_E_SMALL_BUFFER); + } +#endif +} /* Crypto_30_vHsm_ReceiveResponse_CryptoJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReceiveResponse_KeyMJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + */ +FUNC( void, CRYPTO_30_VHSM_CODE ) Crypto_30_vHsm_ReceiveResponse_KeyMJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +#endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType jobResult; + Crypto_30_vHsm_KeyMJobPtr jobTmp; /* PRQA S 3679 */ /* MD_CRYPTO_30_VHSM_3679_JOB_POINTER_AS_VAR */ + + /* ----- Implementation ----------------------------------------------- */ + + /* #20 Deserialize job request */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + jobResult = (uint8)Crypto_30_vHsm_Deserialize_Uint32(jobResponseBuffer); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, jobResult);/* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#else + *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) = Crypto_30_vHsm_Deserialize_Uint32(jobResponseBuffer); /* PRQA S 0310, 3305 */ /* MD_CRYPTO_30_VHSM_SERIALIZATION_MACRO */ /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + jobResult = (uint8)(jobResponseData >> CRYPTO_30_VHSM_JOBRESPONSE_RESULT_BITPOSITION); + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, jobResult); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif /* !(CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) */ + + /* Copy the data only from the buffer to the destination if the job was successful */ + if (E_OK == jobResult) + { + jobTmp = Crypto_30_vHsm_GetKeyMJobOfJobRequest(jobRequestId); + + /* Check if the job contains an output */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + if (((Crypto_30_vHsm_KeyMIOAvailable[jobTmp->action] & CRYPTO_30_VHSM_IO_OUTPUT) == CRYPTO_30_VHSM_IO_OUTPUT) && +#else + if( +#endif + (jobTmp->inputOutput.outputLengthPtr != NULL_PTR) + && (jobTmp->inputOutput.outputPtr != NULL_PTR)) + { +#if (CRYPTO_30_VHSM_READWRITE_AVAILABLE == STD_ON) /* COV_CRYPTO_30_VHSM_READWRITE_AVAILABLE */ + /* Check if the vHsm has written the output to the buffer instead of the original pointer provided within the job */ + if (Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_OUTPUT_BUFFER_NOT_USED) +#endif + { + /* Check if the vHsm produced a bigger result than the buffer provided by the application */ + if (*Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) > *jobTmp->inputOutput.outputLengthPtr) + { + /* Set the length to a safe value to avoid memory corruptions. This should never happen and indicates a wrong behaviour of the vHsm Firmware. */ + *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId) = 0u; /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetResultOfJobRequest(jobRequestId, E_NOT_OK); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + /* #30 Copy output to local job object */ + VStdLib_MemCpy(jobTmp->inputOutput.outputPtr, Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(jobRequestId, Crypto_30_vHsm_GetOutputOffsetOfJobRequest(jobRequestId)), *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId)); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_COPY_TO_DESTINATION_FROM_GLOBAL_BUFFER */ + } + } + /* Copy the length value to the original destination provided within the job */ + *jobTmp->inputOutput.outputLengthPtr = *Crypto_30_vHsm_GetAddrOutputLengthPtrDataBuffer(jobRequestId); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + } +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + else + { + /* #70 Check for buffer replacement error */ + Crypto_30_vHsm_CheckBufferReplacementError(jobRequestId, jobResult, CRYPTO_E_KEY_SIZE_MISMATCH); + } +#endif +} /* Crypto_30_vHsm_ReceiveResponse_KeyMJob() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Jobs.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.h new file mode 100644 index 0000000..84364e0 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Jobs.h @@ -0,0 +1,257 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_Jobs.h + * \brief Vector Hardware Security Module Firmware Jobs + * + * \details Implementation of the Vector Hardware Security Module Firmware Jobs + * + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_JOBS_H) +# define CRYPTO_30_VHSM_JOBS_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_vHsm.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ +# define Crypto_30_vHsm_GetAddrSharedDataBufferOfDriverObject(objectId, usedBuffer) (&((P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))Crypto_30_vHsm_GetAddrSharedDataBuffer(Crypto_30_vHsm_GetSharedDataBufferStartIdxOfObjectInfo(objectId)))[(usedBuffer)]) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +# define Crypto_30_vHsm_GetSharedDataBufferSizeOfDriverObject(objectId) ((uint32)(((uint32)Crypto_30_vHsm_GetSharedDataBufferEndIdxOfObjectInfo(objectId) - (uint32)Crypto_30_vHsm_GetSharedDataBufferStartIdxOfObjectInfo(objectId))*(uint32)4uL)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReceiveResponse_CryptoJob() + *********************************************************************************************************************/ +/*! + * \brief Receive crypto job response. + * \details - + * \param[in] jobRequestId Valid job request Id + * \param[in] jobResponseData Data containing concatenated information of the job response like the retval and state + * \param[in] jobResponseBuffer Valid job response buffer with at least CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE bytes of storage + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ReceiveResponse_CryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +# endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer); + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReceiveResponse_KeyMJob() + *********************************************************************************************************************/ +/*! + * \brief Receive key management job response. + * \details - + * \param[in] jobRequestId Valid job request Id + * \param[in] jobResponseData Data containing concatenated information of the job response like the retval + * \param[in] jobResponseBuffer Valid job response buffer with at least CRYPTO_30_VHSM_KEYM_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE bytes of storage + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + */ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ReceiveResponse_KeyMJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +# endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer); + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a crypto job + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 80. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +# endif + ); + +# if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a crypto job + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 44. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_MacGen( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +# endif + ); +# endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) */ + +# if (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a crypto job + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 48. + * \param[in,out] jobRedirectionInfoPtr Valid pointer to the redirection info. + * The availability of this parameter depends on the configuration. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_MacVer( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf +# if (CRYPTO_30_VHSM_REDIRECTION == STD_ON) +, P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRedirectionInfoPtr +# endif + ); +# endif /* (CRYPTO_30_VHSM_IPC_MAC_JOB_OPTIMIZATION == STD_ON) */ + +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a key management job for key element copy partial + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] keyMJobPtr Valid pointer to job result object + * \param[in,out] ptrBuf Valid pointer to buffer where the key job will be serialized. + * Must be at least of size 32. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_KeyMJob_CopyPartial( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyMJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf); + +# if (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a key derive job + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] cryptoJobPtr Valid pointer to job object + * \param[in,out] ptrBuf Valid pointer to buffer where the crypto job will be serialized. + * Must be at least of size 36. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_CryptoJob_KeyDerive( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) cryptoJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf); +# endif /* (CRYPTO_30_VHSM_KEY_DERIVE_JOB_SUPPORT == STD_ON) */ +# endif /* (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2) */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_SerializeRequest_KeyMJob() + *********************************************************************************************************************/ +/*! + * \brief Serialization of a key management job + * \details - + * \param[in] jobRequestId Valid jobRequestId + * \param[in] keyMJobPtr Valid pointer to job result object + * \param[in,out] ptrBuf Valid pointer to buffer where the key job will be serialized. + * Must be at least of size 36. + * \return E_OK if no errors occurred, otherwise E_NOT_OK. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_SerializeRequest_KeyMJob( + Crypto_30_vHsm_JobRequestIterType jobRequestId, + P2CONST(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyMJobPtr, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) ptrBuf); + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_VHSM_JOBS_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Jobs.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.c b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.c new file mode 100644 index 0000000..b4ec5d2 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.c @@ -0,0 +1,1547 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_KeyManagement.c + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Implementation of the MICROSAR Crypto Driver (Crypto) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_KEYMANAGEMENT_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Crypto_30_vHsm.h" +#include "Crypto_30_vHsm_Ipc.h" +#include "SchM_Crypto_30_vHsm.h" + +#include "vstdlib.h" +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_KEYM_JOBID_MASK (0xFF000000u) + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ +#if !defined (CRYPTO_30_VHSM_LOCAL) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL static +#endif + +#if !defined (CRYPTO_30_VHSM_LOCAL_INLINE) /* COV_CRYPTO_30_VHSM_LOCAL_DEFINE */ +# define CRYPTO_30_VHSM_LOCAL_INLINE LOCAL_INLINE +#endif + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessKeyMJob() + *********************************************************************************************************************/ +/*! \brief Process key management job + * \details Check if vHsm is busy, otherwise execute job + * \param[in] keyMJob Pointer to a valid KeyM job structure. + * \param[in] partitionIdx Valid identifier of the partition. + * \return E_OK Process job successful. + * E_NOT_OK Process job failed. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessKeyMJob( + P2VAR(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyMJob, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_AllocateKeyMJob() + *********************************************************************************************************************/ +/*! \brief Find a free job request Id + * \details Locking the driver object has to be done outside this function. + * \param[out] jobRequestIdPtr Pointer to a free jobRequestId which is the same as a free driver object + * \param[in] partitionIdx Valid identifier of the partition. + * \return E_OK Free management driver object has been found + * E_NOT_OK No free management driver objects available + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_AllocateKeyMJob( + P2VAR(Crypto_30_vHsm_JobRequestIterType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRequestIdPtr, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReadStatusRegister() + *********************************************************************************************************************/ +/*! \brief Read status register + * \details Read from a given register address into an uint8 array. + * \param[in] registerAddress Address of status register + * \param[out] destPtr Pointer to destination array + * \param[in,out] destLengthPtr Length pointer of the destination array + * \return E_OK Status information are available + * E_NOT_OK Status information could not be stored + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ReadStatusRegister( + uint32 registerAddress, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) destPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) destLengthPtr); + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#define CRYPTO_30_VHSM_START_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_AllocateKeyMJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL_INLINE FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_AllocateKeyMJob( + P2VAR(Crypto_30_vHsm_JobRequestIterType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) jobRequestIdPtr, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + Std_ReturnType retVal = E_NOT_OK; + Crypto_30_vHsm_KeyMgmObjIterType mngObjectIdx; + + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + + /* #10 Iterate oder all management driver object references */ + for (mngObjectIdx = 0u; mngObjectIdx < Crypto_30_vHsm_GetSizeOfKeyMgmObj(); mngObjectIdx++) + { + Crypto_30_vHsm_JobRequestIterType jobRequestIdTmp = Crypto_30_vHsm_GetObjectInfoIdxOfKeyMgmObj(mngObjectIdx); + /* #30 Check if the driver object is currently not used */ + if( (Crypto_30_vHsm_GetDriverObjectLock(jobRequestIdTmp) == CRYPTO_30_VHSM_ACCEPT_ANY_JOBID) + && (Crypto_30_vHsm_IsLockOfJobRequest(jobRequestIdTmp) == FALSE) /* PRQA S 3415 */ /* MD_CRYPTO_30_VHSM_3415_LOGICAL_OPERATOR */ +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES > 1u) + && (Crypto_30_vHsm_GetCurrentPartitionIdxOfObjectInfo(jobRequestIdTmp) == partitionIdx) /* Check if that KeyM driver object can be used for the current partition */ +#endif + ) + { + Crypto_30_vHsm_SetDriverObjectLock(jobRequestIdTmp, (CRYPTO_30_VHSM_KEYM_JOBID_MASK | jobRequestIdTmp)); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestIdTmp, TRUE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + *jobRequestIdPtr = jobRequestIdTmp; /* SBSW_CRYPTO_30_VHSM_VARIABLE_ACCESS_PTR_FROM_STACK */ + retVal = E_OK; + break; + } + } + + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_0(); + +#if (CRYPTO_30_VHSM_NUMBER_OF_IPC_INSTANCES < 2u) + CRYPTO_30_VHSM_DUMMY_STATEMENT(partitionIdx); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + /* #40 Return if a free driver object has been found */ + return retVal; +} /* Crypto_30_vHsm_AllocateKeyMJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ProcessKeyMJob() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ProcessKeyMJob( + P2VAR(Crypto_30_vHsm_KeyM_JobType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyMJob, + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal; + + Crypto_30_vHsm_JobRequestIterType jobRequestId = 0u; + + /* ----- Implementation ----------------------------------------------- */ + if(Crypto_30_vHsm_AllocateKeyMJob(&jobRequestId, partitionIdx) == E_OK) /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + { + if (keyMJob->action == CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPYPARTIAL) + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + else + { + Crypto_30_vHsm_SetKindOfJobRequest(jobRequestId, CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + } + Crypto_30_vHsm_SetKeyMJobOfJobRequest(jobRequestId, keyMJob); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetCancelOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetProcessingTypeOfJobRequest(jobRequestId, CRYPTO_PROCESSING_SYNC); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_SetContextClassOfJobRequest(jobRequestId, CRYPTO_30_VHSM_CALLOUT_KEYMJOB); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + Crypto_30_vHsm_SetContextIdOfJobRequest(jobRequestId, Crypto_30_vHsm_GetKeyMJobOfJobRequest(jobRequestId)->cryptoKeyId); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ +#endif + + retVal = Crypto_30_vHsm_ProcessJobRequest(jobRequestId, partitionIdx); + + if (retVal == E_OK) + { + retVal = (Std_ReturnType)Crypto_30_vHsm_GetResultOfJobRequest(jobRequestId); + } + +#if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) + if (Crypto_30_vHsm_GetStateOfJobRequest(jobRequestId) != CRYPTO_30_VHSM_JOBREQUEST_STATE_TIMEOUT) +#endif + { + Crypto_30_vHsm_SetLockOfJobRequest(jobRequestId, FALSE); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Enter_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + Crypto_30_vHsm_SetDriverObjectLock(jobRequestId, CRYPTO_30_VHSM_ACCEPT_ANY_JOBID); /* SBSW_CRYPTO_30_VHSM_CSL02_OBJECTINFO */ + SchM_Exit_Crypto_30_vHsm_CRYPTO_30_VHSM_EXCLUSIVE_AREA_2(); + } + } + else + { + retVal = CRYPTO_E_BUSY; + } + + return retVal; +} /* Crypto_30_vHsm_ProcessKeyMJob() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_ReadStatusRegister() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + */ +CRYPTO_30_VHSM_LOCAL FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_ReadStatusRegister( + uint32 registerAddress, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) destPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) destLengthPtr) +{ + Std_ReturnType retVal = E_NOT_OK; + uint32 regVal; + + if (*destLengthPtr >= 4u) + { + regVal = *(volatile P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))registerAddress; /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ + + VStdLib_MemCpy(destPtr, ®Val, 4u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + + *destLengthPtr = 4u; /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + + retVal = E_OK; + } + return retVal; +} /* Crypto_30_vHsm_ReadStatusRegister() */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementIdsGet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementIdsGet( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyElementIdsPtr, /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyElementIdsLengthPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00161] */ + errorId = CRYPTO_E_UNINIT; + } + else if (keyElementIdsPtr == NULL_PTR) + { + /* [SWS_Crypto_00162] */ + errorId = CRYPTO_E_PARAM_HANDLE; + } + else if (keyElementIdsLengthPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_HANDLE; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTIDSGET; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.secondaryCryptoKeyId = 0u; + + /* Set rest of parameters to default values */ + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; +#endif + keyMJob.inputOutput.outputPtr = (P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))keyElementIdsPtr; /* PRQA S 0310 */ /* MD_CRYPTO_30_VHSM_0310_KEYELEMENT_CONTENT */ + keyMJob.inputOutput.outputLengthPtr = keyElementIdsLengthPtr; + + /* Multiply by 4 because given length is the number of uint32 elements. This way, there is no special handling in the IPC, because the length is now the number of bytes. */ + *keyElementIdsLengthPtr = (uint32)(*keyElementIdsLengthPtr * sizeof(uint32)); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + + /* Divide by 4 because length should be the number of uint32 elements. This way, there is no special handling in the IPC. */ + *keyElementIdsLengthPtr = (uint32)(*keyElementIdsLengthPtr / sizeof(uint32)); /* SBSW_CRYPTO_30_VHSM_PTR_ACCESS_WITH_DET_CHECK */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_ELEMENT_IDS_GET, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + CRYPTO_30_VHSM_DUMMY_STATEMENT(cryptoKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return retVal; +} /* Crypto_30_vHsm_KeyElementIdsGet() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyCopy() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyCopy( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Check plausibility of input parameters */ + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00156] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + /* #20 Set the parameters inside the job needed for this command */ + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYCOPY; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.secondaryCryptoKeyId = targetCryptoKeyId; + + /* #21 Set rest of parameters to default values */ + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + /* #22 Execute the job */ + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + /* #30 Report Det if error happened */ + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_COPY, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyCopy() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementCopy() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementCopy( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00149] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPY; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.keyElementId = keyElementId; + keyMJob.secondaryCryptoKeyId = targetCryptoKeyId; + keyMJob.secondaryKeyElementId = targetKeyElementId; + + /* Set rest of parameters to default values */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_ELEMENT_COPY, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + return retVal; +} /* Crypto_30_vHsm_KeyElementCopy() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + /* PRQA S 6060 1 */ /* MD_MSR_STPAR */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementCopyPartial( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00149] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPYPARTIAL; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.keyElementId = keyElementId; + keyMJob.secondaryCryptoKeyId = targetCryptoKeyId; + keyMJob.secondaryKeyElementId = targetKeyElementId; + keyMJob.inputOutput.keyElementCopyLength = keyElementCopyLength; + keyMJob.inputOutput.keyElementSourceOffset = keyElementSourceOffset; + keyMJob.inputOutput.keyElementTargetOffset = keyElementTargetOffset; + + /* Set rest of parameters to default values */ +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_ELEMENT_COPY_PARTIAL, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + return retVal; +} /* Crypto_30_vHsm_KeyElementCopyPartial() */ + +/* [SWS_Crypto_91004] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementSet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6030, 6080 1 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyPtr, + uint32 keyLength) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00075] */ + } + else if (keyPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; /* [SWS_Crypto_00078] */ + } +# if (CRYPTO_30_VHSM_KEY_ELEMENT_DELETE_SUPPORT == STD_OFF) + else if (keyLength == 0u) + { + errorId = CRYPTO_E_PARAM_VALUE; /* [SWS_Crypto_00079] */ + } +# endif + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* Check if HOST2HSM register shall be set */ + if (keyElementId == CRYPTO_KE_CUSTOM_VHSM_STATUS_HOST2HSM) + { + if (keyLength == 4u) + { + uint32 regVal; + + VStdLib_MemCpy(®Val, keyPtr, 4u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + *(volatile P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))CRYPTO_30_VHSM_HOST2_HSM_ADDRESS = regVal; /* PRQA S 0303 */ /* MD_CRYPTO_30_VHSM_REGISTER_ACCESS */ /* SBSW_CRYPTO_30_VHSM_REGISTER_ACCESS */ + + retVal = E_OK; + } + } + /* Otherwise process KeyMJob to HSM */ + else + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTSET; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.keyElementId = keyElementId; + keyMJob.inputOutput.inputPtr = keyPtr; + keyMJob.inputOutput.inputLength = keyLength; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + /* Check if the code flash operation has finished */ + if ((keyElementId == CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION) + && (keyLength == 1u) + && (keyPtr[0] == CRYPTO_30_VHSM_CODEFLASH_STOP)) + { + /* Indicate the end of the RAM execution */ + Crypto_30_vHsm_Ipc_EndRamExec(partitionIdx); /* PRQA S 0310, 3305, 4404 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* SBSW_CRYPTO_30_VHSM_SET_VALUE_IN_IPC */ + +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Start_Callout( + CRYPTO_30_VHSM_CALLOUT_EXITRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + + /* Wait until the vHsm indicates that it is not any longer running in the RAM loop. */ + while (Crypto_30_vHsm_Ipc_IsRamExec(partitionIdx) == TRUE) /* PRQA S 0310, 3305, 4340 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT */ + { +#if (CRYPTO_30_VHSM_WAIT_LOOP_CALLOUT_ENABLED == STD_ON) + Crypto_30_vHsm_GetWaitLoopCallout()(); +#endif +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Loop_Callout( + CRYPTO_30_VHSM_CALLOUT_EXITRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + } +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( + CRYPTO_30_VHSM_CALLOUT_EXITRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + } + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + + /* Check if this was the start of a code flash operation */ + if ((keyElementId == CRYPTO_KE_CUSTOM_VHSM_FLASH_OPERATION) + && (keyLength == 1u) + && (keyPtr[0] == CRYPTO_30_VHSM_CODEFLASH_START) + && (retVal == E_OK)) + { +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Start_Callout( + CRYPTO_30_VHSM_CALLOUT_ENTERRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + /* Wait until the vHsm is in the RAM loop. */ + while (Crypto_30_vHsm_Ipc_IsRamExec(partitionIdx) != TRUE) /* PRQA S 0310, 3305, 4340 */ /* MD_CRYPTO_30_VHSM_IPC_MACRO */ /* FETA_CRYPTO_30_VHSM_WAIT_FOR_HSM_WITH_CALLOUT */ + { +#if (CRYPTO_30_VHSM_WAIT_LOOP_CALLOUT_ENABLED == STD_ON) + Crypto_30_vHsm_GetWaitLoopCallout()(); +#endif +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_Loop_Callout( + CRYPTO_30_VHSM_CALLOUT_ENTERRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + } +#if (CRYPTO_30_VHSM_TIMEOUT_CALLOUT == STD_ON) + Crypto_30_vHsm_TimeoutDetect_End_Callout( + CRYPTO_30_VHSM_CALLOUT_ENTERRAMLOOP, + 0u, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB, + cryptoKeyId); +#endif + } + } + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_ELEMENT_SET, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyElementSet() */ + +/* [SWS_Crypto_91005] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyValidSet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyValidSet( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + errorId = CRYPTO_E_UNINIT; /* [SWS_Crypto_00082] */ + } + else +#endif + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYVALIDSET; + keyMJob.cryptoKeyId = cryptoKeyId; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_VALID_SET, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyValidSet() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeySetInvalid() + *********************************************************************************************************************/ + /*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeySetInvalid( + uint32 cryptoKeyId) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + errorId = CRYPTO_E_UNINIT; + } + else +#endif + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYSETINVALID; + keyMJob.cryptoKeyId = cryptoKeyId; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_SET_INVALID, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeySetInvalid() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyGetStatus() + *********************************************************************************************************************/ + /*! + * + * Internal comment removed. + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyStatusPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + errorId = CRYPTO_E_UNINIT; + } + else if (keyStatusPtr == NULL_PTR) + { + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + uint32 outputLength = sizeof(Crypto_KeyStatusType); + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYGETSTATUS; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.inputOutput.outputPtr = keyStatusPtr; + keyMJob.inputOutput.outputLengthPtr = &outputLength; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_GET_STATUS, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyGetStatus() */ + +/* [SWS_Crypto_91006] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementGet() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) resultLengthPtr) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00085] */ + errorId = CRYPTO_E_UNINIT; + } + else if (resultPtr == NULL_PTR) + { + /* [SWS_Crypto_00088] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (resultLengthPtr == NULL_PTR) + { + /* [SWS_Crypto_00089] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (*resultLengthPtr == 0u) + { + /* [SWS_Crypto_00090] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* Check if HOST2HSM register shall be read */ + if (keyElementId == CRYPTO_KE_CUSTOM_VHSM_STATUS_HOST2HSM) + { + retVal = Crypto_30_vHsm_ReadStatusRegister(CRYPTO_30_VHSM_HOST2_HSM_ADDRESS, resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_VHSM_FORWARDING_PTR */ + } + /* Check if HSM2HOST register shall be read */ + else if (keyElementId == CRYPTO_KE_CUSTOM_VHSM_STATUS_HSM2HOST) + { + retVal = Crypto_30_vHsm_ReadStatusRegister(CRYPTO_30_VHSM_HSM2_HOST_ADDRESS, resultPtr, resultLengthPtr); /* SBSW_CRYPTO_30_VHSM_FORWARDING_PTR */ + } + /* Otherwise process KeyMJob to HSM */ + else + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTGET; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.keyElementId = keyElementId; + keyMJob.inputOutput.outputPtr = resultPtr; + keyMJob.inputOutput.outputLengthPtr = resultLengthPtr; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_ELEMENT_GET, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyElementGet() */ + +/* [SWS_Crypto_91013] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_RandomSeed() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) entropyPtr, + uint32 entropyLength) +{ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00128] */ + errorId = CRYPTO_E_UNINIT; + } + else if (entropyPtr == NULL_PTR) + { + /* [SWS_Crypto_00130] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (entropyLength == 0u) + { + /* [SWS_Crypto_00131] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_RANDOMSEED; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.inputOutput.inputPtr = (P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))entropyPtr; + keyMJob.inputOutput.inputLength = entropyLength; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_RANDOM_SEED, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_RandomSeed() */ + +/* [SWS_Crypto_91007] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyGenerate() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyGenerate( + uint32 cryptoKeyId) +{ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00094] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYGENERATE; + keyMJob.cryptoKeyId = cryptoKeyId; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_GENERATE, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyGenerate() */ + +/* [SWS_Crypto_91008] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyDerive() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00097] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYDERIVE; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.secondaryCryptoKeyId = targetCryptoKeyId; + + /* Set rest of parameters to default values */ + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_DERIVE, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyDerive() */ + +/* [SWS_Crypto_91009] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) publicValueLengthPtr) +{ + uint8 errorId = CRYPTO_E_NO_ERROR; + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00103] */ + errorId = CRYPTO_E_UNINIT; + } + else if (publicValuePtr == NULL_PTR) + { + /* [SWS_Crypto_00105] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (publicValueLengthPtr == NULL_PTR) + { + /* [SWS_Crypto_00106] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (*publicValueLengthPtr == 0u) + { + /* [SWS_Crypto_00107] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCPUBVAL; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.inputOutput.outputPtr = publicValuePtr; + keyMJob.inputOutput.outputLengthPtr = publicValueLengthPtr; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_EXCHANGE_CALC_PUB_VAL, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyExchangeCalcPubVal() */ + +/* [SWS_Crypto_91010] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00111] */ + errorId = CRYPTO_E_UNINIT; + } + else if (partnerPublicValuePtr == NULL_PTR) + { + /* [SWS_Crypto_00113] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else if (partnerPublicValueLength == 0u) + { + /* [SWS_Crypto_00115] */ + errorId = CRYPTO_E_PARAM_VALUE; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCSECRET; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.inputOutput.inputPtr = (P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA))partnerPublicValuePtr; + keyMJob.inputOutput.inputLength = partnerPublicValueLength; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_KEY_EXCHANGE_CALC_SECRET, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_KeyExchangeCalcSecret() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_CertificateParse() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CertificateParse( + uint32 cryptoKeyId) +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00168] */ + errorId = CRYPTO_E_UNINIT; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEPARSE; + keyMJob.cryptoKeyId = cryptoKeyId; + + /* Set rest of parameters to default values */ + keyMJob.secondaryCryptoKeyId = 0u; + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; + keyMJob.inputOutput.outputPtr = NULL_PTR; + keyMJob.inputOutput.outputLengthPtr = NULL_PTR; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_CERTIFICATE_PARSE, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_CertificateParse() */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_CertificateVerify() + *********************************************************************************************************************/ +/*! + * + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CertificateVerify( + uint32 cryptoKeyId, + uint32 verifyCryptoKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_CRYPTO_30_VHSM_3673_API_SPECIFIC */ +{ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CRYPTO_E_NO_ERROR; + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx = Crypto_30_vHsm_GetCurrentPartitionIdx(); + + /* ----- Development Error Checks ------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) + if (Crypto_30_vHsm_GetPartitionInitialized(partitionIdx) != CRYPTO_30_VHSM_INITIALIZED) + { + /* [SWS_Crypto_00172] */ + errorId = CRYPTO_E_UNINIT; + } + else if (verifyPtr == NULL_PTR) + { + /* [SWS_Crypto_00175] */ + errorId = CRYPTO_E_PARAM_POINTER; + } + else +#endif /* (CRYPTO_30_VHSM_DEV_ERROR_DETECT == STD_ON) */ + { + Crypto_30_vHsm_KeyM_JobType keyMJob; + uint32 verifyLength = sizeof(Crypto_VerifyResultType); + + keyMJob.action = CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEVERIFY; + keyMJob.cryptoKeyId = cryptoKeyId; + keyMJob.secondaryCryptoKeyId = verifyCryptoKeyId; + /* OutputPtr is used instead of verifyPtr which is not available for KeyM jobs in the IPC */ + keyMJob.inputOutput.outputLengthPtr = &verifyLength; + keyMJob.inputOutput.outputPtr = (P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR))verifyPtr; + + /* Set rest of parameters to default values */ + keyMJob.keyElementId = 0u; + keyMJob.secondaryKeyElementId = 0u; +#if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 2u) + keyMJob.inputOutput.inputPtr = NULL_PTR; + keyMJob.inputOutput.inputLength = 0u; +#endif + + retVal = Crypto_30_vHsm_ProcessKeyMJob(&keyMJob, partitionIdx); /* SBSW_CRYPTO_30_VHSM_STACK_VARIABLE_AS_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +#if (CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CRYPTO_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CRYPTO_30_VHSM_MODULE_ID, + CRYPTO_30_VHSM_INSTANCE_ID, + CRYPTO_30_VHSM_SID_CERTIFICATE_VERIFY, + errorId); + } +#else /* !(CRYPTO_30_VHSM_DEV_ERROR_REPORT == STD_ON) */ + CRYPTO_30_VHSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* Crypto_30_vHsm_CertificateVerify() */ + +#define CRYPTO_30_VHSM_STOP_SEC_CODE +#include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_KeyManagement.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.h new file mode 100644 index 0000000..1b7a2be --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_KeyManagement.h @@ -0,0 +1,465 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_KeyManagement.h + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Internal header file for service key management function prototypes + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_KEYMANAGEMENT_H) +# define CRYPTO_30_VHSM_KEYMANAGEMENT_H +# include "Csm_Types.h" + +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyCopy() + *********************************************************************************************************************/ +/*! \brief Copy the key + * \details Copies a key with all its elements to another key in the same crypto driver. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131140 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyCopy( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementCopy() + *********************************************************************************************************************/ +/*! \brief Copy key element + * \details Copies a key element to another key element in the same crypto driver. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_EXTRACT_DENIED Request failed, not allowed to extract key material. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131141 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementCopy( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! \brief Copy key element partial + * \details Copies a key element to another key element in the same crypto driver. The keyElementSourceOffset + * and keyElementCopyLength allows to copy just a part of the source key element into the destination. + * The offset of the target key is also specified with this function. + * The target key element needs to have partial access. + * The key element can only be copied, if the destination key element write access right is less than + * WA_INTERNAL_COPY. + * Additional the read access right of the source must be less than RA_INTERNAL_COPY and the destination + * read access right must be higher or equal than the source read access right. + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset Holds the offset of the of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset Holds the offset of the of the target key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Holds the number of bytes that shall be copied. + * \param[in] targetCryptoKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element sizes are not compatible. + * CRYPTO_E_KEY_EMPTY Request failed, uninitialized source key element. + * \pre - + * \context TASK + * \reentrant TRUE, for different crypto keys + * \synchronous TRUE + * \trace CREQ-180788 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementCopyPartial( + uint32 cryptoKeyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetCryptoKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementIdsGet() + *********************************************************************************************************************/ +/*! \brief Used to retrieve information which key elements are available in a given key. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose available element ids shall be exported. + * \param[out] keyElementIdsPtr Contains the pointer to the array where the ids of the key + * elements shall be stored. + * \param[in,out] keyElementIdsLengthPtr Holds a pointer to the memory location in which the number of key element + * in the given key is stored. On calling this function, this parameter + * shall contain the size of the buffer provided by keyElementIdsPtr. When the + * request has finished, the actual number of key elements is stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131139 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementIdsGet( + uint32 cryptoKeyId, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyElementIdsPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyElementIdsLengthPtr); + +/* [SWS_Crypto_91004] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementSet() + *********************************************************************************************************************/ +/*! \brief Sets a key element + * \details Sets the given key element bytes to the key identified by cryptoKeyId. . + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be set. + * \param[in] keyElementId Holds the identifier of the key element which shall be set. + * \param[in] keyPtr Holds the pointer to the key data which shall be set as key element. + * \param[in] keyLength Contains the length of the key element in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_WRITE_FAIL Request failed, write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the key element size does not match size of provided + * data. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-WaitLoopCallout, CREQ-131144 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementSet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) keyPtr, + uint32 keyLength); + +/* [SWS_Crypto_91005] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyValidSet() + *********************************************************************************************************************/ +/*! \brief Sets the key to valid + * \details Sets the key state of the key identified by cryptoKeyId to valid. + * \param[in] cryptoKeyId Holds the identifier of the key whose key elements shall be set to valid. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131143 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyValidSet( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Sets the key to invalid + * \details Sets the key state of the key identified by cryptoKeyId to invalid. + * \param[in] cryptoKeyId Holds the identifier of the key whose key elements shall be set to invalid. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-KeySetInvalid + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeySetInvalid( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyGetStatus() + *********************************************************************************************************************/ +/*! \brief Returns the key state of the key identified by cryptoKeyId. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key for which the key state shall be returned. + * \param[out] keyStatusPtr Contains the pointer to the data where the status of the key shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-Crypto-KeyGetStatus + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyGetStatus( + uint32 cryptoKeyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) keyStatusPtr); + +/* [SWS_Crypto_91006] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyElementGet() + *********************************************************************************************************************/ +/*! \brief This interface shall be used to get a key element of the key identified by the cryptoKeyId and store + * the key element in the memory location pointed by the result pointer. + * \details - + * \param[in] cryptoKeyId Holds the identifier of the key whose key element shall be returned. + * \param[in] keyElementId Holds the identifier of the key element which shall be returned. + * \param[out] resultPtr Holds the pointer of the buffer for the returned key element + * \param[in,out] resultLengthPtr Holds a pointer to a memory location in which the length information is + * stored. On calling this function this parameter shall contain the size of the + * buffer provided by resultPtr. If the key element is configured to allow + * partial access, this parameter contains the amount of data which should + * be read from the key element. The size may not be equal to the size of + * the provided buffer anymore. When the request has finished, the amount + * of data that has been stored shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_KEY_READ_FAIL Request failed, read access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed, the key is not available. + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131142 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyElementGet( + uint32 cryptoKeyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) resultLengthPtr); + +/* [SWS_Crypto_91013] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_RandomSeed() + *********************************************************************************************************************/ +/*! \brief Initialize the seed + * \details This function generates the internal seed state using the provided entropy source. + * Furthermore, this function can be used to update the seed state with new entropy + * \param[in] cryptoKeyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] entropyPtr Holds a pointer to the memory location which contains the + * data to feed the entropy. + * \param[in] entropyLength Contains the length of the entropy in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-131137 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_RandomSeed( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) entropyPtr, + uint32 entropyLength); + +/* [SWS_Crypto_91007] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyGenerate() + *********************************************************************************************************************/ +/*! \brief Generates a key + * \details This function shall dispatch the key generate function to the configured crypto driver object. + * \param[in] cryptoKeyId Holds the identifier of the key which is to be updated with the generated + * value. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-155909 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyGenerate( + uint32 cryptoKeyId); + +/* [SWS_Crypto_91008] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a key + * \details Derives a new key by using the key elements in the given key identified by the cryptoKeyId. + * The given key contains the key elements for the password, salt. The derived key is stored + * in the key element with the id 1 of the key identified by targetCryptoKeyId. + * The number of iterations is given in the key element CRYPTO_KE_KEYDERIVATION_ITERATIONS. + * \param[in] cryptoKeyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetCryptoKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-132407 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyDerive( + uint32 cryptoKeyId, + uint32 targetCryptoKeyId); + +/* [SWS_Crypto_91009] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Calculation of the public value + * \details Calculates the public value for the key exchange and stores the public key in the + * memory location pointed by the public value pointer. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-132409 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyExchangeCalcPubVal( + uint32 cryptoKeyId, + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) publicValueLengthPtr); + +/* [SWS_Crypto_91010] */ +/********************************************************************************************************************** + * Crypto_30_vHsm_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Calculation of the secret + * \details Calculates the shared secret key for the key exchange with the key material of the key identified + * by the cryptoKeyId and the partner public key. The shared secret key is stored + * as a key element in the same key. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partners + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partners public value in bytes. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * CRYPTO_E_SMALL_BUFFER Request failed, the provided buffer is too small to store the result. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-132408 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_KeyExchangeCalcSecret( + uint32 cryptoKeyId, + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Crypto_30_vHsm_CertificateParse() + *********************************************************************************************************************/ +/*! \brief Parse stored certificate + * \details Parses the certificate data stored in the key element CRYPTO_KE_CERT_DATA and fills the key elements + * CRYPTO_KE_CERT_SIGNEDDATA, CRYPTO_KE_CERT_PARSEDPUBLICKEY and CRYPTO_KE_CERT_SIGNATURE + * \param[in] cryptoKeyId Holds the identifier of the key slot in which the certificate has been + * stored. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-155910 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CertificateParse( + uint32 cryptoKeyId); + +/********************************************************************************************************************** + * Crypto_30_vHsm_CertificateVerify() + *********************************************************************************************************************/ +/*! \brief Certificate verification + * \details Verifies the certificate stored in the key referenced by verifyCryptoKeyId with the + * certificate stored in the key referenced by cryptoKeyId. + * \param[in] cryptoKeyId Holds the identifier of the key which shall be used to validate the + * certificate. + * \param[in] verifyCryptoKeyId Holds the identifier of the key containing the certificate, which shall be + * verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the + * certificate verification. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-155911 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_CertificateVerify( + uint32 cryptoKeyId, + uint32 verifyCryptoKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) verifyPtr); + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_VHSM_KEYMANAGEMENT_H) */ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Private.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Private.h new file mode 100644 index 0000000..7b7d61a --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Private.h @@ -0,0 +1,105 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_30_vHsm_Private.h + * \brief MICROSAR vHsm Crypto Driver (Crypto) + * + * \details Private declarations for the module. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_PRIVATE_H) +# define CRYPTO_30_VHSM_PRIVATE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_30_vHsm_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +# define CRYPTO_30_VHSM_START_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) +/********************************************************************************************************************** + * Crypto_30_vHsm_HandleTimeout() + *********************************************************************************************************************/ +/*! + * \brief Poll all timeouted Ipc job requests for an answer of the Hsm. + * \details - + * \param[in] partitionIdx The currently active partition index + * \pre - + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_HandleTimeout(Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx); + +/********************************************************************************************************************** + * Crypto_30_vHsm_RecoverFromTimeout() + *********************************************************************************************************************/ +/*! + * \brief Frees the Ipc channel of the jobRequestId. Also tries to recover the jobRequest. + * \details Can be callout by inside the loop callout by the user when a timeout is detected. + * \param[in] partitionIdx The currently active partition index + * \param[in] jobRequestId The Id of the timeouted jobRequest + * \param[in] writeIdx The writeIdx of the Hsm response + * \param[in] jobResponseData Data containing concatenated information of the job response like the retval and state + * \param[in] jobResponseBuffer Valid job response buffer with at least CRYPTO_30_VHSM_CRYPTO_JOBRESULTTYPE_DESERIALIZED_BUF_SIZE bytes of storage + * \pre Crypto_30_vHsm_SetChannelOfJobRequest has to have been called for the same jobRequestId. + * \context TASK, ISR2 + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CRYPTO_30_VHSM_CODE) Crypto_30_vHsm_RecoverFromTimeout( + Crypto_30_vHsm_PartitionIdentifiersIterType partitionIdx, + Crypto_30_vHsm_JobRequestIterType jobRequestId, + uint32 writeIdx, +# if (CRYPTO_30_VHSM_IPC_PROTOCOL_VERSION == 3u) + uint32 jobResponseData, +# endif + Crypto_30_vHsm_JobResponseBufferPtrType jobResponseBuffer); +# endif /* (CRYPTO_30_VHSM_TIMEOUT_RECOVERY == STD_ON) */ + +# define CRYPTO_30_VHSM_STOP_SEC_CODE +# include "Crypto_30_vHsm_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CRYPTO_30_VHSM_PRIVATE_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Private.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Types.h b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Types.h new file mode 100644 index 0000000..17b7c7e --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Crypto_30_vHsm_Types.h @@ -0,0 +1,136 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Crypto_30_vHsm_Types.h + * \brief Vector Hardware Security Module Firmware Types + * + * \details Declares data structures required for interaction with Vector Hardware Security Module Firmware. + * + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_30_VHSM_TYPES_H) +# define CRYPTO_30_VHSM_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* vHsm Number of job request kinds */ +# define CRYPTO_30_VHSM_CRYPTO_JOBKIND (0u) /*!< Job kind for Crypto jobs */ +# define CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND (1u) /*!< Job kind for Key Management jobs */ +# define CRYPTO_30_VHSM_KEYMANAGEMENT_COPY_PARTIAL_JOBKIND (2u) /*!< Job kind for Key Element Copy Partial jobs */ +# define CRYPTO_30_VHSM_CRYPTO_MACGEN_JOBKIND (3u) /*!< Job kind for MAC Generate jobs */ +# define CRYPTO_30_VHSM_CRYPTO_MACVER_JOBKIND (4u) /*!< Job kind for MAC Verify jobs */ +# define CRYPTO_30_VHSM_KEYMANAGEMENT_KEYDERIVEJOB_JOBKIND (5u) /*!< Job kind for MAC Verify jobs */ +# define CRYPTO_30_VHSM_JOBKIND_INVALID (6u) /*!< Invalid Job kind */ +# define CRYPTO_30_VHSM_NR_OF_JOBKINDS (CRYPTO_30_VHSM_JOBKIND_INVALID) /*!< Number of valid job kinds */ + +/* vHsm Key management actions */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTSET (0x00u) /*!< Action for Crypto_30_KeyElementSet() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTGET (0x01u) /*!< Action for Crypto_30_KeyElementGet() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPY (0x02u) /*!< Action for Crypto_30_KeyElementCopy() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYCOPY (0x03u) /*!< Action for Crypto_30_KeyCopy() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYDERIVE (0x04u) /*!< Action for Crypto_30_KeyDerive() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYGENERATE (0x05u) /*!< Action for Crypto_30_KeyGenerate() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYVALIDSET (0x06u) /*!< Action for Crypto_30_KeyValidSet() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_RANDOMSEED (0x07u) /*!< Action for Crypto_30_RandomSeed() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEPARSE (0x08u) /*!< Action for Crypto_30_CertificateParse() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_CERTIFICATEVERIFY (0x09u) /*!< Action for Crypto_30_CertificateVerify() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCPUBVAL (0x0Au) /*!< Action for Crypto_30_KeyExchangeCalcPubVal() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYEXCHANGECALCSECRET (0x0Bu) /*!< Action for Crypto_30_KeyExchangeCalcSecret() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTIDSGET (0x0Cu) /*!< Action for Crypto_30_KeyElementIdsGet() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYELEMENTCOPYPARTIAL (0x0Du) /*!< Action for Crypto_30_KeyElementCopyPartial() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYSETINVALID (0x0Eu) /*!< Action for Crypto_30_KeySetInvalid() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_KEYGETSTATUS (0x0Fu) /*!< Action for Crypto_30_KeyGetStatus() */ +# define CRYPTO_30_VHSM_KEYM_ACTION_INVALID (0x10u) /*!< Invalid Job kind */ +# define CRYPTO_30_VHSM_NR_OF_KEYM_ACTION (CRYPTO_30_VHSM_KEYM_ACTION_INVALID) /*!< Number of valid job kinds */ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +typedef uint8 Crypto_30_vHsm_ChannelIdType; + +typedef P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) Crypto_30_vHsm_JobRequestBufferPtrType; +typedef P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) Crypto_30_vHsm_JobResponseBufferPtrType; + +typedef uint32 Crypto_30_vHsm_JobResponseBufferSizeType; +typedef uint32 Crypto_30_vHsm_JobRequestBufferSizeType; + +typedef uint32 Crypto_30_vHsm_KeyM_ActionType; + +/*! Struct containing the input and output information of a KeyM job */ +typedef struct Crypto_30_vHsm_KeyM_InputOutputTypeStruct +{ + P2CONST(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_DATA) inputPtr; /*!< Pointer for the input data */ + uint32 inputLength; /*!< Size of the input data */ + P2VAR(uint8, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) outputPtr; /*!< Pointer for the output data */ + P2VAR(uint32, AUTOMATIC, CRYPTO_30_VHSM_APPL_VAR) outputLengthPtr; /*!< Size of the output data */ + uint32 keyElementSourceOffset; /*!< offset for the source key element during key element copy partial */ + uint32 keyElementTargetOffset; /*!< offset for the target key element during key element copy partial */ + uint32 keyElementCopyLength; /*!< Number of bytes to copy during key element copy partial */ +} Crypto_30_vHsm_KeyM_InputOutputType; + +/*! Struct containing basic information about a KeyM job */ +typedef struct Crypto_30_vHsm_KeyM_JobTypeStruct +{ + Crypto_30_vHsm_KeyM_ActionType action; /*!< action which shall be performed (e.g. KeyElementGet, KeyElementSet,...) */ + uint32 cryptoKeyId; /*!< Id of they key */ + uint32 secondaryCryptoKeyId; /*!< Id of they secondary key */ + uint32 keyElementId; /*!< Id of they key element */ + uint32 secondaryKeyElementId; /*!< Id of they secondary key element */ + Crypto_30_vHsm_KeyM_InputOutputType inputOutput; /*!< struct containing the input and output information */ +} Crypto_30_vHsm_KeyM_JobType; + +typedef uint8 Crypto_30_vHsm_JobKindType; + +typedef enum +{ + CRYPTO_30_VHSM_CALLOUT_JOBREQUEST = 0, + CRYPTO_30_VHSM_CALLOUT_HSMREADY, + CRYPTO_30_VHSM_CALLOUT_IPCINIT, + CRYPTO_30_VHSM_CALLOUT_ENTERRAMLOOP, + CRYPTO_30_VHSM_CALLOUT_EXITRAMLOOP, + CRYPTO_30_VHSM_CALLOUT_ASYNC +} Crypto_30_vHsm_CalloutIdType; + +typedef enum +{ + CRYPTO_30_VHSM_CALLOUT_CRYPTOJOB = CRYPTO_30_VHSM_CRYPTO_JOBKIND, + CRYPTO_30_VHSM_CALLOUT_KEYMJOB = CRYPTO_30_VHSM_KEYMANAGEMENT_JOBKIND, + CRYPTO_30_VHSM_CALLOUT_NOT_DEFINED +} Crypto_30_vHsm_CalloutContextClassType; + +typedef enum +{ + CRYPTO_30_VHSM_TIMEOUT_RECOVERY_IDLE = 0, + CRYPTO_30_VHSM_TIMEOUT_RECOVERY_PENDING, + CRYPTO_30_VHSM_TIMEOUT_RECOVERY_TRIGGERED +} Crypto_30_vHsm_TimeoutRecoveryStateType; + +#endif /* !defined (CRYPTO_30_VHSM_TYPES_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_30_vHsm_Types.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_cfg.mak b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_cfg.mak new file mode 100644 index 0000000..da8768a --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_cfg.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Crypto_30_vHsm_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_vHsm_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefor the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +#_CONFIG_PATH = + + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + +#_DRIVER_MODE = singlechannel + + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_check.mak b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_check.mak new file mode 100644 index 0000000..cf9bb7c --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : Crypto_30_vHsm_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_vHsm_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_defs.mak b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_defs.mak new file mode 100644 index 0000000..29255ca --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_defs.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Crypto_30_vHsm_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Crypto_30_vHsm_rules.mak file. +############################################################################### + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... +CRYPTO_30_VHSM_CORE_PATH = +# e.g.: CAN_OUTPUT_PATH = $(GENDATA_DIR) +CRYPTO_30_VHSM_OUTPUT_PATH = $(GENDATA_DIR) + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: can_DEPENDENT_PLUGINS = +CRYPTO_30_VHSM_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += Crypto_30_vHsm$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_rules.mak b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_rules.mak new file mode 100644 index 0000000..e2216e6 --- /dev/null +++ b/Source/bsw/Crypto_30_vHsm/Make/Crypto_30_vHsm_rules.mak @@ -0,0 +1,102 @@ +############################################################################### +# File Name : Crypto_30_vHsm_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2015-05-22 vistof Creation for ASR 4.0.3 +# 1.01.00 2015-08-03 vistof Added Crypto_SheKeyWrapSym +# 1.01.01 2015-09-29 vistof Corrected reference to Crypto_SheKeyWrapSym.c +# 1.02.00 2019-02-06 vircbl Added support of component-based SIP structure +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += $(LIB_OUPUT_PATH)\vendorx_canlib1.$(LIB_FILE_SUFFIX) +LIBRARIES_TO_BUILD += Crypto_30_vHsm +Crypto_30_vHsm_FILES = Crypto_30_vHsm$(BSW_SRC_DIR)\Crypto_30_vHsm*.c + +# e.g.: CC_FILES_TO_BUILD += drv\can_drv.c +CC_FILES_TO_BUILD += Crypto_30_vHsm$(BSW_SRC_DIR)\Crypto_30_vHsm*.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\Crypto_30_vHsm_Cfg.c + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: + #$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/Csm/Crypto_GeneralTypes.h b/Source/bsw/Csm/Crypto_GeneralTypes.h new file mode 100644 index 0000000..943c94a --- /dev/null +++ b/Source/bsw/Csm/Crypto_GeneralTypes.h @@ -0,0 +1,837 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Crypto_GeneralTypes.h + * \brief MICROSAR Crypto Service Manager (CSM) + * + * \details This header is used to provide the type declarations of the Crypto stack. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file (Csm.h). + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#if !defined (CRYPTO_GENERALTYPES_H) +# define CRYPTO_GENERALTYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Std_Types.h" +# include "Csm_Generated_Types.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Crypto Stack Error Codes [SWS_Csm_01069] [SWS_Crypto_00042] */ +# if !defined (CRYPTO_E_BUSY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_BUSY 2u +# endif + +# if !defined (CRYPTO_E_SMALL_BUFFER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_SMALL_BUFFER 3u +# endif + +# if !defined (CRYPTO_E_ENTROPY_EXHAUSTED) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_ENTROPY_EXHAUSTED 4u +# endif + +# if !defined (CRYPTO_E_ENTROPY_EXHAUSTION) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_ENTROPY_EXHAUSTION CRYPTO_E_ENTROPY_EXHAUSTED +# endif + +# if !defined (CRYPTO_E_QUEUE_FULL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_QUEUE_FULL 5u +# endif + +# if !defined (CRYPTO_E_KEY_READ_FAIL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_READ_FAIL 6u +# endif + +# if !defined (CRYPTO_E_KEY_WRITE_FAIL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_WRITE_FAIL 7u +# endif + +# if !defined (CRYPTO_E_KEY_NOT_AVAILABLE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_NOT_AVAILABLE 8u +# endif + +# if !defined (CRYPTO_E_KEY_NOT_VALID) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_NOT_VALID 9u +# endif + +# if !defined (CRYPTO_E_KEY_SIZE_MISMATCH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_SIZE_MISMATCH 10u +# endif + +# if !defined (CRYPTO_E_COUNTER_OVERFLOW) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_COUNTER_OVERFLOW 11u +# endif + +# if !defined (CRYPTO_E_JOB_CANCELED) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_JOB_CANCELED 12u +# endif + +# if !defined (CRYPTO_E_KEY_EMPTY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_KEY_EMPTY 13u +# endif + +# if (CSM_JOB_TYPE_LAYOUT_VAR_MEMBERS == STD_ON) +# define CSM_DEPENDENT_CONST(type) VAR(type, AUTOMATIC) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +# else +# define CSM_DEPENDENT_CONST(type) CONST(type, AUTOMATIC) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +# endif + +# if !defined (CSM_E_PENDING) /* COV_CSM_USER_DEFINES */ +# if defined (E_PENDING) /* COV_CSM_USER_DEFINES */ +# define CSM_E_PENDING E_PENDING +# else +# define CSM_E_PENDING 2u +# endif +# endif + +/* Key Elements [SWS_Csm_01022] */ +# if !defined (CRYPTO_KE_MAC_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_MAC_KEY 1u +# endif + +# if !defined (CRYPTO_KE_MAC_PROOF) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_MAC_PROOF 2u +# endif + +# if !defined (CRYPTO_KE_SIGNATURE_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_SIGNATURE_KEY 1u +# endif + +# if !defined (CRYPTO_KE_SIGNATURE_CURVETYPE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_SIGNATURE_CURVETYPE 29u +# endif + +# if !defined (CRYPTO_KE_RANDOM_SEED_STATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_RANDOM_SEED_STATE 3u +# endif + +# if !defined (CRYPTO_KE_RANDOM_ALGORITHM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_RANDOM_ALGORITHM 4u +# endif + +# if !defined (CRYPTO_KE_CIPHER_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CIPHER_KEY 1u +# endif + +# if !defined (CRYPTO_KE_CIPHER_IV) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CIPHER_IV 5u +# endif + +# if !defined (CRYPTO_KE_CIPHER_PROOF) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CIPHER_PROOF 6u +# endif + +# if !defined (CRYPTO_KE_CIPHER_2NDKEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CIPHER_2NDKEY 7u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_BASE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYEXCHANGE_BASE 8u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_PRIVKEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYEXCHANGE_PRIVKEY 9u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYEXCHANGE_OWNPUBKEY 10u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYEXCHANGE_SHAREDVALUE 1u +# endif + +# if !defined (CYRPTO_KE_KEYEXCHANGE_SHAREDVALUE) +/* ASR define with typo - without define is above */ +# define CYRPTO_KE_KEYEXCHANGE_SHAREDVALUE 1u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_ALGORITHM) /* COV_CSM_USER_DEFINES */ +/* e.g. X25519, RSA, ... */ +# define CRYPTO_KE_KEYEXCHANGE_ALGORITHM 12u +# endif + +# if !defined (CRYPTO_KE_KEYEXCHANGE_CURVETYPE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYEXCHANGE_CURVETYPE 29u +# endif + +# if !defined (CRYPTO_KE_KEYDERIVATION_PASSWORD) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYDERIVATION_PASSWORD 1u +# endif + +# if !defined (CRYPTO_KE_KEYDERIVATION_SALT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYDERIVATION_SALT 13u +# endif + +# if !defined (CRYPTO_KE_KEYDERIVATION_ITERATIONS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYDERIVATION_ITERATIONS 14u +# endif + +# if !defined (CRYPTO_KE_KEYDERIVATION_ALGORITHM) /* COV_CSM_USER_DEFINES */ +/* e.g. KDF2, KDFX963, ... */ +# define CRYPTO_KE_KEYDERIVATION_ALGORITHM 15u +# endif + +# if !defined (CRYPTO_KE_KEYDERIVATION_CURVETYPE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYDERIVATION_CURVETYPE 29u +# endif + +# if !defined (CRYPTO_KE_KEYGENERATE_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYGENERATE_KEY 1u +# endif + +# if !defined (CRYPTO_KE_KEYGENERATE_SEED) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYGENERATE_SEED 16u +# endif + +# if !defined (CRYPTO_KE_KEYGENERATE_ALGORITHM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYGENERATE_ALGORITHM 17u +# endif + +# if !defined (CRYPTO_KE_KEYGENERATE_CURVETYPE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYGENERATE_CURVETYPE 29u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_DATA) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_DATA 0u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_PARSING_FORMAT) /* COV_CSM_USER_DEFINES */ +/* e.g. X.509, C2X */ +# define CRYPTO_KE_CERTIFICATE_PARSING_FORMAT 18u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_CURRENT_TIME) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_CURRENT_TIME 19u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_VERSION) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_VERSION 20u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_SERIALNUMBER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_SERIALNUMBER 21u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_SIGNATURE_ALGORITHM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_SIGNATURE_ALGORITHM 22u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_ISSUER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_ISSUER 23u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_VALIDITY_NOT_BEFORE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_VALIDITY_NOT_BEFORE 24u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_VALIDITY_NOT_AFTER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_VALIDITY_NOT_AFTER 25u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_SUBJECT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_SUBJECT 26u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_SUBJECT_PUBLIC_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_SUBJECT_PUBLIC_KEY 1u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_EXTENSIONS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_EXTENSIONS 27u +# endif + +# if !defined (CRYPTO_KE_CERTIFICATE_SIGNATURE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_CERTIFICATE_SIGNATURE 28u +# endif + +# if !defined (CRYPTO_KE_KEYWRAP_KEY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYWRAP_KEY 1u +# endif + +# if !defined (CRYPTO_KE_KEYWRAP_HEADER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KE_KEYWRAP_HEADER 2u +# endif + +/* [SWS_Csm_01028] Crypto_JobStateType */ +typedef uint8 Crypto_JobStateType; +# define CRYPTO_JOBSTATE_IDLE 0u +# define CRYPTO_JOBSTATE_ACTIVE 1u +# define CRYPTO_JOBSTATE_PROGRESSING 2u + +/* [SWS_Csm_01028] Crypto_ServiceInfoType */ +typedef uint8 Crypto_ServiceInfoType; +# if !defined (CRYPTO_HASH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_HASH 0x00u +# endif +# if !defined (CRYPTO_MACGENERATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_MACGENERATE 0x01u +# endif +# if !defined (CRYPTO_MACVERIFY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_MACVERIFY 0x02u +# endif +# if !defined (CRYPTO_ENCRYPT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ENCRYPT 0x03u +# endif +# if !defined (CRYPTO_DECRYPT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_DECRYPT 0x04u +# endif +# if !defined (CRYPTO_AEADENCRYPT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_AEADENCRYPT 0x05u +# endif +# if !defined (CRYPTO_AEADDECRYPT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_AEADDECRYPT 0x06u +# endif +# if !defined (CRYPTO_SIGNATUREGENERATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SIGNATUREGENERATE 0x07u +# endif +# if !defined (CRYPTO_SIGNATUREVERIFY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SIGNATUREVERIFY 0x08u +# endif +# if !defined (CRYPTO_SECCOUNTERINCREMENT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SECCOUNTERINCREMENT 0x09u +# endif +# if !defined (CRYPTO_SECCOUNTERREAD) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SECCOUNTERREAD 0x0Au +# endif +# if !defined (CRYPTO_RANDOMGENERATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_RANDOMGENERATE 0x0Bu +# endif +# if !defined (CRYPTO_RANDOMSEED) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_RANDOMSEED 0x0Cu +# endif +# if !defined (CRYPTO_KEYGENERATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYGENERATE 0x0Du +# endif +# if !defined (CRYPTO_KEYDERIVE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYDERIVE 0x0Eu +# endif +# if !defined (CRYPTO_KEYEXCHANGECALCPUBVAL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYEXCHANGECALCPUBVAL 0x0Fu +# endif +# if !defined (CRYPTO_KEYEXCHANGECALCSECRET) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYEXCHANGECALCSECRET 0x10u +# endif +# if !defined (CRYPTO_CERTIFICATEPARSE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_CERTIFICATEPARSE 0x11u +# endif +# if !defined (CRYPTO_CERTIFICATEVERIFY) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_CERTIFICATEVERIFY 0x12u +# endif +# if !defined (CRYPTO_KEYSETVALID) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYSETVALID 0x13u +# endif +# if !defined (CRYPTO_KEYSETINVALID) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYSETINVALID 0x14u +# endif +# if !defined (CRYPTO_CUSTOM_SERVICE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_CUSTOM_SERVICE 0x15u +# endif +# if !defined (CRYPTO_KEYWRAP) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYWRAP 0x16u +# endif +# if !defined (CRYPTO_KEYUNWRAP) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYUNWRAP 0x17u +# endif + +# if !defined (CRYPTO_RANDOM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_RANDOM CRYPTO_RANDOMGENERATE +# endif +# if !defined (CRYPTO_SECURECOUNTERREAD) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SECURECOUNTERREAD CRYPTO_SECCOUNTERREAD +# endif +# if !defined (CRYPTO_SECURECOUNTERINCREMENT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_SECURECOUNTERINCREMENT CRYPTO_SECCOUNTERINCREMENT +# endif + +/* [SWS_Csm_01047] Crypto_AlgorithmFamilyType */ +typedef uint8 Crypto_AlgorithmFamilyType; +typedef uint8 Crypto_AlgorithmSecondaryFamilyType; +# if !defined (CRYPTO_ALGOFAM_NOT_SET) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_NOT_SET 0x00u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA1) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA1 0x01u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_224) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_224 0x02u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_256 0x03u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_384) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_384 0x04u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_512) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512 0x05u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_512_224) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512_224 0x06u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA2_512_256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA2_512_256 0x07u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA3_224) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_224 0x08u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA3_256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_256 0x09u +# endif +# if !defined (CRYPTO_ALGOFAM_SHA3_384) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_384 0x0Au +# endif +# if !defined (CRYPTO_ALGOFAM_SHA3_512) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_512 0x0Bu +# endif +# if !defined (CRYPTO_ALGOFAM_SHAKE128) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHAKE128 0x0Cu +# endif +# if !defined (CRYPTO_ALGOFAM_SHAKE256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHAKE256 0x0Du +# endif +# if !defined (CRYPTO_ALGOFAM_RIPEMD160) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RIPEMD160 0x0Eu +# endif +# if !defined (CRYPTO_ALGOFAM_BLAKE_1_256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_1_256 0x0Fu +# endif +# if !defined (CRYPTO_ALGOFAM_BLAKE_1_512) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_1_512 0x10u +# endif +# if !defined (CRYPTO_ALGOFAM_BLAKE_2s_256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_2s_256 0x11u +# endif +# if !defined (CRYPTO_ALGOFAM_BLAKE_2s_512) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BLAKE_2s_512 0x12u +# endif +# if !defined (CRYPTO_ALGOFAM_3DES) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_3DES 0x13u +# endif +# if !defined (CRYPTO_ALGOFAM_AES) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_AES 0x14u +# endif +# if !defined (CRYPTO_ALGOFAM_CHACHA) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_CHACHA 0x15u +# endif +# if !defined (CRYPTO_ALGOFAM_RSA) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RSA 0x16u +# endif +# if !defined (CRYPTO_ALGOFAM_ED25519) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ED25519 0x17u +# endif +# if !defined (CRYPTO_ALGOFAM_BRAINPOOL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_BRAINPOOL 0x18u +# endif +# if !defined (CRYPTO_ALGOFAM_ECCNIST) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCNIST 0x19u +# endif +# if !defined (CRYPTO_ALGOFAM_SECURECOUNTER) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SECURECOUNTER 0x1Au +# endif +# if !defined (CRYPTO_ALGOFAM_RNG) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_RNG 0x1Bu +# endif +# if !defined (CRYPTO_ALGOFAM_SIPHASH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SIPHASH 0x1Cu +# endif +# if !defined (CRYPTO_ALGOFAM_ECIES) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECIES 0x1Du +# endif +# if !defined (CRYPTO_ALGOFAM_ECCANSI) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCANSI 0x1Eu +# endif +# if !defined (CRYPTO_ALGOFAM_ECCSEC) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECCSEC 0x1Fu +# endif +# if !defined (CRYPTO_ALGOFAM_DRBG) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_DRBG 0x20u +# endif +# if !defined (CRYPTO_ALGOFAM_FIPS186) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_FIPS186 0x21u +# endif +# if !defined (CRYPTO_ALGOFAM_PADDING_PKCS7) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PADDING_PKCS7 0x22u +# endif +# if !defined (CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS 0x23u +# endif +# if !defined (CRYPTO_ALGOFAM_PBKDF2) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_PBKDF2 0x24u +# endif +# if !defined (CRYPTO_ALGOFAM_KDFX963) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_KDFX963 0x25u +# endif +# if !defined (CRYPTO_ALGOFAM_DH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_DH 0x26u +# endif +# if !defined (CRYPTO_ALGOFAM_SM2) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SM2 0x27u +# endif +# if !defined (CRYPTO_ALGOFAM_EEA3) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_EEA3 0x28u +# endif +# if !defined (CRYPTO_ALGOFAM_SM3) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SM3 0x29u +# endif +# if !defined (CRYPTO_ALGOFAM_EIA3) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_EIA3 0x2Au +# endif +# if !defined (CRYPTO_ALGOFAM_HKDF) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_HKDF 0x2Bu +# endif +# if !defined (CRYPTO_ALGOFAM_ECDSA) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECDSA 0x2Cu +# endif +# if !defined (CRYPTO_ALGOFAM_POLY1305) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_POLY1305 0x2Du +# endif + +/* Backward compatibility: + The define was corrected to CRYPTO_ALGOFAM_POLY1305 */ +# if !defined (CRYPTO_ALGOFAM_POLY13) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_POLY13 0x2Du +# endif + +# if !defined (CRYPTO_ALGOFAM_X25519) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_X25519 0x2Eu +# endif +# if !defined (CRYPTO_ALGOFAM_ECDH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_ECDH 0x2Fu +# endif +# if !defined (CRYPTO_ALGOFAM_CUSTOM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_CUSTOM 0xFFu +# endif + +/* Keep previous definition for backward compatibility */ +# if !defined (CRYPTO_ALGOFAM_FIPS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_FIPS CRYPTO_ALGOFAM_FIPS186 +# endif + +/* Until AUTOSAR 4.4.0, there was an inconsistency in the standard where CRYPTO_ALGOFAM_SHAKE would + * sometimes be referred to as CRYPTO_ALGOFAM_SHA3_SHAKE128. We want to support both. */ +# if !defined (CRYPTO_ALGOFAM_SHA3_SHAKE128) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_SHAKE128 CRYPTO_ALGOFAM_SHAKE128 +# endif +# if !defined (CRYPTO_ALGOFAM_SHA3_SHAKE256) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOFAM_SHA3_SHAKE256 CRYPTO_ALGOFAM_SHAKE256 +# endif + +/* [SWS_Csm_01048] Crypto_AlgorithmModeType */ +typedef uint8 Crypto_AlgorithmModeType; +# if !defined (CRYPTO_ALGOMODE_NOT_SET) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_NOT_SET 0x00u +# endif +# if !defined (CRYPTO_ALGOMODE_ECB) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_ECB 0x01u +# endif +# if !defined (CRYPTO_ALGOMODE_CBC) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CBC 0x02u +# endif +# if !defined (CRYPTO_ALGOMODE_CFB) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CFB 0x03u +# endif +# if !defined (CRYPTO_ALGOMODE_OFB) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_OFB 0x04u +# endif +# if !defined (CRYPTO_ALGOMODE_CTR) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CTR 0x05u +# endif +# if !defined (CRYPTO_ALGOMODE_XTS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_XTS 0x06u +# endif +# if !defined (CRYPTO_ALGOMODE_GCM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_GCM 0x07u +# endif +# if !defined (CRYPTO_ALGOMODE_RSAES_OAEP) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSAES_OAEP 0x08u +# endif +# if !defined (CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 0x09u +# endif +# if !defined (CRYPTO_ALGOMODE_RSASSA_PSS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSASSA_PSS 0x0Au +# endif +# if !defined (CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 0x0Bu +# endif +# if !defined (CRYPTO_ALGOMODE_8ROUNDS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_8ROUNDS 0x0Cu +# endif +# if !defined (CRYPTO_ALGOMODE_12ROUNDS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_12ROUNDS 0x0Du +# endif +# if !defined (CRYPTO_ALGOMODE_20ROUNDS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_20ROUNDS 0x0Eu +# endif +# if !defined (CRYPTO_ALGOMODE_HMAC) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_HMAC 0x0Fu +# endif +# if !defined (CRYPTO_ALGOMODE_CMAC) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CMAC 0x10u +# endif +# if !defined (CRYPTO_ALGOMODE_GMAC) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_GMAC 0x11u +# endif +# if !defined (CRYPTO_ALGOMODE_CTRDRBG) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CTRDRBG 0x12u +# endif +# if !defined (CRYPTO_ALGOMODE_SIPHASH_2_4) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_SIPHASH_2_4 0x13u +# endif +# if !defined (CRYPTO_ALGOMODE_SIPHASH_4_8) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_SIPHASH_4_8 0x14u +# endif +# if !defined (CRYPTO_ALGOMODE_PXXXR1) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_PXXXR1 0x15u +# endif +# if !defined (CRYPTO_ALGOMODE_AESKEYWRAP) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_AESKEYWRAP 0x16u +# endif + +# if !defined (CRYPTO_ALGOMODE_CUSTOM) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_ALGOMODE_CUSTOM 0xFFu +# endif + +/* [SWS_Csm_91024] Crypto_InputOutputRedirectionConfigType */ +typedef uint8 Crypto_InputOutputRedirectionConfigType; +# define CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT 0x01u +# define CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT 0x02u +# define CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT 0x04u +# define CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT 0x10u +# define CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT 0x20u + +/* [SWS_Csm_01008] Crypto_AlgorithmInfoType */ +typedef struct +{ + Crypto_AlgorithmFamilyType family; + Crypto_AlgorithmSecondaryFamilyType secondaryFamily; + uint32 keyLength; + Crypto_AlgorithmModeType mode; +} Crypto_AlgorithmInfoType; + +/* Operation Modes */ +# if !defined (Rte_TypeDef_Crypto_OperationModeType) +typedef uint8 Crypto_OperationModeType; +# endif + +# if !defined (CRYPTO_OPERATIONMODE_START) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_START 1u +# endif +# if !defined (CRYPTO_OPERATIONMODE_UPDATE) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_UPDATE 2u +# endif +# if !defined (CRYPTO_OPERATIONMODE_FINISH) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_FINISH 4u +# endif + +/* [SWS_Crypto_00016] */ /* [SWS_Crypto_00017] */ +# if !defined (CRYPTO_OPERATIONMODE_STREAMSTART) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_STREAMSTART ( CRYPTO_OPERATIONMODE_START | CRYPTO_OPERATIONMODE_UPDATE ) +# endif +# if !defined (CRYPTO_OPERATIONMODE_SINGLECALL) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_SINGLECALL ( CRYPTO_OPERATIONMODE_START | CRYPTO_OPERATIONMODE_UPDATE | CRYPTO_OPERATIONMODE_FINISH ) +# endif + +# if !defined (CRYPTO_OPERATIONMODE_SAVE_CONTEXT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_SAVE_CONTEXT 8u +# endif + +# if !defined (CRYPTO_OPERATIONMODE_RESTORE_CONTEXT) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_OPERATIONMODE_RESTORE_CONTEXT 16u +# endif + +/* [SWS_Csm_01049] Crypto_ProcessingType */ +typedef uint8 Crypto_ProcessingType; +# define CRYPTO_PROCESSING_ASYNC 0u +# define CRYPTO_PROCESSING_SYNC 1u + +# define CSM_ASYNCHRONOUS CRYPTO_PROCESSING_ASYNC +# define CSM_SYNCHRONOUS CRYPTO_PROCESSING_SYNC + +/* [SWS_Csm_01024] Crypto_VerifyResultType */ +# if !defined (Rte_TypeDef_Crypto_VerifyResultType) +typedef uint8 Crypto_VerifyResultType; +# endif + +# if !defined (CRYPTO_E_VER_OK) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_VER_OK 0u +# endif +# if !defined (CRYPTO_E_VER_NOT_OK) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_E_VER_NOT_OK 1u +# endif + +# if !defined (CSM_E_VER_OK) /* COV_CSM_USER_DEFINES */ +# define CSM_E_VER_OK CRYPTO_E_VER_OK +# endif +# if !defined (CSM_E_VER_NOT_OK) /* COV_CSM_USER_DEFINES */ +# define CSM_E_VER_NOT_OK CRYPTO_E_VER_NOT_OK +# endif + +/* [SWS_Csm_91044] Crypto_ResultType */ +# if !defined (Rte_TypeDef_Crypto_ResultType) +typedef uint8 Crypto_ResultType; +# endif + +/* [SWS_Csm_91001] Csm_ResultType */ +# if !defined (Rte_TypeDef_Csm_ResultType) +typedef uint8 Csm_ResultType; +# endif + +/* [SWS_Csm_91102] Crypto_KeyStatusType */ +# if !defined (Rte_TypeDef_Crypto_KeyStatusType) +typedef uint8 Crypto_KeyStatusType; +# endif + +# if !defined (CRYPTO_KEYSTATUS_INVALID) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYSTATUS_INVALID 0u +# endif + +# if !defined (CRYPTO_KEYSTATUS_VALID) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYSTATUS_VALID 1u +# endif + +# if !defined (CRYPTO_KEYSTATUS_UPDATE_IN_PROGRESS) /* COV_CSM_USER_DEFINES */ +# define CRYPTO_KEYSTATUS_UPDATE_IN_PROGRESS 2u +# endif + +/* [SWS_Csm_00930] Each crypto primitive configuration shall be realized as a constant structure of type Crypto_PrimitiveInfoType. */ +/* [SWS_Csm_01011] */ +typedef struct +{ +# if (CSM_JOB_TYPE_LAYOUT_RESULT_LENGTH == STD_ON) + /* ResultLength was removed in ASR R20-11 */ + CSM_DEPENDENT_CONST(uint32) resultLength; +# endif + CSM_DEPENDENT_CONST(Crypto_ServiceInfoType) service; + CSM_DEPENDENT_CONST(Crypto_AlgorithmInfoType) algorithm; +} Crypto_PrimitiveInfoType; + +/* [SWS_Csm_00932] Each user primitive configuration shall be realized as a constant structure of type Crypto_JobPrimitiveInfoType. */ +/* [SWS_Csm_01012] */ +typedef struct +{ + CSM_DEPENDENT_CONST(uint32) callbackId; + P2CONST(Crypto_PrimitiveInfoType, AUTOMATIC, CSM_CONST) primitiveInfo; +# if (CSM_JOB_TYPE_LAYOUT_SECURE_COUNTER_ID == STD_ON) + /* secureCounterId was removed in ASR 4.4.0 */ + CSM_DEPENDENT_CONST(uint32) secureCounterId; +# endif + CSM_DEPENDENT_CONST(uint32) cryIfKeyId; + CSM_DEPENDENT_CONST(Crypto_ProcessingType) processingType; +# if (CSM_JOB_TYPE_LAYOUT_CALLBACK_UPDATE_NOTIFICATION == STD_ON) + /* callbackUpdateNotification was removed in ASR R19-11 */ + CSM_DEPENDENT_CONST(boolean) callbackUpdateNotification; +# endif +} Crypto_JobPrimitiveInfoType; + +/* [SWS_Csm_01009] Crypto_JobPrimitiveInputOutputType */ +typedef struct +{ + P2CONST(uint8, AUTOMATIC, CSM_APPL_CONST) inputPtr; + uint32 inputLength; + P2CONST(uint8, AUTOMATIC, CSM_APPL_CONST) secondaryInputPtr; + uint32 secondaryInputLength; + P2CONST(uint8, AUTOMATIC, CSM_APPL_CONST) tertiaryInputPtr; + uint32 tertiaryInputLength; + + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) outputPtr; + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) outputLengthPtr; + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) secondaryOutputPtr; + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) secondaryOutputLengthPtr; + +# if (CSM_JOB_TYPE_LAYOUT_INPUT64 == STD_ON) + uint64 input64; +# endif + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr; +# if (CSM_JOB_TYPE_LAYOUT_OUTPUT64_PTR == STD_ON) + P2VAR(uint64, AUTOMATIC, CSM_APPL_VAR) output64Ptr; +# endif + Crypto_OperationModeType mode; + + /* Following members were added in ASR 4.4.0 */ + uint32 cryIfKeyId; + uint32 targetCryIfKeyId; +} Crypto_JobPrimitiveInputOutputType; + +typedef struct +{ + CSM_DEPENDENT_CONST(uint32) jobId; + CSM_DEPENDENT_CONST(uint32) jobPriority; +} Crypto_JobInfoType; + +/* [SWC_Csm_91026] Crypto_JobRedirectionInfoType */ +typedef struct +{ + uint8 redirectionConfig; + uint32 inputKeyId; + uint32 inputKeyElementId; + uint32 secondaryInputKeyId; + uint32 secondaryInputKeyElementId; + uint32 tertiaryInputKeyId; + uint32 tertiaryInputKeyElementId; + uint32 outputKeyId; + uint32 outputKeyElementId; + uint32 secondaryOutputKeyId; + uint32 secondaryOutputKeyElementId; +} Crypto_JobRedirectionInfoType; + +/* [SWS_Csm_01013] Crypto_JobType */ +typedef struct +{ + /* Members of ASR 4.3.0 resp. 4.3.1 */ + uint32 jobId; + Crypto_JobStateType jobState; + Crypto_JobPrimitiveInputOutputType jobPrimitiveInputOutput; + P2CONST(Crypto_JobPrimitiveInfoType, AUTOMATIC, CSM_CONST) jobPrimitiveInfo; +# if (CSM_JOB_TYPE_LAYOUT_REDIRECTION_INFO_REF == STD_ON) && (CSM_JOB_TYPE_LAYOUT_FIELD_ORDERING == CSM_ASR_VERSION_R21_11) + P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CSM_VAR_NOINIT) jobRedirectionInfoRef; +# endif +# if (CSM_JOB_TYPE_LAYOUT_JOB_INFO_PTR == STD_ON) + P2CONST(Crypto_JobInfoType, AUTOMATIC, CSM_CONST) jobInfo; +# endif + uint32 cryptoKeyId; + /* Following members were added in ASR 4.4.0 */ +# if (CSM_JOB_TYPE_LAYOUT_REDIRECTION_INFO_REF == STD_ON) && (CSM_JOB_TYPE_LAYOUT_FIELD_ORDERING == CSM_ASR_VERSION_4_03) + P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CSM_VAR_NOINIT) jobRedirectionInfoRef; +# endif + uint32 targetCryptoKeyId; + /* The jobPriority was added in ASR R20-11 as replacement of the jobInfo pointer. */ + uint32 jobPriority; +# if (CSM_JOB_TYPE_LAYOUT_ASR430_COMPATIBILITY == STD_ON) + /* ASR 4.3.0 compatibility - same content as jobState and jobPrimitiveInputOutput but accessible for 4.3.0 crypto drivers. */ + Crypto_JobStateType state; + Crypto_JobPrimitiveInputOutputType PrimitiveInputOutput; +# endif +} Crypto_JobType; + +/* End of Service Config Types */ + +#endif /* !defined (CRYPTO_GENERALTYPES_H) */ + +/********************************************************************************************************************** + * END OF FILE: Crypto_GeneralTypes.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm.c b/Source/bsw/Csm/Csm.c new file mode 100644 index 0000000..4cdafea --- /dev/null +++ b/Source/bsw/Csm/Csm.c @@ -0,0 +1,5728 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Csm.c + * \brief MICROSAR Crypto Service Manager (CSM) + * + * \details Implementation of the MICROSAR Crypto Service Manager (CSM) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define CSM_SOURCE +/* PRQA S 6060 EOF */ /* MD_MSR_STPAR */ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Csm.h" +#include "Csm_Cbk.h" +#include "CryIf.h" +#include "SchM_Csm.h" + +#if (CSM_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + + /* Check the version of CSM header file */ +#if ( (CSM_SW_MAJOR_VERSION != (9u)) \ + || (CSM_SW_MINOR_VERSION != (1u)) \ + || (CSM_SW_PATCH_VERSION != (1u))) +# error "Vendor specific version numbers of Csm.c and Csm.h are inconsistent" +#endif + +/* AUTOSAR version information check has to match definition in header file */ +#if ((CSM_AR_RELEASE_MAJOR_VERSION != (4u)) \ + || (CSM_AR_RELEASE_MINOR_VERSION != (7u)) \ + || (CSM_AR_RELEASE_REVISION_VERSION != (0u))) +# error "AUTOSAR Specification Version numbers of Csm.c and Csm.h are inconsistent!" +#endif + +/* Check the version of the configuration header file to ensure that the generated files match the static files. */ +#if ( (CSM_CFG_MAJOR_VERSION != (9u)) \ + || (CSM_CFG_MINOR_VERSION != (1u)) \ + || (CSM_CFG_PATCH_VERSION != (1u)) ) +# error "Version numbers of Csm.c and Csm_Cfg.h are inconsistent!" +#endif + +/* Check the version of the generator. */ +#if ( (CSM_GENERATOR_MAJOR_VERSION != (9u)) \ + || (CSM_GENERATOR_MINOR_VERSION != (1u)) ) +# error "Version numbers of Csm.c and Csm_Cfg.h (generator version) are inconsistent!" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/*! Callback is idle and must not be notified to RTE. */ +#define CSM_CALLBACK_IDLE (0xFEu) + +/*! Job ID which is used to mark Job as empty/free for usage. */ +#define CSM_EMPTY_JOB (0xFFFFFFFFu) + +/* States used for internal job state of Csm. */ + +/*! Job is IDLE - Ready to be used by application */ +#define CSM_JOB_STATE_IDLE CRYPTO_JOBSTATE_IDLE + +/*! Job is Active - That means it was started but waits for a further UPDATE or the FINISH call */ +#define CSM_JOB_STATE_ACTIVE CRYPTO_JOBSTATE_ACTIVE + +/*! Job is currently progressing in lower layer - Csm is waiting for function to return or for callback notification. */ +#define CSM_JOB_STATE_PROGRESSING CRYPTO_JOBSTATE_PROGRESSING + +/*! An asynchronous job was passed to lower layer - Csm is waiting for the callback, job is now cancelable as known by + * lower layer */ +#define CSM_JOB_STATE_WAITING 3u + +/*! Asynchronous job is on QUEUE */ +#define CSM_JOB_STATE_QUEUED 4u + +/*! Job canceling pending - currently the job is tried to be canceled in lower layer */ +#define CSM_JOB_STATE_CANCELING 5u + +/*! Asynchronous Job was cancelled in lower layer but CallbackNotification is required to complete cancellation. */ +#define CSM_JOB_STATE_CANCELED 6u + +/*! Asynchronous job's callback has occurred */ +#define CSM_JOB_STATE_CALLBACK_OCCURRED 64u + +/*! Clear mask for state Asynchronous job's callback has occurred */ +#define CSM_JOB_STATE_CALLBACK_OCCURRED_CLEAR_MASK 191u /* = ~CSM_JOB_STATE_CALLBACK_OCCURRED */ + +/*! State of asynchronous job retriggering */ +#define CSM_ASYNC_JOB_RETRIGGER_STATE_IDLE (0x00u) +#define CSM_ASYNC_JOB_RETRIGGER_STATE_PENDING (0x01u) + +/*! Determine which return value shall be used if queue is full. + * Since ASR 4.4, CRYPTO_E_BUSY is used instead of CRYPTO_E_QUEUE_FULL. */ +#if !defined (CSM_QUEUE_FULL_RETVAL) /* COV_CSM_ASR_COMPATIBILITY_DEFINE */ +# define CSM_QUEUE_FULL_RETVAL CRYPTO_E_BUSY +#endif + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +#if !defined (CSM_LOCAL) /* COV_CSM_LOCAL_DEFINE */ +# define CSM_LOCAL static +#endif + +#if !defined (CSM_LOCAL_INLINE) /* COV_CSM_LOCAL_DEFINE */ +# define CSM_LOCAL_INLINE LOCAL_INLINE +#endif + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define CSM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (CSM_JOB == STD_ON) +/********************************************************************************************************************** + * Csm_ProcessJob() + *********************************************************************************************************************/ +/*! \brief Process the received job + * \details This function unifies all external calls to call CryIf_ProcessJob. + * \param[in,out] job Pointer to the configuration of the job. Contains structures with user and + * primitive relevant information. + * \param[in] partition Id of the current active partition. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \pre Param queueIdx needs to be a valid index. + * \pre Job must point to a valid job object. + * \pre CSM_EXCLUSIVE_AREA_0 must be entered as it is left inside this function. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_ProcessJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_GetJobObj() + *********************************************************************************************************************/ +/*! \brief Fetches the job object for the given job id. + * \details Job has either a dedicated object or it is received from the job pool + * \param[in] jobId Holds the identifier of the job. + * \param[in] partition Id of the current active partition. + * \param[out] jobObjId Pointer which will hold the id of the job object to use. + * \return E_OK Request successful. + * E_NOT_OK Request failed. + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy or queue is full. + * \pre Should only be called with locked interrupts + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_GetJobObj( + uint32 jobId, + Csm_SizeOfPartitionIdentifiersType partition, + P2VAR(Csm_SizeOfJobType, AUTOMATIC, AUTOMATIC) jobObjId); + +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) +/********************************************************************************************************************** + * Csm_PrepareJobObj() + *********************************************************************************************************************/ +/*! \brief Set all fields of the given job structure to the data of the given job id. + * \details - + * \param[in] jobId Holds the identifier of the job. + * \param[out] job Pointer to a job which will be adapted to the given job id. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_PrepareJobObj( + uint32 jobId, + P2VAR(Crypto_JobType, AUTOMATIC, AUTOMATIC) job); +# endif /* (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) */ + +# if (CSM_ASYNC_PROCESSING == STD_ON) +/********************************************************************************************************************** + * Csm_EnqueueJob() + *********************************************************************************************************************/ +/*! \brief Enqueue Job. + * \details This function is enqueuing a job to the given queue directly sorting by its priority. + * \param[in] queueIdx Holds the identifier of the queue info. + * \param[in,out] job Pointer to a job that shall be enqueued. + * \param[in] partition Id of the current active partition. + * \return E_OK Request successful. + * CRYPTO_E_BUSY Request failed, the queue is full. + * \pre Param queueIdx needs to be a valid index. + * \pre Job must point to a valid job object. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \note Shall only be called with locked interrupts + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_EnqueueJob( + Csm_QueueInfoIterType queueIdx, + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_DequeueJob() + *********************************************************************************************************************/ +/*! \brief Dequeue Job. + * \details This function removes a given job id from the queue filling gaps. + * \param[in] queueIdx Holds the identifier of the queue. + * \param[in] jobId Id of the job that shall be removed. + * \param[in] partition Id of the current active partition. + * \pre Param queueIdx needs to be a valid index. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \note Shall only be called with locked interrupts + * \context TASK|ISR + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_DequeueJob( + Csm_QueueInfoIterType queueIdx, + uint32 jobId, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_TriggerAsynchJobProcessing() + *********************************************************************************************************************/ +/*! \brief Triggers the Processing of asynchronous jobs + * \details This function checks for the given queue if an asynchronous job is available. If so, it triggers the + * CryIf to process this asynchronous job. + * \param[in] queueIdx Holds the identifier of the queue. + * \pre Param queueIdx needs to be a valid index. + * Must be called within CSM_EXCLUSIVE_AREA_0. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_TriggerAsynchJobProcessing(Csm_QueueInfoIterType queueIdx); + +/********************************************************************************************************************** + * Csm_HandleCryIfCancelResultInStateCanceling() + *********************************************************************************************************************/ +/*! \brief Handles result of CryIf_CancelJob is job state in CANCELING. + * \details Depending on CryIf_CancelJob result, the necessary steps for canceling an asynchronous jobs are executed. + * \param[in] partition Id of the current active partition. + * \param[in] jobId Holds the identifier of the job. + * \param[in] cryIfRetVal Return value of CryIf_CancelJob + * \param[in] cancelFailedState Job state which shall be entered if cancel failed + * \return TRUE Notify via callback + * FALSE Do not notify via callback + * \pre CSM_EXCLUSIVE_AREA_0 must be entered as is is left inside this function. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \pre Param jobId needs to be a valid index. + * \pre Job state must be CANCELING + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(boolean, CSM_CODE) Csm_HandleCryIfCancelResultInStateCanceling( + Csm_SizeOfPartitionIdentifiersType partition, + uint32 jobId, + Std_ReturnType cryIfRetVal, + uint8 cancelFailedState); + +# if (CSM_CANCELATION_DURING_PROCESSING == STD_ON) +/********************************************************************************************************************** + * Csm_HandleCryIfCancelResultStateHasChanged() + *********************************************************************************************************************/ +/*! \brief Handles result of CryIf_CancelJob if job state has changed. + * \details Depending on CryIf_CancelJob result, the necessary steps for canceling an asynchronous jobs are executed. + * \param[in] partition Id of the current active partition. + * \param[in] jobId Holds the identifier of the job. + * \param[in] cryIfRetVal Return value of CryIf_CancelJob + * \pre CSM_EXCLUSIVE_AREA_0 must be entered as is is left inside this function. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \pre Param jobId needs to be a valid index. + * \pre Job state must not be CANCELING + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleCryIfCancelResultStateHasChanged( + Csm_SizeOfPartitionIdentifiersType partition, + uint32 jobId, + Std_ReturnType cryIfRetVal); +# endif /* (CSM_CANCELATION_DURING_PROCESSING == STD_ON) */ + +/********************************************************************************************************************** + * Csm_CancelAsynchronousJob() + *********************************************************************************************************************/ +/*! \brief Cancels an asynchronous job + * \details Depending on job state, the necessary steps for canceling an asynchronous jobs are executed + * \param[in,out] job Holds the asynchronous job object which shall be cancelled + * \param[in] partition Id of the current active partition. + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre CSM_EXCLUSIVE_AREA_0 must be entered as is is left inside this function. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_CancelAsynchronousJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_HandleCallbackNotification() + *********************************************************************************************************************/ +/*! \brief Handle the Callback Notification from the lower layer + * \details Handle the result of an asynchronous job and forwards the notification to the application. + * \param[in,out] job Holds a pointer to the job which has been finished. + * \param[in] result Contains the result of the cryptographic operation. + * \param[out] runtimeErrorIdPtr Pointer to store the ID of the detected runtime development error. + * \pre All pointers must be valid. + * job's processing type must be set to CRYPTO_PROCESSING_ASYNC + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleCallbackNotification( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Crypto_ResultType result, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) runtimeErrorIdPtr); + +/********************************************************************************************************************** + * Csm_HandleApplicationCallback() + *********************************************************************************************************************/ +/*! \brief Handles the application callback. + * \details Calls the configured user callback function. + * \param[in,out] job Holds a pointer to the job, which has finished. + * \param[in] result Contains the result of the cryptographic operation. + * \param[in] partition Id of the current active partition. + * \pre CSM_EXCLUSIVE_AREA_0 must be entered as it is left inside this function. + * job's processing type must be set to CRYPTO_PROCESSING_ASYNC + * job must have a valid callback function configured + * \context TASK, ISR + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleApplicationCallback( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Std_ReturnType result, + Csm_SizeOfPartitionIdentifiersType partition); + +# if (CSM_RTECALLBACK == STD_ON) +/********************************************************************************************************************** + * Csm_HandleRteCallbacks() + *********************************************************************************************************************/ +/*! \brief Handles the RTE callbacks. + * \details Calls the RTE callback functions. + * \param[in] partition The current partition index. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleRteCallbacks(Csm_SizeOfPartitionIdentifiersType partition); +# endif /* (CSM_RTECALLBACK == STD_ON) */ + +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + +/********************************************************************************************************************** + * Csm_HandleJobProcessing() + *********************************************************************************************************************/ +/*! \brief Triggers the CryIf to process the given job. + * \details This function triggers the CryIf to process the corresponding job. Furthermore, pre- and post-job + * callouts are called from this function if enabled. + * \param[in] channelId Holds the identifier of the queue. + * \param[in,out] job Pointer to the corresponding job + * \param[in] partition Id of the current active partition. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \pre Param channelId needs to be a valid CryIf channel. + * \pre Param Job needs to be a valid pointer to a job object. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_HandleJobProcessing( + Csm_ChannelIdOfQueueInfoType channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_AppendRedirectionToJob() + *********************************************************************************************************************/ +/*! \brief Appends redirection info to job object. + * \details If the job is configured to use an in-out redirection, it is appended to the job object in this function. + * \param[in,out] job Pointer to the corresponding job. + * \param[in] partition Id of the current active partition. + * \pre Param job needs to point to a valid job object. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_AppendRedirectionToJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_GetPartitionIdx() + *********************************************************************************************************************/ +/*! \brief Provide the currently active partition index. + * \details The partition index is determined by the OS application id. + * \return The executing partition index or Csm_GetSizeOfPartitionIdentifiers() if application was not found. + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Csm_SizeOfPartitionIdentifiersType, CSM_CODE) Csm_GetPartitionIdx(void); + +# if (CSM_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Csm_VerifyJobParam() + *********************************************************************************************************************/ +/*! \brief Verifies the provided jobId, the requested service and the partition's initialization state + * \details - + * \param[in] jobId Id of the job which shall be verified + * \param[in,out] errorId Pointer to the errorId. If an error occurs, the errorId is set + * respectively + * \param[in] service Service which is called for the Job + * \return E_OK Request successful + * E_NOT_OK Request failed + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyJobParam( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + Crypto_ServiceInfoType service); + +/********************************************************************************************************************** + * Csm_VerifyJobParamAndMode() + *********************************************************************************************************************/ +/*! \brief Compares the provided operation mode of the job to possible operation mode restrictions of the + * queue the job is mapped to + * \details In addition, this function does the same checks as Csm_VerifyJobParam(). + * \param[in] jobId Id of the job which shall be verified + * \param[in,out] errorId Pointer to the errorId. If an error occurs, the errorId is set + * respectively + * \param[in] service Service which is called for the Job + * \param[in] mode Indicates which operation mode(s) to perform. + * \return E_OK Request successful + * E_NOT_OK Request failed + * \pre - + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyJobParamAndMode( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + Crypto_ServiceInfoType service, + Crypto_OperationModeType mode); + +/********************************************************************************************************************** + * Csm_VerifyInitAndPartition() + *********************************************************************************************************************/ +/*! \brief Verify the initialization state of the related partition + * \details - + * \param[in] jobId Id of the job which shall be checked + * \param[in,out] errorId Pointer to the errorId. If an error occurs, the errorId is set + * respectively + * \return E_OK Request successful + * E_NOT_OK Request failed + * \pre jobId has to be verified to be in range of the configured jobs. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyInitAndPartition( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId); +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Csm_GetPartitionOfJob() + *********************************************************************************************************************/ +/*! \brief Provides the partition on which the job is configured + * \details - + * \param[in] jobId Id of Job from which the partitionIndex is returned. + * \return The partition index configured for the requested job + * \pre jobId must be verified before this function is used. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Csm_SizeOfPartitionIdentifiersType, CSM_CODE) Csm_GetPartitionOfJob(uint32 jobId); +#endif /* (CSM_JOB == STD_ON) */ + +#if (CSM_CALLOUT == STD_ON) +/********************************************************************************************************************** + * Csm_CallPreJobCallout() + *********************************************************************************************************************/ +/*! \brief Triggers the calling of the configured pre-job callout. + * \details This function checks for the given job if an pre-job callout has to be called. If so, it triggers the + * call. + * \param[in,out] job Pointer to the corresponding job. + * \param[in] partition Id of the current active partition. + * \return E_OK Request successful + * E_NOT_OK Request failed + * \pre Param job needs to point to a valid job object. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_CallPreJobCallout( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition); + +/********************************************************************************************************************** + * Csm_CallPostJobCallout() + *********************************************************************************************************************/ +/*! \brief Triggers the calling of the configured post-job callout. + * \details This function checks for the given job if an post-job callout has to be called. If so, it triggers + * the call. + * \param[in,out] job Pointer to the job. + * \param[in,out] retValFromProcessing Pointer to the processing result of the corresponding job. It can be + * overwritten by the post-job callout. + * \param[in] partition Id of the current active partition. + * \pre Param job needs to point to a valid job object. + * \pre Param retValFromProcessing needs to point to a valid location. + * \pre Param partition must be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() -1) + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + *********************************************************************************************************************/ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_CallPostJobCallout( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + P2VAR(Std_ReturnType, AUTOMATIC, AUTOMATIC) retValFromProcessing, + Csm_SizeOfPartitionIdentifiersType partition); +#endif /* (CSM_CALLOUT == STD_ON) */ +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CSM_CALLOUT == STD_ON) +/********************************************************************************************************************** + * Csm_CallPostJobCallout() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_CallPostJobCallout( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + P2VAR(Std_ReturnType, AUTOMATIC, AUTOMATIC) retValFromProcessing, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Csm_CalloutInfoIdxOfJobTableType calloutInfoId; + + calloutInfoId = Csm_GetCalloutInfoIdxOfJobTable(job->jobId); + + /* #10 Check if post-job callout is configured for the given job. */ + if (calloutInfoId < Csm_GetSizeOfCalloutInfo()) + { + /* #20 Call post-job callout and reset the callout state to IDLE. */ + (void)Csm_GetPostJobCalloutFuncOfCallout(Csm_GetCalloutIdxOfCalloutInfo(calloutInfoId))( /* SBSW_CSM_FUNCTION_POINTER */ + job, + CSM_CALLOUT_STATE_POST_INITIAL, + retValFromProcessing); + + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + } +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ +} /* Csm_CallPostJobCallout() */ + +/********************************************************************************************************************** + * Csm_CallPreJobCallout() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_CallPreJobCallout( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Csm_CalloutInfoIdxOfJobTableType calloutInfoId; + Std_ReturnType retVal = E_OK; + + /* Retrieve reference to callout for given job */ + calloutInfoId = Csm_GetCalloutInfoIdxOfJobTable(job->jobId); + + /* Check if pre-job callout is configured for the given job. */ + if (calloutInfoId < Csm_GetSizeOfCalloutInfo()) + { +# if (CSM_ASYNC_PROCESSING == STD_ON) + uint8 calloutState = Csm_GetCalloutStateOfCalloutState(calloutInfoId, partition); + + if( job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_ASYNC) + { + /* If no callout has been called before or callout did not finish yet, call pre-job. */ + if ((calloutState == CSM_CALLOUT_STATE_IDLE) || (calloutState == CSM_CALLOUT_STATE_PRE_PENDING)) + { + /* Call pre-job callout */ + retVal = Csm_GetPreJobCalloutFuncOfCallout(Csm_GetCalloutIdxOfCalloutInfo(calloutInfoId))( /* SBSW_CSM_FUNCTION_POINTER */ + job, + (calloutState == CSM_CALLOUT_STATE_IDLE) ? (CSM_CALLOUT_STATE_PRE_INITIAL) : (CSM_CALLOUT_STATE_PRE_PENDING)); + + /* Set state according to return value of callout. */ + switch (retVal) + { + case E_OK: + { + /* pre-job callout has finished, Processing can start */ + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_PROCESSING, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + break; + } + + case CSM_E_PENDING: + { + /* pre-job callout has not yet finished, this is only possible in asynchronous job configurations */ + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_PRE_PENDING, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + break; + } + + default: + { + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_PROCESSING_ABORTED_BY_CALLOUT, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + /* Change retVal to E_OK to remove job from queue since processing shall never be started */ + retVal = E_OK; + break; + } + } + } + } + else +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + { + /* Call pre-job callout. */ + retVal = Csm_GetPreJobCalloutFuncOfCallout(Csm_GetCalloutIdxOfCalloutInfo(calloutInfoId))(job, CSM_CALLOUT_STATE_PRE_INITIAL); /* SBSW_CSM_FUNCTION_POINTER */ + + /* Set state according to return value of callout. */ + if(retVal == E_OK) + { + /* If return value is equal to E_OK, the job shall be executed as without callout. */ + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_PROCESSING, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + } + else + { + /* If return value is different to E_OK, processing of the job shall be suppressed. */ + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_POST_INITIAL, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + /* Call post-job callout. */ + Csm_CallPostJobCallout(job, &retVal, partition); /* SBSW_CSM_PASS_JOB_STACK_AND_PARTITION */ + } + } + } + return retVal; +} /* Csm_CallPreJobCallout() */ +#endif /* (CSM_CALLOUT == STD_ON) */ + +#if (CSM_JOB == STD_ON) +/********************************************************************************************************************** + * Csm_AppendRedirectionToJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_AppendRedirectionToJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + Csm_SizeOfPartitionIdentifiersType partition) +{ +# if (CSM_INOUTREDIRECTION == STD_ON) + uint32 jobId = job->jobId; + + /* #10 If job in- or output shall be redirected, copy corresponding redirection sources and destinations to the job object. */ + if(Csm_IsInOutRedirectionMapUsedOfJobTable(jobId)) + { + Csm_SizeOfInOutJobRedirectionTableType indexOfInOutRedirectionTable = Csm_GetInOutJobRedirectionTableIdxOfInOutRedirectionMap(Csm_GetInOutRedirectionMapIdxOfJobTable(jobId), partition); + Csm_RedirectionConfigValueOfInOutJobRedirectionTableType redirectionConfigValue = Csm_GetRedirectionConfigValueOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); + + job->jobRedirectionInfoRef = Csm_GetAddrInOutRedirection(Csm_GetInOutRedirectionMapIdxOfJobTable(jobId), partition); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->redirectionConfig = redirectionConfigValue; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_INPUT) + { + job->jobRedirectionInfoRef->inputKeyElementId = Csm_GetInputKeyElementIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->inputKeyId = Csm_GetCryIfKeyIdOfKey(Csm_GetInputKeyIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_INPUT) + { + job->jobRedirectionInfoRef->secondaryInputKeyElementId = Csm_GetSecondaryInputKeyElementIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->secondaryInputKeyId = Csm_GetCryIfKeyIdOfKey(Csm_GetSecondaryInputKeyIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_TERTIARY_INPUT) + { + job->jobRedirectionInfoRef->tertiaryInputKeyElementId = Csm_GetTertiaryInputKeyElementIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->tertiaryInputKeyId = Csm_GetCryIfKeyIdOfKey(Csm_GetTertiaryInputKeyIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_PRIMARY_OUTPUT) + { + job->jobRedirectionInfoRef->outputKeyElementId = Csm_GetOutputKeyElementIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->outputKeyId = Csm_GetCryIfKeyIdOfKey(Csm_GetOutputKeyIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } + + if((redirectionConfigValue & ((uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT)) == (uint8)CRYPTO_REDIRECT_CONFIG_SECONDARY_OUTPUT) + { + job->jobRedirectionInfoRef->secondaryOutputKeyElementId = Csm_GetSecondaryOutputKeyElementIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobRedirectionInfoRef->secondaryOutputKeyId = Csm_GetCryIfKeyIdOfKey(Csm_GetSecondaryOutputKeyIdOfInOutJobRedirectionTable(indexOfInOutRedirectionTable)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } + } + else +# endif /* (CSM_INOUTREDIRECTION == STD_ON) */ + { + /* #20 Else set redirection to dummy value. */ +# if (CSM_JOB_TYPE_LAYOUT_REDIRECTION_INFO_REF == STD_ON) + job->jobRedirectionInfoRef = (P2VAR(Crypto_JobRedirectionInfoType, AUTOMATIC, CSM_VAR_NOINIT)) (NULL_PTR); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# else + CSM_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + } +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ +} /* Csm_AppendRedirectionToJob() */ + +/********************************************************************************************************************** + * Csm_HandleJobProcessing() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_HandleJobProcessing( + Csm_ChannelIdOfQueueInfoType channelId, + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Std_ReturnType retVal; + +# if (CSM_CALLOUT == STD_ON) + Csm_CalloutInfoIdxOfJobTableType calloutInfoId; + + /* Retrieve reference to callout for given job */ + calloutInfoId = Csm_GetCalloutInfoIdxOfJobTable(job->jobId); + + /* #10 Call preJobCallout */ + retVal = Csm_CallPreJobCallout(job, partition); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + + if ((calloutInfoId >= Csm_GetSizeOfCalloutInfo()) || (Csm_GetCalloutStateOfCalloutState(calloutInfoId, partition) == CSM_CALLOUT_STATE_PROCESSING)) +# endif /* (CSM_CALLOUT == STD_ON) */ + { + /* #20 Call CryIf to process given job */ + retVal = CryIf_ProcessJob(channelId, job); /* SBSW_CSM_PASS_JOB_POINTER_API_REQUIREMENT */ +# if (CSM_CALLOUT == STD_ON) + if (calloutInfoId < Csm_GetSizeOfCalloutInfo()) + { + /* Job has finished, either successful (E_OK) or not */ +# if (CSM_ASYNC_PROCESSING == STD_ON) + if (job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_SYNC) +# endif + { + /* We need to call the post callout routine */ + Csm_SetCalloutStateOfCalloutState(calloutInfoId, CSM_CALLOUT_STATE_POST_INITIAL, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + Csm_CallPostJobCallout(job, &retVal, partition); /* SBSW_CSM_PASS_JOB_POINTER_PARTITION_AND_STACK_API_REQUIREMENT */ + } + } +# else /* !(CSM_CALLOUT == STD_ON) */ + CSM_DUMMY_STATEMENT_CONST(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + } + return retVal; +} /* Csm_HandleJobProcessing() */ + +/********************************************************************************************************************** + * Csm_ProcessJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030, 6080 1 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_ProcessJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Std_ReturnType retVal; + uint32 jobId = job->jobId; + Csm_QueueInfoIterType queueInfoIdx = Csm_GetQueueInfoIdxOfJobTable(jobId); + Csm_ChannelIdOfQueueInfoType channelId = Csm_GetChannelIdOfQueueInfo(queueInfoIdx); + +# if (CSM_ASYNC_PROCESSING == STD_ON) + Crypto_JobStateType combinedJobState = job->jobState; + +# if (CSM_JOB_TYPE_LAYOUT_ASR430_COMPATIBILITY == STD_ON) + combinedJobState |= job->state; +# endif +# endif + + /* #05 Append job redirection to job object */ + Csm_AppendRedirectionToJob(job, partition); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + + /* Switch depending on whether there is asynchronous processing at all */ +# if (CSM_ASYNC_PROCESSING == STD_ON) + /* Check if the job is asynchronous. */ + if (job->jobPrimitiveInfo->processingType == CRYPTO_PROCESSING_ASYNC) + { + boolean gotLockOfQueue = (Csm_GetLockOfQueueState(queueInfoIdx, partition) == 0u) ? TRUE : FALSE; + /* Job is asynchronous */ + /* #19 Check if the job's processing mode matches the processing mode of the queue the job is mapped to */ + if (Csm_GetProcessingModeOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId)) == CRYPTO_PROCESSING_SYNC) + { + retVal = E_NOT_OK; + } + /* #20 Determine if queue is empty or job is already active and queue is not locked + * (e.g. by this function) and call Csm_HandleJobProcessing if so */ + else if ((gotLockOfQueue == TRUE) && + ((Csm_GetQueueIdxOfQueueState(queueInfoIdx, partition) == Csm_GetQueueStartIdxOfQueueInfo(queueInfoIdx)) + || ((combinedJobState & CRYPTO_JOBSTATE_ACTIVE) == CRYPTO_JOBSTATE_ACTIVE))) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_PROGRESSING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + Csm_IncLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + Csm_SetRetriggeringOfQueueState(queueInfoIdx, CSM_ASYNC_JOB_RETRIGGER_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ +# endif + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + /* Call CryIf_ProcessJob() */ + retVal = Csm_HandleJobProcessing(channelId, job, partition); /* SBSW_CSM_PASS_CHANNEL_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_DecLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else + { + /* Set retVal temporarily to busy to force enqueuing */ + retVal = CRYPTO_E_BUSY; + } + + /* #22 Enqueuing necessary if return value is either BUSY or QUEUE_FULL */ + if ((retVal == CRYPTO_E_BUSY) || (retVal == CRYPTO_E_QUEUE_FULL)) + { + /* #23 Append job redirection to job object again to overwrite changes that were made during last processing attempt */ + Csm_AppendRedirectionToJob(job, partition); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + + /* #24 Enqueue job or return QUEUE_FULL */ + retVal = Csm_EnqueueJob(queueInfoIdx, job, partition); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + if (Csm_IsTriggerAsynchJobsInCallbackOfQueueInfo(queueInfoIdx)) /* PRQA S 4304 */ /* MD_MSR_AutosarBoolean */ + { + /* #25 If triggering asynchronous jobs is enabled for the queue handle the retriggering depending on whether + * getting the queue lock failed or not. */ + if (!gotLockOfQueue) + { + Csm_SetRetriggeringOfQueueState(queueInfoIdx, CSM_ASYNC_JOB_RETRIGGER_STATE_PENDING, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else if (Csm_GetRetriggeringOfQueueState(queueInfoIdx, partition) == CSM_ASYNC_JOB_RETRIGGER_STATE_PENDING) + { + Csm_TriggerAsynchJobProcessing(queueInfoIdx); + } + else + { + /* Do nothing */ + } + } +# endif /* (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) */ + } + /* #26 Request has been successfully passed to lower layer */ + else if (retVal == E_OK) + { + /* #27 Check if the job is still in state PROGRESSING or callback already occurred */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_PROGRESSING) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_WAITING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else + { + /* Callback already occurred but was not ready to process the application callback - do that now. */ + /* Lock queue to prevent a recursive call of Csm_ProcessJob from the application callback function */ + Csm_IncLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_CallbackNotification(job, Csm_GetJobState(jobId, partition) & CSM_JOB_STATE_CALLBACK_OCCURRED_CLEAR_MASK); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_DecLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + } + else + { + Csm_SetJobState(jobId, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + job->jobId = CSM_EMPTY_JOB; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif + } + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + else + { + /* The job is synchronous */ + /* #35 If any jobs are queued and job is not active, compare the job priority with the highest priority in the queue + * (This is relevant for queues which process both synchronous and asynchronous jobs.) */ + if ((Csm_GetProcessingModeOfQueueInfo(queueInfoIdx) != CRYPTO_PROCESSING_SYNC) + && (Csm_GetQueueIdxOfQueueState(queueInfoIdx, partition) != Csm_GetQueueStartIdxOfQueueInfo(queueInfoIdx)) + && ((combinedJobState & CRYPTO_JOBSTATE_ACTIVE) != CRYPTO_JOBSTATE_ACTIVE) + ) + { + /* #37 Call Csm_HandleJobProcessing function if job priority is higher than the highest priority in the queue, + * otherwise return busy */ + if (job->jobPriority > (Csm_GetQueue((Csm_QueueIdxOfQueueStateType)(Csm_GetQueueIdxOfQueueState(queueInfoIdx, partition) - 1u), partition)->jobPriority)) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_PROGRESSING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + Csm_IncLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + retVal = Csm_HandleJobProcessing(channelId, job, partition); /* SBSW_CSM_PASS_CHANNEL_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_DecLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else + { + retVal = CRYPTO_E_BUSY; + } + + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + else +# else /* !(CSM_ASYNC_PROCESSING == STD_ON) */ + { +# endif + { + /* #40 Process synchronous job if queue is empty or job is active */ + Csm_SetJobState(jobId, CSM_JOB_STATE_PROGRESSING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + /* Call CryIf_ProcessJob() */ + retVal = Csm_HandleJobProcessing(channelId, job, partition); /* SBSW_CSM_PASS_CHANNEL_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + } + + /* #41 Free object if job finishes or is rejected, otherwise set to active */ + if ((retVal != E_OK) || ((job->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_FINISH) == CRYPTO_OPERATIONMODE_FINISH) +# if (CSM_OPERATIONMODELIMITATIONOFQUEUEINFO == STD_ON) + || (Csm_IsOperationModeLimitationOfQueueInfo(queueInfoIdx)) +# endif + ) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + job->jobId = CSM_EMPTY_JOB; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif + } + else + { + Csm_SetJobState(jobId, CSM_JOB_STATE_ACTIVE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + } + + return retVal; +} /* Csm_ProcessJob() */ + +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) +/********************************************************************************************************************** + * Csm_PrepareJobObj() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_PrepareJobObj( + uint32 jobId, + P2VAR(Crypto_JobType, AUTOMATIC, AUTOMATIC) job) +{ + job->jobId = jobId; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobPrimitiveInfo = Csm_GetAddrJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(jobId)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# if (CSM_JOB_TYPE_LAYOUT_JOB_INFO_PTR == STD_ON) + job->jobInfo = Csm_GetAddrJobInfo(Csm_GetJobInfoIdxOfJobTable(jobId)); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif + job->jobPriority = Csm_GetPriorityOfJobTable(jobId); /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->jobState = CRYPTO_JOBSTATE_IDLE; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + +# if (CSM_JOB_TYPE_LAYOUT_ASR430_COMPATIBILITY == STD_ON) + job->PrimitiveInputOutput = job->jobPrimitiveInputOutput; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + job->state = job->jobState; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif +} /* Csm_PrepareJobObj() */ +# endif /* (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) */ + +/********************************************************************************************************************** + * Csm_GetJobObj() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_GetJobObj( + uint32 jobId, + Csm_SizeOfPartitionIdentifiersType partition, + P2VAR(Csm_SizeOfJobType, AUTOMATIC, AUTOMATIC) jobObjId) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = CRYPTO_E_BUSY; + + /* #10 Differ between job states */ + if (Csm_GetJobState(jobId, partition) >= CSM_JOB_STATE_PROGRESSING) + { + /* #11 Job is currently in use, e.g. queued or in driver, reject request with busy */ + /* retval is already set. */ + } + else if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_ACTIVE) + { + /* #12 Job is active but is waiting for further input. Job object was reserved already - return it. */ + *jobObjId = Csm_GetJobToObjMap(jobId, partition); /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + retVal = E_OK; + } +# if (CSM_JOBIDXOFJOBTABLE == STD_ON) + else +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + if (Csm_IsJobUsedOfJobTable(jobId)) +# endif + { + /* #20 Job has a dedicated job object, return it. */ + *jobObjId = Csm_GetJobIdxOfJobTable(jobId); /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + Csm_SetJobToObjMap(jobId, *jobObjId, partition); /* SBSW_WRITE_TO_OBJECTMAP_BY_JOBID */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + Csm_GetAddrJob(*jobObjId, partition)->jobId = jobId; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif + retVal = E_OK; + } +# endif /* (CSM_JOBIDXOFJOBTABLE == STD_ON) */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + else + { + /* #21 Job Sharing: Find a free slot and return it, return busy if there is none */ + Csm_QueueInfoIterType queueInfoIdx = Csm_GetQueueInfoIdxOfJobTable(jobId); + Csm_SizeOfJobType idx; +# if (CSM_ASYNC_PROCESSING == STD_ON) + /* If it is an asynchronous job fetch the next job object from the pool which is free for usage. */ + if (Csm_IsAsynchronousOfJobTable(jobId)) + { + retVal = CSM_QUEUE_FULL_RETVAL; + + for (idx = Csm_GetJobPoolStartIdxOfQueueInfo(queueInfoIdx); idx < Csm_GetJobPoolEndIdxOfQueueInfo(queueInfoIdx); idx++) /* FETA_CSM_STRICTLY_INCREASING_BY_ONE */ + { + if (Csm_GetJob(idx, partition).jobId == CSM_EMPTY_JOB) + { + *jobObjId = idx; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + Csm_SetJobToObjMap(jobId, idx, partition); /* SBSW_WRITE_TO_OBJECTMAP_BY_JOBID */ + Csm_PrepareJobObj(jobId, Csm_GetAddrJob(idx, partition)); /* SBSW_CSM_PASS_JOB */ + retVal = E_OK; + break; + } + } +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (retVal == CSM_QUEUE_FULL_RETVAL) + { + /* #22 Report runtime error if no free slot is available equivalent to queue is full */ + (void)Det_ReportRuntimeError(CSM_MODULE_ID, CSM_INSTANCE_ID, CSM_GENERIC_JOB_PROCESSING_ID, CSM_E_QUEUE_FULL); + } +# endif + } + else +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + { + /* Fetch the one job object reserved for all synchronous jobs for this queue and check if it is free for usage. */ + idx = Csm_GetJobObjSynchronousIdxOfQueueInfo(queueInfoIdx); + if (Csm_GetJob(idx, partition).jobId == CSM_EMPTY_JOB) + { + *jobObjId = idx; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + Csm_SetJobToObjMap(jobId, idx, partition); /* SBSW_WRITE_TO_OBJECTMAP_BY_JOBID */ + Csm_PrepareJobObj(jobId, Csm_GetAddrJob(idx, partition)); /* SBSW_CSM_PASS_JOB */ + retVal = E_OK; + } + } + } +# endif /* (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) */ + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + + return retVal; +} /* Csm_GetJobObj() */ + +# if (CSM_ASYNC_PROCESSING == STD_ON) +/********************************************************************************************************************** + * Csm_EnqueueJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_EnqueueJob( + Csm_QueueInfoIterType queueIdx, + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Std_ReturnType retVal = E_OK; + Csm_QueueIterType i, j; + + /* #5 Check if job that shall be enqueued is active and if queue has an empty place.*/ + if ((Csm_GetJobState(job->jobId, partition) == CSM_JOB_STATE_ACTIVE) && (Csm_GetQueueIdxOfQueueState(queueIdx, partition) < Csm_GetQueueEndIdxOfQueueInfo(queueIdx))) + { + Csm_SetQueue(Csm_GetQueueIdxOfQueueState(queueIdx, partition), job, partition); /* SBSW_CSM_WRITE_TO_QUEUE_API_REQ */ + + Csm_IncQueueIdxOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_API_REQ */ + } + /* #10 Check if queue has two empty places, so that there is always one empty place for an active job, + * otherwise return QUEUE_FULL and report runtime error. */ + else if (Csm_GetQueueIdxOfQueueState(queueIdx, partition) < (Csm_GetQueueEndIdxOfQueueInfo(queueIdx) - 1u)) + { + for (i = Csm_GetQueueStartIdxOfQueueInfo(queueIdx); i <= Csm_GetQueueIdxOfQueueState(queueIdx, partition); i++) /* FETA_CSM_STRICTLY_INCREASING_BY_ONE_WITH_PRE_CHECK */ + { + /* #11 If end of queue is reached, new job has the highest priority. Simply add new job at the end. */ + if (i == Csm_GetQueueIdxOfQueueState(queueIdx, partition)) + { + Csm_SetQueue(i, job, partition); /* SBSW_CSM_WRITE_TO_QUEUE_BY_LOCALIDX */ + } + /* #12 If job priority of job is lower or equal to the one in the queue, + * or if the one in the queue is active, take its place. */ + else if ((job->jobPriority <= Csm_GetQueue(i, partition)->jobPriority) || (Csm_GetJobState(Csm_GetQueue(i, partition)->jobId, partition) == CSM_JOB_STATE_ACTIVE)) + { + /* Place found in which job needs to be inserted */ + /* #13 Move all remaining jobs, which are already sorted, by one place to the right. */ + for (j = Csm_GetQueueIdxOfQueueState(queueIdx, partition); j > i; j--) /* FETA_CSM_STRICTLY_DECREASING_BY_ONE */ + { + Csm_SetQueue(j, Csm_GetQueue(j - 1u, partition), partition); /* PRQA S 2841 */ /* MD_CSM_QUEUE_BY_QUEUEIDX */ /* SBSW_CSM_WRITE_TO_QUEUE_BY_LOCALIDX */ + } + + /* #14 Insert new job into the freed place. */ + Csm_SetQueue(i, job, partition); /* SBSW_CSM_WRITE_TO_QUEUE_BY_LOCALIDX */ + break; + } + else + { + /* Priority of job to insert is higher, check next slot of queue. */ + } + } + + Csm_SetJobState(job->jobId, CSM_JOB_STATE_QUEUED, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + Csm_IncQueueIdxOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_API_REQ */ + } + else + { + retVal = CSM_QUEUE_FULL_RETVAL; +# if (CSM_DEV_ERROR_REPORT == STD_ON) + (void)Det_ReportRuntimeError(CSM_MODULE_ID, CSM_INSTANCE_ID, CSM_GENERIC_JOB_PROCESSING_ID, CSM_E_QUEUE_FULL); +# endif + } + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + + return retVal; +} /* Csm_EnqueueJob() */ + +/********************************************************************************************************************** + * Csm_DequeueJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_DequeueJob( + Csm_QueueInfoIterType queueIdx, + uint32 jobId, + Csm_SizeOfPartitionIdentifiersType partition) +{ + Csm_QueueIterType i, j; + + /* #10 Iterate over enqueued jobs. */ + for (i = Csm_GetQueueIdxOfQueueState(queueIdx, partition); i > Csm_GetQueueStartIdxOfQueueInfo(queueIdx); i--) /* FETA_CSM_STRICTLY_DECREASING_BY_ONE */ + { + if (jobId == Csm_GetQueue(i - 1u, partition)->jobId) + { + /* #20 Fill the possible gap by shifting remaining jobs to the left. */ + for (j = i; j < Csm_GetQueueIdxOfQueueState(queueIdx, partition); j++) /* FETA_CSM_STRICTLY_INCREASING_BY_ONE */ + { + Csm_SetQueue(j - 1u, Csm_GetQueue(j, partition), partition); /* PRQA S 2841 */ /* MD_CSM_QUEUE_BY_QUEUEIDX */ /* SBSW_CSM_WRITE_TO_QUEUE_BY_LOCALIDX */ + } + + /* #21 Decrease queue size to finalize dequeuing. */ + Csm_DecQueueIdxOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + + break; + } + } + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + +} /* Csm_DequeueJob() */ + +/********************************************************************************************************************** + * Csm_TriggerAsynchJobProcessing() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +CSM_LOCAL FUNC(void, CSM_CODE) Csm_TriggerAsynchJobProcessing(Csm_QueueInfoIterType queueIdx) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + uint32 jobId; + Std_ReturnType retVal; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionConfigIdxOfQueueInfo(queueIdx); + + /* ----- Implementation ----------------------------------------------- */ + + /* #10 Check if queue has entries and processing is possible (queue not locked due to an active request): */ + if ((Csm_GetLockOfQueueState(queueIdx, partition) == 0u) && (Csm_GetQueueIdxOfQueueState(queueIdx, partition) != Csm_GetQueueStartIdxOfQueueInfo(queueIdx))) + { + job = Csm_GetQueue(Csm_GetQueueIdxOfQueueState(queueIdx, partition) - 1u, partition); + jobId = job->jobId; + +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + Csm_SetRetriggeringOfQueueState(queueIdx, CSM_ASYNC_JOB_RETRIGGER_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT */ +# endif + + if (jobId < Csm_GetSizeOfJobState(partition)) + { + /* #20 Lock queue temporarily and pass job to underlying crypto. */ + Csm_SetJobState(jobId, CSM_JOB_STATE_PROGRESSING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + Csm_IncLockOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_SIZE */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + retVal = Csm_HandleJobProcessing(Csm_GetChannelIdOfQueueInfo(queueIdx), job, partition); /* SBSW_CSM_PASS_JOB */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_DecLockOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_SIZE */ + + /* #31 If Job was successfully passed to lower layer remove it from queue. */ + if (retVal == E_OK) + { + Csm_DequeueJob(queueIdx, jobId, partition); + /* #32 Check if the job is still in state PROGRESSING or callback already occurred. */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_PROGRESSING) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_WAITING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + else + { + /* Callback already occurred but was not ready to process the application callbacks - do that now */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_CallbackNotification(job, Csm_GetJobState(jobId, partition) & CSM_JOB_STATE_CALLBACK_OCCURRED_CLEAR_MASK); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* #33 If job cannot be processed because of busy driver or full queue. Let job in queue and try again later. */ + else if ((retVal == CRYPTO_E_BUSY) || (retVal == CRYPTO_E_QUEUE_FULL)) + { + /* #34 Append job redirection to job object again to overwrite changes that were made during last processing attempt */ + Csm_AppendRedirectionToJob(job, partition); /* SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT */ + + Csm_SetJobState(jobId, CSM_JOB_STATE_QUEUED, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + else + { + /* #40 If lower layer returns an error remove job from queue and notify application. */ + Csm_DequeueJob(queueIdx, jobId, partition); + /* change to state waiting for correct handling in callback notification */ + Csm_SetJobState(jobId, CSM_JOB_STATE_WAITING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_CallbackNotification(job, retVal); /* SBSW_CSM_PASS_JOB_POINTER_LOCAL */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + else + { + /* job invalid - throw it away */ + Csm_DecQueueIdxOfQueueState(queueIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_SIZE */ + } + } +} /* Csm_TriggerAsynchJobProcessing() */ + +/********************************************************************************************************************** + * Csm_HandleCryIfCancelResultInStateCanceling() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +CSM_LOCAL FUNC(boolean, CSM_CODE) Csm_HandleCryIfCancelResultInStateCanceling( + Csm_SizeOfPartitionIdentifiersType partition, + uint32 jobId, + Std_ReturnType cryIfRetVal, + uint8 cancelFailedState) +{ + boolean notifyByCallback = FALSE; + + if (cryIfRetVal == E_OK) + { + notifyByCallback = TRUE; + } + else if (cryIfRetVal == CRYPTO_E_JOB_CANCELED) + { + /* No immediate cancellation in lower layer possible, wait for next Csm_CallbackNotification */ + Csm_SetJobState(jobId, CSM_JOB_STATE_CANCELED, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else + { + /* Canceling failed, restore state */ + Csm_SetJobState(jobId, cancelFailedState, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + + return notifyByCallback; +} + +# if (CSM_CANCELATION_DURING_PROCESSING == STD_ON) +/********************************************************************************************************************** + * Csm_HandleCryIfCancelResultStateHasChanged() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleCryIfCancelResultStateHasChanged( + Csm_SizeOfPartitionIdentifiersType partition, + uint32 jobId, + Std_ReturnType cryIfRetVal) +{ + + if (cryIfRetVal == E_OK) + { + /* Nothing to do, callback already occurred */ + } + else if (cryIfRetVal == CRYPTO_E_JOB_CANCELED) + { + /* No immediate cancellation in lower layer possible, wait for next Csm_CallbackNotification */ + Csm_SetJobState(jobId, CSM_JOB_STATE_CANCELED, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + else + { + /* Job State has changed due to callback. Leave the state as it is. */ + } + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + +} +# endif /* (CSM_CANCELATION_DURING_PROCESSING == STD_ON) */ + +/********************************************************************************************************************** + * Csm_CancelAsynchronousJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6030 1 */ /* MD_MSR_STCYC */ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_CancelAsynchronousJob( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Csm_SizeOfPartitionIdentifiersType partition) +{ + uint32 jobId = job->jobId; + Std_ReturnType retVal = E_NOT_OK; + Csm_QueueInfoIterType queueInfoIdx = Csm_GetQueueInfoIdxOfJobTable(jobId); + + boolean notifyByCallback = FALSE; + +# if (CSM_CANCELATION_DURING_PROCESSING == STD_ON) + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_WAITING) + { + /* #10 Object is in driver and could call Csm_Notification at any time. Even if lower layer returns, + * driver could have already invoked the Csm_CallbackNotification function or be on the way. */ + + Csm_SetJobState(jobId, CSM_JOB_STATE_CANCELING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #12 Cancel job in lower layer */ + retVal = CryIf_CancelJob(Csm_GetChannelIdOfQueueInfo(queueInfoIdx), job); /* SBSW_CSM_PASS_JOB */ + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_CANCELING) + { + notifyByCallback = Csm_HandleCryIfCancelResultInStateCanceling(partition, jobId, retVal, CSM_JOB_STATE_WAITING); + } + else + { + Csm_HandleCryIfCancelResultStateHasChanged(partition, jobId, retVal); + } + } + else +# endif /* (CSM_CANCELATION_DURING_PROCESSING == STD_ON) */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_QUEUED) + { + /* #21 If Job is not started yet, cancellation can be done in Csm only, otherwise cancellation in lower layer required. */ + if ((job->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_START) == CRYPTO_OPERATIONMODE_START) + { + retVal = E_OK; + } + else + { + /* Job was already started and waits for input in driver - cancel it in lower layer too */ + /* #23 Pause processing when canceling in lower layer. Otherwise job could be passed to lower layer in between */ + Csm_IncLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + retVal = CryIf_CancelJob(Csm_GetChannelIdOfQueueInfo(queueInfoIdx), job); /* SBSW_CSM_PASS_JOB */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_DecLockOfQueueState(queueInfoIdx, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ */ + } + + if (retVal == E_OK) + { + /* #24 Remove job from queue in case of successful cancellation */ + Csm_DequeueJob(queueInfoIdx, jobId, partition); + notifyByCallback = TRUE; + } + } + else if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_ACTIVE) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_CANCELING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #32 Cancel job in lower layer */ + retVal = CryIf_CancelJob(Csm_GetChannelIdOfQueueInfo(queueInfoIdx), job); /* SBSW_CSM_PASS_JOB */ + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_CANCELING) + { + notifyByCallback = Csm_HandleCryIfCancelResultInStateCanceling(partition, jobId, retVal, CSM_JOB_STATE_ACTIVE); + } + else + { + /* Job State was modified in between so Csm_CallbackNotification already occurred */ + retVal = E_OK; + } + } + else + { + /* Job is in mode which cannot be cancelled - retVal already set */ + } + + /* #40 If job was canceled, call configured callback notification function */ + if (notifyByCallback) + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_CallbackNotification(job, CRYPTO_E_JOB_CANCELED); /* SBSW_CSM_FORWARDING_PTR */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + } + + return retVal; +} /* Csm_CancelAsynchronousJob() */ + +/********************************************************************************************************************** + * Csm_HandleCallbackNotification() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleCallbackNotification( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + Crypto_ResultType result, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) runtimeErrorIdPtr +) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType resultCopy = result; + boolean notify = TRUE; + + /* Keep jobId local to still have it availabe after clearing the job object in case of a shared job object */ + uint32 jobId = job->jobId; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + Csm_SizeOfJobType jobObjId = Csm_GetSizeOfJob(partition); +# endif + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); +# if (CSM_CANCELATION_DURING_PROCESSING == STD_ON) + /* #21 Check if job was cancelled in between and update return value accordingly */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_CANCELED) + { + resultCopy = CRYPTO_E_JOB_CANCELED; + Csm_SetJobState(jobId, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + else +# endif /* (CSM_CANCELATION_DURING_PROCESSING == STD_ON) */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_IDLE) + { + /* Job is not running - Illegal function call, ignore it */ + notify = FALSE; + *runtimeErrorIdPtr = CSM_E_UNEXPECTED_CALLBACK; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + } + /* #22 If not yet in state waiting but in state progressing due to preemption, + * save result and call callback in initial call. */ + else if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_PROGRESSING) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_CALLBACK_OCCURRED | resultCopy, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + notify = FALSE; + } + /* #23 Update state to accept new request directly triggered in callback of application. + Set new state to idle or active depending on whether operation mode contains operation mode finish. */ + else if ((resultCopy == E_OK) && ((job->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_FINISH) != CRYPTO_OPERATIONMODE_FINISH)) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_ACTIVE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + else + { +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + /* Get Csm object since passed job object could be a copy made by crypto driver */ + jobObjId = Csm_GetJobToObjMap(jobId, partition); +# endif + Csm_SetJobState(jobId, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #24 Check wether user is already to be notified and shared object is to be freed */ + if (notify) + { +# if (CSM_CALLOUT == STD_ON) + Csm_CallPostJobCallout(job, &resultCopy, partition); /* SBSW_CSM_PASS_JOB_STACK_AND_PARTITION */ +# endif /* (CSM_CALLOUT == STD_ON) */ + + /* #30 Call user callback function */ + Csm_HandleApplicationCallback(job, resultCopy, partition); /* SBSW_CSM_PASS_JOB_POINTER_API_REQUIREMENT_AND_STACK */ + + /* #31 Free object if job finishes or is rejected if job has no dedicated object */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + if ((jobObjId < Csm_GetSizeOfJob(partition)) +# if (CSM_JOBIDXOFJOBTABLE == STD_ON) + && (!(Csm_IsJobUsedOfJobTable(jobId))) +# endif + ) + { + Csm_GetAddrJob(jobObjId, partition)->jobId = CSM_EMPTY_JOB; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ + } +# endif /* (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) */ + +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + { + /* #40 Trigger new asynchronous job. Derive the retrigger state depending on whether getting queue lock succeeded + * or failed. */ + Csm_QueueInfoIterType queueInfoIdx; + queueInfoIdx = Csm_GetQueueInfoIdxOfJobTable(jobId); + + if (Csm_IsTriggerAsynchJobsInCallbackOfQueueInfo(queueInfoIdx)) /* PRQA S 4304 */ /* MD_MSR_AutosarBoolean */ + { + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + Csm_SetRetriggeringOfQueueState(queueInfoIdx, CSM_ASYNC_JOB_RETRIGGER_STATE_PENDING, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT */ + Csm_TriggerAsynchJobProcessing(queueInfoIdx); /* SBSW_CSM_PASS_QUEUESTATEINDEX */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } +# endif /* (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) */ + } +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + +} /* Csm_HandleCallbackNotification() */ + +/********************************************************************************************************************** + * Csm_HandleApplicationCallback() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleApplicationCallback( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + Std_ReturnType result, + Csm_SizeOfPartitionIdentifiersType partition) +{ + /* #10 Call configured user callback function */ +# if (CSM_CALLBACK_START_NOTIFICATION == STD_OFF) + if ((((job->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_UPDATE) == CRYPTO_OPERATIONMODE_UPDATE) + && Csm_IsPrimitiveCallbackUpdateNotificationOfJobTable(job->jobId)) + || ((job->jobPrimitiveInputOutput.mode & CRYPTO_OPERATIONMODE_FINISH) == CRYPTO_OPERATIONMODE_FINISH) + || (result == CRYPTO_E_JOB_CANCELED)) +# endif /* (CSM_CALLBACK_START_NOTIFICATION == STD_OFF) */ + { +# if (CSM_CALLBACKFUNC43OFBSWCALLBACKS == STD_ON) + if (Csm_IsBswCallbacksUsedOfJobTable(job->jobId) && (Csm_GetCallbackFunc43OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId)) != NULL_PTR)) + { + Csm_GetCallbackFunc43OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId))(job, result); /* SBSW_CSM_FUNCTION_POINTER */ + } + else +# endif /* (CSM_CALLBACKFUNC43OFBSWCALLBACKS == STD_ON) */ + +# if(CSM_CALLBACKFUNC44OFBSWCALLBACKS == STD_ON) + if (Csm_IsBswCallbacksUsedOfJobTable(job->jobId) && (Csm_GetCallbackFunc44OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId)) != NULL_PTR)) + { + Csm_GetCallbackFunc44OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId))(job->jobId, result); /* SBSW_CSM_FUNCTION_POINTER */ + } + else +# endif /* (CSM_CALLBACKFUNC44OFBSWCALLBACKS == STD_ON) */ + +# if(CSM_CALLBACKFUNC45OFBSWCALLBACKS == STD_ON) + if (Csm_IsBswCallbacksUsedOfJobTable(job->jobId) && (Csm_GetCallbackFunc45OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId)) != NULL_PTR)) + { + Csm_GetCallbackFunc45OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId))(job, result); /* SBSW_CSM_FUNCTION_POINTER */ + } + else +# endif /* (CSM_CALLBACKFUNC45OFBSWCALLBACKS == STD_ON) */ + +# if(CSM_CALLBACKFUNC46OFBSWCALLBACKS == STD_ON) + /* Coming to this line Csm_GetCallbackFunc46OfBswCallbacks is always != NULL_PTR */ + if (Csm_IsBswCallbacksUsedOfJobTable(job->jobId)) + { + Csm_GetCallbackFunc46OfBswCallbacks(Csm_GetBswCallbacksIdxOfJobTable(job->jobId))(job->jobId, result); /* SBSW_CSM_FUNCTION_POINTER */ + } + else +# endif /* (CSM_CALLBACKFUNC46OFBSWCALLBACKS == STD_ON) */ + +# if (CSM_RTECALLBACK == STD_ON) + { + Csm_SetRteResult(Csm_GetRteCallbackIdxOfJobTable(job->jobId), result, partition); /* SBSW_CSM_WRITE_TO_RTERESULT_BY_JOBID */ + Csm_SetRteCallbackOccurred(TRUE, partition); /* SBSW_CSM_CSL_VAR_ACCESS */ + } +# endif /* (CSM_RTECALLBACK == STD_ON) */ + { + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + } + } +} /* Csm_HandleApplicationCallback() */ + +# if (CSM_RTECALLBACK == STD_ON) +/********************************************************************************************************************** + * Csm_HandleRteCallbacks() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CSM_LOCAL_INLINE FUNC(void, CSM_CODE) Csm_HandleRteCallbacks(Csm_SizeOfPartitionIdentifiersType partition) +{ + /* Rte Notifications */ + if (Csm_IsRteCallbackOccurred(partition)) + { + Csm_RteCallbackIterType callbackIdx; + Std_ReturnType retVal; + + Csm_SetRteCallbackOccurred(FALSE, partition); /* SBSW_CSM_CSL_VAR_ACCESS */ + for (callbackIdx = 0u; callbackIdx < Csm_GetSizeOfRteCallback(partition); callbackIdx++) + { + retVal = Csm_GetRteResult(callbackIdx, partition); + if (retVal != CSM_CALLBACK_IDLE) + { + Csm_SetRteResult(callbackIdx, CSM_CALLBACK_IDLE, partition); /* SBSW_CSM_WRITE_TO_RTERESULT_BY_SIZE_API_REQ */ + (void)Csm_GetRteCallback(callbackIdx, partition)(retVal); /* SBSW_CSM_FUNCTION_POINTER */ + } + } + } + + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Csm_HandleRteCallbacks() */ +# endif /* (CSM_RTECALLBACK == STD_ON) */ + +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + +# if (CSM_DEV_ERROR_DETECT == STD_ON) +/********************************************************************************************************************** + * Csm_VerifyJobParam() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CSM_LOCAL FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyJobParam( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + Crypto_ServiceInfoType service) +{ + uint8 retVal = E_NOT_OK; + + /* Check if the provided job id is in range of the configured jobs */ + if (jobId >= Csm_GetSizeOfJobTable()) + { + *errorId = CSM_E_PARAM_HANDLE; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + } + /* Check if the requested service matches the configured one */ + else if (Csm_GetJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(jobId)).primitiveInfo->service != service) + { + *errorId = CSM_E_SERVICE_TYPE; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + } + /* Check if the current partition is active and initialized */ + else + { + retVal = Csm_VerifyInitAndPartition(jobId, errorId); /* SBSW_CSM_FORWARDING_PTR */ + } + + return retVal; +} /* Csm_VerifyJobParam() */ + +/********************************************************************************************************************** + * Csm_VerifyJobParamAndMode() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyJobParamAndMode( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId, + Crypto_ServiceInfoType service, + Crypto_OperationModeType mode) +{ + uint8 retVal = Csm_VerifyJobParam(jobId, errorId, service); /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + +# if (CSM_OPERATIONMODELIMITATIONOFQUEUEINFO == STD_ON) + if (retVal == E_OK) + { + if ((mode != CRYPTO_OPERATIONMODE_SINGLECALL) && (Csm_IsOperationModeLimitationOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId)))) + { + *errorId = CSM_E_PROCESSING_MODE; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + retVal = E_NOT_OK; + } + } +# else + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_OPERATIONMODELIMITATIONOFQUEUEINFO == STD_ON) */ + + return retVal; +} /* Csm_VerifyJobParamAndMode() */ + +/********************************************************************************************************************** + * Csm_VerifyInitAndPartition() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(Std_ReturnType, CSM_CODE) Csm_VerifyInitAndPartition( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, AUTOMATIC) errorId) +{ + Std_ReturnType retVal = E_NOT_OK; + + /* Job id is reliable - Get the partition from the job */ + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + /* Check the initialization state of the partition */ + if (Csm_GetPartitionDataInitialized(partition) != CSM_INITIALIZED) + { + *errorId = CSM_E_UNINIT; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + } +# if (CSM_MULTI_PARTITION_RUNTIME_CHECKS == STD_ON) + /* Check if the currently executing partition matches the configured partition */ + else if (Csm_GetPartitionIdx() != partition) + { + *errorId = CSM_E_INVALID_PARTITION; /* SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE */ + } +# endif + else + { + retVal = E_OK; + } + +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + + return retVal; +} /* Csm_VerifyInitAndPartition() */ +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + +/********************************************************************************************************************** + * Csm_GetPartitionOfJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +CSM_LOCAL_INLINE FUNC(Csm_SizeOfPartitionIdentifiersType, CSM_CODE) Csm_GetPartitionOfJob(uint32 jobId) +{ + return Csm_GetPartitionConfigIdxOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId)); +} +#endif /* (CSM_JOB == STD_ON) */ + +#if ((CSM_DEV_ERROR_DETECT == STD_ON) || (CSM_JOB == STD_ON)) +/********************************************************************************************************************** + * Csm_GetPartitionIdx() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +CSM_LOCAL_INLINE FUNC(Csm_SizeOfPartitionIdentifiersType, CSM_CODE) Csm_GetPartitionIdx(void) +{ + Csm_SizeOfPartitionIdentifiersType partIdx = Csm_GetSizeOfPartitionIdentifiers(); + +# if (CSM_NUMBER_OF_PARTITIONS > 1u) + ApplicationType currentApplicationId = GetApplicationID(); + + /* Iterate over all available partitions */ + Csm_SizeOfPartitionIdentifiersType index = 0u; + + for (index = 0u; index < Csm_GetSizeOfPartitionIdentifiers(); index++) + { + /* Check if the application id match with one of the configured application id's */ + if (currentApplicationId == Csm_GetPartitionSNVOfPartitionIdentifiers(index)) + { + partIdx = index; + break; + } + } +# else /* !(CSM_NUMBER_OF_PARTITIONS > 1u) */ + partIdx = 0u; +# endif + /* Return the index of the configured partition */ + return partIdx; +} /* Csm_GetPartitionIdx() */ +#endif /* ((CSM_DEV_ERROR_DETECT == STD_ON) || (CSM_JOB == STD_ON)) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * Csm_InitMemory_Local() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(void, CSM_CODE) Csm_InitMemory_Local(Csm_SizeOfPartitionIdentifiersType partition) +{ + /* ----- Implementation ----------------------------------------------- */ +#if (CSM_DEV_ERROR_DETECT == STD_ON) + /* Initialize the initialization flag of the calling partition. */ + Csm_SetPartitionDataInitialized(CSM_UNINIT, partition); /* SBSW_CSM_WRITE_PARTITION_DATA */ +#endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Csm_InitMemory_Local() */ + +/********************************************************************************************************************** + * Csm_Init() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6010, 6030, 6080 1 */ /* MD_MSR_STPTH */ /* MD_MSR_STCYC */ /* MD_MSR_STMIF */ +FUNC(void, CSM_CODE) Csm_Init(void) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CSM_E_NO_ERROR; + +#if ((CSM_DEV_ERROR_DETECT == STD_ON) || (CSM_JOB == STD_ON)) + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionIdx(); +#endif + /* ----- Development Error Checks ------------------------------------- */ +#if (CSM_DEV_ERROR_DETECT == STD_ON) +# if (CSM_NUMBER_OF_PARTITIONS > 1u) + /* #10 Check initialization state */ + if (partition >= Csm_GetSizeOfPartitionIdentifiers()) + { + errorId = CSM_E_INVALID_PARTITION; + } + else +# endif /* (CSM_NUMBER_OF_PARTITIONS > 1u) */ + if (Csm_GetPartitionDataInitialized(partition) == (uint8)CSM_INITIALIZED) + { + errorId = CSM_E_ALREADY_INITIALIZED; + } + else +#endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { +#if (CSM_JOB == STD_ON) + uint32_least index; + P2VAR(Crypto_JobType, AUTOMATIC, AUTOMATIC) job; + /* ----- Implementation ----------------------------------------------- */ + /* #20 Initialize job input/output buffer */ + for (index = 0u; index < Csm_GetSizeOfJob(partition); index++) + { + job = Csm_GetAddrJob(index, partition); + job->jobState = CRYPTO_JOBSTATE_IDLE; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.inputPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.inputLength = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.secondaryInputPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.secondaryInputLength = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.tertiaryInputPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.tertiaryInputLength = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.outputPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.outputLengthPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.secondaryOutputPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.secondaryOutputLengthPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.verifyPtr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# if (CSM_JOB_TYPE_LAYOUT_INPUT64 == STD_ON) + job->jobPrimitiveInputOutput.input64 = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif +# if (CSM_JOB_TYPE_LAYOUT_OUTPUT64_PTR == STD_ON) + job->jobPrimitiveInputOutput.output64Ptr = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif + job->jobPrimitiveInputOutput.mode = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->cryptoKeyId = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobId = CSM_EMPTY_JOB; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPriority = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# if (CSM_JOB_TYPE_LAYOUT_ASR430_COMPATIBILITY == STD_ON) + job->PrimitiveInputOutput = job->jobPrimitiveInputOutput; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->state = CRYPTO_JOBSTATE_IDLE; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif + + /* The following initialization is not necessarily needed and done for consistency. */ + job->jobPrimitiveInputOutput.cryIfKeyId = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInputOutput.targetCryIfKeyId = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->jobPrimitiveInfo = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + job->targetCryptoKeyId = 0u; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ + +# if (CSM_JOB_TYPE_LAYOUT_REDIRECTION_INFO_REF == STD_ON) && (CSM_JOB_TYPE_LAYOUT_FIELD_ORDERING == CSM_ASR_VERSION_R21_11) + job->jobRedirectionInfoRef = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif +# if (CSM_JOB_TYPE_LAYOUT_REDIRECTION_INFO_REF == STD_ON) && (CSM_JOB_TYPE_LAYOUT_FIELD_ORDERING == CSM_ASR_VERSION_4_03) + job->jobRedirectionInfoRef = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif +# if (CSM_JOB_TYPE_LAYOUT_JOB_INFO_PTR == STD_ON) + job->jobInfo = NULL_PTR; /* SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION */ +# endif + } + + for (index = 0u; index < Csm_GetSizeOfJobTable(); index++) + { +# if (CSM_NUMBER_OF_PARTITIONS > 1u) + /* #21 Check if the job relates to the current application */ + if (Csm_GetPartitionOfJob((uint32)index) == partition) +# endif + { +# if (CSM_JOBIDXOFJOBTABLE == STD_ON) +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + if (Csm_IsJobUsedOfJobTable(index) == TRUE) +# endif + { + job = Csm_GetAddrJob(Csm_GetJobIdxOfJobTable(index), partition); + job->jobPrimitiveInfo = Csm_GetAddrJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(index)); /* SBSW_CSM_WRITE_TO_JOB_BY_JOBTABLE */ +# if (CSM_JOB_TYPE_LAYOUT_JOB_INFO_PTR == STD_ON) + job->jobInfo = Csm_GetAddrJobInfo(Csm_GetJobInfoIdxOfJobTable(index)); /* SBSW_CSM_WRITE_TO_JOB_BY_JOBTABLE */ +# endif + job->jobId = (uint32)index; /* SBSW_CSM_WRITE_TO_JOB_BY_JOBTABLE */ + job->jobPriority = Csm_GetPriorityOfJobTable(index); /* SBSW_CSM_WRITE_TO_JOB_BY_JOBTABLE */ + } +# endif /* (CSM_JOBIDXOFJOBTABLE == STD_ON) */ + Csm_SetJobState(index, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + } + + /* #30 Init queues */ + for (index = 0u; index < Csm_GetSizeOfQueueInfo(); index++) + { +# if (CSM_NUMBER_OF_PARTITIONS > 1u) + /* Check if the queue relates to the current application */ + if (Csm_GetPartitionConfigIdxOfQueueInfo(index) == partition) +# endif + { + Csm_SetQueueIdxOfQueueState(index, Csm_GetQueueStartIdxOfQueueInfo(index), partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT_SEARCHED */ + Csm_SetLockOfQueueState(index, 0u, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT_SEARCHED */ + +# if ((CSM_ASYNC_PROCESSING == STD_ON) && (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON)) + if (Csm_IsTriggerAsynchJobsInCallbackOfQueueInfo(index)) /* PRQA S 4304 */ /* MD_MSR_AutosarBoolean */ + { + Csm_SetRetriggeringOfQueueState(index, CSM_ASYNC_JOB_RETRIGGER_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT_SEARCHED */ + } +# endif + } + } + +# if (CSM_CALLOUT == STD_ON) + /* Initialize Callout State */ + for (index = 0u; index < Csm_GetSizeOfCalloutState(partition); index++) + { + Csm_SetCalloutStateOfCalloutState(index, CSM_CALLOUT_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION */ + } +# endif /* (CSM_CALLOUT == STD_ON) */ + +# if (CSM_RTECALLBACK == STD_ON) + Csm_SetRteCallbackOccurred(FALSE, partition); /* SBSW_CSM_CSL_VAR_ACCESS */ + for (index = 0u; index < Csm_GetSizeOfRteResult(partition); index++) + { + Csm_SetRteResult(index, CSM_CALLBACK_IDLE, partition); /* SBSW_CSM_WRITE_TO_RTERESULT_BY_SIZE */ + } +# endif /* (CSM_RTECALLBACK == STD_ON) */ + +#endif /* (CSM_JOB == STD_ON) */ + +#if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #40 Set CSM initialization state to initialized */ + Csm_SetPartitionDataInitialized(CSM_INITIALIZED, partition); /* SBSW_CSM_WRITE_PARTITION_DATA */ +#endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + + } + /* ----- Development Error Report --------------------------------------- */ +#if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError(CSM_MODULE_ID, CSM_INSTANCE_ID, CSM_INIT_ID, errorId); + } +#else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* (CSM_DEV_ERROR_REPORT == STD_ON) */ +#if ((CSM_DEV_ERROR_DETECT == STD_ON) || (CSM_JOB == STD_ON)) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif +} /* Csm_Init() */ + +#if (CSM_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Csm_GetVersionInfo() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, CSM_CODE) Csm_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, CSM_APPL_VAR) versioninfo) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + if (versioninfo == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + else +# endif /* (CSM_DEV_ERROR_REPORT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + versioninfo->vendorID = (uint16)CSM_VENDOR_ID; /* SBSW_CSM_GETVERSIONINFO */ + versioninfo->moduleID = (uint8)CSM_MODULE_ID; /* SBSW_CSM_GETVERSIONINFO */ + versioninfo->sw_major_version = (uint8)CSM_SW_MAJOR_VERSION; /* SBSW_CSM_GETVERSIONINFO */ + versioninfo->sw_minor_version = (uint8)CSM_SW_MINOR_VERSION; /* SBSW_CSM_GETVERSIONINFO */ + versioninfo->sw_patch_version = (uint8)CSM_SW_PATCH_VERSION; /* SBSW_CSM_GETVERSIONINFO */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)CSM_GETVERSIONINFO_ID, errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ +} /* Csm_GetVersionInfo() */ +#endif /* (CSM_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Csm_MainFunction_Local() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080, 6030 1 */ /* MD_MSR_STMIF */ /* MD_MSR_STCYC */ +FUNC(void, CSM_CODE) Csm_MainFunction_Local(Csm_SizeOfPartitionIdentifiersType partition) +{ +#if (CSM_JOB == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + if (partition >= Csm_GetSizeOfPartitionIdentifiers()) + { + errorId = CSM_E_INVALID_PARTITION; + } + /* #10 Check initialization state */ + else if (Csm_GetPartitionDataInitialized(partition) != CSM_INITIALIZED) + { + errorId = CSM_E_UNINIT; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { +# if (CSM_ASYNC_PROCESSING == STD_ON) + + Csm_QueueInfoIterType queueInfoIdx; +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + Csm_QueueIterType triggerCounter; +# endif + + /* ----- Implementation ----------------------------------------------- */ + + /* #20 Loop over configured queues and trigger asynchronous job processing */ + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + for (queueInfoIdx = 0u; queueInfoIdx < Csm_GetSizeOfQueueInfo(); queueInfoIdx++) + { +# if (CSM_NUMBER_OF_PARTITIONS > 1u) + if (Csm_GetPartitionConfigIdxOfQueueInfo(queueInfoIdx) == partition) +# endif + { +# if (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) + if (Csm_IsTriggerAsynchJobsInCallbackOfQueueInfo(queueInfoIdx)) /* PRQA S 4304 */ /* MD_MSR_AutosarBoolean */ + { + /* #30 Check whether retriggering of asynchronous job processing has halted. If so, trigger it again. */ + /* The following difference is calculated from generated table values and assumed to be always greater or equal than 0 */ + for (triggerCounter = 0u; triggerCounter < ((Csm_QueueIterType)(Csm_GetQueueEndIdxOfQueueInfo(queueInfoIdx)) - (Csm_QueueIterType)(Csm_GetQueueStartIdxOfQueueInfo(queueInfoIdx))); triggerCounter++) /* FETA_CSM_STRICTLY_INCREASING_BY_ONE */ + { + Csm_TriggerAsynchJobProcessing(queueInfoIdx); + + if (Csm_GetRetriggeringOfQueueState(queueInfoIdx, partition) == CSM_ASYNC_JOB_RETRIGGER_STATE_IDLE) + { + break; + } + } + } + else +# endif /* (CSM_TRIGGERASYNCHJOBSINCALLBACKOFQUEUEINFO == STD_ON) */ + { + Csm_TriggerAsynchJobProcessing(queueInfoIdx); + } + } + } + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #40 Handle callback notifications if processing has been aborted by callouts */ +# if (CSM_CALLOUT == STD_ON) + { + Csm_CalloutInfoIterType calloutInfoIdx; + for (calloutInfoIdx = 0u; calloutInfoIdx < Csm_GetSizeOfCalloutInfo(); calloutInfoIdx++) + { + if (Csm_GetCalloutStateOfCalloutState(calloutInfoIdx, partition) == CSM_CALLOUT_STATE_PROCESSING_ABORTED_BY_CALLOUT) + { + Csm_CallbackNotification(Csm_GetAddrJob(Csm_GetJobToObjMap(Csm_GetJobTableIdxOfCalloutInfo(calloutInfoIdx), partition), partition), E_NOT_OK); /* SBSW_CSM_PASS_JOB_POINTER_CSL03 */ + } + } + } +# endif /* (CSM_CALLOUT == STD_ON) */ + +# if (CSM_RTECALLBACK == STD_ON) + Csm_HandleRteCallbacks(partition); +# endif + +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_MAINFUNCTION_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ +#endif /* (CSM_JOB == STD_ON) */ + + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +} /* Csm_MainFunction_Local() */ + +/********************************************************************************************************************** + * Csm_CallbackNotification() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ + /* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(void, CSM_CODE) Csm_CallbackNotification( + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + Crypto_ResultType result) +{ +#if (CSM_JOB == STD_ON) && (CSM_ASYNC_PROCESSING == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = CSM_E_NO_ERROR; + uint8 runtimeErrorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* Verify the job pointer */ + if (job == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + /* Ignore not used sharing jobs */ + if (job->jobId == CSM_EMPTY_JOB) + { + /* Ignore Call, job is not used anymore */ + runtimeErrorId = CSM_E_UNEXPECTED_CALLBACK; + } + else +# endif +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* Verify provided jobId */ + if (job->jobId >= Csm_GetSizeOfJobTable()) + { + errorId = CSM_E_PARAM_HANDLE; + } + /* Verify initialization state */ + else if (Csm_VerifyInitAndPartition(job->jobId, &errorId) != E_OK) /* SBSW_CSM_PASS_JOBID_AND_STACK */ + { + /* errorId already set in subfunction */ + } + /* For synchronous jobs, return an error */ + else if (Csm_GetJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(job->jobId)).processingType == CRYPTO_PROCESSING_SYNC) + { + errorId = CSM_E_PARAM_METHOD_INVALID; + } + else if ((result & CSM_JOB_STATE_CALLBACK_OCCURRED) != 0u) + { + errorId = CSM_E_PARAM_METHOD_INVALID; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + Csm_HandleCallbackNotification(job, result, &runtimeErrorId); /* SBSW_CSM_PASS_JOB_POINTER_API_REQUIREMENT_AND_STACK */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_CALLBACKNOTIFICATION_ID), errorId); + } + + if (runtimeErrorId != CSM_E_NO_ERROR) + { + (void)Det_ReportRuntimeError(CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_CALLBACKNOTIFICATION_ID), runtimeErrorId); + } +# else + CSM_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(runtimeErrorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_DEV_ERROR_REPORT == STD_ON) */ +#else /* !(CSM_JOB == STD_ON) && (CSM_ASYNC_PROCESSING == STD_ON) */ + CSM_DUMMY_STATEMENT(job); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(result); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif /* (CSM_JOB == STD_ON) && (CSM_ASYNC_PROCESSING == STD_ON) */ + +} /* Csm_CallbackNotification() */ + +/* Csm Key Management Functions */ +/********************************************************************************************************************** + * Csm_KeyElementSet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementSet( + uint32 keyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + uint32 keyLength) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if (keyPtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_KeyElementSet function */ + retVal = CryIf_KeyElementSet(Csm_GetCryIfKeyIdOfKey(keyId), keyElementId, keyPtr, keyLength); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYELEMENTSET_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT_CONST(keyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyElementSet() */ + +/********************************************************************************************************************** + * Csm_KeySetValid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetValid(uint32 keyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeySetValid function */ + retVal = CryIf_KeySetValid(Csm_GetCryIfKeyIdOfKey(keyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYSETVALID_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeySetValid() */ + +/********************************************************************************************************************** + * Csm_KeySetInvalid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetInvalid(uint32 keyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeySetInvalid function */ + retVal = CryIf_KeySetInvalid(Csm_GetCryIfKeyIdOfKey(keyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYSETINVALID_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeySetInvalid() */ + +/********************************************************************************************************************** + * Csm_KeyGetStatus() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGetStatus( + uint32 keyId, + P2VAR(Crypto_KeyStatusType, AUTOMATIC, CSM_APPL_VAR) keyStatusPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if (keyStatusPtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_KeyGetStatus function */ + retVal = CryIf_KeyGetStatus(Csm_GetCryIfKeyIdOfKey(keyId), keyStatusPtr); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYGETSTATUS_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyStatusPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyGetStatus() */ + +/********************************************************************************************************************** + * Csm_KeyElementGet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGet( + uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if ((keyPtr == NULL_PTR) + || (keyLengthPtr == NULL_PTR)) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_KeyElementGet function */ + retVal = CryIf_KeyElementGet(Csm_GetCryIfKeyIdOfKey(keyId), keyElementId, keyPtr, keyLengthPtr); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYELEMENTGET_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyElementGet() */ + +/********************************************************************************************************************** + * Csm_KeyElementCopy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopy( + uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if ((keyId >= Csm_GetSizeOfKey()) || (targetKeyId >= Csm_GetSizeOfKey())) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeyElementCopy function */ + retVal = CryIf_KeyElementCopy(Csm_GetCryIfKeyIdOfKey(keyId), keyElementId, Csm_GetCryIfKeyIdOfKey(targetKeyId), targetKeyElementId); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYELEMENTCOPY_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyElementCopy() */ + +/********************************************************************************************************************** + * Csm_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyPartial( + uint32 keyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetKeyId, + uint32 targetKeyElementId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if ((keyId >= Csm_GetSizeOfKey()) || (targetKeyId >= Csm_GetSizeOfKey())) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeyElementCopyPartial function */ + retVal = CryIf_KeyElementCopyPartial(Csm_GetCryIfKeyIdOfKey(keyId), keyElementId, keyElementSourceOffset, keyElementTargetOffset, keyElementCopyLength, Csm_GetCryIfKeyIdOfKey(targetKeyId), targetKeyElementId); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYELEMENTCOPYPARTIAL_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementSourceOffset); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementTargetOffset); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(keyElementCopyLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyElementId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_KEY == STD_ON) */ +} /* Csm_KeyElementCopyPartial() */ + +/********************************************************************************************************************** + * Csm_KeyCopy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopy( + uint32 keyId, + uint32 targetKeyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if ((keyId >= Csm_GetSizeOfKey()) || (targetKeyId >= Csm_GetSizeOfKey())) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeyCopy function */ + retVal = CryIf_KeyCopy(Csm_GetCryIfKeyIdOfKey(keyId), Csm_GetCryIfKeyIdOfKey(targetKeyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYCOPY_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyCopy() */ + +/********************************************************************************************************************** + * Csm_RandomSeed() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomSeed( + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if (seedPtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_RandomSeed function */ + retVal = CryIf_RandomSeed(Csm_GetCryIfKeyIdOfKey(keyId), seedPtr, seedLength); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_RANDOMSEED_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT_CONST(seedPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(seedLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_RandomSeed() */ + +/********************************************************************************************************************** + * Csm_KeyGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerate(uint32 keyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeyGenerate function */ + retVal = CryIf_KeyGenerate(Csm_GetCryIfKeyIdOfKey(keyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYGENERATE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyGenerate() */ + +/********************************************************************************************************************** + * Csm_KeyDerive() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDerive( + uint32 keyId, + uint32 targetKeyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if ((keyId >= Csm_GetSizeOfKey()) || (targetKeyId >= Csm_GetSizeOfKey())) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_KeyDerive function */ + retVal = CryIf_KeyDerive(Csm_GetCryIfKeyIdOfKey(keyId), Csm_GetCryIfKeyIdOfKey(targetKeyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYDERIVE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyDerive() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubVal( + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if ((publicValuePtr == NULL_PTR) + || (publicValueLengthPtr == NULL_PTR)) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_KeyExchangeCalcPubVal function */ + retVal = CryIf_KeyExchangeCalcPubVal(Csm_GetCryIfKeyIdOfKey(keyId), publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYEXCHANGECALCPUBVAL_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(publicValuePtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(publicValueLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyExchangeCalcPubVal() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecret( + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if (partnerPublicValuePtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_KeyExchangeCalcSecret function */ + retVal = CryIf_KeyExchangeCalcSecret(Csm_GetCryIfKeyIdOfKey(keyId), partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_KEYEXCHANGECALCSECRET_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(partnerPublicValuePtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(partnerPublicValueLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_KeyExchangeCalcSecret() */ + +/********************************************************************************************************************** + * Csm_CertificateParse() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateParse(uint32 keyId) +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check key range */ + if (keyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #30 Call of CryIf_CertificateParse function */ + retVal = CryIf_CertificateParse(Csm_GetCryIfKeyIdOfKey(keyId)); + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_CERTIFICATEPARSE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_CertificateParse() */ + +/********************************************************************************************************************** + * Csm_CertificateVerify() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateVerify( + uint32 keyId, + uint32 verifyKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_KEY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #20 Check for null pointers */ + if (verifyPtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #30 Check key range */ + else if ((keyId >= Csm_GetSizeOfKey()) || (verifyKeyId >= Csm_GetSizeOfKey())) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + /* #40 Call of CryIf_CertificateVerify function */ + retVal = CryIf_CertificateVerify(Csm_GetCryIfKeyIdOfKey(keyId), Csm_GetCryIfKeyIdOfKey(verifyKeyId), verifyPtr); /* SBSW_CSM_FORWARDING_PTR */ + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_CERTIFICATEVERIFY_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_KEY == STD_ON) */ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_KEY == STD_ON) */ +} /* Csm_CertificateVerify() */ + +/********************************************************************************************************************** + * Csm_CancelJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJob( + uint32 jobId, + Crypto_OperationModeType mode) +{ +#if (CSM_JOB == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided jobId */ + if (jobId >= Csm_GetSizeOfJobTable()) + { + errorId = CSM_E_PARAM_HANDLE; + } + /* #20 Verify initialization state */ + else if (Csm_VerifyInitAndPartition(jobId, &errorId) != E_OK) /* SBSW_CSM_PASS_JOBID_AND_STACK */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_IDLE) + { + /* #30 If Job is idle - No canceling needed */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + retVal = E_OK; + } + else + { + /* Job is running, object exists */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job = Csm_GetAddrJob(Csm_GetJobToObjMap(jobId, partition), partition); + +# if (CSM_ASYNC_PROCESSING == STD_ON) + if (Csm_IsAsynchronousOfJobTable(jobId)) + { + retVal = Csm_CancelAsynchronousJob(job, partition); /* SBSW_CSM_PASS_JOB_AND_PARTITION */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + else +# endif /* (CSM_ASYNC_PROCESSING == STD_ON) */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_ACTIVE) + { + Csm_SetJobState(jobId, CSM_JOB_STATE_CANCELING, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #55 Cancel Job in lower layer */ + retVal = CryIf_CancelJob(Csm_GetChannelIdOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId)), job); /* SBSW_CSM_PASS_JOB */ + + if (retVal == E_OK) + { + /* #56 Canceling successful - Call post-job callout and free job oject */ +# if (CSM_CALLOUT == STD_ON) + /* retVal only acts as information for post job callout that job was cancelled. + * Set it back to E_OK in each case as canceling was already performed. */ + retVal = CRYPTO_E_JOB_CANCELED; + Csm_CallPostJobCallout(job, &retVal, partition); /* SBSW_CSM_PASS_JOB_STACK_AND_PARTITION */ + retVal = E_OK; +# endif +# if (CSM_JOBSHARINGOFQUEUEINFO == STD_ON) + job->jobId = CSM_EMPTY_JOB; /* SBSW_CSM_WRITE_TO_JOB_POINTER */ +# endif + Csm_SetJobState(jobId, CSM_JOB_STATE_IDLE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + else + { + /* #57 Canceling failed, set active again */ + Csm_SetJobState(jobId, CSM_JOB_STATE_ACTIVE, partition); /* SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION */ + } + } + else + { + /* #60 Job cancelation is not possible as the job is currently in or on the way to the lower layer. + * If job is currently on the way to the lower layer, Crypto would return E_OK as it does not know the job yet + * Due to this, Csm cannot rely on the return value. + */ + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + /* retVal already set to E_NOT_OK */ + } + } +# if (CSM_NUMBER_OF_PARTITIONS <= 1u) + CSM_DUMMY_STATEMENT(partition); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* (CSM_NUMBER_OF_PARTITIONS <= 1u) */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_CANCELJOB_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return retVal; +#else /* !(CSM_JOB == STD_ON) */ + + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_JOB == STD_ON) */ +} /* Csm_CancelJob() */ + +/* Csm Service Functions */ + +/********************************************************************************************************************** + * Csm_Hash() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_Hash( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_HASH == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_HASH, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = resultPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = resultLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_HASH_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_HASH == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_HASH == STD_ON) */ +} /* Csm_Hash() */ + +/********************************************************************************************************************** + * Csm_MacGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerate( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_MACGENERATE == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_MACGENERATE, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = macPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = macLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_MACGENERATE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_MACGENERATE == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(macPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(macLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_MACGENERATE == STD_ON) */ +} /* Csm_MacGenerate() */ + +/********************************************************************************************************************** + * Csm_MacVerify() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerify( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_MACVERIFY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_MACVERIFY, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputPtr = macPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputLength = macLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.verifyPtr = verifyPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_MACVERIFY_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_MACVERIFY == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(macPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(macLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_MACVERIFY == STD_ON) */ +} /* Csm_MacVerify() */ + +/********************************************************************************************************************** + * Csm_Encrypt() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_Encrypt( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_ENCRYPT == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_ENCRYPT, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = resultPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = resultLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_ENCRYPT_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_ENCRYPT == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_ENCRYPT == STD_ON) */ +} /* Csm_Encrypt() */ + +/********************************************************************************************************************** + * Csm_Decrypt() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_Decrypt( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_DECRYPT == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_DECRYPT, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = resultPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = resultLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_DECRYPT_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_DECRYPT == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_DECRYPT == STD_ON) */ +} /* Csm_Decrypt() */ + +/********************************************************************************************************************** + * Csm_AEADEncrypt() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncrypt( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_AEADENCRYPT == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_AEADENCRYPT, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = plaintextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = plaintextLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputPtr = associatedDataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputLength = associatedDataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = ciphertextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = ciphertextLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryOutputPtr = tagPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryOutputLengthPtr = tagLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_AEADENCRYPT_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_AEADENCRYPT == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(plaintextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(plaintextLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(associatedDataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(associatedDataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(tagPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(tagLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_AEADENCRYPT == STD_ON) */ +} /* Csm_AEADEncrypt() */ + +/********************************************************************************************************************** + * Csm_AEADDecrypt() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecrypt( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_AEADDECRYPT == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_AEADDECRYPT, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = ciphertextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = ciphertextLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputPtr = associatedDataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputLength = associatedDataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.tertiaryInputPtr = tagPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.tertiaryInputLength = tagLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = plaintextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = plaintextLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.verifyPtr = verifyPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_AEADDECRYPT_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_AEADDECRYPT == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(associatedDataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(associatedDataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(tagPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(tagLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(plaintextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(plaintextLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_AEADDECRYPT == STD_ON) */ +} /* Csm_AEADDecrypt() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerate( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_SIGNATUREGENERATE == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_SIGNATUREGENERATE, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = resultPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = resultLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_SIGNATUREGENERATE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_SIGNATUREGENERATE == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_SIGNATUREGENERATE == STD_ON) */ +} /* Csm_SignatureGenerate() */ + +/********************************************************************************************************************** + * Csm_SignatureVerify() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerify( + uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_SIGNATUREVERIFY == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParamAndMode(jobId, &errorId, CRYPTO_SIGNATUREVERIFY, mode) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = mode; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = dataPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = dataLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputPtr = signaturePtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputLength = signatureLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.verifyPtr = verifyPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_SIGNATUREVERIFY_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_SIGNATUREVERIFY == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(mode); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(dataLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(signaturePtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(signatureLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_SIGNATUREVERIFY == STD_ON) */ +} /* Csm_SignatureVerify() */ + +/********************************************************************************************************************** + * Csm_RandomGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerate( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_RANDOMGENERATE == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_RANDOMGENERATE) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = resultPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = resultLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_RANDOMGENERATE_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_RANDOMGENERATE == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(resultLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_RANDOMGENERATE == STD_ON) */ +} /* Csm_RandomGenerate() */ + +/********************************************************************************************************************** + * Csm_JobKeySetValid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeySetValid( uint32 jobId ) +{ +#if (CSM_EXIST_JOBKEYSETVALID == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYSETVALID) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYSETVALID_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYSETVALID == STD_ON) */ + CSM_DUMMY_STATEMENT( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYSETVALID == STD_ON) */ +} /* Csm_JobKeySetValid() */ + +/********************************************************************************************************************** + * Csm_JobKeySetValid44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeySetValid44x( uint32 jobId, uint32 keyId ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeySetValid(jobId); +} /* Csm_JobKeySetValid44x() */ + +/********************************************************************************************************************** + * Csm_JobKeySetInvalid() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetInvalid(uint32 jobId) +{ +#if (CSM_EXIST_JOBKEYSETINVALID == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYSETINVALID) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYSETINVALID_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYSETINVALID == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYSETVALID == STD_ON) */ +} /* Csm_JobKeySetInvalid() */ + +/********************************************************************************************************************** + * Csm_JobKeySetInvalid44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeySetInvalid44x( uint32 jobId, uint32 keyId ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeySetInvalid(jobId); +} /* Csm_JobKeySetInvalid44x() */ + +/********************************************************************************************************************** + * Csm_JobRandomSeed() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobRandomSeed( + uint32 jobId, P2CONST( uint8, AUTOMATIC, CSM_APPL_VAR ) seedPtr, + uint32 seedLength) +{ +#if (CSM_EXIST_JOBRANDOMSEED == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_RANDOMSEED) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = seedPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = seedLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBRANDOMSEED_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBRANDOMSEED == STD_ON) */ + CSM_DUMMY_STATEMENT_CONST( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT_CONST( seedPtr ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( seedLength ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBRANDOMSEED == STD_ON) */ +} /* Csm_JobRandomSeed() */ + +/********************************************************************************************************************** + * Csm_JobRandomSeed44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobRandomSeed44x( + uint32 jobId, + uint32 keyId, + P2CONST( uint8, AUTOMATIC, CSM_APPL_VAR ) seedPtr, + uint32 seedLength ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobRandomSeed(jobId, seedPtr, seedLength); /* SBSW_CSM_FORWARDING_PTR */ +} /* Csm_JobRandomSeed44x() */ + +/********************************************************************************************************************** + * Csm_JobKeyGenerate() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyGenerate( uint32 jobId ) +{ +#if (CSM_EXIST_JOBKEYGENERATE == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYGENERATE) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYGENERATE_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYGENERATE == STD_ON) */ + CSM_DUMMY_STATEMENT( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYGENERATE == STD_ON) */ +} /* Csm_JobKeyGenerate() */ + +/********************************************************************************************************************** + * Csm_JobKeyGenerate44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyGenerate44x( uint32 jobId, uint32 keyId ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeyGenerate(jobId); +} /* Csm_JobKeyGenerate44x() */ + +/********************************************************************************************************************** + * Csm_JobKeyDerive() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyDerive( + uint32 jobId, + uint32 targetKeyId) +{ +#if (CSM_EXIST_JOBKEYDERIVE == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYDERIVE) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else if (targetKeyId >= Csm_GetSizeOfKey()) + { + errorId = CSM_E_PARAM_HANDLE; + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.targetCryIfKeyId = Csm_GetCryIfKeyIdOfKey( targetKeyId ); /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYDERIVE_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYDERIVE == STD_ON) */ + CSM_DUMMY_STATEMENT( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( targetKeyId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYDERIVE == STD_ON) */ +} /* Csm_JobKeyDerive() */ + +/********************************************************************************************************************** + * Csm_JobKeyDerive44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyDerive44x( uint32 jobId, uint32 keyId, uint32 targetKeyId ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeyDerive(jobId, targetKeyId); +} /* Csm_JobKeyDerive44x() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyExchangeCalcPubVal( + uint32 jobId, + P2VAR( uint8, AUTOMATIC, CSM_APPL_VAR ) publicValuePtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR( uint32, AUTOMATIC, CSM_APPL_VAR ) publicValueLengthPtr ) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_EXIST_JOBKEYEXCHANGECALCPUBVAL == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYEXCHANGECALCPUBVAL) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = publicValuePtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = publicValueLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYEXCHANGECALCPUBVAL_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYEXCHANGECALCPUBVAL == STD_ON) */ + CSM_DUMMY_STATEMENT( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( publicValuePtr ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( publicValueLengthPtr ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYEXCHANGECALCPUBVAL == STD_ON) */ +} /* Csm_JobKeyExchangeCalcPubVal() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubVal44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyExchangeCalcPubVal44x( + uint32 jobId, + uint32 keyId, + P2VAR( uint8, AUTOMATIC, CSM_APPL_VAR ) publicValuePtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR( uint32, AUTOMATIC, CSM_APPL_VAR ) publicValueLengthPtr ) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeyExchangeCalcPubVal(jobId, publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_FORWARDING_PTR */ +} /* Csm_JobKeyExchangeCalcPubVal44x() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +/* PRQA S 6080 */ /* MD_MSR_STMIF */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyExchangeCalcSecret( + uint32 jobId, + P2CONST( uint8, AUTOMATIC, CSM_APPL_VAR ) partnerPublicValuePtr, + uint32 partnerPublicValueLength ) +{ +#if (CSM_EXIST_JOBKEYEXCHANGECALCSECRET == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYEXCHANGECALCSECRET) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = partnerPublicValuePtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = partnerPublicValueLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError( (uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYEXCHANGECALCSECRET_ID), errorId ); + } +# else + CSM_DUMMY_STATEMENT( errorId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYEXCHANGECALCSECRET == STD_ON) */ + CSM_DUMMY_STATEMENT( jobId ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( partnerPublicValuePtr ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT( partnerPublicValueLength ); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_EXIST_JOBKEYEXCHANGECALCSECRET == STD_ON) */ +} /* Csm_JobKeyExchangeCalcSecret() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecret44x() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC( Std_ReturnType, CSM_CODE ) Csm_JobKeyExchangeCalcSecret44x( + uint32 jobId, + uint32 keyId, + P2CONST( uint8, AUTOMATIC, CSM_APPL_VAR ) partnerPublicValuePtr, + uint32 partnerPublicValueLength ) +{ + CSM_DUMMY_STATEMENT(keyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + + return Csm_JobKeyExchangeCalcSecret(jobId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_FORWARDING_PTR */ +} /* Csm_JobKeyExchangeCalcSecret44x() */ + +/********************************************************************************************************************** + * Csm_JobKeyWrap() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyWrap(uint32 jobId, + uint32 sourceKeyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) authenticatorPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) authenticatorLengthPtr) +{ +#if (CSM_EXIST_JOBKEYWRAP == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYWRAP) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + job->jobPrimitiveInputOutput.outputPtr = ciphertextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = ciphertextLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryOutputPtr = authenticatorPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryOutputLengthPtr = authenticatorLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + job->jobPrimitiveInputOutput.targetCryIfKeyId = Csm_GetCryIfKeyIdOfKey(sourceKeyId); /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYWRAP_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYWRAP == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(sourceKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(authenticatorPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(authenticatorLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_JOBKEYWRAP == STD_ON) */ +} + +/********************************************************************************************************************** + * Csm_JobKeyUnwrap() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyUnwrap(uint32 jobId, + uint32 targetKeyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) authenticatorPtr, + uint32 authenticatorLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ +#if (CSM_EXIST_JOBKEYUNWRAP == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id, service and partition */ + if (Csm_VerifyJobParam(jobId, &errorId, CRYPTO_KEYUNWRAP) != E_OK) /* SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST */ + { + /* errorId already set in subfunction */ + } + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SINGLECALL; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = ciphertextPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = ciphertextLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + job->jobPrimitiveInputOutput.secondaryInputPtr = authenticatorPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.secondaryInputLength = authenticatorLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + job->jobPrimitiveInputOutput.verifyPtr = verifyPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + job->jobPrimitiveInputOutput.cryIfKeyId = job->jobPrimitiveInfo->cryIfKeyId; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.targetCryIfKeyId = Csm_GetCryIfKeyIdOfKey(targetKeyId); /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_JOBKEYUNWRAP_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_EXIST_JOBKEYUNWRAP == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(targetKeyId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(ciphertextLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(authenticatorPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(authenticatorLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(verifyPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* !(CSM_EXIST_JOBKEYUNWRAP == STD_ON) */ +} + + +/********************************************************************************************************************** + * Csm_SaveContextJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SaveContextJob( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) contextBufferLengthPtr ) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if (CSM_JOB == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided job id */ + if (jobId >= Csm_GetSizeOfJobTable()) + { + errorId = CSM_E_PARAM_HANDLE; + } + /* #11 Verify initialization states */ + else if (Csm_VerifyInitAndPartition(jobId, &errorId) != E_OK) /* SBSW_CSM_PASS_JOBID_AND_STACK */ + { + /* Error already set in subfunction */ + } + /* #12 Check for Null Pointer */ + else if ((contextBufferPtr == NULL_PTR) || (contextBufferLengthPtr == NULL_PTR)) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #13 Check if the correct API was called for the corresponding service */ + else if (Csm_GetJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(jobId)).primitiveInfo->service > CRYPTO_SIGNATUREVERIFY) + { + errorId = CSM_E_SERVICE_TYPE; + } +# if (CSM_OPERATIONMODELIMITATIONOFQUEUEINFO == STD_ON) + /* #14 Check if the queue is limited to jobs in mode single call */ + else if (Csm_IsOperationModeLimitationOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId))) + { + errorId = CSM_E_PROCESSING_MODE; + } +# endif + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + /* #15 Check if the job state is active */ + if (Csm_GetJobState(jobId, partition) == CSM_JOB_STATE_IDLE) + { + /* retVal is already set to E_NOT_OK */ + } + else + { + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_SAVE_CONTEXT; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputPtr = contextBufferPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.outputLengthPtr = contextBufferLengthPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_SAVECONTEXTJOB_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_JOB == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(contextBufferPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(contextBufferLengthPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_JOB == STD_ON) */ +} /* Csm_SaveContextJob() */ + +/********************************************************************************************************************** + * Csm_RestoreContextJob() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RestoreContextJob( + uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ + uint32 contextBufferLength ) +{ +#if (CSM_JOB == STD_ON) + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_NOT_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + uint8 errorId = CSM_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (CSM_DEV_ERROR_DETECT == STD_ON) + /* #10 Verify provided jobId */ + if (jobId >= Csm_GetSizeOfJobTable()) + { + errorId = CSM_E_PARAM_HANDLE; + } + /* #11 Verify initialization states */ + else if (Csm_VerifyInitAndPartition(jobId, &errorId) != E_OK) /* SBSW_CSM_PASS_JOBID_AND_STACK */ + { + /* Error already set in subfunction */ + } + /* #12 Check for Null Pointer */ + else if (contextBufferPtr == NULL_PTR) + { + errorId = CSM_E_PARAM_POINTER; + } + /* #13 Check if the correct API was called for the corresponding service */ + else if (Csm_GetJobPrimitiveInfo(Csm_GetJobPrimitiveInfoIdxOfJobTable(jobId)).primitiveInfo->service > CRYPTO_SIGNATUREVERIFY) + { + errorId = CSM_E_SERVICE_TYPE; + } +# if (CSM_OPERATIONMODELIMITATIONOFQUEUEINFO == STD_ON) + /* #14 Check if the queue is not limited to jobs in mode single call, since in this case restoring +* any context does not make sense */ + else if (Csm_IsOperationModeLimitationOfQueueInfo(Csm_GetQueueInfoIdxOfJobTable(jobId))) + { + errorId = CSM_E_PROCESSING_MODE; + } +# endif + else +# endif /* (CSM_DEV_ERROR_DETECT == STD_ON) */ + { + /* ----- Implementation ----------------------------------------------- */ + P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job; + Csm_SizeOfJobType jobObjId = 0u; + Csm_SizeOfPartitionIdentifiersType partition = Csm_GetPartitionOfJob(jobId); + + SchM_Enter_Csm_CSM_EXCLUSIVE_AREA_0(); + /* #20 Get and fill job object */ + retVal = Csm_GetJobObj(jobId, partition, &jobObjId); /* SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE */ + if (retVal == E_OK) + { + job = Csm_GetAddrJob(jobObjId, partition); + + job->jobPrimitiveInputOutput.mode = CRYPTO_OPERATIONMODE_RESTORE_CONTEXT; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputPtr = contextBufferPtr; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + job->jobPrimitiveInputOutput.inputLength = contextBufferLength; /* SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ */ + + /* #21 Process job */ + retVal = Csm_ProcessJob(job, partition); /* SBSW_CSM_PASS_JOB */ + /* SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0 is left in Csm_ProcessJob */ + } + else + { + SchM_Exit_Csm_CSM_EXCLUSIVE_AREA_0(); + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (CSM_DEV_ERROR_REPORT == STD_ON) + if (errorId != CSM_E_NO_ERROR) + { + (void)Det_ReportError((uint16)CSM_MODULE_ID, CSM_INSTANCE_ID, (uint8)(CSM_RESTORECONTEXTJOB_ID), errorId); + } +# else + CSM_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif /* !(CSM_DEV_ERROR_REPORT == STD_ON) */ + + return retVal; +#else /* !(CSM_JOB == STD_ON) */ + CSM_DUMMY_STATEMENT(jobId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(contextBufferPtr); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + CSM_DUMMY_STATEMENT(contextBufferLength); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ + return E_NOT_OK; +#endif /* (CSM_JOB == STD_ON) */ +} /* Csm_RestoreContextJob() */ + +#define CSM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Module specific MISRA deviations + *********************************************************************************************************************/ +/* Module specific MISRA deviations: + MD_CSM_QUEUE_BY_QUEUEIDX: + Reason: If Queue variable has only a size of 1, accessing with any index + 1 causes this message. + Risk: Access could be executed causing an invalid memory access. + Prevention: During runtime, loop is only entered if Queue is at least two since index is checked against localQueueIndex. Covered by code review. + + MD_CSM_0316: + Reason: Cast is needed since upper layer Rte expects super type as parameter. + Risk: Wrong type is casted or size does not match. + Prevention: Covered by code review. + + MD_CSM_CALLBACK_DECLARATIONS: + Description: Rule 8.5: An external object or function shall be declared once in one and only one file + Reason: MICROSAR Csm declares its callbacks and pre and post job callouts in its Cfg.h. Modules that also declares them see a double declaration. + Risk: Compile warning or error due to declaration mismatch. + Prevention: Not necessary + */ + +/* SBSW_JUSTIFICATION_BEGIN + + \ID SBSW_CSM_GETVERSIONINFO + \DESCRIPTION The function Csm_GetVersionInfo writes to the object referenced by parameter VersionInfoPtr + \COUNTERMEASURE \N The caller ensures that the pointer passed to the parameter VersionInfoPtr is valid. + + \ID SBSW_CSM_FUNCTION_POINTER + \DESCRIPTION The API call is made using a function pointer which is read using ComStackLib macros. + Pointer might be forwarded. + \COUNTERMEASURE \N The function pointer is read using the passed Id and ComStackLib macros (CSL03). + The pointer are forwarded and assumed to be valid. + + \ID SBSW_CSM_FORWARDING_PTR + \DESCRIPTION Passing received pointer to called function. + \COUNTERMEASURE \N The pointer is forwarded and assumed to be valid. + + \ID SBSW_CSM_PASS_UNCHECKED_JOBID_STACKPTR_AND_CONST + \DESCRIPTION The function passes an unchecked job identifier to a subfunction for verification. Since an unchecked job identifier + is expected, this is safe. Furthermore a pointer to a stack variable of expected size is passed to a synchronous function. + The const value is of the expected size but only used for comparision. + \COUNTERMEASURE \N The job id is verified in the called function. The pointer to the stack variable is of expected size. + [CM_CSM_STACK_VARIABLE] + + \ID SBSW_CSM_PASS_CHECKED_JOBID_PARTITION_AND_STACK_VARIABLE + \DESCRIPTION The function passes a checked job id and a partition read by using job id (CSL03). + Furthermore, a pointer to a stack variable of expected size is passed to the synchronous function. + \COUNTERMEASURE \R The job id was checked and the partition is read using the passed job id and ComStackLib macros (CSL03). + [CM_CSM_STACK_VARIABLE] + + \ID SBSW_CSM_PASS_JOB + \DESCRIPTION A job pointer is passed to the function. This pointer was originally determined by the given and + checked job id. This is done by accessing the job structure from the global job array via + indirection over JobTable or using one of the shared job objects. The shared job objects are + determined by accessing the QueueInfo via indirection over the JobTable. Having the QueueInfo index, + accesses to the global job strucure is done via indirection of QueueInfo. Therefore the pointer always + points to a valid job structure, that is safe to pass to an asynchronous function. + \COUNTERMEASURE \N The job pointer is set using the passed Id and ComStackLib macros (CSL03). + + \ID SBSW_CSM_PASS_JOB_AND_PARTITION + \DESCRIPTION A job pointer is passed to the function. This pointer was originally determined by the given and + checked job id. This is done by accessing the job structure from the global job array via + indirection over JobTable or using one of the shared job objects. The shared job objects are + determined by accessing the QueueInfo via indirection over the JobTable. Having the QueueInfo index, + accesses to the global job strucure is done via indirection of QueueInfo. Therefore the pointer always + points to a valid job structure, that is safe to pass to an asynchronous function + The partition is derived from the job id. + \COUNTERMEASURE \N The job pointer is set using the passed Id and ComStackLib macros (CSL03). + The index for the Partition specific data is either fixed (for single partition use case) or provided by searching the current application id + in the PartitionIdentifiers and using its corresponding partitionIdx (Qualified use-case CSL05 of ComStackLib). + If no partitionIdx can be found, usage of an invalid index is prevented by checking the index to be in acceptable range. + Therefore it is always guaranteed to be in the acceptable range. + + \ID SBSW_CSM_PASS_JOBID_AND_STACK + \DESCRIPTION The function passes a checked job id and a pointer to a stack variable of expected size to a synchronous function. + \COUNTERMEASURE \R The job id was checked if it is in range. + [CM_CSM_STACK_VARIABLE] + + \ID SBSW_CSM_PASS_JOB_STACK_AND_PARTITION + \DESCRIPTION The function passes a checked job pointer (see [SBSW_CSM_PASS_JOB]), a pointer to a stack + variable of expected size and a checked partition index to an synchronous function. + \COUNTERMEASURE \N The function pointer is read using the passed Id and ComStackLib macros (CSL03). + [CM_CSM_STACK_VARIABLE] + + \ID SBSW_CSM_PASS_JOB_POINTER_LOCAL + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been initialized and points to a valid job object. + \COUNTERMEASURE \N The pointer is initialized from a local queue. The queue is only filled with valid job objects and therefore always contains valid jobs except when it is empty. In this case, the function is not called. + + \ID SBSW_CSM_PASS_JOB_POINTER_AND_PARTITION_API_REQUIREMENT + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been passed by the caller. The API requires that the referenced job is valid. + The function passes a partition index. The passed partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N The caller ensures that the pointer passed as parameter is valid and references a valid object. + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_PASS_JOB_POINTER_PARTITION_AND_STACK_API_REQUIREMENT + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been passed by the caller. The API requires that the referenced job is valid. + The function passes a pointer to a stack variable of expected size to an synchronous function. + The function passes a partition index. The passed partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N The caller ensures that the pointer passed as parameter is valid and references a valid object. + The passed stack variable is of expected size + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_PASS_JOB_POINTER_API_REQUIREMENT_AND_STACK + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been passed by the caller. The API requires that the referenced job is valid. + The function also passes a pointer to a stack variable of expected size to an synchronous function. + \COUNTERMEASURE \N The caller ensures that the pointer passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_PASS_JOB_POINTER_API_REQUIREMENT + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been passed by the caller. The API requires that the referenced job is valid. + \COUNTERMEASURE \N The caller ensures that the pointer passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_PASS_JOB_POINTER_CSL03 + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer is valid since it is an indirection to Job via CalloutInfo. + \COUNTERMEASURE \N Qualified use-case CSL03 of ComStackLib + + \ID SBSW_CSM_PASS_CHANNEL_JOB_POINTER_AND_PARTITION_API_REQUIREMENT + \DESCRIPTION The function passes a pointer referencing a job. The passed pointer has been passed by the caller. The API requires that the referenced job is valid. + The function passes a partition index. The passed partition index has been passed by the caller. The API requires that the partition index is valid. + The channel id is retrieved by the ComStackLib from the qualified job, passed by the caller. + \COUNTERMEASURE \N The caller ensures that the pointer passed as parameter is valid and references a valid object. + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_PASS_QUEUESTATEINDEX + \DESCRIPTION The function passes a queue state index qualified by size. + \COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_JOB_POINTER + \DESCRIPTION The function does a write access on the job pointer. See [SBSW_CSM_PASS_JOB] for checking validity of job pointer. + \COUNTERMEASURE \R The pointer is checked when it was passed to the service. + + \ID SBSW_CSM_WRITE_TO_JOB_POINTER_FROM_JOBOBJ + \DESCRIPTION The function does a write access on the job pointer. The job pointer is retrieved from a job object by the ComStackLib. + The job object is qualified by a function. + The used partition index is retrieved by the ComStackLib. + \COUNTERMEASURE \R Qualified use-case CSL 05 of ComStackLib + The job object is verified in the function "Csm_GetJobObj" and inside verified by CSL 02. + + \ID SBSW_WRITE_TO_PASSED_LOCAL_STACK_VARIABLE + \DESCRIPTION The function writes to a pointer which is passed by local caller and located on the stack. + \COUNTERMEASURE \R The calling function ensures that the pointer passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE + \DESCRIPTION Access of CalloutState using ComStackLib + \COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_CALLOUT_STATE_BY_SIZE_AND_PARTITION + \DESCRIPTION Access of CalloutState using ComStackLib + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N Qualified use-case CSL02, CSL05 of ComStackLib + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_JOB_BY_SIZE_OF_PARTITION + \DESCRIPTION Access of Job using ComStackLib + Write of partition specific data using ComStackLib. + \COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib + The index for the partition specific data is either fixed (for single partition use case) or provided by searching the current application id + in the partitionIdentifiers and using its corresponding partitionIdx (Qualified use-case CSL05 of ComStackLib). + If no partitionIdx can be found, usage of an invalid index is prevented by checking the index to be in acceptable range. + Therefore it is always guaranteed to be in the acceptable range. + + \ID SBSW_CSM_WRITE_TO_JOB_BY_JOBTABLE + \DESCRIPTION Access to Job via indirection over JobTable. + \COUNTERMEASURE \N Qualified use-case CSL03 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_QUEUESTATE_BY_SIZE + \DESCRIPTION Access of QueueState using ComStackLib + \COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_QUEUESTATE_API_REQ + \DESCRIPTION Access of QueueState using passed parameters from the caller. The API requires those parameters to be valid. + \COUNTERMEASURE \N The caller ensures that the parameters passed are valid. + + \ID SBSW_CSM_WRITE_TO_QUEUESTATE_BY_JOBID_AND_PARTITION_API_REQ + \DESCRIPTION Access to QueueState via indirection over JobTable. + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N Qualified use-case CSL03 of ComStackLib + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT + \DESCRIPTION Access of QueueState using multi-partition indirection over QueueInfo + \COUNTERMEASURE \N Qualified use-case CSL05 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_QUEUESTATE_PARTITION_DEPENDENT_SEARCHED + \DESCRIPTION Access of QueueState using ComStackLib + Write of partition specific data using ComStackLib. + \COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib for the queue state index + The index for the partition specific data is either fixed (for single partition use case) or provided by searching the current application id + in the partitionIdentifiers and using its corresponding partitionIdx (Qualified use-case CSL05 of ComStackLib). + If no partitionIdx can be found, usage of an invalid index is prevented by checking the index to be in acceptable range. + Therefore it is always guaranteed to be in the acceptable range. + + \ID SBSW_CSM_WRITE_TO_RTERESULT_BY_SIZE_API_REQ + \DESCRIPTION Access of RteCallback and RteResult with same index using ComStackLib + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_RTERESULT_BY_SIZE + \DESCRIPTION Access of RteCallback and RteResult with same index using ComStackLib + Write of partition specific data using ComStackLib. + \COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib + The index for the partition specific data is either fixed (for single partition use case) or provided by searching the current application id + in the partitionIdentifiers and using its corresponding partitionIdx (Qualified use-case CSL05 of ComStackLib). + If no partitionIdx can be found, usage of an invalid index is prevented by checking the index to be in acceptable range. + Therefore it is always guaranteed to be in the acceptable range. + + \ID SBSW_CSM_WRITE_TO_RTERESULT_BY_JOBID + \DESCRIPTION Access to RteResult via indirection over JobTable. + The partition id is retrieved from the jobId by the ComStackLib + \COUNTERMEASURE \N Qualified use-case CSL03 of ComStackLib + + \ID SBSW_CSM_WRITE_TO_QUEUE_BY_LOCALIDX + \DESCRIPTION Access to Queue via localQueueIndex which is always checked against its size via indirection over QueueInfo. + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N Qualified use-case CSL03 of ComStackLib + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_QUEUE_API_REQ + \DESCRIPTION Access of the queue using passed parameters from the caller. The API requires those parameters to be valid. + \COUNTERMEASURE \N The caller ensures that the parameters passed are valid. + + \ID SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION_API_REQ + \DESCRIPTION Access of JobState and JobTable with same index using ComStackLib + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N Qualified use-case CSL02, CSL05 of ComStackLib + The caller ensures that the partition index passed as parameter is valid and references a valid object. + + \ID SBSW_CSM_WRITE_TO_JOBSTATE_BY_JOBID_AND_PARTITION + \DESCRIPTION Access of JobState and JobTable with same index using ComStackLib + The used partition index is qualified to be in range of 0 to (Csm_GetSizeOfPartitionIdentifiers() - 1) + \COUNTERMEASURE \N Qualified use-case CSL02, CSL05 of ComStackLib + + \ID SBSW_WRITE_TO_OBJECTMAP_BY_JOBID + \DESCRIPTION Access of ObjectMap and JobTable with same index using ComStackLib + \COUNTERMEASURE \N Qualified use-case CSL02 of ComStackLib + + \ID SBSW_CSM_CSL_VAR_ACCESS + \DESCRIPTION A ComStackLib generated variable is accessed. + The used partition index has been passed by the caller. The API requires that the partition index is valid. + \COUNTERMEASURE \N The variable is written using a generated macro of the CSL. It immediately dereferences the variables address without pointer arithmetic. + + \ID SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER + \DESCRIPTION The API call is forwarded to an existing API function. + The API is called with one or more pointers passed from the wrapper API function. + \COUNTERMEASURE \N The called functions in the wrapper functions are API functions that are supposed to be silent. + + \ID SBSW_CSM_WRITE_PARTITION_DATA + \DESCRIPTION Write of partition specific data using ComStackLib. + \COUNTERMEASURE \N The index for the partition specific data is either fixed (for single partition use case) or provided by searching the current application id + in the partitionIdentifiers and using its corresponding partitionIdx. + Therefore the index is guaranteed to be in the acceptable range. +SBSW_JUSTIFICATION_END */ + +/* COUNTERMEASURES_BEGIN + + \CM CM_CSM_STACK_VARIABLE The address of the stack variable is always valid for synchronous call context. + +COUNTERMEASURES_END */ + +/* COV_JUSTIFICATION_BEGIN + \ID COV_CSM_USER_DEFINES + \ACCEPT TX + \ACCEPT XF + \REASON Ifndef is present for redefinition prevention. This allows the user or RTE to manually override this value + while also ensuring that the constant is present if the user or RTE does not override it. + + \ID COV_CSM_LOCAL_DEFINE + \ACCEPT TX + \REASON CSM_LOCAL is not defined externally. + + \ID COV_CSM_ASR_COMPATIBILITY_DEFINE + \ACCEPT XF + \ACCEPT TX + \REASON The behavior was changed in AUTOSAR. To support older AUTOSAR versions, the the defines can be overwritten. + Standard is the behavior of latest AUTOSAR version. + + \ID COV_CSM_ASR_COMPATIBILITY_FUNCTIONS + \ACCEPT XF + \ACCEPT TX + \REASON The Csm header provides function declarations based on the configured AUTOSAR version for the including + module. When Csm implementation itself includes the header, always the newest supported version is set. + +COV_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * FETA JUSTIFICATIONS + *********************************************************************************************************************/ + +/* FETA_JUSTIFICATION_BEGIN + + \ID FETA_CSM_STRICTLY_INCREASING_BY_ONE + \DESCRIPTION Loop is strictly monotonically increasing. Loop variable is only increased by one in each iteration. + Types of loop variable and upper bound are of same same size and overflow is excluded by not + including the highest possible upper bound value in the comparison (e.g. usage of < 255 and not <= 255). + \COUNTERMEASURE \N No countermeasure necessary, loop is terminating. + + \ID FETA_CSM_STRICTLY_DECREASING_BY_ONE + \DESCRIPTION Loop is strictly monotonically decreasing. Loop variable is only decreased by one in each iteration. + Types of loop variable and lower bound are of same same size and overflow is excluded by not + including the lowest possible lower bound value in the comparison (e.g. usage of > 0 and not >= 0). + \COUNTERMEASURE \N No countermeasure necessary, loop is terminating. + + \ID FETA_CSM_STRICTLY_INCREASING_BY_ONE_WITH_PRE_CHECK + \DESCRIPTION Loop is strictly monotonically increasing. Loop variable is only increased by one in each iteration. + Types of loop variable and upper bound are of same same size but overflow is possible due to including + the highest possible value in the comparison (e.g. <= 255). + \COUNTERMEASURE \R A runtime check before the loop limits the upper boundary. + +FETA_JUSTIFICATION_END */ + +/********************************************************************************************************************** + * END OF FILE: Csm.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm.h b/Source/bsw/Csm/Csm.h new file mode 100644 index 0000000..e7e9fa1 --- /dev/null +++ b/Source/bsw/Csm/Csm.h @@ -0,0 +1,1586 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Csm.h + * \brief MICROSAR Crypto Service Manager (CSM) + * + * \details Implementation of the MICROSAR Crypto Service Manager (CSM) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-10-31 vismss Major rework for ASR 4.3 + * 01.00.01 2016-12-06 vismss Adaption to the specification + * 01.00.02 2016-12-16 vismss ESCAN00093323 Correction of Csm_RandomGenerate + * 01.00.03 2017-01-04 vismss ESCAN00093383 Encapsulation of RTE related types + * 01.00.04 2017-01-12 vismss ESCAN00093703 Adaption of Csm_Types.h to the specification + * 01.01.00 2017-02-16 visgut FEATC-814 Support CSM 4.3 + * Introduce Exclusive Areas to protect queue resources + * Add missing DET Checks + * Support Csm_CancelJob + * Remove lower layer queue handling structures from Csm_Types.h + * Remove declaration of Csm_MainFunction as will be declared in SchM_Csm.h + * 01.02.00 2017-05-05 vismss FEATC-1227 Added/Corrected Doxygen comments + * Adapted code to MISRA + * Adapted null pointer checks to operation modes + * Improved job queueing + * 01.02.01 2017-05-25 vismss ESCAN00095301 Correction of DET null pointer exceptions + * 01.03.00 2017-06-08 vismaw FEAT-2500 SafeBSW for CSM 4.3 + * ESCAN00095452 Job sorting is only triggered during MainFunction + * ESCAN00094770 Csm_GetSizeOfJob() macro definition is missing if no job is configured + * 02.03.00 2017-08-22 visrpp ESCAN00096371 After cancellation, job is executed anyway or ECU results in + * unexpected behavior + * ESCAN00096373 Synchronous job is executed even if there were asynchronous jobs with + * higher priority queued before + * ESCAN00096489 Callbacks are not notified to the RTE + * 02.03.01 2018-03-13 visrpp ESCAN00097686 Added jobId to Crypto_JobType to increase compatibility to 3rd party + Crypto drivers + * ESCAN00098768 Jobs are not executed/passed to wrong channel if queue size is > 255 + * 03.00.00 2018-08-03 vismaw STORYC-5809 Introduce pre-and post job callouts + * STORYC-5999 Process new async job in callback + * ESCAN00100309 Application is not notified if a queued job is rejected by CryIf + * ESCAN00099325 Compiler warning: Csm.c: '<' : signed/unsigned mismatch + * 03.01.00 2018-08-20 vismaw STORYC-6300 Misra 2012 for Csm + * 03.01.01 2018-10-23 vismwe ESCAN00100873 CryIf_CertificateVerify is called with wrong verifyCryIfKeyId + * 04.00.00 2018-11-07 vismaw STORYC-6542 Support redirection of input/output buffers from/to key elements + * STORYC-6545 Support partial key element copy + * 04.01.00 2019-03-06 vismaw STORYC-7653 Release of CSM 4.x + * 04.01.01 2019-06-28 vismaw ESCAN00102925 Crypto_JobType is not declared as specified in ASR 4.3.x + * 04.02.00 2019-07-25 vismaw SEC-675 Add possibility to configure const members of job type as var + * 05.00.00 2019-10-30 visenc SEC-21 Add Asynchronous Key Handling + * SEC-907 CSM SWC according ASR 4.4 + * ESCAN00104302 Mapped Csm_ServiceToApiIdTable to CONST_8BIT memory section + * SEC-1001 Support ASR 4.4- and 4.5-style Callbacks + * 05.00.01 2020-01-20 visewl ESCAN00105342 Set operation mode for key management jobs always to single call + * ESCAN00105391 Resolve compiler warning that typedef name has already been declared + * ESCAN00105395 Resolve compiler warning that var. was declared but never referenced + * 2020-02-12 visewl ESCAN00105626 Resolve compiler errors due to possible loss of data using least types + * 05.01.00 2020-07-07 visrpp SEC-1454 Revised switches used for defining layout of Crypto_JobType structure + * SEC-1584 Reduce footprint through shared job objects + * SEC-1645 Call post job callout also for skipped synchronous jobs + * SEC-1655 Canceling of jobs according ASR 4.4 + * ESCAN00105993 Add field input64 to Crypto_JobPrimitiveInputOutputType + * ESCAN00106799 Add CYRPTO_KE_KEYEXCHANGE_SHAREDVALUE with typo as defined in AUTOSAR + * 06.00.00 2021-01-20 vismxe SEC-1889 Update algorithm modes and families to AUTOSAR R20-11 + * 06.01.00 2021-03-16 visenc SEC-2474 Save and restore context for running crypto operations + * ESCAN00108742 Execution of queued jobs might be delayed + * 06.01.01 2021-06-07 visrpp ESCAN00109411 Enqueued job might get lost + * 06.02.00 2021-11-25 visewl ESCAN00110824 Correct job state handling for asynchronous jobs + * ESCAN00110897 Free only shared job objects in callback function + * SEC-3604 Improve retriggering of asynchronous job processing + * 06.03.00 2022-03-10 visrpp SEC-4254 Speed up retriggering of asynchronous job if queue was empty + * 07.00.00 2023-01-18 visrpp SEC-5797 Use CRYPTO_E_BUSY instead of CRYPTO_E_QUEUE_FULL according ASR 4.4 + * SEC-5476 Remove keyId parameter from JobKey APIs according ASR R21-11 + * SEC-5478 CSM SWC according ASR R21-11 + * SEC-5804 Adapt types according ASR R21-11 and move them to Crypto_GeneralTypes.h + * SEC-5472 Introduce APIs KeyGetStatus, KeySetInvalid and JobKeySetInvalid + * SEC-5802 Adapt error reporting to ASR R21/11 + * SEC-4188 Finite Execution Time Analysis for Csm + * 07.01.00 2023-01-18 visrpp HSM-3724 Add multi-core/multi-partition support + * 07.02.00 2023-06-13 visfnn ESCAN00114839 Fix unreferenced variables + * HSM-4388 Rework Csm_InitMemory + * ESCAN00114847 Rename incorrect define CRYPTO_ALGOFAM_POLY13 to CRYPTO_ALGOFAM_POLY1305 + * 07.02.01 2024-02-15 visrpp ESCAN00116232 Prefix swc interface error codes with CRYPTO_E starting from ASR R19-11 + * vismwe ESCAN00115844 Avoid duplicated call of Csm_CallbackNotification during Csm_CancelJob + * vismwe CRY-508 Add CRYPTO_KEYSTATUS_UPDATE_IN_PROGRESS as value for KeyStatusType + * mapelt ESCAN00116539 Redirection might fail during asynchronous job processing + * main-1 2024-06-14 viseag CRY-715 Change history is maintained in the global ChangeHistory.txt file + * starting with this release. + *********************************************************************************************************************/ + +#if !defined (CSM_H) +# define CSM_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm_Cfg.h" +# include "Csm_Cbk.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Vendor and module identification */ +# define CSM_VENDOR_ID (30u) +# define CSM_MODULE_ID (110u) +# define CSM_INSTANCE_ID (0u) + +/* AUTOSAR Software specification version information */ +# define CSM_AR_RELEASE_MAJOR_VERSION (0x04u) +# define CSM_AR_RELEASE_MINOR_VERSION (0x07u) +# define CSM_AR_RELEASE_REVISION_VERSION (0x00u) + +/* ----- Component version information (decimal version of ALM implementation package) ----- */ +# define CSM_SW_MAJOR_VERSION (9u) +# define CSM_SW_MINOR_VERSION (1u) +# define CSM_SW_PATCH_VERSION (1u) + +/* ----- API service IDs ----- */ +/* Service ID: Csm_Init() */ +# define CSM_INIT_ID (0x00u) +/* Service ID: Csm_MainFunction() */ +# define CSM_MAINFUNCTION_ID (0x01u) +/* Service ID: Csm_GetVersionInfo() */ +# define CSM_GETVERSIONINFO_ID (0x3Bu) +/* Service ID: Csm_KeyElementSet() */ +# define CSM_KEYELEMENTSET_ID (0x78u) +/* Service ID: Csm_KeySetValid() */ +# define CSM_KEYSETVALID_ID (0x67u) +/* Service ID: Csm_JobKeySetValid() */ +# define CSM_JOBKEYSETVALID_ID (0x7Au) +/* Service ID: Csm_KeySetInvalid() */ +# define CSM_KEYSETINVALID_ID (0x85u) +/* Service ID: Csm_JobKeySetInvalid() */ +# define CSM_JOBKEYSETINVALID_ID (0x84u) +/* Service ID: Csm_KeyGetStatus() */ +# define CSM_KEYGETSTATUS_ID (0x83u) +/* Service ID: Csm_KeyElementGet() */ +# define CSM_KEYELEMENTGET_ID (0x68u) +/* Service ID: Csm_KeyElementCopy() */ +# define CSM_KEYELEMENTCOPY_ID (0x71u) +/* Service ID: Csm_KeyElementCopyPartial() */ +# define CSM_KEYELEMENTCOPYPARTIAL_ID (0x79u) +/* Service ID: Csm_KeyCopy() */ +# define CSM_KEYCOPY_ID (0x73u) +/* Service ID: Csm_RandomSeed() */ +# define CSM_RANDOMSEED_ID (0x69u) +/* Service ID: Csm_JobRandomSeed() */ +# define CSM_JOBRANDOMSEED_ID (0x7Bu) +/* Service ID: Csm_KeyGenerate() */ +# define CSM_KEYGENERATE_ID (0x6Au) +/* Service ID: Csm_JobKeyGenerate() */ +# define CSM_JOBKEYGENERATE_ID (0x7Cu) +/* Service ID: Csm_KeyDerive() */ +# define CSM_KEYDERIVE_ID (0x6Bu) +/* Service ID: Csm_JobKeyDerive() */ +# define CSM_JOBKEYDERIVE_ID (0x7Du) +/* Service ID: Csm_KeyExchangeCalcPubVal() */ +# define CSM_KEYEXCHANGECALCPUBVAL_ID (0x6Cu) +/* Service ID: Csm_JobKeyExchangeCalcPubVal() */ +# define CSM_JOBKEYEXCHANGECALCPUBVAL_ID (0x7Eu) +/* Service ID: Csm_KeyExchangeCalcSecret() */ +# define CSM_KEYEXCHANGECALCSECRET_ID (0x6Du) +/* Service ID: Csm_JobKeyExchangeCalcSecret() */ +# define CSM_JOBKEYEXCHANGECALCSECRET_ID (0x7Fu) +/* Service ID: Csm_CertificateParse() */ +# define CSM_CERTIFICATEPARSE_ID (0x6Eu) +/* Service ID: Csm_CertificateVerify() */ +# define CSM_CERTIFICATEVERIFY_ID (0x74u) +/* Service ID: Csm_Hash() */ +# define CSM_HASH_ID (0x5Du) +/* Service ID: Csm_MacGenerate() */ +# define CSM_MACGENERATE_ID (0x60u) +/* Service ID: Csm_MacVerify() */ +# define CSM_MACVERIFY_ID (0x61u) +/* Service ID: Csm_Encrypt() */ +# define CSM_ENCRYPT_ID (0x5Eu) +/* Service ID: Csm_Decrypt() */ +# define CSM_DECRYPT_ID (0x5Fu) +/* Service ID: Csm_AEADEncrypt() */ +# define CSM_AEADENCRYPT_ID (0x62u) +/* Service ID: Csm_AEADDecrypt() */ +# define CSM_AEADDECRYPT_ID (0x63u) +/* Service ID: Csm_SignatureGenerate() */ +# define CSM_SIGNATUREGENERATE_ID (0x76u) +/* Service ID: Csm_SignatureVerify() */ +# define CSM_SIGNATUREVERIFY_ID (0x64u) +/* Service ID: Csm_SecureCounterIncrement() */ +# define CSM_SECURECOUNTERINCREMENT_ID (0x65u) +/* Service ID: Csm_SecureCounterRead() */ +# define CSM_SECURECOUNTERREAD_ID (0x66u) +/* Service ID: Csm_RandomGenerate() */ +# define CSM_RANDOMGENERATE_ID (0x72u) +/* Service ID: Csm_CancelJob() */ +# define CSM_CANCELJOB_ID (0x6Fu) +/* Service ID: Csm_CallbackNotification() */ +# define CSM_CALLBACKNOTIFICATION_ID (0x70u) +/* Service ID: Csm_SaveContextJob() */ +# define CSM_SAVECONTEXTJOB_ID (0x86u) +/* Service ID: Csm_RestoreContextJob() */ +# define CSM_RESTORECONTEXTJOB_ID (0x87u) +/* Service ID: Csm_JobKeyWrap() */ +# define CSM_JOBKEYWRAP_ID (0x89u) +/* Service ID: Csm_JobKeyUnwrap() */ +# define CSM_JOBKEYUNWRAP_ID (0x8Au) +/* Service ID: This id is notified to DET if e.g. an error occurs during + job processing which is not related to a specific API. */ +# define CSM_GENERIC_JOB_PROCESSING_ID (0xFFu) + +/* ----- Error codes ----- */ +/* Error Code: Used to check if no error occurred */ +# define CSM_E_NO_ERROR (0x00u) +/* Error Code: API request called with invalid parameter (null pointer) */ +# define CSM_E_PARAM_POINTER (0x01u) +/* Error Code: API request called with invalid parameter (invalid method for selected service) */ +# define CSM_E_PARAM_METHOD_INVALID (0x03u) +/* Error Code: API request called with Csm configuration ID out of range */ +# define CSM_E_PARAM_HANDLE (0x04u) +/* Error Code: API request called before initialization of CSM module */ +# define CSM_E_UNINIT (0x05u) +/* Error Code: Initialization of CSM module failed */ +# define CSM_E_INIT_FAILED (0x07u) +/* Error Code: API request called with invalid processing mode */ +# define CSM_E_PROCESSING_MODE (0x08u) +/* Error Code: Mismatch between the called API request and the service type of the job */ +# define CSM_E_SERVICE_TYPE (0x09u) +/* Error code: The service Csm_Init() is called while the module is already initialized */ +# define CSM_E_ALREADY_INITIALIZED (0x11u) +/* Error code: API request called on wrong partition */ +# define CSM_E_INVALID_PARTITION (0x12u) + +/* Runtime Error code: Queue overrun - More jobs have been requested than the queue can store */ +# define CSM_E_QUEUE_FULL (0x01u) +/* Runtime Error code: Unexpected callback from lower layer */ +# define CSM_E_UNEXPECTED_CALLBACK (0x81u) + +/* ----- Modes ----- */ +/* State: Uninitialized */ +# define CSM_UNINIT (0x00u) +/* State: Initialized */ +# define CSM_INITIALIZED (0x01u) + +# define CSM_CALLOUT_STATE_IDLE (0x00u) +# define CSM_CALLOUT_STATE_PRE_INITIAL (0x01u) +# define CSM_CALLOUT_STATE_PRE_PENDING (0x02u) +# define CSM_CALLOUT_STATE_PROCESSING (0x03u) +# define CSM_CALLOUT_STATE_PROCESSING_ABORTED_BY_CALLOUT (0x04u) +# define CSM_CALLOUT_STATE_POST_INITIAL (0x05u) +# define CSM_CALLOUT_STATE_POST_PENDING (0x06u) + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define CSM_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* General Function Prototypes */ +/********************************************************************************************************************** + * Csm_Init() + *********************************************************************************************************************/ +/*! \brief Initializes the CSM module. + * \details Set all service states to initial idle. + * \pre None + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + *********************************************************************************************************************/ +FUNC(void, CSM_CODE) Csm_Init(void); + +# if (CSM_VERSION_INFO_API == STD_ON) +/********************************************************************************************************************** + * Csm_GetVersionInfo() + *********************************************************************************************************************/ +/*! \brief Returns the version information of this module. + * \details Stores version information, i.e. Module Id, Vendor Id, Vendor specific version numbers to structure + * pointed by versioninfo. + * \param[out] versioninfo Pointer where the version info data shall be stored. + * \pre GetVersionInfo API is enabled via pre-compile configuration. + * \context TASK + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-129269 + *********************************************************************************************************************/ +FUNC(void, CSM_CODE) Csm_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, CSM_APPL_VAR) versioninfo); +# endif /* (CSM_VERSION_INFO_API == STD_ON) */ + +/********************************************************************************************************************** + * Csm_CancelJob() + *********************************************************************************************************************/ +/*! \brief Cancels the job processing from asynchronous or streaming jobs. + * \details Removes the job in the Csm Queue and calls the job's callback with the result + * CRYPTO_E_JOB_CANCELED. It also passes the cancellation command to the + * CryIf to try to cancel the job in the Crypto Driver. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Not used, just for interface compatibility provided + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note For cancellation of asynchronous jobs the application must be able to handle two callbacks. + * It is possible that the normal job callback notification will be called while cancelling. + * The cancel callback notification can be identified by contained result CRYPTO_E_JOB_CANCELED. + * \trace CREQ-129244 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJob(uint32 jobId, Crypto_OperationModeType mode); + +/* Key Management Function Prototypes */ +/********************************************************************************************************************** + * Csm_KeyElementSet() + *********************************************************************************************************************/ +/*! \brief Sets the given key element bytes to the key identified by keyId. + * \details If the values of a key element are modified with Csm_KeyElementSet(), the key needs to be + * re-validated by calling Csm_KeySetValid() before using it for a cryptographic operation. + * \param[in] keyId Holds the identifier of the key for which a new material shall be set. + * \param[in] keyElementId Holds the identifier of the key element to be written. + * \param[in] keyPtr Holds the pointer to the key element bytes to be processed. + * \param[in] keyLength Contains the number of key element bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data. + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129256 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementSet(uint32 keyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * Csm_KeySetValid() + *********************************************************************************************************************/ +/*! \brief Sets the key state of the key identified by keyId to valid. + * \details - + * \param[in] keyId Holds the identifier of the key for which a new material shall be validated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \trace CREQ-129255 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetValid(uint32 keyId); + +/********************************************************************************************************************** + * Csm_KeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Sets the key status to invalid. The key cannot be used any longer for cryptographic operations + * until it has been set to valid state again. + * \details - + * \param[in] keyId Holds the identifier of the key which shall be invalidated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-3000000 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetInvalid(uint32 keyId); + +/********************************************************************************************************************** + * Csm_KeyGetStatus() + *********************************************************************************************************************/ +/*! \brief Returns the key state of the key identified by keyId. + * \details - + * \param[in] keyId Holds the identifier of the key for which the key state shall be returned. + * \param[out] keyStatusPtr Contains the pointer to the data where the status of the key shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-3000001 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGetStatus(uint32 keyId, P2VAR(Crypto_KeyStatusType, AUTOMATIC, CSM_APPL_VAR) keyStatusPtr); + +/********************************************************************************************************************** + * Csm_KeyElementGet() + *********************************************************************************************************************/ +/*! \brief Retrieves the key element bytes from a specific key element of the key identified by the keyId and + * stores the key element in the memory location pointed by the key pointer. + * \details - + * \param[in] keyId Holds the identifier of the key from which a key element shall be + * extracted. + * \param[in] keyElementId Holds the identifier of the key element to be extracted. + * \param[out] keyPtr Holds the pointer to the memory location where the key shall be copied + * to. + * \param[in,out] keyLengthPtr Holds a pointer to the memory location in which the output buffer length + * in bytes is stored. On calling this function, this parameter shall + * contain the buffer length in bytes of the keyPtr. When the request has + * finished, the actual size of the written input bytes shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129254 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGet(uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyElementCopy() + *********************************************************************************************************************/ +/*! \brief This function shall copy a key elements from one key to a target key. + * \details - + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for + * the copy operation. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination + * for the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129253 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopy(uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Csm_KeyElementCopyPartial() + *********************************************************************************************************************/ +/*! \brief This function copies a key element partially from one key to a target key. + * \details The function copies a specific chunk of the source key element to a specific location of the target key. + * The locations are given through the parameters. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset This is the offset of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset This is the offset of the destination key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Specifies the number of bytes that shall be copied. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-185644 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyPartial(uint32 keyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Csm_KeyCopy() + *********************************************************************************************************************/ +/*! \brief This function shall copy all key elements from the source key to a target key. + * \details - + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129252 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopy(uint32 keyId, + uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_RandomSeed() + *********************************************************************************************************************/ +/*! \brief Feeds the key element CRYPTO_KE_RANDOM_SEED with a random seed. + * \details - + * \param[in] keyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the + * seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129251 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomSeed(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength); + +/********************************************************************************************************************** + * Csm_KeyGenerate() + *********************************************************************************************************************/ +/*! \brief Generates new key material and store it in the key identified by keyId. + * \details - + * \param[in] keyId Holds the identifier of the key for which a new material shall be generated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129250 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerate(uint32 keyId); + +/********************************************************************************************************************** + * Csm_KeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a new key by using the key elements in the given key identified by the keyId. The given key + * contains the key elements for the password and salt. The derived key is stored in the key element + * with the id 1 of the key identified by targetCryptoKeyId. + * \details - + * \param[in] keyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129249 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDerive(uint32 keyId, + uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Calculates the public value of the current user for the key exchange and stores the public key in + * the memory location pointed by the public value pointer. + * \details - + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER Request failed because the provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129248 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubVal(uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Calculates the shared secret key for the key exchange with the key material of the key identified by + * the keyId and the partner public key. The shared secret key is stored as a key element in the same + * key. + * \details - + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129247 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecret(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_CertificateParse() + *********************************************************************************************************************/ +/*! \brief This function shall dispatch the certificate parse function to the CryIf. + * \details - + * \param[in] keyId Holds the identifier of the key to be used for the certificate parsing. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \trace CREQ-129246 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateParse(uint32 keyId); + +/********************************************************************************************************************** + * Csm_CertificateVerify() + *********************************************************************************************************************/ +/*! \brief Verifies the certificate stored in the key referenced by verifyKeyId with the certificate stored in + * the key referenced by keyId. Note: Only certificates stored in the same Crypto Driver can be + * verified against each other. If the key element CRYPTO_KE_CERTIFICATE_CURRENT_TIME is used for the + * verification of the validity period of the certificate identified by verifyKeyId, it shall have the + * same format as the timestamp in the certificate. + * \details - + * \param[in] keyId Holds the identifier of the key which shall be used to validate the certificate. + * \param[in] verifyKeyId Holds the identifier of the key containing the certificate to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the certificate + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \trace CREQ-129245 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateVerify(uint32 keyId, + uint32 verifyKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/* CSM Service Function Prototypes */ +/********************************************************************************************************************** + * Csm_Hash() + *********************************************************************************************************************/ +/*! \brief Uses the given data to perform the hash calculation and stores the hash in the memory location + * pointed to by the result pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the hash shall be computed. + * \param[in] dataLength Contains the number of bytes to be hashed. + * \param[out] resultPtr Contains the pointer to the data where the hash value shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by resultPtr. When the request has finished, the actual length of + * the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129268 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_Hash(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerate() + *********************************************************************************************************************/ +/*! \brief Uses the given data to perform a MAC generation and stores the MAC in the memory location pointed to + * by the MAC pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerate(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacVerify() + *********************************************************************************************************************/ +/*! \brief Verifies the given MAC by comparing if the MAC is generated with the given data. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerify(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_Encrypt() + *********************************************************************************************************************/ +/*! \brief Encrypts the given data and store the ciphertext in the memory location pointed by the result + * pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129265 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_Encrypt(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_Decrypt() + *********************************************************************************************************************/ +/*! \brief Decrypts the given encrypted data and store the decrypted plaintext in the memory location pointed + * by the result pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129264 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_Decrypt(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncrypt() + *********************************************************************************************************************/ +/*! \brief Uses the given input data to perform a AEAD encryption and stores the ciphertext and the MAC in the + * memory locations pointed by the ciphertext pointer and Tag pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129263 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncrypt(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADDecrypt() + *********************************************************************************************************************/ +/*! \brief Uses the given data to perform an AEAD decryption and stores the plaintext and the result of + * verification in the memory locations pointed by the plaintext pointer and verifyPtr pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129262 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecrypt(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerate() + *********************************************************************************************************************/ +/*! \brief Uses the given data to perform the signature calculation and stores the signature in the memory + * location pointed by the result pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] resultPtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129261 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerate(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerify() + *********************************************************************************************************************/ +/*! \brief Verifies the given MAC by comparing if the signature is generated with the given data. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129260 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerify(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_RandomGenerate() + *********************************************************************************************************************/ +/*! \brief Generate a random number and stores it in the memory location pointed by the result pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] resultPtr Holds a pointer to the memory location which will hold the result of the + * random number generation. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the result length in bytes + * is stored. On calling this function, this parameter shall contain the + * number of random bytes, which shall be stored to the buffer provided by + * resultPtr. When the request has finished, the actual length of the returned + * value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129257 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerate(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeySetValid() + *********************************************************************************************************************/ +/*! \brief Stores the key if necessary and sets the key state of the key configured in the job to valid. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129255 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValid(uint32 jobId); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeySetValid44x() + *********************************************************************************************************************/ +/*! \brief Stores the key if necessary and sets the key state of the key configured in the job to valid. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129255 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValid44x(uint32 jobId, uint32 keyId); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeySetInvalid() + *********************************************************************************************************************/ +/*! \brief Sets the key status to invalid. The key cannot be used any longer for cryptographic operations + * until it has been set to valid state again. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-3000000 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetInvalid(uint32 jobId); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeySetInvalid44x() + *********************************************************************************************************************/ +/*! \brief Sets the key status to invalid. The key cannot be used any longer for cryptographic operations + * until it has been set to valid state again. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-3000000 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetInvalid44x(uint32 jobId, uint32 keyId); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobRandomSeed() + *********************************************************************************************************************/ +/*! \brief This function shall dispatch the random seed function to the configured Crypto Driver object. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129251 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeed(uint32 jobId, P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, uint32 seedLength); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobRandomSeed44x() + *********************************************************************************************************************/ +/*! \brief This function shall dispatch the random seed function to the configured Crypto Driver object. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129251 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeed44x(uint32 jobId, uint32 keyId, P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, uint32 seedLength); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeyGenerate() + *********************************************************************************************************************/ +/*! \brief Generates new key material and stores it in the key configured in the job. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129250 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerate(uint32 jobId); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeyGenerate44x() + *********************************************************************************************************************/ +/*! \brief Generates new key material and stores it in the key identified by keyId. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129250 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerate44x(uint32 jobId, uint32 keyId); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeyDerive() + *********************************************************************************************************************/ +/*! \brief Derives a new key by using the key elements in the key configured in the job. + * The key contains the key elements for the password and salt. The derived key is + * stored in the key element with the id 1 of the key identified by targetKeyId. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129249 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDerive(uint32 jobId, uint32 targetKeyId); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeyDerive44x() + *********************************************************************************************************************/ +/*! \brief Derives a new key by using the key elements in the key configured in the job. + * The key contains the key elements for the password and salt. The derived key is + * stored in the key element with the id 1 of the key identified by targetKeyId. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129249 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDerive44x(uint32 jobId, uint32 keyId, uint32 targetKeyId); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubVal() + *********************************************************************************************************************/ +/*! \brief Calculates the public value of the current user for the key exchange and stores the + * public key in the memory location pointed by the public value pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129248 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubVal(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubVal44x() + *********************************************************************************************************************/ +/*! \brief Calculates the public value of the current user for the key exchange and stores the + * public key in the memory location pointed by the public value pointer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129248 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubVal44x(uint32 jobId, + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecret() + *********************************************************************************************************************/ +/*! \brief Calculates the shared secret key for the key exchange with the key material of the key configured in + * the job and the partner public key. The shared secret key is stored as a key element in the same key. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129247 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecret(uint32 jobId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_R21_11) */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecret44x() + *********************************************************************************************************************/ +/*! \brief Calculates the shared secret key for the key exchange with the key material of the key configured in + * the job and the partner public key. The shared secret key is stored as a key element in the same key. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-129247 + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecret44x(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_JobKeyWrap() + *********************************************************************************************************************/ +/*! \brief Wraps the plaintext key given by sourceKeyId (in the key element with the id 1) with the key + * wrapping key associated with the jobId. The wrapped key will be written to ciphertextPtr. If the + * algorithm does provide an authenticator this will be written to authenticatorPtr. If the algorithm + * has no authenticator or the algorithm has an authenticator and no authentication shall be done, + * authenticatorLengthPtr shall be set to zero. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] sourceKeyId Holds the identifier of the key to be wrapped. + * \param[in] ciphertextPtr References the data of the wrapped key. + * \param[in,out] ciphertextLengthPtr Contains the length in bytes of the wrapped key. + * \param[in] authenticatorPtr References the data of the authenticator - NOT USED. + * \param[in,out] authenticatorLengthPtr Contains the length in bytes of the authenticator. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_JOB_CANCELED Request failed because the job has been canceled. + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-Csm-KeyWrap + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyWrap(uint32 jobId, + uint32 sourceKeyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) authenticatorPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) authenticatorLengthPtr); + +/********************************************************************************************************************** + * Csm_JobKeyUnwrap() + *********************************************************************************************************************/ +/*! \brief Unwraps the wrapped key given by the ciphertextPtr with the key wrapping key associated with + * the jobId. The unwrapped key will be written to targetKeyId in the element with the Id 1. If an + * authentication shall be done, the authenticator shall be referenced with authenticatorPtr. If the + * algorithm has no authenticator or the algorithm has an authenticator and no authentication shall + * be done, authenticatorLengthPtr shall be set to zero. If the algorithm has no authentication, + * verifyPtr will be set to CRYPTO_E_VER_OK. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] targetKeyId Holds the identifier of the slot where the plaintext key shall be + * written. + * \param[in] ciphertextPtr References the data of the wrapped key. + * \param[in] ciphertextLength Contains the length in bytes of the wrapped key. + * \param[in] authenticatorPtr References the data of the authenticator - NOT USED. + * \param[in] authenticatorLength Contains the length in bytes of the authenticator. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_JOB_CANCELED Request failed because the job has been canceled + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + * \trace CREQ-Csm-KeyUnwrap + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyUnwrap(uint32 jobId, + uint32 targetKeyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) authenticatorPtr, + uint32 authenticatorLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SaveContextJob() + *********************************************************************************************************************/ +/*! \brief The Crypto Driver stores the internal context of the respective crypto operation to the contextBuffer. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] contextBufferPtr Pointer to the buffer in the application where the context data shall be + * stored to. + * \param[in,out] contextBufferLengthPtr Pointer to the buffer, where the length value is located.As input data it + * provides the maximum length of data available in contextBufferPtr.As + * output data it provides the actual length of data located in context + * BufferPtr(or 0 in case of a failure) + * \return E_OK Context data successfully provided. + * E_NOT_OK Context data could not be provided, values are not valid. + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_SaveContextJob(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) contextBufferLengthPtr); + +/********************************************************************************************************************** + * Csm_RestoreContextJob() + *********************************************************************************************************************/ +/*! \brief The Crypto Driver extracts the context data from the contextBuffer and restores the + * internal state so that further crypto operation of this crypto service will continue at + * the exact point when the context was taken. + * \details - + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] contextBufferPtr Pointer to the buffer, where the context data are located that + * shall be restored. + * \param[in] contextBufferLength Provides the length of context data that are located in contextBufferPtr. + * \return E_OK Context data successfully restored. + * E_NOT_OK Context data could not be restored. + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, CSM_CODE) Csm_RestoreContextJob(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + uint32 contextBufferLength); + +# define CSM_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* AUTOSAR Compatibility Block */ +# if (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_4_04) /* COV_CSM_ASR_COMPATIBILITY_FUNCTIONS */ +# define Csm_JobKeySetValid Csm_JobKeySetValid44x +# define Csm_JobKeySetInvalid Csm_JobKeySetInvalid44x +# define Csm_JobRandomSeed Csm_JobRandomSeed44x +# define Csm_JobKeyGenerate Csm_JobKeyGenerate44x +# define Csm_JobKeyDerive Csm_JobKeyDerive44x +# define Csm_JobKeyExchangeCalcPubVal Csm_JobKeyExchangeCalcPubVal44x +# define Csm_JobKeyExchangeCalcSecret Csm_JobKeyExchangeCalcSecret44x +# endif /* (CSM_JOB_KEY_API_VERSION == CSM_ASR_VERSION_4_04) */ + +/*! + * \exclusivearea CSM_EXCLUSIVE_AREA_0 + * Ensures consistency of global RAM variables. + * \protects Job state and queue handling variables. + * \usedin Csm_Hash, Csm_MacGenerate, Csm_MacVerify, Csm_Encrypt, Csm_Decrypt, Csm_AEADEncrypt, Csm_AEADDecrypt, + * Csm_SignatureGenerate, Csm_SignatureVerify, Csm_RandomGenerate, Csm_JobKeySetValid, Csm_JobKeySetInvalid, + * Csm_JobRandomSeed, Csm_JobKeyGenerate, Csm_JobKeyDerive, Csm_JobKeyExchangeCalcPubVal, + * Csm_JobKeyExchangeCalcSecret, Csm_SaveContextJob, Csm_RestoreContextJob, Csm_CallbackNotification, + * Csm_CancelJob, Csm_MainFunction + * \exclude All functions in which this exclusive area is used in. + * \length MEDIUM for Job state and queue handling. + * \endexclusivearea + */ + +#endif /* !defined (CSM_H) */ +/********************************************************************************************************************** + * END OF FILE: Csm.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm_Cbk.h b/Source/bsw/Csm/Csm_Cbk.h new file mode 100644 index 0000000..6ac7c47 --- /dev/null +++ b/Source/bsw/Csm/Csm_Cbk.h @@ -0,0 +1,65 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Csm_Cbk.h + * \brief MICROSAR Crypto Service Manager (CSM) + * + * \details Implementation of the MICROSAR Crypto Service Manager (CSM) + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file (Csm.h). + *********************************************************************************************************************/ + +#if !defined (CSM_CBK_H) +# define CSM_CBK_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm_Types.h" + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPE + *********************************************************************************************************************/ +# define CSM_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Csm_CallbackNotification() + *********************************************************************************************************************/ +/*! \brief Callback Notification + * \details Notifies the Csm that a job has finished. This function is used by the underlying layer (CryIf) + * \param[in,out] job Holds a pointer to the job, which has finished. + * \param[in] result Contains the result of the cryptographic operation. + * The second most important bit of result must not be set. It must always be zero. + * \pre - + * \context TASK|ISR2|ISR1 + * \reentrant TRUE + * \synchronous TRUE + * \trace CREQ-129243 + *********************************************************************************************************************/ +FUNC(void, CSM_CODE) Csm_CallbackNotification(P2VAR(Crypto_JobType, AUTOMATIC, CSM_APPL_VAR) job, + Crypto_ResultType result); + +# define CSM_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* !defined (CSM_CBK_H) */ + +/********************************************************************************************************************** + * END OF FILE: Csm_Cbk.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm_Rte.c b/Source/bsw/Csm/Csm_Rte.c new file mode 100644 index 0000000..fc2304a --- /dev/null +++ b/Source/bsw/Csm/Csm_Rte.c @@ -0,0 +1,1861 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Csm_Rte.c + * \brief MICROSAR Crypto Service Manager (CSM) RTE + * + * \details Implementation of the MICROSAR Crypto Service Manager (CSM) service APIs used only by RTE + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define CSM_RTE_SOURCE +/* PRQA S 6060 EOF */ /* MD_MSR_STPAR */ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Csm_Rte.h" + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (CSM_RTE_PORTS == STD_ON) + +# define CSM_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Csm_HashAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_HashAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Hash */ + return Csm_Hash(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_HashAsr4_03() */ + +/********************************************************************************************************************** + * Csm_HashDataRefAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRefAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Hash */ + return Csm_Hash(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_HashDataRefAsr4_03() */ + +/********************************************************************************************************************** + * Csm_HashDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Hash */ + return Csm_Hash(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_HashDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_HashDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Hash */ + return Csm_Hash(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))resultPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_HashDataRef() */ + +/********************************************************************************************************************** + * Csm_MacGenerateAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) +{ + /* #10 Call Csm_MacGenerate */ + return Csm_MacGenerate(jobId, mode, dataPtr, dataLength, macPtr, macLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacGenerateAsr4_03() */ + +/********************************************************************************************************************** + * Csm_MacGenerateAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) +{ + /* #10 Call Csm_MacGenerate */ + return Csm_MacGenerate(jobId, mode, dataPtr, dataLength, macPtr, macLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacGenerateAsr4_04() */ + +/********************************************************************************************************************** + * Csm_MacGenerateDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) +{ + /* #10 Call Csm_MacGenerate */ + return Csm_MacGenerate(jobId, mode, dataPtr, dataLength, macPtr, macLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacGenerateDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_MacGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) +{ + /* #10 Call Csm_MacGenerate */ + return Csm_MacGenerate(jobId, mode, dataPtr, dataLength, macPtr, macLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacGenerateDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_MacGenerateDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr) +{ + /* #10 Call Csm_MacGenerate */ + return Csm_MacGenerate(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))macPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + macLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacGenerateDataRef() */ + +/********************************************************************************************************************** + * Csm_MacVerifyAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_MacVerify */ + return Csm_MacVerify(jobId, mode, dataPtr, dataLength, macPtr, macLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacVerifyAsr4_03() */ + +/********************************************************************************************************************** + * Csm_MacVerifyAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_MacVerify */ + return Csm_MacVerify(jobId, mode, dataPtr, dataLength, macPtr, macLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacVerifyAsr4_04() */ + +/********************************************************************************************************************** + * Csm_MacVerifyDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_MacVerify */ + return Csm_MacVerify(jobId, mode, dataPtr, dataLength, macPtr, macLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacVerifyDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_MacVerifyDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_MacVerify */ + return Csm_MacVerify(jobId, mode, dataPtr, dataLength, macPtr, macLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacVerifyDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_MacVerifyDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_MacVerify */ + return Csm_MacVerify(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))macPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + macLength, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_MacVerifyDataRef() */ + +/********************************************************************************************************************** + * Csm_EncryptAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Encrypt */ + return Csm_Encrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_EncryptAsr4_03() */ + +/********************************************************************************************************************** + * Csm_EncryptAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Encrypt */ + return Csm_Encrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_EncryptAsr4_04() */ + +/********************************************************************************************************************** + * Csm_EncryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Encrypt */ + return Csm_Encrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_EncryptDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_EncryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Encrypt */ + return Csm_Encrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_EncryptDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_EncryptDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Encrypt */ + return Csm_Encrypt(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))resultPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_EncryptDataRef() */ + +/********************************************************************************************************************** + * Csm_DecryptAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Decrypt */ + return Csm_Decrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_DecryptAsr4_03() */ + +/********************************************************************************************************************** + * Csm_DecryptAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Decrypt */ + return Csm_Decrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_DecryptAsr4_04() */ + +/********************************************************************************************************************** + * Csm_DecryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Decrypt */ + return Csm_Decrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_DecryptDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_DecryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Decrypt */ + return Csm_Decrypt(jobId, mode, dataPtr, dataLength, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_DecryptDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_DecryptDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_Decrypt */ + return Csm_Decrypt(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))resultPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_DecryptDataRef() */ + +/********************************************************************************************************************** + * Csm_AEADEncryptAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) +{ + /* #10 Call Csm_AEADEncrypt */ + return Csm_AEADEncrypt(jobId, + mode, + plaintextPtr, + plaintextLength, + associatedDataPtr, + associatedDataLength, + ciphertextPtr, + ciphertextLengthPtr, + tagPtr, + tagLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADEncryptAsr4_03() */ + +/********************************************************************************************************************** + * Csm_AEADEncryptAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) +{ + /* #10 Call Csm_AEADEncrypt */ + return Csm_AEADEncrypt(jobId, + mode, + plaintextPtr, + plaintextLength, + associatedDataPtr, + associatedDataLength, + ciphertextPtr, + ciphertextLengthPtr, + tagPtr, + tagLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADEncryptAsr4_04() */ + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) +{ + /* #10 Call Csm_AEADEncrypt */ + return Csm_AEADEncrypt(jobId, + mode, + plaintextPtr, + plaintextLength, + associatedDataPtr, + associatedDataLength, + ciphertextPtr, + ciphertextLengthPtr, + tagPtr, + tagLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADEncryptDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) +{ + /* #10 Call Csm_AEADEncrypt */ + return Csm_AEADEncrypt(jobId, + mode, + plaintextPtr, + plaintextLength, + associatedDataPtr, + associatedDataLength, + ciphertextPtr, + ciphertextLengthPtr, + tagPtr, + tagLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADEncryptDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr) +{ + /* #10 Call Csm_AEADEncrypt */ + return Csm_AEADEncrypt(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))plaintextPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + plaintextLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))associatedDataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + associatedDataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))ciphertextPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + ciphertextLengthPtr, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))tagPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + tagLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADEncryptDataRef() */ + +/********************************************************************************************************************** + * Csm_AEADDecryptAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_AEADDecrypt */ + return Csm_AEADDecrypt(jobId, + mode, + ciphertextPtr, + ciphertextLength, + associatedDataPtr, + associatedDataLength, + tagPtr, + tagLength, + plaintextPtr, + plaintextLengthPtr, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADDecryptAsr4_03() */ + +/********************************************************************************************************************** + * Csm_AEADDecryptAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_AEADDecrypt */ + return Csm_AEADDecrypt(jobId, + mode, + ciphertextPtr, + ciphertextLength, + associatedDataPtr, + associatedDataLength, + tagPtr, + tagLength, + plaintextPtr, + plaintextLengthPtr, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADDecryptAsr4_04() */ + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_AEADDecrypt */ + return Csm_AEADDecrypt(jobId, + mode, + ciphertextPtr, + ciphertextLength, + associatedDataPtr, + associatedDataLength, + tagPtr, + tagLength, + plaintextPtr, + plaintextLengthPtr, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADDecryptDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_AEADDecrypt */ + return Csm_AEADDecrypt(jobId, + mode, + ciphertextPtr, + ciphertextLength, + associatedDataPtr, + associatedDataLength, + tagPtr, + tagLength, + plaintextPtr, + plaintextLengthPtr, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADDecryptDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_AEADDecrypt */ + return Csm_AEADDecrypt(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))ciphertextPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + ciphertextLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))associatedDataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + associatedDataLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))tagPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + tagLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))plaintextPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + plaintextLengthPtr, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_AEADDecryptDataRef() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerateAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr) +{ + /* #10 Call Csm_SignatureGenerate */ + return Csm_SignatureGenerate(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureGenerateAsr4_03() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerateAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr) +{ + /* #10 Call Csm_SignatureGenerate */ + return Csm_SignatureGenerate(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureGenerateAsr4_04() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr) +{ + /* #10 Call Csm_SignatureGenerate */ + return Csm_SignatureGenerate(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureGenerateDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr) +{ + /* #10 Call Csm_SignatureGenerate */ + return Csm_SignatureGenerate(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureGenerateDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr) +{ + /* #10 Call Csm_SignatureGenerate */ + return Csm_SignatureGenerate(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))signaturePtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + signatureLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureGenerateDataRef() */ + +/********************************************************************************************************************** + * Csm_SignatureVerifyAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_SignatureVerify */ + return Csm_SignatureVerify(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureVerifyAsr4_03() */ + +/********************************************************************************************************************** + * Csm_SignatureVerifyAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_SignatureVerify */ + return Csm_SignatureVerify(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureVerifyAsr4_04() */ + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRefAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_SignatureVerify */ + return Csm_SignatureVerify(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureVerifyDataRefAsr4_04() */ + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_SignatureVerify */ + return Csm_SignatureVerify(jobId, mode, dataPtr, dataLength, signaturePtr, signatureLength, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureVerifyDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_SignatureVerify */ + return Csm_SignatureVerify(jobId, + mode, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))dataPtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + dataLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))signaturePtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + signatureLength, + verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SignatureVerifyDataRef() */ + +/********************************************************************************************************************** + * Csm_RandomGenerateAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateAsr4_03(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_RandomGenerate */ + return Csm_RandomGenerate(jobId, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RandomGenerateAsr4_03() */ + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRefAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRefAsr4_03(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_RandomGenerate */ + return Csm_RandomGenerate(jobId, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RandomGenerateDataRefAsr4_03() */ + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRefAsrR19_11(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_RandomGenerate */ + return Csm_RandomGenerate(jobId, resultPtr, resultLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RandomGenerateDataRefAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRef() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRef(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr) +{ + /* #10 Call Csm_RandomGenerate */ + return Csm_RandomGenerate(jobId, (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))resultPtr, resultLengthPtr); /* PRQA S 0316 */ /* MD_CSM_0316 */ /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RandomGenerateDataRef() */ + +/********************************************************************************************************************** + * Csm_CancelJobAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobAsr4_03(uint32 jobId, Crypto_OperationModeType mode) +{ + /* #10 Call Csm_CancelJob */ + return Csm_CancelJob(jobId, mode); +} /* Csm_CancelJobAsr4_03() */ + +/********************************************************************************************************************** + * Csm_CancelJobAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobAsr4_04(uint32 jobId, Crypto_OperationModeType mode) +{ + /* #10 Call Csm_CancelJob */ + return Csm_CancelJob(jobId, mode); +} /* Csm_CancelJobAsr4_04() */ + +/********************************************************************************************************************** + * Csm_CancelJobNoOpMode() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpMode(uint32 jobId) +{ + /* #10 Call Csm_CancelJob */ + return Csm_CancelJob(jobId, CRYPTO_OPERATIONMODE_SINGLECALL); +} /* Csm_CancelJobNoOpMode() */ + +/********************************************************************************************************************** + * Csm_CancelJobNoOpModeAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpModeAsr4_03(uint32 jobId) +{ + /* #10 Call Csm_CancelJob */ + return Csm_CancelJob(jobId, CRYPTO_OPERATIONMODE_SINGLECALL); +} /* Csm_CancelJobNoOpModeAsr4_03() */ + +/********************************************************************************************************************** + * Csm_CancelJobNoOpModeAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpModeAsr4_04(uint32 jobId) +{ + /* #10 Call Csm_CancelJob */ + return Csm_CancelJob(jobId, CRYPTO_OPERATIONMODE_SINGLECALL); +} /* Csm_CancelJobNoOpModeAsr4_04() */ + +/********************************************************************************************************************** + * Csm_JobKeyDeriveAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDeriveAsr4_03(uint32 jobId, uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_JobKeyDerive44x */ + return Csm_JobKeyDerive44x(jobId, keyId, targetKeyId); +} /* Csm_JobKeyDeriveAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeyDeriveAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDeriveAsrR19_11(uint32 jobId, uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_JobKeyDerive44x */ + return Csm_JobKeyDerive44x(jobId, keyId, targetKeyId); +} /* Csm_JobKeyDeriveAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR21_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR21_11(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_JobKeyExchangeCalcPubVal */ + return Csm_JobKeyExchangeCalcPubVal(jobId, (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))publicValuePtr, publicValueLengthPtr); /* PRQA S 0316 */ /* MD_CSM_0316 */ /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcPubValAsrR21_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR20_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR20_11(uint32 jobId, + uint32 keyId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_JobKeyExchangeCalcPubVal44x */ + return Csm_JobKeyExchangeCalcPubVal44x(jobId, + keyId, + (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))publicValuePtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + publicValueLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcPubValAsrR20_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsr4_03(uint32 jobId, + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_JobKeyExchangeCalcPubVal44x */ + return Csm_JobKeyExchangeCalcPubVal44x(jobId, keyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcPubValAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR19_11(uint32 jobId, + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_JobKeyExchangeCalcPubVal44x */ + return Csm_JobKeyExchangeCalcPubVal44x(jobId, keyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcPubValAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR21_11_A() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR21_11_A(uint32 jobId, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_JobKeyExchangeCalcSecret */ + return Csm_JobKeyExchangeCalcSecret(jobId, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))partnerPublicValuePtr, /* PRQA S 0316 */ /* MD_CSM_0316 */ + partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcSecretAsrR21_11_A() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR21_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR21_11(uint32 jobId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_JobKeyExchangeCalcSecret */ + return Csm_JobKeyExchangeCalcSecret(jobId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcSecretAsrR21_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsr4_03(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_JobKeyExchangeCalcSecret44x */ + return Csm_JobKeyExchangeCalcSecret44x(jobId, keyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcSecretAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR19_11(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_JobKeyExchangeCalcSecret44x */ + return Csm_JobKeyExchangeCalcSecret44x(jobId, keyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobKeyExchangeCalcSecretAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_JobKeyGenerateAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerateAsr4_03(uint32 jobId, uint32 keyId) +{ + /* #10 Call Csm_JobKeyGenerate44x */ + return Csm_JobKeyGenerate44x(jobId, keyId); +} /* Csm_JobKeyGenerateAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeyGenerateAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerateAsrR19_11(uint32 jobId, uint32 keyId) +{ + /* #10 Call Csm_JobKeyGenerate44x */ + return Csm_JobKeyGenerate44x(jobId, keyId); +} /* Csm_JobKeyGenerateAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_JobKeySetInvalidAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetInvalidAsr4_03(uint32 jobId, uint32 keyId) +{ + /* #10 Call Csm_JobKeySetInvalid44x */ + return Csm_JobKeySetInvalid44x(jobId, keyId); +} /* Csm_JobKeySetInvalidAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeySetValidAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValidAsr4_03(uint32 jobId, uint32 keyId) +{ + /* #10 Call Csm_JobKeySetValid44x */ + return Csm_JobKeySetValid44x(jobId, keyId); +} /* Csm_JobKeySetValidAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobKeySetValidAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValidAsrR19_11(uint32 jobId, uint32 keyId) +{ + /* #10 Call Csm_JobKeySetValid44x */ + return Csm_JobKeySetValid44x(jobId, keyId); +} /* Csm_JobKeySetValidAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_JobRandomSeedAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeedAsr4_03(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength) +{ + /* #10 Call Csm_JobRandomSeed44x */ + return Csm_JobRandomSeed44x(jobId, keyId, seedPtr, seedLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobRandomSeedAsr4_03() */ + +/********************************************************************************************************************** + * Csm_JobRandomSeedAsrR19_11() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeedAsrR19_11(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength) +{ + /* #10 Call Csm_JobRandomSeed44x */ + return Csm_JobRandomSeed44x(jobId, keyId, seedPtr, seedLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_JobRandomSeedAsrR19_11() */ + +/********************************************************************************************************************** + * Csm_CertificateParseAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateParseAsr4_03(uint32 keyId) +{ + /* #10 Call Csm_CertificateParse */ + return Csm_CertificateParse(keyId); +} /* Csm_CertificateParseAsr4_03() */ + +/********************************************************************************************************************** + * Csm_CertificateVerifyAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateVerifyAsr4_03(uint32 keyId, + uint32 verifyKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr) +{ + /* #10 Call Csm_CertificateVerify */ + return Csm_CertificateVerify(keyId, verifyKeyId, verifyPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_CertificateVerifyAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyCopyAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopyAsr4_03(uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_KeyCopy */ + return Csm_KeyCopy(keyId, targetKeyId); +} /* Csm_KeyCopyAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyCopyAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopyAsr4_04(uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_KeyCopy */ + return Csm_KeyCopy(keyId, targetKeyId); +} /* Csm_KeyCopyAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyDeriveAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDeriveAsr4_03(uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_KeyDerive */ + return Csm_KeyDerive(keyId, targetKeyId); +} /* Csm_KeyDeriveAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyDeriveAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDeriveAsr4_04(uint32 keyId, uint32 targetKeyId) +{ + /* #10 Call Csm_KeyDerive */ + return Csm_KeyDerive(keyId, targetKeyId); +} /* Csm_KeyDeriveAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyElementCopyAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyAsr4_03(uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId) +{ + /* #10 Call Csm_KeyElementCopy */ + return Csm_KeyElementCopy(keyId, keyElementId, targetKeyId, targetKeyElementId); +} /* Csm_KeyElementCopyAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyElementCopyAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyAsr4_04(uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId) +{ + /* #10 Call Csm_KeyElementCopy */ + return Csm_KeyElementCopy(keyId, keyElementId, targetKeyId, targetKeyElementId); +} /* Csm_KeyElementCopyAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyElementCopyPartialAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyPartialAsr4_03(uint32 keyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetKeyId, + uint32 targetKeyElementId) +{ + /* #10 Call Csm_KeyElementCopyPartial */ + return Csm_KeyElementCopyPartial(keyId, + keyElementId, + keyElementSourceOffset, + keyElementTargetOffset, + keyElementCopyLength, + targetKeyId, + targetKeyElementId); +} /* Csm_KeyElementCopyPartialAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyElementGetAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGetAsr4_03(uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr) +{ + /* #10 Call Csm_KeyElementGet */ + return Csm_KeyElementGet(keyId, keyElementId, keyPtr, keyLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyElementGetAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyElementGetAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGetAsr4_04(uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr) +{ + /* #10 Call Csm_KeyElementGet */ + return Csm_KeyElementGet(keyId, keyElementId, keyPtr, keyLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyElementGetAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyElementSetAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementSetAsr4_03(uint32 keyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + uint32 keyLength) +{ + /* #10 Call Csm_KeyElementSet */ + return Csm_KeyElementSet(keyId, keyElementId, keyPtr, keyLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyElementSetAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubValAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubValAsr4_03(uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_KeyExchangeCalcPubVal */ + return Csm_KeyExchangeCalcPubVal(keyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyExchangeCalcPubValAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubValAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubValAsr4_04(uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr) +{ + /* #10 Call Csm_KeyExchangeCalcPubVal */ + return Csm_KeyExchangeCalcPubVal(keyId, publicValuePtr, publicValueLengthPtr); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyExchangeCalcPubValAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecretAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecretAsr4_03(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_KeyExchangeCalcSecret */ + return Csm_KeyExchangeCalcSecret(keyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyExchangeCalcSecretAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecretAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecretAsr4_04(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength) +{ + /* #10 Call Csm_KeyExchangeCalcSecret */ + return Csm_KeyExchangeCalcSecret(keyId, partnerPublicValuePtr, partnerPublicValueLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_KeyExchangeCalcSecretAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeyGenerateAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerateAsr4_03(uint32 keyId) +{ + /* #10 Call Csm_KeyGenerate */ + return Csm_KeyGenerate(keyId); +} /* Csm_KeyGenerateAsr4_03() */ + +/********************************************************************************************************************** + * Csm_KeyGenerateAsr4_04() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerateAsr4_04(uint32 keyId) +{ + /* #10 Call Csm_KeyGenerate */ + return Csm_KeyGenerate(keyId); +} /* Csm_KeyGenerateAsr4_04() */ + +/********************************************************************************************************************** + * Csm_KeySetValidAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetValidAsr4_03(uint32 keyId) +{ + /* #10 Call Csm_KeySetValid */ + return Csm_KeySetValid(keyId); +} /* Csm_KeySetValidAsr4_03() */ + +/********************************************************************************************************************** + * Csm_RandomSeedAsr4_03() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RandomSeedAsr4_03(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength) +{ + /* #10 Call Csm_RandomSeed */ + return Csm_RandomSeed(keyId, seedPtr, seedLength); /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RandomSeedAsr4_03() */ + +/********************************************************************************************************************** + * Csm_SaveContextJobWithVoidPtr() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_SaveContextJobWithVoidPtr(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) contextBufferLengthPtr) +{ + /* #10 Call Csm_SaveContextJob */ + return Csm_SaveContextJob(jobId, (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))contextBufferPtr, contextBufferLengthPtr); /* PRQA S 0316 */ /* MD_CSM_0316 */ /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_SaveContextJobWithVoidPtr() */ + +/********************************************************************************************************************** + * Csm_RestoreContextJobWithVoidPtr() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +FUNC(Std_ReturnType, CSM_CODE) Csm_RestoreContextJobWithVoidPtr(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + uint32 contextBufferLength) +{ + /* #10 Call Csm_RestoreContextJob */ + return Csm_RestoreContextJob(jobId, (P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR))contextBufferPtr, contextBufferLength); /* PRQA S 0316 */ /* MD_CSM_0316 */ /* SBSW_CSM_API_CALL_FORWARDING_PTR_WRAPPER */ +} /* Csm_RestoreContextJobWithVoidPtr() */ + +# define CSM_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* (CSM_RTE_PORTS == STD_ON) */ + +/********************************************************************************************************************** + * END OF FILE: Csm_Rte.c + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm_Rte.h b/Source/bsw/Csm/Csm_Rte.h new file mode 100644 index 0000000..ce06a22 --- /dev/null +++ b/Source/bsw/Csm/Csm_Rte.h @@ -0,0 +1,2903 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/* \file Csm_Rte.h + * \brief MICROSAR Crypto Service Manager (CSM) RTE + * + * \details Description of the MICROSAR Crypto Service Manager (CSM) service APIs used only by RTE + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#if !defined (CSM_RTE_H) +# define CSM_RTE_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Csm.h" + + /* Usage check */ +# if !defined (CSM_RTE_SOURCE) +# error "This is a private header and should only be included by Csm_Rte.c" +# endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + + /********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +# if (CSM_RTE_PORTS == STD_ON) + +# define CSM_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * Csm_HashAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Hash(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the hash shall be computed. + * \param[in] dataLength Contains the number of bytes to be hashed. + * \param[out] resultPtr Contains the pointer to the data where the hash value shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by resultPtr. When the request has finished, the actual length of + * the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_HashAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_HashDataRefAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Hash(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the hash shall be computed. + * \param[in] dataLength Contains the number of bytes to be hashed. + * \param[out] resultPtr Contains the pointer to the data where the hash value shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by resultPtr. When the request has finished, the actual length of + * the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRefAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_HashDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Hash(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the hash shall be computed. + * \param[in] dataLength Contains the number of bytes to be hashed. + * \param[out] resultPtr Contains the pointer to the data where the hash value shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by resultPtr. When the request has finished, the actual length of + * the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_HashDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Hash(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the hash shall be computed. + * \param[in] dataLength Contains the number of bytes to be hashed. + * \param[out] resultPtr Contains the pointer to the data where the hash value shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by resultPtr. When the request has finished, the actual length of + * the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_HashDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerateAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerateAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerateDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacGenerateDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be computed. + * \param[in] dataLength Contains the number of bytes for the MAC generation. + * \param[out] macPtr Contains the pointer to the data where the MAC shall be stored. + * \param[in,out] macLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer provided by macPtr. When the request has finished, the actual length of + * the returned MAC shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacGenerateDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) macPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) macLengthPtr); + +/********************************************************************************************************************** + * Csm_MacVerifyAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_MacVerifyAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_MacVerifyDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_MacVerifyDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_MacVerifyDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_MacVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data for which the MAC shall be verified. + * \param[in] dataLength Contains the number of data bytes for which the MAC shall be verified. + * \param[in] macPtr Holds a pointer to the MAC to be verified. + * \param[in] macLength Contains the MAC length in BITS to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the MAC + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_MacVerifyDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) macPtr, + uint32 macLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_EncryptAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Encrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_EncryptAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Encrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_EncryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Encrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_EncryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Encrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_EncryptDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Encrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be encrypted. + * \param[in] dataLength Contains the number of bytes to encrypt. + * \param[out] resultPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_EncryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_DecryptAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Decrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_DecryptAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Decrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_DecryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Decrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_DecryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Decrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_DecryptDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_Decrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be decrypted. + * \param[in] dataLength Contains the number of bytes to decrypt. + * \param[out] resultPtr Contains the pointer to the data where the decrypted data shall be stored. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the output length information is + * stored in bytes. On calling this function, this parameter shall contain the size + * of the buffer provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_DecryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncryptAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADEncrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncryptAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADEncrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADEncrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADEncrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADEncryptDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADEncrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] plaintextPtr Contains the pointer to the data to be encrypted. + * \param[in] plaintextLength Contains the number of bytes to encrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[out] ciphertextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] ciphertextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the ciphertext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by ciphertextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in,out] tagLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the Tag is stored. On calling this function, this parameter shall contain the + * size of the buffer in bytes provided by tagPtr. When the request has + * finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADEncryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + uint32 plaintextLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) ciphertextLengthPtr, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) tagPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) tagLengthPtr); + +/********************************************************************************************************************** + * Csm_AEADDecryptAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADDecrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_AEADDecryptAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADDecrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADDecrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADDecrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_AEADDecryptDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_AEADDecrypt(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] ciphertextPtr Contains the pointer to the data to be decrypted. + * \param[in] ciphertextLength Contains the number of bytes to decrypt. + * \param[in] associatedDataPtr Contains the pointer to the associated data. + * \param[in] associatedDataLength Contains the number of bytes of the associated data. + * \param[in] tagPtr Contains the pointer to the data where the Tag shall be stored. + * \param[in] tagLength Contains the length in bytes of the Tag to be verified. + * \param[out] plaintextPtr Contains the pointer to the data where the encrypted data shall be stored. + * \param[in,out] plaintextLengthPtr Holds a pointer to the memory location in which the output length in bytes of + * the plaintext is stored. On calling this function, this parameter shall + * contain the size of the buffer in bytes provided by plaintextPtr. When the + * request has finished, the actual length of the returned value shall be stored. + * \param[out] verifyPtr Contains the pointer to the result of the verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_AEADDecryptDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) ciphertextPtr, + uint32 ciphertextLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) associatedDataPtr, + uint32 associatedDataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) tagPtr, + uint32 tagLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) plaintextPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) plaintextLengthPtr, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerateAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] signaturePtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] signatureLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerateAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] signaturePtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] signatureLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] signaturePtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] signatureLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] signaturePtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] signatureLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureGenerateDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be signed. + * \param[in] dataLength Contains the number of bytes to sign. + * \param[out] signaturePtr Contains the pointer to the data where the signature shall be stored. + * \param[in,out] signatureLengthPtr Holds a pointer to the memory location in which the output length in bytes is + * stored. On calling this function, this parameter shall contain the size of the + * buffer in bytes provided by resultPtr. When the request has finished, the actual + * length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureGenerateDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) signatureLengthPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerifyAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyAsr4_03(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerifyAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRefAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRefAsr4_04(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRefAsrR19_11(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_SignatureVerifyDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SignatureVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Indicates which operation mode(s) to perform. + * \param[in] dataPtr Contains the pointer to the data to be verified. + * \param[in] dataLength Contains the number of bytes to be verified. + * \param[in] signaturePtr Holds a pointer to the signature to be verified. + * \param[in] signatureLength Contains the signature length in bytes. + * \param[out] verifyPtr Holds a pointer to the memory location, which will hold the result of the + * signature verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SignatureVerifyDataRef(uint32 jobId, + Crypto_OperationModeType mode, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) dataPtr, + uint32 dataLength, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) signaturePtr, + uint32 signatureLength, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_RandomGenerateAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RandomGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] resultPtr Holds a pointer to the memory location which will hold the result of the + * random number generation. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the result length in bytes + * is stored. On calling this function, this parameter shall contain the + * number of random bytes, which shall be stored to the buffer provided by + * resultPtr. When the request has finished, the actual length of the returned + * value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateAsr4_03(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRefAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RandomGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] resultPtr Holds a pointer to the memory location which will hold the result of the + * random number generation. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the result length in bytes + * is stored. On calling this function, this parameter shall contain the + * number of random bytes, which shall be stored to the buffer provided by + * resultPtr. When the request has finished, the actual length of the returned + * value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRefAsr4_03(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRefAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RandomGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] resultPtr Holds a pointer to the memory location which will hold the result of the + * random number generation. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the result length in bytes + * is stored. On calling this function, this parameter shall contain the + * number of random bytes, which shall be stored to the buffer provided by + * resultPtr. When the request has finished, the actual length of the returned + * value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRefAsrR19_11(uint32 jobId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_RandomGenerateDataRef() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RandomGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] resultPtr Holds a pointer to the memory location which will hold the result of the + * random number generation. + * \param[in,out] resultLengthPtr Holds a pointer to the memory location in which the result length in bytes + * is stored. On calling this function, this parameter shall contain the + * number of random bytes, which shall be stored to the buffer provided by + * resultPtr. When the request has finished, the actual length of the returned + * value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * CRYPTO_E_ENTROPY_EXHAUSTION Request failed, entropy of random number generator is exhausted + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RandomGenerateDataRef(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) resultPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) resultLengthPtr); + +/********************************************************************************************************************** + * Csm_CancelJobAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CancelJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Not used, just for interface compatibility provided + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobAsr4_03(uint32 jobId, Crypto_OperationModeType mode); + +/********************************************************************************************************************** + * Csm_CancelJobAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CancelJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] mode Not used, just for interface compatibility provided + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobAsr4_04(uint32 jobId, Crypto_OperationModeType mode); + +/********************************************************************************************************************** + * Csm_CancelJobNoOpMode() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CancelJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpMode(uint32 jobId); + +/********************************************************************************************************************** + * Csm_CancelJobNoOpModeAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CancelJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpModeAsr4_03(uint32 jobId); + +/********************************************************************************************************************** + * Csm_CancelJobNoOpModeAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CancelJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \return E_OK Request successful - Job was cancelled or was already Idle + * E_NOT_OK Request failed - Job could not be cancelled + * CRYPTO_E_JOB_CANCELED Request pending - Job will be cancelled with next callback notification + * \pre - + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with E_NOT_OK) + * \synchronous TRUE + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CancelJobNoOpModeAsr4_04(uint32 jobId); + +/********************************************************************************************************************** + * Csm_JobKeyDeriveAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyDerive44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDeriveAsr4_03(uint32 jobId, uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_JobKeyDeriveAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyDerive44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyDeriveAsrR19_11(uint32 jobId, uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR21_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcPubVal(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR21_11(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR20_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcPubVal44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR20_11(uint32 jobId, + uint32 keyId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcPubVal44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsr4_03(uint32 jobId, + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcPubValAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcPubVal44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length information + * is stored. On calling this function, this parameter shall contain the size of the buffer provided + * by publicValuePtr. When the request has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcPubValAsrR19_11(uint32 jobId, + uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR21_11_A() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcSecret(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR21_11_A(uint32 jobId, + P2CONST(void, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR21_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcSecret(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR21_11(uint32 jobId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcSecret44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsr4_03(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_JobKeyExchangeCalcSecretAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyExchangeCalcSecret44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyExchangeCalcSecretAsrR19_11(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_JobKeyGenerateAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyGenerate44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerateAsr4_03(uint32 jobId, uint32 keyId); + +/********************************************************************************************************************** + * Csm_JobKeyGenerateAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeyGenerate44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeyGenerateAsrR19_11(uint32 jobId, uint32 keyId); + +/********************************************************************************************************************** + * Csm_JobKeySetInvalidAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeySetInvalid44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetInvalidAsr4_03(uint32 jobId, uint32 keyId); + +/********************************************************************************************************************** + * Csm_JobKeySetValidAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeySetValid44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValidAsr4_03(uint32 jobId, uint32 keyId); + +/********************************************************************************************************************** + * Csm_JobKeySetValidAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobKeySetValid44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobKeySetValidAsrR19_11(uint32 jobId, uint32 keyId); + +/********************************************************************************************************************** + * Csm_JobRandomSeedAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobRandomSeed44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeedAsr4_03(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength); + +/********************************************************************************************************************** + * Csm_JobRandomSeedAsrR19_11() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_JobRandomSeed44x(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] keyId Not used - keyId already given by corresponding job of passed jobId + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_JobRandomSeedAsrR19_11(uint32 jobId, + uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength); + +/********************************************************************************************************************** + * Csm_CertificateParseAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CertificateParse(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key to be used for the certificate parsing. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateParseAsr4_03(uint32 keyId); + +/********************************************************************************************************************** + * Csm_CertificateVerifyAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_CertificateVerify(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which shall be used to validate the certificate. + * \param[in] verifyKeyId Holds the identifier of the key containing the certificate to be verified. + * \param[out] verifyPtr Holds a pointer to the memory location which will contain the result of the certificate + * verification. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_CertificateVerifyAsr4_03(uint32 keyId, + uint32 verifyKeyId, + P2VAR(Crypto_VerifyResultType, AUTOMATIC, CSM_APPL_VAR) verifyPtr); + +/********************************************************************************************************************** + * Csm_KeyCopyAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyCopy(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopyAsr4_03(uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_KeyCopyAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyCopy(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyCopyAsr4_04(uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_KeyDeriveAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyDerive(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDeriveAsr4_03(uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_KeyDeriveAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyDerive(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which is used for key derivation. + * \param[in] targetKeyId Holds the identifier of the key which is used to store the derived key. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_READ_FAIL Request failed, not allowed to extract key element + * CRYPTO_E_KEY_WRITE_FAIL Request failed, not allowed to write key element + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyDeriveAsr4_04(uint32 keyId, uint32 targetKeyId); + +/********************************************************************************************************************** + * Csm_KeyElementCopyAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementCopy(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for + * the copy operation. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination + * for the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyAsr4_03(uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Csm_KeyElementCopyAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementCopy(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for + * the copy operation. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the + * destination element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination + * for the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyAsr4_04(uint32 keyId, + uint32 keyElementId, + uint32 targetKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Csm_KeyElementCopyPartialAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementCopyPartial(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key whose key element shall be the source + * element. + * \param[in] keyElementId Holds the identifier of the key element which shall be the source for the + * copy operation. + * \param[in] keyElementSourceOffset This is the offset of the source key element indicating the start index + * of the copy operation. + * \param[in] keyElementTargetOffset This is the offset of the destination key element indicating the start index + * of the copy operation. + * \param[in] keyElementCopyLength Specifies the number of bytes that shall be copied. + * \param[in] targetKeyId Holds the identifier of the key whose key element shall be the destination + * element. + * \param[in] targetKeyElementId Holds the identifier of the key element which shall be the destination for + * the copy operation. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element sizes are not compatible + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementCopyPartialAsr4_03(uint32 keyId, + uint32 keyElementId, + uint32 keyElementSourceOffset, + uint32 keyElementTargetOffset, + uint32 keyElementCopyLength, + uint32 targetKeyId, + uint32 targetKeyElementId); + +/********************************************************************************************************************** + * Csm_KeyElementGetAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementGet(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key from which a key element shall be + * extracted. + * \param[in] keyElementId Holds the identifier of the key element to be extracted. + * \param[out] keyPtr Holds the pointer to the memory location where the key shall be copied + * to. + * \param[in,out] keyLengthPtr Holds a pointer to the memory location in which the output buffer length + * in bytes is stored. On calling this function, this parameter shall + * contain the buffer length in bytes of the keyPtr. When the request has + * finished, the actual size of the written input bytes shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGetAsr4_03(uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyElementGetAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementGet(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key from which a key element shall be + * extracted. + * \param[in] keyElementId Holds the identifier of the key element to be extracted. + * \param[out] keyPtr Holds the pointer to the memory location where the key shall be copied + * to. + * \param[in,out] keyLengthPtr Holds a pointer to the memory location in which the output buffer length + * in bytes is stored. On calling this function, this parameter shall + * contain the buffer length in bytes of the keyPtr. When the request has + * finished, the actual size of the written input bytes shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_READ_FAIL Request failed because read access was denied + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER The provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementGetAsr4_04(uint32 keyId, + uint32 keyElementId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) keyLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyElementSetAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyElementSet(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key for which a new material shall be set. + * \param[in] keyElementId Holds the identifier of the key element to be written. + * \param[in] keyPtr Holds the pointer to the key element bytes to be processed. + * \param[in] keyLength Contains the number of key element bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_WRITE_FAIL Request failed because write access was denied. + * CRYPTO_E_KEY_NOT_AVAILABLE Request failed because the key is not available + * CRYPTO_E_KEY_SIZE_MISMATCH Request failed, key element size does not match size of provided data. + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyElementSetAsr4_03(uint32 keyId, + uint32 keyElementId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) keyPtr, + uint32 keyLength); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubValAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyExchangeCalcPubVal(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER Request failed because the provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubValAsr4_03(uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcPubValAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyExchangeCalcPubVal(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[out] publicValuePtr Contains the pointer to the data where the public value shall be stored. + * \param[in,out] publicValueLengthPtr Holds a pointer to the memory location in which the public value length + * information is stored. On calling this function, this parameter shall + * contain the size of the buffer provided by publicValuePtr. When the request + * has finished, the actual length of the returned value shall be stored. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * CRYPTO_E_SMALL_BUFFER Request failed because the provided buffer is too small to store the result + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcPubValAsr4_04(uint32 keyId, + P2VAR(uint8, AUTOMATIC, CSM_APPL_VAR) publicValuePtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) publicValueLengthPtr); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecretAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyExchangeCalcSecret(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecretAsr4_03(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_KeyExchangeCalcSecretAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyExchangeCalcSecret(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key which shall be used for the key exchange + * protocol. + * \param[in] partnerPublicValuePtr Holds the pointer to the memory location which contains the partner's + * public value. + * \param[in] partnerPublicValueLength Contains the length of the partner's public value in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyExchangeCalcSecretAsr4_04(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) partnerPublicValuePtr, + uint32 partnerPublicValueLength); + +/********************************************************************************************************************** + * Csm_KeyGenerateAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key for which a new material shall be generated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerateAsr4_03(uint32 keyId); + +/********************************************************************************************************************** + * Csm_KeyGenerateAsr4_04() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeyGenerate(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key for which a new material shall be generated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * CRYPTO_E_KEY_EMPTY Request failed because of uninitialized source key element + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeyGenerateAsr4_04(uint32 keyId); + +/********************************************************************************************************************** + * Csm_KeySetValidAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_KeySetValid(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key for which a new material shall be validated. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_KeySetValidAsr4_03(uint32 keyId); + +/********************************************************************************************************************** + * Csm_RandomSeedAsr4_03() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RandomSeed(). + * \details See original function for behavior, parameter and return value description. + * \param[in] keyId Holds the identifier of the key for which a new seed shall be generated. + * \param[in] seedPtr Holds a pointer to the memory location which contains the data to feed the + * seed. + * \param[in] seedLength Contains the length of the seed in bytes. + * \return E_OK Request successful + * E_NOT_OK Request failed + * CRYPTO_E_BUSY Request failed, Crypto Driver Object is busy + * CRYPTO_E_KEY_NOT_VALID Request failed, the key's state is "invalid" + * \context TASK + * \reentrant TRUE, but not for the same keyId + * \synchronous TRUE + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RandomSeedAsr4_03(uint32 keyId, + P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR) seedPtr, + uint32 seedLength); + +/********************************************************************************************************************** + * Csm_SaveContextJobWithVoidPtr() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_SaveContextJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[out] contextBufferPtr Pointer to the buffer in the application where the context data shall be + * stored to. + * \param[in,out] contextBufferLengthPtr Pointer to the buffer, where the length value is located.As input data it + * provides the maximum length of data available in contextBufferPtr.As + * output data it provides the actual length of data located in context + * BufferPtr(or 0 in case of a failure) + * \return E_OK Context data successfully provided. + * E_NOT_OK Context data could not be provided, values are not valid. + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_SaveContextJobWithVoidPtr(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + P2VAR(uint32, AUTOMATIC, CSM_APPL_VAR) contextBufferLengthPtr); + +/********************************************************************************************************************** + * Csm_RestoreContextJobWithVoidPtr() + *********************************************************************************************************************/ +/*! \brief Wrapper function of Csm_RestoreContextJob(). + * \details See original function for behavior, parameter and return value description. + * \param[in] jobId Holds the identifier of the job using the CSM service. + * \param[in] contextBufferPtr Pointer to the buffer, where the context data are located that + * shall be restored. + * \param[in] contextBufferLength Provides the length of context data that are located in contextBufferPtr. + * \return E_OK Context data successfully restored. + * E_NOT_OK Context data could not be restored. + * CRYPTO_E_BUSY Request failed, service is busy or queue is full + * \context TASK + * \reentrant TRUE, but not for the same jobId (will be rejected with CRYPTO_E_BUSY) + * \synchronous TRUE|FALSE Depends on given job. + * \pre - + * \note Shall only be called by Rte. + * The returned value is defined by the underlying Crypto Driver and may differ from the listed ones. + *********************************************************************************************************************/ +extern FUNC(Std_ReturnType, CSM_CODE) Csm_RestoreContextJobWithVoidPtr(uint32 jobId, + P2VAR(void, AUTOMATIC, CSM_APPL_VAR) contextBufferPtr, + uint32 contextBufferLength); + +# define CSM_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# endif /* (CSM_RTE_PORTS == STD_ON) */ + +#endif /* !defined (CSM_RTE_H) */ +/********************************************************************************************************************** + * END OF FILE: Csm_Rte.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Csm_Types.h b/Source/bsw/Csm/Csm_Types.h new file mode 100644 index 0000000..5a40736 --- /dev/null +++ b/Source/bsw/Csm/Csm_Types.h @@ -0,0 +1,45 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file Csm_Types.h + * \brief MICROSAR Crypto Service Manager (CSM) + * + * \details This header was used to provide the type declarations needed by other modules. Starting with Csm + * version 7.00.00, these type declarations were moved to Crypto_GeneralTypes.h according to AUTOSAR + * R19-11 and later. This header is kept for backward compatibility. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file (Csm.h). + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#if !defined (CSM_TYPES_H) +# define CSM_TYPES_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +# include "Crypto_GeneralTypes.h" + +#endif /* !defined (CSM_TYPES_H) */ + +/********************************************************************************************************************** + * END OF FILE: Csm_Types.h + *********************************************************************************************************************/ diff --git a/Source/bsw/Csm/Make/Csm_cfg.mak b/Source/bsw/Csm/Make/Csm_cfg.mak new file mode 100644 index 0000000..25c76bb --- /dev/null +++ b/Source/bsw/Csm/Make/Csm_cfg.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Csm_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Csm_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefor the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +#CSM_CONFIG_PATH = + + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + +#CSM_DRIVER_MODE = singlechannel + + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/Csm/Make/Csm_check.mak b/Source/bsw/Csm/Make/Csm_check.mak new file mode 100644 index 0000000..c6b4171 --- /dev/null +++ b/Source/bsw/Csm/Make/Csm_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : Csm_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Csm_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/Csm/Make/Csm_defs.mak b/Source/bsw/Csm/Make/Csm_defs.mak new file mode 100644 index 0000000..e3441fe --- /dev/null +++ b/Source/bsw/Csm/Make/Csm_defs.mak @@ -0,0 +1,81 @@ +############################################################################### +# File Name : Csm_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Csm_rules.mak file. +############################################################################### + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... +CSM_CORE_PATH = +# e.g.: CAN_OUTPUT_PATH = $(GENDATA_DIR) +CSM_OUTPUT_PATH = $(GENDATA_DIR) + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: can_DEPENDENT_PLUGINS = +CSM_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += Csm$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/Csm/Make/Csm_rules.mak b/Source/bsw/Csm/Make/Csm_rules.mak new file mode 100644 index 0000000..9672694 --- /dev/null +++ b/Source/bsw/Csm/Make/Csm_rules.mak @@ -0,0 +1,102 @@ +############################################################################### +# File Name : Csm_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2012-10-01 visrpp Creation for ASR 4.0.3 +# 1.00.01 2017-08-21 visrpp Updated to new template +# 1.01.00 2019-02-06 vircbl Added support of component-based SIP structure +# 1.02.00 2019-11-25 visenc Added new file +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += $(LIB_OUPUT_PATH)\vendorx_canlib1.$(LIB_FILE_SUFFIX) +LIBRARIES_TO_BUILD += Csm +Csm_FILES = Csm$(BSW_SRC_DIR)\Csm.c Csm$(BSW_SRC_DIR)\Csm_Rte.c + +# e.g.: CC_FILES_TO_BUILD += drv\can_drv.c +CC_FILES_TO_BUILD += Csm$(BSW_SRC_DIR)\Csm.c Csm$(BSW_SRC_DIR)\Csm_Rte.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\Csm_*Cfg.c + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: + #$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/Det/Det.c b/Source/bsw/Det/Det.c new file mode 100644 index 0000000..1c4b89e --- /dev/null +++ b/Source/bsw/Det/Det.c @@ -0,0 +1,1055 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file Det.c + * \brief Default Error Tracer source file + * + * \details Contains the implementation of static and API functions. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define DET_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + + #include "Det.h" + #include "Det_Private_Cfg.h" + +/* use internal target define to handle DualTarget use case where the DET_PROCESSOR_ switch is generated for the real target */ +#if defined (DET_PROCESSOR_CANOEEMU) || defined (VVIRTUALTARGET) +# define DET_TARGET_CANOEEMU +#endif + +#if defined (DET_TARGET_CANOEEMU) +# include /* PRQA S 5124 */ /* MD_DET_5124 */ /* simulation environment, no production code */ +# include "CANoeApi.h" +# if (CANOEAPI_VERSION >= 239) /* COV_DET_CANOE_VTT */ +# include "CANoeEmuProcessor.h" +# endif +# if (_MSC_VER >= 1400) /* COV_DET_CANOE_VTT */ +# include +# include /* PRQA S 5127 */ /* MD_DET_5127 */ /* simulation environment, no production code */ +# endif + /* detect VTT use case */ +# if (CANOEAPI_VERSION >= 200) /* COV_DET_CANOE_VTT */ +# if defined (VVIRTUALTARGET) +# define DET_VTTUSECASE +# endif +# else +# if defined (_MICROSOFT_C_VTT_) /* COV_DET_CANOE_VTT */ +# define DET_VTTUSECASE +# endif +# endif +#endif /* (DET_TARGET_CANOEEMU) */ + +#if (DET_DEBUG_ENABLED == STD_ON) +# include "SchM_Det.h" +#endif + +#if (DET_FORWARD_TO_DEM == STD_ON) +# include "Dem.h" +#endif + +#if (DET_FORWARD_TO_DLT == STD_ON) +# include "Dlt.h" +#endif + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + +/** + * Version check for source and header file consistency + */ +#if (DET_SW_MAJOR_VERSION != 25) +# error "Source and Header file are inconsistent!" +#endif + +#if (DET_SW_MINOR_VERSION != 0) +# error "Source and Header file are inconsistent!" +#endif + +#if (DET_SW_PATCH_VERSION != 0) +# error "Source and Header file are inconsistent!" +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + **********************************************************************************************************************/ + + +/********************** compiler abstraction *******************************/ +#if !defined (DET_LOCAL) /* COV_DET_COMPATIBILITY */ +# define DET_LOCAL static /* standard AutoSar 4.x define */ +#endif + +#if !defined (DET_LOCAL_INLINE) /* COV_DET_COMPATIBILITY */ +# if defined (LOCAL_INLINE) /* COV_DET_COMPATIBILITY */ +# define DET_LOCAL_INLINE LOCAL_INLINE +# else +# define DET_LOCAL_INLINE DET_LOCAL +# endif +#endif + +#if (DET_ENABLED == STD_ON) + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + **********************************************************************************************************************/ + +/* critical section macros \trace DSGN-Det22791 */ +# define Det_EnterCritical() SchM_Enter_Det_DET_EXCLUSIVE_AREA_0() +# define Det_LeaveCritical() SchM_Exit_Det_DET_EXCLUSIVE_AREA_0() + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + **********************************************************************************************************************/ + +# define DET_START_SEC_VAR_INIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +DET_LOCAL volatile VAR(boolean, DET_VAR) detModuleInit = FALSE; + +# define DET_STOP_SEC_VAR_INIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define DET_START_SEC_VAR_NOINIT_8BIT +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (DET_REPORT_ERROR_RECURSIONLIMIT > 0) +DET_LOCAL volatile VAR(uint8, DET_VAR) detRecursionCounterReportError; /* recursion limit counter \trace DSGN-Det22792 */ +# endif + +# if (DET_REPORT_RUNTIMEERROR_RECURSIONLIMIT > 0) +DET_LOCAL volatile VAR(uint8, DET_VAR) detRecursionCounterReportRuntimeError; /* recursion limit counter \trace DSGN-Det22792 */ +# endif + +# if (DET_REPORT_TRANSIENTFAULT_RECURSIONLIMIT > 0) +DET_LOCAL volatile VAR(uint8, DET_VAR) detRecursionCounterReportTransientFault; /* recursion limit counter \trace DSGN-Det22792 */ +# endif + +# define DET_STOP_SEC_VAR_NOINIT_8BIT +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +# define DET_START_SEC_VAR_NOINIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (DET_DEBUG_ENABLED == STD_ON) + +/* global variables, should be put in a watch window */ +# if (DET_GLOBALFILTERSIZE > 0) +volatile VAR(DetInfoType, DET_VAR) detGlobalFilter[DET_GLOBALFILTERSIZE]; /* ##### use this variable to configure global filters */ /* PRQA S 1504 */ /* MD_MSR_Rule8.7 */ +# endif +# if (DET_BREAKFILTERSIZE > 0) +volatile VAR(DetInfoType, DET_VAR) detBreakFilter[DET_BREAKFILTERSIZE]; /* ##### use this variable to configure break filters */ /* PRQA S 1504 */ /* MD_MSR_Rule8.7 */ +# endif +# if (DET_DLTFILTERSIZE > 0) +volatile VAR(DetInfoType, DET_VAR) detDltFilter[DET_DLTFILTERSIZE]; /* ##### use this variable to configure dlt filters */ /* PRQA S 1504 */ /* MD_MSR_Rule8.7 */ +# endif +# if (DET_LOGBUFFERSIZE > 0) +volatile VAR(DetInfoType, DET_VAR) detLogBuffer[DET_LOGBUFFERSIZE]; /* ##### use this variable to view log buffer */ /* PRQA S 1504 */ /* MD_MSR_Rule8.7 */ +# endif +volatile VAR(DetStatusType, DET_VAR) detStatus; /* ##### use this variable to configure DET debug operation */ /* PRQA S 1504 */ /* MD_MSR_Rule8.7 */ + +# endif /* DET_DEBUG_ENABLED */ + +# define DET_STOP_SEC_VAR_NOINIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +# define DET_START_SEC_CODE +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (DET_DEBUG_ENABLED == STD_ON) +/*********************************************************************************************************************** + * Det_CheckFilterMatch() + **********************************************************************************************************************/ +/*! \brief Check if a DET error matches filter conditions + * \details A filter match is detected if all structure members of at least one filter and detInfo are identical + * or the non-identical ones are don't care (0xFF). + * \param[in] filter pointer to an array of filters + * \param[in] size number of filters + * \param[in] active flag to indicate if filter is active + * \param[in] detInfo pointer to structure holding DET error for filtering + * \return FALSE: no filter match, TRUE: filter match + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-Det22783, DSGN-Det22785 + **********************************************************************************************************************/ +# if (DET_GLOBALFILTERSIZE > 0) || (DET_BREAKFILTERSIZE > 0) +DET_LOCAL_INLINE FUNC(boolean, DET_CODE) Det_CheckFilterMatch( volatile P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) filter, uint8 size, boolean active, P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) detInfo ); +# endif + +/*********************************************************************************************************************** + * Det_LogError() + **********************************************************************************************************************/ +/*! \brief Store a DET error in the log buffer + * \details It is further detected if an overrun occurs and if a forced break handler call is required. + * \param[in] active flag to indicate if logging is active + * \param[in] detInfo pointer to structure holding DET error for filtering + * \return FALSE: do not force break handler call, TRUE: force break handler call + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \trace DSGN-Det22792, DSGN-Det22784 + **********************************************************************************************************************/ +# if (DET_LOGBUFFERSIZE > 0) +DET_LOCAL_INLINE FUNC(boolean, DET_CODE) Det_LogError( boolean active, P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) detInfo ); +# endif + +# endif /* DET_DEBUG_ENABLED */ + +/*********************************************************************************************************************** + * Det_CanoeOutput() + **********************************************************************************************************************/ +/*! \brief Output DET error information in CANoe + * \details Its behavior depends on the version of the simulation environment. + * \param[in] ModuleId Module ID of calling module + * \param[in] InstanceId The identifier of the index based instance of a module + * \param[in] ApiId ID of API service in which error is detected + * \param[in] ErrorId ID of detected development error + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + **********************************************************************************************************************/ +# if defined (DET_TARGET_CANOEEMU) +DET_LOCAL_INLINE FUNC(void, DET_CODE) Det_CanoeOutput( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ); +# endif + +/*********************************************************************************************************************** + * Det_EndlessLoop() + **********************************************************************************************************************/ +/*! \brief Enter endless loop + * \details Used to stop further processing. + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + **********************************************************************************************************************/ +DET_LOCAL FUNC(void, DET_CODE) Det_EndlessLoop( void ); + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +# if (DET_DEBUG_ENABLED == STD_ON) +/*********************************************************************************************************************** + * Det_CheckFilterMatch() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + **********************************************************************************************************************/ +# if (DET_GLOBALFILTERSIZE > 0) || (DET_BREAKFILTERSIZE > 0) +DET_LOCAL_INLINE FUNC(boolean, DET_CODE) Det_CheckFilterMatch( volatile P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) filter, uint8 size, boolean active, P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) detInfo ) +{ + VAR(uint8_least, AUTOMATIC) i; + VAR (boolean, AUTOMATIC) retval = FALSE; /* no filter match */ + /* #10 if filter is active */ + if(active == TRUE) + { + /* #20 linear search over all filters */ + for(i = 0; i < size; i++) + { + /* #30 compare each structure member if it is identical or if filter is set to don't care */ + if( + ((filter[i].mModuleId == detInfo->mModuleId) || (filter[i].mModuleId == DET_DONTCARE_16)) && + ((filter[i].mInstanceId == detInfo->mInstanceId) || (filter[i].mInstanceId == DET_DONTCARE_8)) && + ((filter[i].mApiId == detInfo->mApiId) || (filter[i].mApiId == DET_DONTCARE_8)) && + ((filter[i].mErrorId == detInfo->mErrorId) || (filter[i].mErrorId == DET_DONTCARE_8)) + ) + { + retval = TRUE; + break; + } + } + } + return retval; +} +# endif + +/*********************************************************************************************************************** + * Det_LogError() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + **********************************************************************************************************************/ +# if (DET_LOGBUFFERSIZE > 0) +DET_LOCAL_INLINE FUNC(boolean, DET_CODE) Det_LogError( boolean active, P2CONST( DetInfoType, AUTOMATIC, DET_VAR ) detInfo ) +{ + VAR (boolean, AUTOMATIC) forceBreakHandler = FALSE; /* do not force break handler call */ + + /* #10 if logging is active */ + if(active == TRUE) + { + Det_EnterCritical(); + detStatus.logIndex++; /* PRQA S 3387 */ /* MD_DET_3387 */ + /* #20 if overrun of circular buffer occurs */ + if(detStatus.logIndex >= DET_LOGBUFFERSIZE) + { + detStatus.logIndex = 0; + /* #30 if break on overrun is active set return value to force break handler call */ +# if (DET_BREAKFILTERSIZE > 0) + if(detStatus.breakOnLogOverrun == TRUE) + { + forceBreakHandler = TRUE; + } +# endif + } + /* #40 store DET error in log buffer */ + detLogBuffer[detStatus.logIndex].mModuleId = detInfo->mModuleId; /* SBSW_DET_1 */ + detLogBuffer[detStatus.logIndex].mInstanceId = detInfo->mInstanceId; /* SBSW_DET_1 */ + detLogBuffer[detStatus.logIndex].mApiId = detInfo->mApiId; /* SBSW_DET_1 */ + detLogBuffer[detStatus.logIndex].mErrorId = detInfo->mErrorId; /* SBSW_DET_1 */ + Det_LeaveCritical(); + } + return forceBreakHandler; +} +# endif + +# endif /* DET_DEBUG_ENABLED */ + +/*********************************************************************************************************************** + * Det_CanoeOutput() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + **********************************************************************************************************************/ +# if defined (DET_TARGET_CANOEEMU) +DET_LOCAL_INLINE FUNC(void, DET_CODE) Det_CanoeOutput( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ) +{ +# if defined (DET_VTTUSECASE) + /* #10 if VIP is configured forward error to CANoe API */ + (void) CANoeAPI_DetReportError(ModuleId, InstanceId, ApiId, ErrorId); +# else + /* #20 else format error string and output it in the CANoe write window */ + { + char str[255]; /* PRQA S 5013 */ /* MD_DET_5013 */ + +# if (_MSC_VER >= 1400) /* COV_DET_CANOE_VTT */ + time_t timeVal; + struct tm timeS; + + (void) time(&timeVal); /* PRQA S 5127,5139 */ /* MD_DET_5127 */ /* simulation environment, no production code */ /* SBSW_DET_3 */ + (void) localtime_s(&timeS, &timeVal); /* PRQA S 5127,5139 */ /* MD_DET_5127 */ /* simulation environment, no production code */ /* SBSW_DET_3 */ + + (void) strftime(str, sizeof(str), "%H:%M:%S", &timeS); /* PRQA S 5127,5139 */ /* MD_DET_5127 */ /* simulation environment, no production code */ /* SBSW_DET_3 */ + + (void) sprintf_s(str + strlen(str), sizeof(str) - strlen(str), /* PRQA S 0488 */ /* MD_DET_0488 */ /* simulation environment, no production code */ /* SBSW_DET_3 */ /* VCA_DET_1 */ + " DET Error: ModuleId 0x%x, InstanceId 0x%x, ApiId 0x%x, ErrorId 0x%x", ModuleId, InstanceId, ApiId, ErrorId); +# else + (void) sprintf(str, "DET Error: ModuleId 0x%x, InstanceId 0x%x, ApiId 0x%x, ErrorId 0x%x", /* SBSW_DET_3 */ /* VCA_DET_1 */ + ModuleId, InstanceId, ApiId, ErrorId); +# endif + CANoeAPI_WriteString((const char *)str); /* PRQA S 5013 */ /* MD_DET_5013 */ /* SBSW_DET_3 */ + } +# endif +} +# endif + +/*********************************************************************************************************************** + * Det_EndlessLoop() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + **********************************************************************************************************************/ +DET_LOCAL FUNC(void, DET_CODE) Det_EndlessLoop( void ) +{ +# if (DET_DEBUG_ENABLED == STD_ON) +# if ! defined (DET_REGRESSION_TEST) /* COV_DET_TEST_CODE */ + while(detStatus.unlockBreak == FALSE) /* set this variable to TRUE=1 to unlock breakpoint */ +# endif +# else +# if ! defined (DET_REGRESSION_TEST) /* COV_DET_TEST_CODE */ + while(1) +# endif +# endif + { + ; /* ##### typical place for a breakpoint if extended debugging support is enabled */ +# if defined (DET_TARGET_CANOEEMU) +# if (CANOEAPI_VERSION < 200) /* COV_DET_CANOE_VTT */ + break; +# elif (CANOEAPI_VERSION < 239) /* COV_DET_CANOE_VTT */ + CANoeAPI_ConsumeTicks(1000); +# else +# if (DET_DEBUG_ENABLED == STD_ON) + { + sint64 nanoseconds = 100000000LL; /* 100ms */ + CANoeAPI_ConsumeTime(nanoseconds); + } +# else + CANoeEmuProcessor_EndlessLoop(); +# endif +# endif +# endif + } +# if (DET_DEBUG_ENABLED == STD_ON) +# if ! defined (DET_REGRESSION_TEST) /* COV_DET_TEST_CODE */ + detStatus.unlockBreak = FALSE; /* PRQA S 2880 */ /* MD_MSR_Unreachable */ +# else + detStatus.unlockBreak = TRUE; /* PRQA S 2880 */ /* MD_MSR_Unreachable */ +# endif +# endif +} + + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/********************************************************************************************************************** + * Det_Init() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_Init( CONSTP2CONST(Det_ConfigPtrType, AUTOMATIC, DET_CONST ) ConfigPtr ) /* PRQA S 1505 */ /* MD_MSR_Rule8.7 */ +{ +# if (DET_DEBUG_ENABLED == STD_ON) +# if (DET_GLOBALFILTERSIZE > 0) || (DET_BREAKFILTERSIZE > 0) || (DET_LOGBUFFERSIZE > 0) + VAR(uint8_least, AUTOMATIC) i; +# endif + detStatus.globalFilterActive = FALSE; + detStatus.logActive = FALSE; + detStatus.logIndex = 0; + detStatus.breakOnLogOverrun = FALSE; + detStatus.breakFilterActive = FALSE; + detStatus.unlockBreak = FALSE; +# if (DET_GLOBALFILTERSIZE > 0) + for(i = 0; i < DET_GLOBALFILTERSIZE; i++) + { + detGlobalFilter[i].mModuleId = 0; /* SBSW_DET_2 */ + detGlobalFilter[i].mInstanceId = 0; /* SBSW_DET_2 */ + detGlobalFilter[i].mApiId = 0; /* SBSW_DET_2 */ + detGlobalFilter[i].mErrorId = 0; /* SBSW_DET_2 */ + } +# endif +# if (DET_BREAKFILTERSIZE > 0) + for(i = 0; i < DET_BREAKFILTERSIZE; i++) + { + detBreakFilter[i].mModuleId = 0; /* SBSW_DET_2 */ + detBreakFilter[i].mInstanceId = 0; /* SBSW_DET_2 */ + detBreakFilter[i].mApiId = 0; /* SBSW_DET_2 */ + detBreakFilter[i].mErrorId = 0; /* SBSW_DET_2 */ + } +# endif +# if (DET_DLTFILTERSIZE > 0) + for(i = 0; i < DET_DLTFILTERSIZE; i++) + { + detDltFilter[i].mModuleId = 0; /* SBSW_DET_2 */ + detDltFilter[i].mInstanceId = 0; /* SBSW_DET_2 */ + detDltFilter[i].mApiId = 0; /* SBSW_DET_2 */ + detDltFilter[i].mErrorId = 0; /* SBSW_DET_2 */ + } +# endif +# if (DET_LOGBUFFERSIZE > 0) + for(i = 0; i < DET_LOGBUFFERSIZE; i++) + { + detLogBuffer[i].mModuleId = 0; /* SBSW_DET_2 */ + detLogBuffer[i].mInstanceId = 0; /* SBSW_DET_2 */ + detLogBuffer[i].mApiId = 0; /* SBSW_DET_2 */ + detLogBuffer[i].mErrorId = 0; /* SBSW_DET_2 */ + } +# endif +# endif + +# if (DET_REPORT_ERROR_RECURSIONLIMIT > 0) + detRecursionCounterReportError = 0; /* reset recursion limit counter */ +# endif + +# if (DET_REPORT_RUNTIMEERROR_RECURSIONLIMIT > 0) + detRecursionCounterReportRuntimeError = 0; /* reset recursion limit counter */ +# endif + +# if (DET_REPORT_TRANSIENTFAULT_RECURSIONLIMIT > 0) + detRecursionCounterReportTransientFault = 0; /* reset recursion limit counter */ +# endif + + DET_DUMMY_STATEMENT_CONST(ConfigPtr); /* is never used */ /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + + detModuleInit = TRUE; +} + +/*********************************************************************************************************************** + * Det_Start() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_Start( void ) /* PRQA S 1505 */ /* MD_MSR_Rule8.7 */ +{ +# if (DET_FORWARD_TO_DEM == STD_ON) + VAR(Det_DemForwardingTableIterType, AUTOMATIC) indexDemForward; + /* #10 initialize Dem Event status (if configured) */ + for(indexDemForward=0; indexDemForward 0) && (DET_BREAKFILTERSIZE > 0) + VAR(boolean, AUTOMATIC) forceBreakHandler; +# endif +# if (DET_GLOBALFILTERSIZE > 0) || (DET_BREAKFILTERSIZE > 0) || (DET_LOGBUFFERSIZE > 0) || ((DET_FORWARD_TO_DLT == STD_ON) && (DET_DLTFILTERSIZE > 0)) + VAR(DetInfoType, AUTOMATIC) detInfo; + detInfo.mModuleId = ModuleId; + detInfo.mInstanceId = InstanceId; + detInfo.mApiId = ApiId; + detInfo.mErrorId = ErrorId; +# endif +# endif + +# if defined (DET_TARGET_CANOEEMU) + /* #10 forward DET error to CANoe if configured */ + Det_CanoeOutput(ModuleId, InstanceId, ApiId, ErrorId); +# else +# if (DET_FORWARD_TO_DLT == STD_OFF) && (DET_ERROR_HOOK_ENABLED == STD_OFF ) && ((DET_DEBUG_ENABLED == STD_OFF) || \ + ((DET_DEBUG_ENABLED == STD_ON) && (DET_GLOBALFILTERSIZE==0) && (DET_LOGBUFFERSIZE==0) && (DET_BREAKFILTERSIZE==0))) /* COV_DET_DUMMY_STMT */ + DET_DUMMY_STATEMENT(ModuleId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(InstanceId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ApiId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ErrorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ +# endif +# endif + + /* #40 if DET is initialized: */ + if(detModuleInit == TRUE) /* in case of call to uninitialized DET return */ + { + /* #45 increment nesting counter for recursion detection */ +# if (DET_REPORT_ERROR_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportError++; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); + if(detRecursionCounterReportError > DET_REPORT_ERROR_RECURSIONLIMIT) + { + Det_EndlessLoop(); + } + else +#endif + { + /* #50 call error hooks (if configured) */ +# if (DET_ERROR_HOOK_ENABLED == STD_ON ) + for(index = 0; index < Det_GetSizeOfErrorHookTable(); index++) + { + calloutReturn = Det_GetErrorHookTable(index)(ModuleId, InstanceId, ApiId, ErrorId); /* SBSW_DET_4 */ + } +# endif + +# if (DET_FORWARD_TO_DLT == STD_ON) + /* #60 forward DET error to DLT module (if configured) unless filtered out by a DLT filter */ +# if (DET_DEBUG_ENABLED == STD_ON) && (DET_DLTFILTERSIZE > 0) + if(Det_CheckFilterMatch(detDltFilter, DET_DLTFILTERSIZE, detStatus.dltFilterActive, &detInfo) == FALSE) /* SBSW_DET_6 */ +# endif + { + Dlt_DetForwardErrorTrace(ModuleId, InstanceId, ApiId, ErrorId); + } +# endif + + +# if (DET_ERROR_HOOK_ENABLED == STD_ON ) + /* if last error hook (if configured) returned E_OK: */ + if(calloutReturn == E_OK) +# endif + { + +# if (DET_DEBUG_ENABLED == STD_ON) + /* #70 check for global filter match (if configured), in case of no match continue */ +# if (DET_GLOBALFILTERSIZE > 0) + if(Det_CheckFilterMatch(detGlobalFilter, DET_GLOBALFILTERSIZE, detStatus.globalFilterActive, &detInfo) == FALSE) /* SBSW_DET_6 */ +# endif + { +# if (DET_LOGBUFFERSIZE > 0) +# if (DET_BREAKFILTERSIZE > 0) + /* #80 store DET error in log buffer (if configured) */ + forceBreakHandler = Det_LogError(detStatus.logActive, &detInfo); /* SBSW_DET_6 */ +# else + (void) Det_LogError(detStatus.logActive, &detInfo); /* SBSW_DET_6 */ +# endif +# endif + /* #90 check for break filter match or forced break handler call (if configured), in case of no match continue */ +# if (DET_BREAKFILTERSIZE > 0) + if((Det_CheckFilterMatch(detBreakFilter, DET_BREAKFILTERSIZE, detStatus.breakFilterActive, &detInfo) == FALSE) /* SBSW_DET_6 */ +# if (DET_LOGBUFFERSIZE > 0) + || (forceBreakHandler == TRUE) +# endif + ) +# endif + { + /* #100 enter endless loop - in variant with debug support loop can be left by setting a flag */ + Det_EndlessLoop(); + } + } +# else /* DET_DEBUG_ENABLED */ + /* in variant without debug support it is not possible to leave the endless loop on a real target */ + Det_EndlessLoop(); /*lint !e522 */ +# endif /* DET_DEBUG_ENABLED */ + + } + } + /* #110 decrement nesting counter for recursion detection */ +# if (DET_REPORT_ERROR_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportError--; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); +#endif + } + + return E_OK; +} /* Det_ReportError */ + + +/*********************************************************************************************************************** + * Det_ReportRuntimeError() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + **********************************************************************************************************************/ +/* PRQA S 6050, 6080 1 */ /* MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, DET_CODE) Det_ReportRuntimeError( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ) /* PRQA S 1505 */ /* MD_MSR_Rule8.7 */ /*lint -e{438} */ +{ +# if (DET_RUNTIME_ERROR_CALLOUT_ENABLED == STD_ON) + VAR(Std_ReturnType, AUTOMATIC) calloutReturn = E_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + VAR(uint8_least, AUTOMATIC) index; +# endif +# if (DET_FORWARD_TO_DEM == STD_ON) + VAR(Det_DemForwardingTableIterType, AUTOMATIC) indexDemForward; +# endif +# if (DET_DEBUG_ENABLED == STD_ON) +# if (DET_LOGBUFFERSIZE > 0) || ((DET_FORWARD_TO_DLT == STD_ON) && (DET_DLTFILTERSIZE > 0)) + VAR(DetInfoType, AUTOMATIC) detInfo; + detInfo.mModuleId = ModuleId; + detInfo.mInstanceId = InstanceId; + detInfo.mApiId = ApiId; + detInfo.mErrorId = ErrorId; +# endif +# endif + +# if defined (DET_TARGET_CANOEEMU) + /* #10 forward DET error to CANoe if configured */ + Det_CanoeOutput(ModuleId, InstanceId, ApiId, ErrorId); +# else +# if (DET_FORWARD_TO_DLT == STD_OFF) && (DET_RUNTIME_ERROR_CALLOUT_ENABLED == STD_OFF ) && ((DET_DEBUG_ENABLED == STD_OFF) || \ + ((DET_DEBUG_ENABLED == STD_ON) && (DET_LOGBUFFERSIZE==0) )) /* COV_DET_DUMMY_STMT */ + DET_DUMMY_STATEMENT(ModuleId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(InstanceId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ApiId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ErrorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ +# endif +# endif + + /* #40 if DET is initialized: */ + if(detModuleInit == TRUE) /* in case of call to uninitialized DET return */ + { + /* #45 increment nesting counter for recursion detection */ +# if (DET_REPORT_RUNTIMEERROR_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportRuntimeError++; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); + if(detRecursionCounterReportRuntimeError > DET_REPORT_RUNTIMEERROR_RECURSIONLIMIT) + { + Det_EndlessLoop(); + } + else +# endif + { + /* #50 call runtime error callouts (if configured) */ +# if (DET_RUNTIME_ERROR_CALLOUT_ENABLED == STD_ON) + for(index = 0; index < Det_GetSizeOfRuntimeErrorCalloutTable(); index++) + { + calloutReturn = Det_GetRuntimeErrorCalloutTable(index)(ModuleId, InstanceId, ApiId, ErrorId); /* SBSW_DET_4 */ + } +# endif + +# if (DET_FORWARD_TO_DLT == STD_ON) + /* #60 forward DET error to DLT module (if configured) unless filtered out by a DLT filter */ +# if (DET_DEBUG_ENABLED == STD_ON) && (DET_DLTFILTERSIZE > 0) + if(Det_CheckFilterMatch(detDltFilter, DET_DLTFILTERSIZE, detStatus.dltFilterActive, &detInfo) == FALSE) /* SBSW_DET_6 */ +# endif + { + Dlt_DetForwardErrorTrace(ModuleId, InstanceId, ApiId, ErrorId); + } +# endif + +# if (DET_FORWARD_TO_DEM == STD_ON) + { +# if (DET_OSAPPLICATIONIDOFDEMFORWARDINGTABLE == STD_ON) + VAR(ApplicationType, AUTOMATIC) applicationId = GetApplicationID(); +# endif + /* #62 forward DET error to DEM module (if configured) */ + for(indexDemForward=0; indexDemForward 0) + /* #80 store DET error in log buffer (if configured) */ + (void) Det_LogError(detStatus.logActive, &detInfo); /* SBSW_DET_6 */ +# endif +# endif + } + } + /* #110 decrement nesting counter for recursion detection */ +# if (DET_REPORT_RUNTIMEERROR_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportRuntimeError--; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); +#endif + } + + return E_OK; +} /* Det_ReportRuntimeError */ + + +/*********************************************************************************************************************** + * Det_ReportTransientFault() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + **********************************************************************************************************************/ +/* PRQA S 6050, 6080 1 */ /* MD_MSR_STCAL, MD_MSR_STMIF */ +FUNC(Std_ReturnType, DET_CODE) Det_ReportTransientFault( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ) /* PRQA S 1505 */ /* MD_MSR_Rule8.7 */ /*lint -e{438} */ +{ +# if (DET_TRANSIENT_FAULT_CALLOUT_ENABLED == STD_ON) + VAR(Std_ReturnType, AUTOMATIC) calloutReturn = E_OK; /* PRQA S 2981 */ /* MD_MSR_RetVal */ + VAR(uint8_least, AUTOMATIC) index; +# endif +# if (DET_DEBUG_ENABLED == STD_ON) +# if (DET_LOGBUFFERSIZE > 0) || ((DET_FORWARD_TO_DLT == STD_ON) && (DET_DLTFILTERSIZE > 0)) + VAR(DetInfoType, AUTOMATIC) detInfo; + detInfo.mModuleId = ModuleId; + detInfo.mInstanceId = InstanceId; + detInfo.mApiId = ApiId; + detInfo.mErrorId = ErrorId; +# endif +# endif + +# if defined (DET_TARGET_CANOEEMU) + /* #10 forward DET error to CANoe if configured */ + Det_CanoeOutput(ModuleId, InstanceId, ApiId, ErrorId); +# else +# if (DET_FORWARD_TO_DLT == STD_OFF) && (DET_TRANSIENT_FAULT_CALLOUT_ENABLED == STD_OFF ) && ((DET_DEBUG_ENABLED == STD_OFF) || \ + ((DET_DEBUG_ENABLED == STD_ON) && (DET_LOGBUFFERSIZE==0) )) /* COV_DET_DUMMY_STMT */ + DET_DUMMY_STATEMENT(ModuleId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(InstanceId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ApiId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ + DET_DUMMY_STATEMENT(ErrorId); /* PRQA S 1338, 2983, 3112 */ /* MD_MSR_DummyStmt */ /*lint -e{438} */ +# endif +# endif + + /* #40 if DET is initialized: */ + if(detModuleInit == TRUE) /* in case of call to uninitialized DET return */ + { + /* #45 increment nesting counter for recursion detection */ +# if (DET_REPORT_TRANSIENTFAULT_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportTransientFault++; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); + if(detRecursionCounterReportTransientFault > DET_REPORT_TRANSIENTFAULT_RECURSIONLIMIT) + { + Det_EndlessLoop(); + } + else +# endif + { + /* call transient fault callouts (if configured) */ +# if (DET_TRANSIENT_FAULT_CALLOUT_ENABLED == STD_ON) + for(index = 0; index < Det_GetSizeOfTransientFaultCalloutTable(); index++) + { + calloutReturn |= Det_GetTransientFaultCalloutTable(index)(ModuleId, InstanceId, ApiId, ErrorId); /* SBSW_DET_4 */ + } +# endif + +# if (DET_FORWARD_TO_DLT == STD_ON) + /* #60 forward DET error to DLT module (if configured) unless filtered out by a DLT filter */ +# if (DET_DEBUG_ENABLED == STD_ON) && (DET_DLTFILTERSIZE > 0) + if(Det_CheckFilterMatch(detDltFilter, DET_DLTFILTERSIZE, detStatus.dltFilterActive, &detInfo) == FALSE) /* SBSW_DET_6 */ +# endif + { + Dlt_DetForwardErrorTrace(ModuleId, InstanceId, ApiId, ErrorId); + } +# endif + +# if (DET_DEBUG_ENABLED == STD_ON) +# if (DET_LOGBUFFERSIZE > 0) + /* #80 store DET error in log buffer (if configured) */ + (void) Det_LogError(detStatus.logActive, &detInfo); /* SBSW_DET_6 */ +# endif +# endif + } + /* #110 decrement nesting counter for recursion detection */ +# if (DET_REPORT_TRANSIENTFAULT_RECURSIONLIMIT > 0) + Det_EnterCritical(); + detRecursionCounterReportTransientFault--; /* PRQA S 3387 */ /* MD_DET_3387 */ + Det_LeaveCritical(); +#endif + } + +# if (DET_TRANSIENT_FAULT_CALLOUT_ENABLED == STD_ON) + /* #120 use return value of last transient fault callout (if configured) */ + return calloutReturn; +# else + return E_OK; +# endif +} /* Det_ReportTransientFault */ + + +# if (DET_VERSION_INFO_API == STD_ON) +/*********************************************************************************************************************** + * Det_GetVersionInfo() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_GetVersionInfo( P2VAR( Std_VersionInfoType, AUTOMATIC, DET_APPL_DATA ) versioninfo ) /* PRQA S 1505 */ /* MD_MSR_Rule8.7 */ +{ + /* #10 if versioninfo is no NULL pointer */ + if(versioninfo != NULL_PTR) + { + /* #20 fill versions from defines into versioninfo structure */ + versioninfo->vendorID = DET_VENDOR_ID; /* SBSW_DET_7 */ + versioninfo->moduleID = DET_MODULE_ID; /* SBSW_DET_7 */ + versioninfo->sw_major_version = DET_SW_MAJOR_VERSION; /* SBSW_DET_7 */ + versioninfo->sw_minor_version = DET_SW_MINOR_VERSION; /* SBSW_DET_7 */ + versioninfo->sw_patch_version = DET_SW_PATCH_VERSION; /* SBSW_DET_7 */ + } + else + { + (void) Det_ReportError(DET_MODULE_ID, DET_INSTANCE_ID, DET_SID_GETVERSIONINFO, DET_E_PARAM_POINTER); + } +} +# endif + +# define DET_STOP_SEC_CODE +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* DET_ENABLED */ + +/* module specific MISRA deviations: + MD_DET_5013: MISRA2012 rule 4.6 + Reason: Usage of "char" data type is necessary if error messages are output in the CANoe write window because the CANoe API requires this. + Risk: Potentially unknown size and signedness of data type. + Prevention: The affected code part is only active in a PC simulation environment and does not run on an embedded target. Therefore this deviation is not critical. No change planned. + MD_DET_0488: MISRA2012 rule 18.4 + Reason: Pointer arithmetic is only used in the CANoe simulation environment for debug purposes, not included in production code. + Risk: None. + Prevention: No change planned. + MD_DET_5124: MISRA2012 rule 21.6 + Reason: Standard library functionality is only used in the CANoe simulation environment for debug purposes, not included in production code. + Risk: None. + Prevention: No change planned. + MD_DET_5127: MISRA2012 rule 21.10 + Reason: Standard library functionality is only used in the CANoe simulation environment for debug purposes, not included in production code. + Risk: None. + Prevention: No change planned. + MD_DET_3387: MISRA2012 rule 13.3 + Reason: The ++ of -- operator is used on a volatile variable. + Risk: None because the volatile variable access is protected by a critical section. + Prevention: No change planned. +*/ + +/* SBSW_JUSTIFICATION_BEGIN + \ID SBSW_DET_1 + \DESCRIPTION Array Write Access (P6 - Wrong Initialization and Usage of a Pointer due to Wrong Index) + Update of log buffer in Det_LogError. Due to the code structure the calculated array index cannot exceed the array size. + Therefore this is not critical and no out of bounds array access can occur. The index is unconditionally reset to zero if is equal or greater than DET_LOGBUFFERSIZE. + \COUNTERMEASURE \N The code structure already ensures that the index cannot exceed the size of the array. + \ID SBSW_DET_2 + \DESCRIPTION Array Write Access (P6 - Wrong Initialization and Usage of a Pointer due to Wrong Index) + Initialization of global array in Det_Init. Both the array size and the loop is is controlled by generated #defines DET_*SIZE. + Therefore this is not critical and no out of bounds array access can occur. + \COUNTERMEASURE \N The code structure already ensures that the index cannot exceed the size of the array. + \ID SBSW_DET_3 + \DESCRIPTION Function Call + Calls to CANoe API or C stdlib with pointer parameters. + This code is only active in case of the CANoe emulation or vtt environment which is not used production code. + \COUNTERMEASURE \N This code part is not active for embedded production targets. + \ID SBSW_DET_4 + \DESCRIPTION Function Pointer Call + Iteration over generated function pointer tables using identifiers generated by the ComStackLib. + \COUNTERMEASURE \N Qualified use-case CSL01 of ComStackLib assures correct dimension of arrays and consistency of corresponding size definitions. + The validity of the callout function names is covered by SMI-5. + \ID SBSW_DET_6 + \DESCRIPTION Function Call + call of internal functions Det_CheckFilterMatch and Det_LogError (both functions cannot be called by the application or other modules) + There could be a Null pointer dereferencing if these functions are called with invalid pointer parameters. + However, at the three places in Det_ReportError where these functions are called the calls always uses valid pointers. + So there is no need for an additional Null pointer check in these functions. + \COUNTERMEASURE \N The code structure already ensures that the functions are always called with valid pointers. + \ID SBSW_DET_7 + \DESCRIPTION Pointer Write Access (P1 - Wrong Pointer Parameter) + The function Det_GetVersionInfo writes to the object referenced by parameter versioninfo. The structure is provided by application code and passed to the DET. + The fault pattern P9 is already prevented by a NULL pointer check. + \COUNTERMEASURE \N The caller ensures that the pointers passed to the parameter versioninfo is valid. + \ID SBSW_DET_8 + \DESCRIPTION Usage of debug features (generic aspect, not traceable to a specific ReviewHelper finding) + \COUNTERMEASURE \S The DET should not be in production code. + If it is used the extended debug features should be switched off because they are only relevant if a debugger is attached. + All of the above listed array write accesses occur only if extended debug features are enabled. SMI-Det-ExtendedDebugFeatures + \ID SBSW_DET_9 + \DESCRIPTION Argument for completeness of analyzed code (generic aspect, not traceable to a specific ReviewHelper finding) + \COUNTERMEASURE \N If all features of the DET are activated the whole code of the DET is active, there are no mutual exclusive code parts except for the AUTOSAR version which is fixed to 4. + The additional debug code in case of C_COMP_ANSI_CANOE has not been considered because it is a simulation environment only and therefore this code will never run on an ECU. +SBSW_JUSTIFICATION_END */ + +/* VCA_JUSTIFICATION_BEGIN + \ID VCA_DET_1 + \DESCRIPTION Function Call + Calls to CANoe API or C stdlib with pointer parameters. + This code is only active in case of the CANoe emulation or vtt environment which is not used production code. + \COUNTERMEASURE \N This code part is not active for embedded production targets. +VCA_JUSTIFICATION_END */ + +/* START_COVERAGE_JUSTIFICATION +\ID COV_DET_COMPATIBILITY + \ACCEPT TX + \ACCEPT XF + \REASON [COV_MSR_COMPATIBILITY] +\ID COV_DET_CANOE_VTT + \ACCEPT TF xf tf + \ACCEPT TX + \ACCEPT XF + \ACCEPT XX + \REASON Code which is only relevant for the CANoeEmu and VTT simulation environments which are not used by the test suite. +\ID COV_DET_TEST_CODE + \ACCEPT TX + \REASON Code is only deactivated during regression test to prevent endless loop. +\ID COV_DET_DUMMY_STMT + \ACCEPT XF xf xf xf tx xf xf xf + \ACCEPT XF xf xf xf tx xf + \REASON Insert dummy statement only if necessary to avoid compiler warnings. There is no functional impact. +END_COVERAGE_JUSTIFICATION */ diff --git a/Source/bsw/Det/Det.h b/Source/bsw/Det/Det.h new file mode 100644 index 0000000..9eb2e81 --- /dev/null +++ b/Source/bsw/Det/Det.h @@ -0,0 +1,386 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file Det.h + * \brief Header of Default Error Tracer + * + * \details Contains definitions, types, externals and prototype declarations. + * \trace SPEC-2880976, SPEC-2880977 + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 0.01.00 2005-08-18 Om Creation + * 2.00.00 2006-05-18 Om Update for AUTOSAR Release 2.0 + * 3.00.00 2007-08-08 Jk Update for AUTOSAR Release 2.1 + * 3.01.00 2007-09-17 Jk GetVersionInfo API added + * 3.02.00 2007-11-28 HH Extended debug features added + * 4.00.00 2008-01-02 HH Update for AUTOSAR Release 3.0 + * compiler abstraction and memmap added + * 4.01.00 2008-09-12 HH ESCAN00023736: DET entry callout + * ESCAN00029923: DET could be called recursively + * 4.02.00 2008-12-09 HH ESCAN00030591: compile error if extended version check is disabled + * ESCAN00031617: Compiler warning about sprintf on CANoe emulation platform + * 4.03.00 2008-12-09 HH ESCAN00033897: case-sensitive issue: #include "VStdLib.h" instead of "#include "vstdlib.h" in Det.c + * 4.03.01 2009-05-20 HH ESCAN00034249: DET entry callout Appl_DetEntryCallout is only called once + * ESCAN00034566: Compiler warnings because of unused parameters in Det_ReportError + * 4.03.02 2010-07-27 HH ESCAN00039898: Endless loop on CANoe platform + * ESCAN00042300: support time-stamp for write window messages on CANoe platform + * 5.00.00 2011-01-13 HH ESCAN00048023: Update for AUTOSAR Release 4.0 + * 5.01.00 2011-10-27 HH ESCAN00054556: AR3-1698 support CDK MISRA report + * 5.02.00 2012-06-25 HH ESCAN00060956: do not use v_cfg.h for Cfg5 + * 5.03.00 2013-01-18 HH ESCAN00064266: AR4-220: Compiler error: Different errors due to unknown STATIC + * 6.00.00 2013-08-22 HH ESCAN00068394: AR4-292: Reporting of DET and DEM errors via DLT + * 6.00.01 2013-12-17 HH ESCAN00072683: version consistency checking is too strict + * 6.01.00 2014-03-20 HH ESCAN00074316: AR4-647: Adapt DET for VIP + * 7.00.00 2014-12-11 HH ESCAN00080181: FEAT-427: SafeBSW Step I [AR4-728] + * ESCAN00077908: MISRA deviation: MISRA-C:2004 Rule 4060 metric deviation + * ESCAN00079312: change return value from Appl_DetEntryCallout from uint8 to boolean + * ESCAN00077108: ESCAN00077108: Add "consume ticks" for a more realistic behaviour in VTT + * ESCAN00081763: FEAT-1275: SafeBSW Step 2 + * ESCAN00082803: [VTT] Det uses wrong Macro to detect VTT Usecase + * 7.00.01 2015-11-24 HH ESCAN00086457: Compiler warning: file does not end in newline + * 7.01.00 2016-02-22 HH ESCAN00087792: FEAT-1688: SafeBSW Step 4 + * 10.00.00 2016-12-24 HH FEAT-1939: Support AUTOSAR 4.3 + * 11.00.00 2018-08-20 HH STORYC-4674: MISRA-C:2012 Compliance + * 12.00.00 2020-07-16 HH SWAT-37: DET: Improvements + * ESCAN00105736: Compiler error: header file "os.h" not found by case sensitive compiler + * SWAT-1049: Det: AUTOSAR 19-11 Analysis (update to 4.5.0) + * SWAT-1028: Update endless loop handling to new CANoe API + * 13.00.00 2021-04-30 HH SWAT-1098: Usage of _MemMap.h in Det + * 14.00.00 2021-12-07 HH SWAT-1652: DET: use VVIRTUALTARGET instead of _MICROSOFT_C_VTT_ + * 14.00.01 2022-10-13 HH ESCAN00112589: Compiler warning: variable "forceBreakHandler" in function Det_ReportError set but not used + * ESCAN00113283: DualTarget: In case of VTT target no CANoe output is generated and the endless loop may be entered + * main-1 2024-07-22 vishh SWAT-3509 Det Migration to GitLab + * Change history is maintained in the global ChangeHistory.txt file starting with this release. +*********************************************************************************************************************/ + +#ifndef DET_H +# define DET_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Std_Types.h" +# include "Compiler.h" +# include "Det_Cfg.h" + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/** + * Define vendor and module ID + */ +# define DET_VENDOR_ID (30u) /* HIS Vendor ID for Vector */ +# define DET_MODULE_ID (15u) /* Det Module ID according to BSW Modules */ + +/** + * Define AUTOSAR specification version if not already externally specified (ESCAN00072683) + */ +# if !defined (DET_AR_MAJOR_VERSION) /* COV_DET_COMPATIBILITY */ +# define DET_AR_MAJOR_VERSION (4u) +# define DET_AR_MINOR_VERSION (5u) +# define DET_AR_PATCH_VERSION (0u) +# endif + +/** + * Define AUTOSAR release version if not already externally specified (ESCAN00072683) + */ +# if !defined (DET_AR_RELEASE_MAJOR_VERSION) /* COV_DET_COMPATIBILITY */ +# define DET_AR_RELEASE_MAJOR_VERSION (4u) +# define DET_AR_RELEASE_MINOR_VERSION (5u) +# define DET_AR_RELEASE_PATCH_VERSION (0u) +# define DET_AR_RELEASE_REVISION_VERSION DET_AR_RELEASE_PATCH_VERSION +# endif + +/** + * Define version for header and source file consistency (decimal version of ALM implementation package) + */ +# define DET_SW_MAJOR_VERSION (25u) +# define DET_SW_MINOR_VERSION (0u) +# define DET_SW_PATCH_VERSION (0u) + +/** + * Define error types + */ + +/* Development Errors */ +# define DET_E_PARAM_POINTER (1u) + +/* Runtime Errors - currently not used by the DET */ +# define DET_E_CANNOT_REPORT (1u) +# define DET_E_WRONG_MODULE (2u) +# define DET_E_WRONG_INSTANCE (3u) +# define DET_E_WRONG_API (4u) +# define DET_E_WRONG_ERROR (5u) + +/* Transient Faults - currently not used by the DET */ +# define DET_E_UNAVAILABLE (1u) + +/** + * Define API service IDs + */ +#define DET_SID_INIT (0x00u) +#define DET_SID_START (0x02u) +#define DET_SID_REPORTERROR (0x01u) +#define DET_SID_REPORTRUNTIMEERROR (0x04u) +#define DET_SID_REPORTTRANSIENTFAULT (0x05u) +#define DET_SID_GETVERSIONINFO (0x03u) + +#define DET_INSTANCE_ID (0x00u) + +# if (DET_ENABLED == STD_ON) + +/* don't care patterns for filters */ +#define DET_DONTCARE_8 (0xFFu) +#define DET_DONTCARE_16 (0xFFFFu) + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/*! structure used to configure filters and store log data, using 0xFF for a filter item means don't care */ + +typedef uint8 Det_ConfigPtrType; + +typedef struct +{ + uint16 mModuleId; + uint8 mInstanceId; + uint8 mApiId; + uint8 mErrorId; +} DetInfoType; + +# if (DET_DEBUG_ENABLED == STD_ON) +/*! structure to control the operation of DET debug extension */ +typedef struct +{ + boolean globalFilterActive; /* FALSE: global filters disabled, TRUE: global filters enabled */ + boolean logActive; /* FALSE: logging disabled, TRUE: logging enabled */ + boolean breakOnLogOverrun; /* FALSE: break on log buffer overrun disabled, TRUE: break on log buffer overrun enabled */ + boolean breakFilterActive; /* FALSE: break filters disabled, TRUE: break filters enabled */ + boolean unlockBreak; /* FALSE: break, TRUE: unlock break, can be used to unlock endless loop */ + boolean dltFilterActive; /* FALSE: dlt filters disabled, TRUE: dlt filters enabled */ + uint8 logIndex; /* do not modify: last index in array where data was logged, range: 0..DET_LOGBUFFERSIZE-1 */ +} DetStatusType; +# endif + +/********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + *********************************************************************************************************************/ + +# if (DET_DEBUG_ENABLED == STD_ON) + +# define DET_START_SEC_VAR_NOINIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*! global variables, should be put in a watch window */ +# if (DET_GLOBALFILTERSIZE > 0) +/*! ##### use this variable to configure global filters */ +extern volatile VAR(DetInfoType, DET_VAR) detGlobalFilter[DET_GLOBALFILTERSIZE]; +# endif +# if (DET_BREAKFILTERSIZE > 0) +/*! ##### use this variable to configure break filters */ +extern volatile VAR(DetInfoType, DET_VAR) detBreakFilter[DET_BREAKFILTERSIZE]; +# endif +# if (DET_DLTFILTERSIZE > 0) +/*! ##### use this variable to configure dlt filters */ +extern volatile VAR(DetInfoType, DET_VAR) detDltFilter[DET_DLTFILTERSIZE]; +# endif +# if (DET_LOGBUFFERSIZE > 0) +/*! ##### use this variable to view log buffer (circular buffer) */ +extern volatile VAR(DetInfoType, DET_VAR) detLogBuffer[DET_LOGBUFFERSIZE]; +# endif +/*! ##### use this variable to configure DET debug operation */ +extern volatile VAR(DetStatusType, DET_VAR) detStatus; +# define DET_STOP_SEC_VAR_NOINIT_UNSPECIFIED +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# endif /* DET_DEBUG_ENABLED */ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define DET_START_SEC_CODE +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * Det_Init() + **********************************************************************************************************************/ +/*! \brief Initializes the DET + * \details Global function as an interface from EcuM to DET for initialization + * \param[in] ConfigPtr Pointer to configuration (not used) + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Shall be called during startup by EcuM in a safe context, e.g. before the OS is started. + * \trace SPEC-2880978, SPEC-2880979, SPEC-2880995, SPEC-2880996 + * \trace CREQ-1 + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_Init( CONSTP2CONST( Det_ConfigPtrType, AUTOMATIC, DET_CONST ) ConfigPtr ); + +/*********************************************************************************************************************** + * Det_Start() + **********************************************************************************************************************/ +/*! \brief Starts the DET + * \details Global function as an interface from EcuM to DET for start + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Shall be called during startup by EcuM in a safe context, e.g. before the OS is started. + * \trace SPEC-2880980, SPEC-2880998 + * \trace CREQ-2 + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_Start( void ); + +/*********************************************************************************************************************** + * Det_InitMemory() + **********************************************************************************************************************/ +/*! \brief Initializes the DET + * \details Initializes the state variable for the un-init check of the DET. If this function is used it must be called before Det_Init. + * \pre - + * \context TASK + * \reentrant FALSE + * \synchronous TRUE + * \note Shall be called during startup by EcuM in a safe context, e.g. before the OS is started. + * \trace CREQ-1 + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_InitMemory( void ); + +/*********************************************************************************************************************** + * Det_ReportError() + **********************************************************************************************************************/ +/*! \brief Development error reporting function + * \details Global function for BSW-Modules to report errors to the DET. + * If extended debug features are disabled the DET enters an endless loop in case of an embedded target + * or issues an error message in the CANoe write window in case of a simulated target. + * \param[in] ModuleId Module ID of calling module + * \param[in] InstanceId The identifier of the index based instance of a module + * \param[in] ApiId ID of API service in which error is detected + * \param[in] ErrorId ID of detected development error + * \return E_OK (always) + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \note If filtering is active the default settings of the filter discard error reports of ModuleId 0 (zero). + * \trace SPEC-2880982, SPEC-2880983, SPEC-2880984, SPEC-2880985, SPEC-2880986, SPEC-2880987, SPEC-2880988 + * \trace SPEC-2880989, SPEC-2880991, SPEC-2880997, SPEC-2881003 + * \trace CREQ-4, DSGN-Det22798, DSGN-Det22785, DSGN-Det22786, DSGN-Det22801, DSGN-Det22811 + **********************************************************************************************************************/ +FUNC(Std_ReturnType, DET_CODE) Det_ReportError( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ); + +/*********************************************************************************************************************** + * Det_ReportRuntimeError() + **********************************************************************************************************************/ +/*! \brief Runtime error reporting function + * \details Global function for BSW-Modules to report runtime errors to the DET. + * This function returns and issues an error message in the CANoe write window in case of a simulated target. + * \param[in] ModuleId Module ID of calling module + * \param[in] InstanceId The identifier of the index based instance of a module + * \param[in] ApiId ID of API service in which error is detected + * \param[in] ErrorId ID of detected development error + * \return E_OK (always) + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \trace SPEC-2880982, SPEC-2880983, SPEC-2880984, SPEC-2880987, SPEC-2880988, SPEC-2880993 + * \trace SPEC-2880999, SPEC-2881004 + * \trace CREQ-120271, DSGN-Det22801, DSGN-Det22784, DSGN-Det22786, DSGN-Det22811 + **********************************************************************************************************************/ +FUNC(Std_ReturnType, DET_CODE) Det_ReportRuntimeError( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ); + +/*********************************************************************************************************************** + * Det_ReportTransientFault() + **********************************************************************************************************************/ +/*! \brief Transient fault reporting function + * \details Global function for BSW-Modules to report transient faults to the DET. + * This function returns and issues an error message in the CANoe write window in case of a simulated target. + * \param[in] ModuleId Module ID of calling module + * \param[in] InstanceId The identifier of the index based instance of a module + * \param[in] ApiId ID of API service in which error is detected + * \param[in] ErrorId ID of detected development error + * \return E_OK (always) if no callouts are configured - return value of last callout if callouts are configured + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \trace SPEC-2880982, SPEC-2880983, SPEC-2880984, SPEC-2880987, SPEC-2880988, SPEC-2880992 + * \trace SPEC-2881000, SPEC-2881005 + * \trace CREQ-120272, DSGN-Det22801, DSGN-Det22784, DSGN-Det22786, DSGN-Det22811 + **********************************************************************************************************************/ +FUNC(Std_ReturnType, DET_CODE) Det_ReportTransientFault( uint16 ModuleId, uint8 InstanceId, uint8 ApiId, uint8 ErrorId ); + +# if (DET_VERSION_INFO_API == STD_ON) +/*********************************************************************************************************************** + * Det_GetVersionInfo() + **********************************************************************************************************************/ +/*! \brief Read the DET version information + * \details Global function for BSW-Modules to get the Version of DET + * \param[out] versioninfo Version information of the DET + * \pre - + * \context TASK|ISR2 + * \reentrant TRUE + * \synchronous TRUE + * \config DET_VERSION_INFO_API + * \trace SPEC-2880990, SPEC-2880994, SPEC-2881001 + * \trace CREQ-5 + * \spec + * requires $valid(versioninfo, $range(0,0)); + * \endspec + **********************************************************************************************************************/ +FUNC(void, DET_CODE) Det_GetVersionInfo( P2VAR( Std_VersionInfoType, AUTOMATIC, DET_APPL_DATA ) versioninfo ); +# endif + +# define DET_STOP_SEC_CODE +# include "Det_MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# else /* DET_ENABLED */ + +/* if the Det is disabled provide the API as empty macros */ +# define Det_Init(a) +# define Det_Start() +# define Det_InitMemory() +# define Det_ReportError(a,b,c,d) E_OK +# define Det_ReportRuntimeError(a,b,c,d) E_OK +# define Det_ReportTransientFault(a,b,c,d) E_OK +# define Det_GetVersionInfo(a) + +# endif /* DET_ENABLED */ +#endif /* DET_H */ + +/*! + * \exclusivearea DET_EXCLUSIVE_AREA_0 + * Assures atomic storage of reported errors in the log buffer and consistency of recursion counters. + * \protects detLogBuffer, detStatus.logIndex + * \protects detRecursionCounterReportError, detRecursionCounterReportRuntimeError + * \protects detRecursionCounterReportTransientFault + * \usedin Det_ReportError, Det_ReportRuntimeError, Det_ReportTransientFault + * \exclude Det_ReportError, Det_ReportRuntimeError, Det_ReportTransientFault + * \length SHORT maximal 10 C-statements without loop are used this exclusive area. + * \endexclusivearea + */ + +/********************************************************************************************************************** + * END OF FILE: Det.h + *********************************************************************************************************************/ + diff --git a/Source/bsw/Det/Make/Det_cfg.mak b/Source/bsw/Det/Make/Det_cfg.mak new file mode 100644 index 0000000..5ea4fef --- /dev/null +++ b/Source/bsw/Det/Make/Det_cfg.mak @@ -0,0 +1,75 @@ +############################################################################### +# File Name : Det_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Det_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefor the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/Det/Make/Det_check.mak b/Source/bsw/Det/Make/Det_check.mak new file mode 100644 index 0000000..b0791aa --- /dev/null +++ b/Source/bsw/Det/Make/Det_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : Det_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Det_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/Det/Make/Det_defs.mak b/Source/bsw/Det/Make/Det_defs.mak new file mode 100644 index 0000000..54d6d84 --- /dev/null +++ b/Source/bsw/Det/Make/Det_defs.mak @@ -0,0 +1,80 @@ +############################################################################### +# File Name : Det_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the Det_rules.mak file. +############################################################################### + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... +DET_CORE_PATH = +DET_OUTPUT_PATH = $(GENDATA_DIR) + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: can_DEPENDENT_PLUGINS = +DET_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += Det$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/Det/Make/Det_rules.mak b/Source/bsw/Det/Make/Det_rules.mak new file mode 100644 index 0000000..3d3b54d --- /dev/null +++ b/Source/bsw/Det/Make/Det_rules.mak @@ -0,0 +1,103 @@ +############################################################################### +# File Name : Det_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2007-06-13 Aba Initial Version of Template (1.0) +# 1.01.00 2008-02-14 HH Added support of AUTOSAR DET +# 1.02.00 2008-04-30 fbg Changes for ASR library support +# 1.03.00 2017-02-27 HH Added Det_Cfg.c in file list +# 1.04.00 2019-02-06 vircbl Added support of component-based SIP structure +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += $(LIB_OUPUT_PATH)\vendorx_canlib1.$(LIB_FILE_SUFFIX) +LIBRARIES_TO_BUILD += Det +Det_FILES = Det$(BSW_SRC_DIR)\Det.c + +# e.g.: CC_FILES_TO_BUILD += drv\can_drv.c +CC_FILES_TO_BUILD += Det$(BSW_SRC_DIR)\Det.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\Det_Cfg.c + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: +#$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/Fbl/applvect.h b/Source/bsw/Fbl/applvect.h new file mode 100644 index 0000000..a09e80a --- /dev/null +++ b/Source/bsw/Fbl/applvect.h @@ -0,0 +1,106 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Generic application vector table for platforms with Interrupt Vector Base Register. + * This file is usually compiled and linked with the bootloader and is located OUTSIDE the + * protected area of the FBL. It must be compiled, linked and downloaded with the + * application after changing the magic value to 'APPL' + * and setting the start label to the entry point of the application. + * If the application is set to valid, the bootloader checks the magic flag in the first + * entry of the ApplIntJmpTable and then calls the function specified in the second entry. + * + * This file must be compiled and linked in the bootloader + * and the application to the SAME MEMORY LOCATION! + * + * \note Please note, that this file contains example source code used by the Flash Bootloader. These + * functions may influence the behavior of the bootloader in principle. Therefore, great care must + * be taken to verify the correctness of the implementation. The contents of the originally delivered + * files are only examples resp. implementation proposals. With regard to the fact that these + * functions are meant for demonstration purposes only, Vector Informatik's liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2020 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * AUTHOR IDENTITY + * -------------------------------------------------------------------------------------------------------------------- + * Name Initials Company + * -------------------------------------------------------------------------------------------------------------------- + * Johannes Krimmel KJs Vector Informatik GmbH + * Christian Ralcewicz RCn Vector Informatik GmbH + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2017-10-27 KJs Initial version + * 01.00.01 2020-09-18 RCn ESCAN00106567 No changes + **********************************************************************************************************************/ + +#ifndef __APPL_VECT_H__ +#define __APPL_VECT_H__ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#define FBLVTABAPPL_IVBR_VERSION 0x0100u +#define FBLVTABAPPL_IVBR_RELEASE_VERSION 0x01u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define APPLVECT_FROM_BOOT 0x42544C44ul /* 'BTLD', Reserved for Bootloader internal value + * This magic value mustn't be set + * for the application vector table, just + * for the table linked with the Bootloader. + */ + +#define APPLVECT_FROM_APPL 0x4150504Cul /* 'APPL', Set this label only for the + * application vector table linked with the Application! + */ + +/*********************************************************************************************************************** + * EXTERNAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +/* Reset vector pointer definition for the FBL - compiler/hardware specific. + * When using this file for the actual application, FBL_RESET_ENTRY_LABEL may not be defined. + * Please insert the label manually and adapt the defines or include fbl_cfg.h. + */ +#if !defined( FBL_RESET_ENTRY_LABEL ) +# error "Please define FBL_RESET_ENTRY_LABEL to entry label of the startup code." +#else +extern void FBL_RESET_ENTRY_LABEL( void ); +# define RESET_ENTRY_ADDRESS (vuint32)&FBL_RESET_ENTRY_LABEL +#endif /* FBL_ENTRY_LABEL */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBL_APPLVECT_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ +V_MEMROM0 extern V_MEMROM1 vuint32 V_MEMROM2 ApplIntJmpTable[2]; +#define FBL_APPLVECT_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ + +#endif /* __APPL_VECT_H__ */ + +/*********************************************************************************************************************** + * END OF FILE: APPLVECT.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_applvect.c b/Source/bsw/Fbl/fbl_applvect.c new file mode 100644 index 0000000..3f9a5fa --- /dev/null +++ b/Source/bsw/Fbl/fbl_applvect.c @@ -0,0 +1,101 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Generic application vector table for platforms with Interrupt Vector Base Register. + * This file is usually compiled and linked with the bootloader and is located OUTSIDE the + * protected area of the FBL. It must be compiled, linked and downloaded with the + * application after changing the magic value to 'APPL' + * and setting the start label to the entry point of the application. + * If the application is set to valid, the bootloader checks the magic flag in the first + * entry of the ApplIntJmpTable and then calls the function specified in the second entry. + * + * This file must be compiled and linked in the bootloader + * and the application to the SAME MEMORY LOCATION! + * + * \note Please note, that this file contains example source code used by the Flash Bootloader. These + * functions may influence the behavior of the bootloader in principle. Therefore, great care must + * be taken to verify the correctness of the implementation. The contents of the originally delivered + * files are only examples resp. implementation proposals. With regard to the fact that these + * functions are meant for demonstration purposes only, Vector Informatik's liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2020 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * AUTHOR IDENTITY + * -------------------------------------------------------------------------------------------------------------------- + * Name Initials Company + * -------------------------------------------------------------------------------------------------------------------- + * Johannes Krimmel KJs Vector Informatik GmbH + * Christian Ralcewicz RCn Vector Informatik GmbH + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2017-10-27 KJs Initial version + * 01.00.01 2020-09-18 RCn ESCAN00106567 Compiler issue: "fbl_cfg.h" cannot be opened + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_def.h" +#include "applvect.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLVTABAPPL_IVBR_VERSION != 0x0100u ) || \ + ( FBLVTABAPPL_IVBR_RELEASE_VERSION != 0x01u ) +# error "Error in fbl_applvect.c: Source and header file are inconsistent!" +#endif + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBL_APPLVECT_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ +/* PRQA S 305,428 1 */ /* MD_ApplVect_0305, MD_ApplVect_0428*/ +V_MEMROM0 V_MEMROM1 vuint32 V_MEMROM2 ApplIntJmpTable[2] = {APPLVECT_FROM_BOOT, RESET_ENTRY_ADDRESS}; +#define FBL_APPLVECT_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_19.1 */ + +/********************************************************************************************************************** + * MISRA + *********************************************************************************************************************/ + +/* Module specific MISRA deviations: + + MD_ApplVect_0305: + Reason: Cast between a pointer to function and an integral type. + Risk: Target data types are not big enough - data loss occurs. + Prevention: The length of the pointer is known for the used platform and has to be kept in mind by the programmer. + + MD_ApplVect_0428: + Reason: Function identifier is not followed by () but a function call may be intended. + No function call intended. The address of the function shall be used. + Risk: No risk. + Prevention: No prevention required. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: APPLVECT.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_assert.h b/Source/bsw/Fbl/fbl_assert.h new file mode 100644 index 0000000..72a86ca --- /dev/null +++ b/Source/bsw/Fbl/fbl_assert.h @@ -0,0 +1,129 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief System specific assertion defines + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2016-02-26 visach ESCAN00088307 Rework to support FblMain 3.xx + * ESCAN00088433 Moved assertion specific code to fbl_assert.h + * 04.00.01 2016-07-15 visdlm ESCAN00091011 No changes + * 04.01.00 2016-08-18 vistns ESCAN00091531 No changes + * 04.02.00 2016-10-31 viscb ESCAN00092597 No changes + * 04.02.01 2017-05-09 visjhg ESCAN00095090 No changes + * visrie ESCAN00095204 Added assertion defines for DET + * 04.03.00 2017-07-28 viscb ESCAN00095458 No changes + * visach ESCAN00096096 No changes + * 04.04.00 2018-02-26 visdkl ESCAN00098503 No changes + * 04.04.01 2018-07-06 visdkl ESCAN00099860 No changes + * 04.04.01 2018-07-06 visdkl ESCAN00099860 No changes + * 04.05.00 2018-09-13 visrie ESCAN00100731 No changes + * 2018-11-20 visdkl ESCAN00101393 No changes + * 04.06.00 2019-12-03 visjdn FBL-999 No changes + * 05.00.00 2020-03-02 vistbe FBL-949 No changes + * ESCAN00105231 No changes + * 05.01.00 2020-04-29 vistmo FBL-1584 No changes + * 05.02.00 2020-05-08 visrie FBL-1414 No changes + * 05.03.00 2020-07-16 visrie FBL-2021 No changes + * 05.04.00 2024-05-03 visrie FBL-8515 No changes + * ESCAN00117096 No changes + * 05.05.00 2025-10-03 pharring FBL-10242 Add support for logger + * 05.06.00 2025-10-22 mpatil FBL-11533 Logical Block Meta data information is not indexed correctly + * in OTA usecase + **********************************************************************************************************************/ + +#ifndef FBL_ASSERT_H +#define FBL_ASSERT_H + +/*********************************************************************************************************************** + * DEFINITION OF ASSERTION CODES (SYSTEM) + **********************************************************************************************************************/ + +/* Note: System assertions are only allowed in the range from 0x00-0x7F. Others are reserved. */ +#if defined( FBL_ENABLE_ASSERTION ) +/* 0x00-0x1F: General FBL assertions */ +# define kFblSysAssertMissingForcedRCRRP 0x00u + +# define kFblSysAssertInitializationFailed 0x10u + +/* 0x20-0x3F: Internal assertions */ +# define kFblSysAssertServiceReqBeforeResp 0x20u +# define kFblSysAssertServiceMainHandlerInvalid 0x21u +# define kFblSysAssertDet 0x22u + +/* 0x40-0x4F: Generated data assertions */ +# define kFblSysAssertWdBufferOverflow 0x40u + +/* 0x50-0x6F: User parameter assertions */ +# define kFblSysAssertParameterOutOfRange 0x50u +# define kFblAssertIllegalReturnValue 0x51u +# define kFblSysAssertRepeatedCallOnConcludedService 0x60u + +/* 0x70-0x7F: Communication wrapper assertions */ +# define kFblSysAssertStateNotIdle 0x70u +# define kFblSysAssertNoBufferAvailable 0x71u + +/* 0x80-0xFF: OEM specific */ +# include "fbl_assert_oem.h" + +# if defined( __LINE__ ) && defined( __FILE__ ) && defined( FBL_ENABLE_ASSERTION_EXTENDED_INFO ) +# define FBL_DECL_ASSERT_EXTENDED_INFO(n) const vuint8* module, vuint16 line, n +# define FBL_USED_ASSERT_EXTENDED_INFO(n) __FILE__, __LINE__,(n) +# else +# define FBL_DECL_ASSERT_EXTENDED_INFO(n) n /* PRQA S 3410 */ /* MD_FblAssert_3410 */ +# define FBL_USED_ASSERT_EXTENDED_INFO(n) (n) /* PRQA S 3453 */ /* MD_MSR_19.7 */ +# endif /* __LINE__ && __FILE__ && FBL_ENABLE_ASSERTION_EXTENDED_INFO */ +#endif /* FBL_ENABLE_ASSERTION || FBL_ENABLE_LOGGER */ + +/* No statement should be added to below if clauses, in order to prevent errors suggested by Misra rule 14.9 */ +/* PRQA S 3412 4 */ /* MD_FblAssert_Assertion */ +#if defined( FBL_ENABLE_ASSERTION ) +# define assertFbl(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */ +# define assertFblUser(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */ +# define assertFblGen(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */ +# define assertFblInternal(p, e) if (!(p)) ApplFblFatalError(FBL_USED_ASSERT_EXTENDED_INFO(e)) /* PRQA S 2214 */ /* MD_FblAssert_Assertion */ +#else +# define assertFbl(p, e) +# define assertFblUser(p, e) +# define assertFblGen(p, e) +# define assertFblInternal(p, e) +#endif /* FBL_ENABLE_ASSERTION */ + +/* Module specific MISRA deviations: + + MD_FblAssert_Assertion: + Reason: This is an assertion macro used only for debugging in development (FBL_ENABLE_ASSERTION). There should + be no need to extend the amount of statements, so the current usage is accepted. + Risk: Unintended debugging code behavior could result, through adding further statements, + Prevention: A comment is in place to avoid that further statements are added to the if condition. + + MD_FblAssert_3410: + Reason: This macro serves as function parameter type qualifier and cannot have parentheses, because this would + result in an invalid function parameter list. + Risk: Usage at not intended places and unintended code behavior due to the missing parentheses. + Prevention: Reviews must ensure that this macro is only used in function parameter lists. +*/ + +#endif /* FBL_ASSERT_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_ASSERT.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_assert_oem.h b/Source/bsw/Fbl/fbl_assert_oem.h new file mode 100644 index 0000000..8b622ee --- /dev/null +++ b/Source/bsw/Fbl/fbl_assert_oem.h @@ -0,0 +1,78 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief OEM specific assertion defines (Ford) + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * DEFINITION OF ASSERTION CODES (OEM) + **********************************************************************************************************************/ + +/* Note: OEM assertions are only allowed in the range from 0x80-0xFF. Others are reserved. */ + +/* 0x80-0x9F: General FBL assertions */ +#define kFblOemAssertInvalidError 0x82u + +/* 0xA0-0xBF: Internal assertions */ +#define kFblOemAssertSessionIndexNotFound 0xA0u +#define kFblOemAssertIllegalParameter 0xA1u +#define kFblOemAssertIllegalExecutionPath 0xA2u +#define kFblOemAssertInvalidSecLvlIdx 0xA3u + +/* 0xC0-0xDF: Generated data assertions */ +#define kFblOemAssertPreHandlerIdxInvalid 0xC0u + +/* 0xE0-0xFF: User parameter assertions */ +#define kFblOemAssertParameterOutOfRange 0xE0u +#define kFblOemAssertIllegalReturnValue 0xE1u + +/*********************************************************************************************************************** + * END OF FILE: FBL_ASSERT_OEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_def.h b/Source/bsw/Fbl/fbl_def.h new file mode 100644 index 0000000..926a80f --- /dev/null +++ b/Source/bsw/Fbl/fbl_def.h @@ -0,0 +1,423 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main definitions for the Flash Boot Loader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2016-02-26 visach ESCAN00088307 Rework to support FblMain 3.xx + * ESCAN00088433 Moved assertion specific code to fbl_assert.h + * 04.00.01 2016-07-15 visdlm ESCAN00091011 Added programming voltage check defines + * 04.01.00 2016-08-18 vistns ESCAN00091531 Updated support of HMC + * 04.02.00 2016-10-31 viscb ESCAN00092597 Added support for SYMC SLP2 + * 04.02.01 2017-05-09 visjhg ESCAN00095090 Include upper-case Fbl_Cfg.h for DaVinci Configurator use-case + * visrie ESCAN00095204 No changes + * 04.03.00 2017-07-28 viscb ESCAN00095458 Removed unneeded client switches + * visach ESCAN00096096 Added fallback activation of NV-Wrapper and Vector SecMod + * 04.04.00 2018-02-26 visdkl ESCAN00098503 Updated support of Toyota SLP4 + * 04.04.01 2018-07-06 visdkl ESCAN00099860 Compiler error: shift count is too large + * 04.05.00 2018-09-13 visrie ESCAN00100731 Added additional flags for BootManager use-case + * 2018-11-20 visdkl ESCAN00101393 Removed support for Ford SLP6 + * 04.06.00 2019-12-03 visjdn FBL-999 Add define V_ENABLE_USE_DUMMY_STATEMENTS + * 05.00.00 2020-03-02 vistbe FBL-949 Add include for FblBm_Cfg.h + * ESCAN00105231 Compiler error: define syntax + * 05.01.00 2020-04-29 vistmo FBL-1584 Adding OTA startup support + * 05.02.00 2020-05-08 visrie FBL-1414 Adding One-Step-Updater support + * 05.03.00 2020-07-16 visrie FBL-2021 Adding OTA response after reset support + * 05.04.00 2024-05-03 visrie FBL-8515 Add generic defines and cleanup client list + * ESCAN00117096 Compiler error: Bit count of CPU not supported + * 05.05.00 2025-10-03 pharring FBL-10242 No changes + * 05.06.00 2025-10-22 mpatil FBL-11533 No changes + **********************************************************************************************************************/ + +#ifndef FBL_DEF_H +#define FBL_DEF_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +/* Basic configurations */ +#include "v_cfg.h" + +#if defined( VGEN_GENY ) && !defined( VGEN_ENABLE_CANFBL ) +/* This file was obviously not included in FBL, so it's used in user application + check if MAGIC_NUMBER was generated. In this case we have to remove the check for the + following include because FBL generation use different number than application */ +# if defined( MAGIC_NUMBER ) +# undef MAGIC_NUMBER +# endif +#endif + +#include "FblBm_Cfg.h" + +/* Configuration file for flash boot loader */ +#include "Fbl_Cfg.h" +#if defined( VGEN_GENY ) && !defined( VGEN_ENABLE_CANFBL ) +/* The last include redefined MAGIC_NUMBER, which is not relevant for application so + invalidate it */ +# if defined( MAGIC_NUMBER ) +# undef MAGIC_NUMBER +# endif +#endif + +/* Basic type definitions */ +#include "v_def.h" + +#if defined( FBL_ENABLE_SECMOD_VECTOR ) +# include "SecM_cfg.h" +#endif + +/* In application either remove FBL_ENABLE_ASSERTION switch or provide fbl_assert.h */ +# include "fbl_assert.h" + +/* PRQA S 3453 EOF */ /* MD_MSR_19.7 */ +/* PRQA S 3458 EOF */ /* MD_MSR_19.4 */ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblDef CQComponent : Implementation */ +#define FBLDEF_VERSION 0x0506u +#define FBLDEF_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Select usage of unified main interface */ +#define FBL_DEF_ENABLE_NON_KB_MAIN + +#ifndef NULL +# define NULL ((void *)0) +#endif + +/* Configuration of default switches */ +/* Activate NV-Wrapper if not explicitly configured */ +# if !defined( FBL_ENABLE_WRAPPER_NV ) && \ + !defined( FBL_DISABLE_WRAPPER_NV ) +# define FBL_ENABLE_WRAPPER_NV +# endif +/* Activate Vector SecMod if not explicitly configured */ +# if !defined( FBL_ENABLE_SECMOD_VECTOR ) && \ + !defined( FBL_DISABLE_SECMOD_VECTOR ) +# define FBL_ENABLE_SECMOD_VECTOR +# endif +/* Disable StayInBoot if not explicitly configured */ +#if !defined( FBL_ENABLE_STAY_IN_BOOT ) && \ + !defined( FBL_DISABLE_STAY_IN_BOOT ) +# define FBL_DISABLE_STAY_IN_BOOT +#endif + +/* Define return code of several functions */ +#define kFblOk 0x00u +#define kFblFailed 0x01u + +/* Defines for programming voltage check */ +#define kFblVoltageTooLow 0x01u +#define kFblVoltageTooHigh 0x02u + +/* Programming request flag */ +#define kProgRequest 0x00u /**< Diagnostic programming request is reported to main */ +#define kProgRequestXcp 0x01u /**< XCP programming request is reported to main */ +#define kProgRequestOta 0x02u /**< OTA programming request is reported to main */ +#define kNoProgRequest 0xFFu /**< No programming request */ + +#define kProgRequestWithResponse 0x02u /**< External programming request with response required */ +#define kProgRequestNoResponse 0x03u /**< No response required to programming request */ + +#define kCheckStayInBootRequest 0x10u /**< Check for stay in boot message */ +#define kInitKeysRequest 0x11u /**< Initialize crypto keys */ +#define kInitMacsRequest 0x12u /**< Initialize MACs */ + +/* Flag indicates that a response is required after programming request (only used by certain SLPs) */ +#define kFblStartWithResponse 0xAAu /**< FBL shall send a response after startup */ +#define kFblStartNoResponse 0x5Fu /**< FBL shall not send a response after startup */ + +/* Application validation */ +# define kApplValid 1u /**< Application is fully programmed */ +# define kApplInvalid 0u /**< Operational software is missing */ + +/* Memory status (flash erased detection) */ +# define kFlashErased 1u /**< Flash memory is in erased state */ +# define kFlashNotErased 0u /**< Flash memory is not in erased state (already written) */ + +/* Define return code of security access functions (only used by certain SLPs) */ +#define kFblSecNewSeedIssued 3u /**< seed */ +#define kFblSecGranted 4u /**< seed - key - status */ +#define kFblSecDeniedLocked 5u /**< status */ +#define kFblSecDeniedIncorrectLevel 6u /**< seed */ +#define kFblSecDeniedInvalidKey 7u + +#if !defined( FBL_REPEAT_CALL_CYCLE ) +/** Set default to 1ms for repeat time of main loop */ +# define FBL_REPEAT_CALL_CYCLE 1u +#endif + +#if defined( FBL_ENABLE_BANKING ) +#else +# define FBL_CALL_TYPE +#endif /* FBL_ENABLE_BANKING */ + +#ifndef V_CALLBACK_NEAR +# define V_CALLBACK_NEAR +#endif +#ifndef V_API_NEAR +# define V_API_NEAR +#endif + + +/* Defines to convert BigEndian bytes into short or long values ********************/ +#if defined( C_CPUTYPE_BIGENDIAN ) +# if defined( C_CPUTYPE_32BIT ) +# define FblBytesToShort(hi,lo) (((vuint16)(hi) << 8u) | ((vuint16)(lo))) +# else +# define FblBytesToShort(hi,lo) (vuint16)*(V_MEMRAM1_FAR vuint16 V_MEMRAM2_FAR *)(&(hi)) +# endif /* C_CPUTYPE_32BIT */ +#endif /* C_CPUTYPE_BIGENDIAN */ +#if defined( C_CPUTYPE_LITTLEENDIAN ) +# define FblBytesToShort(hi,lo) (((vuint16)(hi) << 8u) | ((vuint16)(lo))) +#endif /* C_CPUTYPE_LITTLEENDIAN */ + +#if defined( C_CPUTYPE_BIGENDIAN ) +# if defined( C_CPUTYPE_32BIT ) +# define FblBytesToLong(hiWrd_hiByt,hiWrd_loByt,loWrd_hiByt,loWrd_loByt) \ + (((vuint32)(hiWrd_hiByt) << 24u) | \ + ((vuint32)(hiWrd_loByt) << 16u) | \ + ((vuint32)(loWrd_hiByt) << 8u) | \ + ((vuint32)(loWrd_loByt) ) ) +# else +# define FblBytesToLong(hiWrd_hiByt,hiWrd_loByt,loWrd_hiByt, loWrd_loByt) \ + (vuint32)*(V_MEMRAM1_FAR vuint32 V_MEMRAM2_FAR *)(&(hiWrd_hiByt)) +# endif /* C_CPUTYPE_32BIT */ +#endif /* C_CPUTYPE_BIGENDIAN */ +#if defined( C_CPUTYPE_LITTLEENDIAN ) +# define FblBytesToLong(hiWrd_hiByt,hiWrd_loByt,loWrd_hiByt,loWrd_loByt) \ + (((vuint32)(hiWrd_hiByt) << 24u) | \ + ((vuint32)(hiWrd_loByt) << 16u) | \ + ((vuint32)(loWrd_hiByt) << 8u) | \ + ((vuint32)(loWrd_loByt) ) ) +#endif /* C_CPUTYPE_LITTLEENDIAN */ + +/* FBL bit definitions */ +#define FBL_BIT0 0x01u +#define FBL_BIT1 0x02u +#define FBL_BIT2 0x04u +#define FBL_BIT3 0x08u +#define FBL_BIT4 0x10u +#define FBL_BIT5 0x20u +#define FBL_BIT6 0x40u +#define FBL_BIT7 0x80u + +/* Defines for response after reset */ +#define RESET_RESPONSE_NOT_REQUIRED 0x00u /**< No response required */ +#define RESET_RESPONSE_SDS_REQUIRED 0x01u /**< Response to SessionControl-DefaultSession required */ +#define RESET_RESPONSE_ECURESET_REQUIRED 0x02u /**< Response to EcuReset-HardReset required */ +#define RESET_RESPONSE_KEYOFFON_REQUIRED 0x03u /**< Response to EcuReset-KeyOffOnReset required */ +#define RESET_RESPONSE_OSU_REQUIRED 0x04u /**< Response to One-Step-Updater required */ +#define RESET_RESPONSE_OTA_REQUIRED 0x05u /**< Response to OTA required */ + +/* Macros to harmonize type casts for inverting bits */ +#define FblInvertBits(x,type) ((type)~((type)(x))) /* PRQA S 0277 */ /* MD_FblDef_Invert */ +#define FblInvert8Bit(x) ((vuint8) ((x) ^ ((vuint8 )0xFFu))) +#define FblInvert16Bit(x) ((vuint16)((x) ^ ((vuint16)0xFFFFu))) +#define FblInvert32Bit(x) ((vuint32)((x) ^ ((vuint32)0xFFFFFFFFul))) + +/* Logical Marker (only used by certain SLPs) */ +#define LM_Upload 0x80u +#define LM_Calibration 0x81u +#define LM_Global 0x82u +#define LM_LogZone 0x83u +#define LM_UploadNoCrc 0x84u +#define LM_AppliKey 0x88u + +# define kFblDiagTimeP2 FBL_DIAG_TIME_P2MAX +# define kFblDiagTimeP2Star FBL_DIAG_TIME_P3MAX + +/* Reprogramming request flags */ +#define kEepFblReprogram 0xB5u /**< FBL is started with normal reprogramming request, e.g. programming session */ +#define kEepFblXcpProgram 0x5Bu /**< FBL is started with XCP reprogramming request */ +#define kEepFblOtaReprogram 0x5Cu /**< FBL is started with OTA reprogramming request */ +#define kEepFblActive 0xA4u +#define kEepFblVpm 0xC6u +#define kEepFblLinkControl 0x93u + +/* Flags to indicate if NV functions should read or write data */ +#define kEepWriteData 1u /**< Write data to NV memory */ +#define kEepReadData 2u /**< Read data from NV memory */ + +/* Error code defines for ApplFblErrorNotification */ +#define kFblErrTypeAppl 0x10u +#define kFblErrTypeFlash 0x20u +#define kFblErrTypeEeprom 0x30u +#define kFblErrTypeSec 0x40u +#define kFblErrTypeVectorTPMC 0x50u + +/** Round length up to next multiple of alignment */ +#define FBL_LENGTH_ALIGN_ROUND_UP(length, align) (((((length) - 1u) / (align)) + 1u) * (align)) +/** Round length down to next multiple of alignment */ +#define FBL_LENGTH_ALIGN_ROUND_DOWN(length, align) (((length) / (align)) * (align)) + +/** Helper macro to get number of array entries */ +#define FBL_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +/** Number of validity bytes required for logical block validity information */ +#define FBL_NUMBER_OF_VALIDITY_FLAG_BYTES (FBL_LENGTH_ALIGN_ROUND_UP(FBL_LBT_BLOCK_COUNT, 8u) / 8u) + +#if defined( FBL_USE_DUMMY_STATEMENT ) +# if !defined( V_ENABLE_USE_DUMMY_STATEMENT ) +# define V_ENABLE_USE_DUMMY_STATEMENT +# endif +#endif + +/*********************************************************************************************************************** + * State handling framework + **********************************************************************************************************************/ + +/* State array settings */ +#if defined( C_CPUTYPE_8BIT ) +typedef vuint8 tFblStateBitmap; +# define FBL_STATE_BITS 8u +# define kFblStateMaskNone 0x00u +# define kFblStateMaskAll 0xFFu +# define FblInvertStates(x) FblInvert8Bit(x) /* PRQA S 3453 */ /* MD_MSR_19.7 */ +#elif defined( C_CPUTYPE_16BIT ) +typedef vuint16 tFblStateBitmap; +# define FBL_STATE_BITS 16u +# define kFblStateMaskNone 0x0000u +# define kFblStateMaskAll 0xFFFFu +# define FblInvertStates(x) FblInvert16Bit(x) /* PRQA S 3453 */ /* MD_MSR_19.7 */ +#elif defined( C_CPUTYPE_32BIT ) || \ + defined( C_CPUTYPE_64BIT ) +typedef vuint32 tFblStateBitmap; +# define FBL_STATE_BITS 32u +# define kFblStateMaskNone 0x00000000ul +# define kFblStateMaskAll 0xFFFFFFFFul +# define FblInvertStates(x) FblInvert32Bit(x) /* PRQA S 3453 */ /* MD_MSR_19.7 */ +#else +# error "Bit count of CPU not supported." +#endif + +/* State mask build macros */ +/* PRQA S 3453 10 */ /* MD_MSR_19.7 */ +#define FBL_STATE_MASK(bit) ((tFblStateBitmap)(1ul << ((bit) % FBL_STATE_BITS))) +#define FBL_STATE_MULTIMASK(min, max) ((((kFblStateMaskAll) >> ((min) % FBL_STATE_BITS)) << ((min) % FBL_STATE_BITS)) ^ (((kFblStateMaskAll) >> (((max) + 1u) % FBL_STATE_BITS)) << (((max) + 1u) % FBL_STATE_BITS))) +#define FBL_STATE_MASKLONG(bit) (1ul << (bit)) +#define FBL_STATE_MULTIMASKLONG(min, max) ((((~0ul) >> (min)) << (min)) ^ (((max) < (STATE_BITS - 1u)) ? (((~0ul) >> ((max) + 1u)) << ((max) + 1u)) : 0ul)) +#define FBL_STATE_INDEX(bit) ((bit) / FBL_STATE_BITS) +#define FBL_STATE_SET(arr, bit) ((arr)[FBL_STATE_INDEX(bit)] |= FBL_STATE_MASK(bit)) +#define FBL_STATE_CLR(arr, bit) ((arr)[FBL_STATE_INDEX(bit)] &= FblInvertStates(FBL_STATE_MASK(bit))) +#define FBL_STATE_MULTICLR(arr, min, max) ((arr)[FBL_STATE_INDEX(min)] &= FblInvertStates(FBL_STATE_MULTIMASK((min), (max)))) +#define FBL_STATE_TEST(arr, bit) (((arr)[FBL_STATE_INDEX(bit)] & FBL_STATE_MASK(bit)) == FBL_STATE_MASK(bit)) + +/*********************************************************************************************************************** + * TYPEDEFS (basic types) + **********************************************************************************************************************/ +typedef vuint8 tFblErrorType; +typedef vuint16 tFblErrorCode; + +typedef vuint8 tFblResult; /**< FBL result codes */ +typedef vuint8 tFblProgStatus; /**< Status of reprogramming flag */ +typedef vuint8 tApplStatus; /**< Application valid status */ +typedef vuint8 tMagicFlag; /**< Application valid flag */ +typedef vuint8 tFlashStatus; /**< Flash erased status flag */ + +/* The below bootloader address types always define logical addresses. + * This is important for those platforms which provide a paged physical memory + * address space. For those platforms with linear physical address space, logical + * and physical addresses are identical. + */ +#if defined( C_CPUTYPE_8BIT ) && !defined( FBL_PROCESSOR_BANKED ) +typedef vuint16 FBL_ADDR_TYPE; +typedef vuint16 FBL_MEMSIZE_TYPE; +#else +typedef vuint32 FBL_ADDR_TYPE; +typedef vuint32 FBL_MEMSIZE_TYPE; +#endif + +typedef vuint8 FBL_MEMID_TYPE; + +typedef FBL_ADDR_TYPE tFblAddress; +typedef FBL_MEMSIZE_TYPE tFblLength; + +typedef FBL_ADDR_TYPE tMtabAddress; +typedef FBL_MEMSIZE_TYPE tMtabLength; +typedef FBL_MEMID_TYPE tMtabMemId; + +typedef vuint16 tChecksum; + +/*********************************************************************************************************************** + * TYPEDEFS (function pointers) + **********************************************************************************************************************/ + +/* Function pointer for FBL-exported functions */ +#if defined( FBL_ENABLE_BANKING ) +typedef FBL_CALL_TYPE void (*FBL_CALL_TYPE tExportFct)(void); /* PRQA S 0313 */ /* MD_FblDef_Export */ +#else +typedef MEMORY_FAR void (*tExportFct)(void); /* PRQA S 0313 */ /* MD_FblDef_Export */ +#endif /* FBL_ENABLE_BANKING */ + +typedef FBL_CALL_TYPE vuint8 (* tFblRealtimeFct)(void); + +/** Function pointer to read memory */ +typedef FBL_CALL_TYPE tFblLength (* tReadMemoryFct)(tFblAddress address, V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * buffer, tFblLength length); + +/*********************************************************************************************************************** + * TYPEDEFS (other) + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +typedef struct tagProcParam +{ + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * dataBuffer; + vuint16 dataLength; + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * dataOutBuffer; + vuint16 dataOutLength; + vuint16 dataOutMaxLength; + vuint8 (* wdTriggerFct)(void); + vuint8 mode; +} tProcParam; +#endif + +#endif /* FBL_DEF_H */ + +/* Module specific MISRA deviations: + + MD_FblDef_Export: + Reason: Verify interface functions are stored as void pointers as actual type is not known at configuration time. + The software that uses these functions has to take care that a cast to the correct function type is being done before usage + Risk: The software that uses this elements does not correctly cast before usage. + Prevention: Review of implementations and testing of the functionality. + + MD_FblDef_Invert: + Reason: Usage of FblInvert.. macros implies usage of ~ operator and appropriate casts. This includes a cast from + negative integer to unsigned value. The integer is only an intermediate type that occurs because of + integer promotion while using ~ operator, though only a bit mask is operated on. + Risk: No risk. + Prevention: No prevention defined. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_DEF.H + **********************************************************************************************************************/ + diff --git a/Source/bsw/Fbl/fbl_diag.c b/Source/bsw/Fbl/fbl_diag.c new file mode 100644 index 0000000..f6fa0a7 --- /dev/null +++ b/Source/bsw/Fbl/fbl_diag.c @@ -0,0 +1,6492 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Diagnostic services supported in boot mode + * Declaration of functions, variables and constants + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 The verification of the flash driver always fails + * ESCAN00112575 Ford tokens are wrongly rejected + * 05.01.00 2022-10-04 jschmitding FBL-5917 Make FBL SWDL 008 Compliant + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 Routine Check Application Validity is failing + * 05.01.02 2023-01-13 fmenke ESCAN00112890 DID D071 does not return the last successful token received + * ESCAN00113612 Server message ID check does not work correctly + * 05.02.00 2023-02-09 vistmo ESCAN00112972 Token with reserved bits set in SyncP is accepted + * ESCAN00113292 Wrong NRC for invalid RoutineControlOptionRecord on Set OTA Update + * ESCAN00113835 For token mode 5 reprogrammable keys are not extracted correctly + * ESCAN00113843 Token with "Has Key ID" bit set in SyncP is accepted + * ESCAN00113764 RID 7013 (token download) is always supported + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 Application validation fails in case of MAC update failure + * regardless logical block is optional or mandatory + * 05.03.00 2023-07-24 fmenke FBL-7335 Support new app signing handling + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 Bootloader does not enter programming session when + * started from application + * 05.03.02 2024-07-16 erizk ESCAN00117344 Compiler error: FblRealTimeSupportVoid undefined, assuming + * extern returning int + * 05.03.03 2025-02-06 virchl ESCAN00118587 No Response for the Routine Control "Check Valid Application" 0x0304 + * 05.04.00 2025-02-28 jjohnson FBL-10065 Support App Signing Specification 2.1.3 + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 Response to programming session request may be wrong + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No NRC is returned to an RID 7013 requested without SBL activation + * 05.05.00 2025-09-01 fmenke FBL-11218 Add support for NXP DSP firmware update + * ESCAN00120917 SBL can be downloaded again and be executed without + * signature verification + * 05.06.00 2025-10-28 mpatil FBL-11690 Adding hooks and return values for callouts for Routine 7013 + * 05.07.00 2026-01-13 dganesh FBL-12162 Support Ford SWDL 008.5 + **********************************************************************************************************************/ + +#define FBL_DIAG_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" /* Common include files */ +#include "fbl_diag.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLDIAG_14229_FORD_VERSION != 0x0507u ) || \ + ( FBLDIAG_14229_FORD_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_diag.c: Source and header file are inconsistent!" +#endif + +#if ( FBLDIAG_14229_FORD_VERSION != _FBLDIAG_OEM_VERSION ) || \ + ( FBLDIAG_14229_FORD_RELEASE_VERSION != _FBLDIAG_OEM_RELEASE_VERSION ) +# error "Error in fbl_diag.c: Source and v_ver.h are inconsistent!" +#endif + + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define FBL_DIAG_IMPL_TYPE_OUTPUT 1 +#define FBL_DIAG_IMPL_TYPE_STATEBITMAP 2 +#define FBL_DIAG_IMPL_TYPE_SERVICEPROPERTY 3 +#define FBL_DIAG_IMPL_TYPE_SERVICELIST 4 +#define FBL_DIAG_IMPL_TYPE_SERVICELIST_HANDLER 5 +#define FBL_DIAG_IMPL_TYPE_SERVICELIST_ENUM 6 + +#define kDiagInitSequenceNum ((vuint8) 0x01u) +#define kDiagSegmentOutOfRange ((vuint8) 0xFFu) +#define kDiagSubparamMask ((vuint8) 0x7Fu) + +/* Transfer types (used with transferType) */ +# define DOWNLOAD_RAM ((vuint8) 0x10u) +# define DOWNLOAD_FLASH ((vuint8) 0x40u) + +/* Allow external definition of RAM state table usage */ +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) || \ + defined( FBL_DIAG_DISABLE_RAM_STATETABLES ) +#else +# define FBL_DIAG_ENABLE_RAM_STATETABLES +#endif +#define FBL_DIAG_STATE_ARRAYS +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +# define FBL_DIAG_SERVICE_LIST_HANDLES +#endif + +#define FBL_DIAG_CHECK_LIST_HANDLES + +/* Maximum wait time for ECU reset request */ +#if !defined( kCwMaxWaitTimeEcuResetRequest ) +# define kFblDiagMaxWaitTimeEcuResetRequest kFblDiagTimeP2Star +#else +# define kFblDiagMaxWaitTimeEcuResetRequest (kCwMaxWaitTimeEcuResetRequest / FBL_REPEAT_CALL_CYCLE) +#endif + +/* Macros to access the ecuReset timer value */ +#define TimeoutEcuResetValue() ecuResetTimeout +#define DecTimeoutEcuResetValue() (ecuResetTimeout--) +#define ResetEcuResetTimeout() (ecuResetTimeout = (vuint16)(kFblDiagMaxWaitTimeEcuResetRequest/DIAG_CALL_CYCLE)) +#define StopEcuResetTimeout() (ecuResetTimeout = 0) + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +/* + * Negative return value for FblDiagGetSessionIndex(). This value has to be greater than 0x7F because the SPRMIB bit + * restricts the value range. + */ +# define kDiagSessionNotFound ((vuint8)0xFFu) +#endif /* FBL_DIAG_ENABLE_SESSION_PARAMETERS */ + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +/* Indicator for non-initialized security level index */ +# define kDiagInvalidSecLvlIdx ((vuint8)0xFFu) +#endif /* FBL_ENABLE_SEC_ADDITIONAL_LEVELS */ + +/* Return values for DID 0xD021 - Current Diagnostic Application */ +#define kFblDiagAppPbl 0x01u +#define kFblDiagAppSbl 0x02u +#define kFblDiagAppUnknown 0xFFu + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +/* Define for customer for getting FESN */ +# if !defined( FblDiagGetFesn ) +# define FblDiagGetFesn() fblCommonData.FordElectronicSerialNumber +# endif + +/* Dynamic offset calculation macro */ +# define FblDiagCalcDynamicSyncPHeaderOffset(offset) ((offset) - FBL_DIAG_TOKEN_FESN_LEN) + +/* Defines for token parameter offset */ +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET 0u +# define FBL_DIAG_TOKEN_PARAM_CPU_DEST_OFFSET 1u +# define FBL_DIAG_TOKEN_PARAM_SERVICE_TYPE_OFFSET 2u +# define FBL_DIAG_TOKEN_PARAM_CRYPTOTYPE_OFFSET 6u +# define FBL_DIAG_TOKEN_PARAM_PAYLOAD_SIZE_OFFSET 7u +# define FBL_DIAG_TOKEN_PARAM_FESN_OFFSET 11u +# define FBL_DIAG_TOKEN_PARAM_SERVERMESSAGEID_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 27u : FblDiagCalcDynamicSyncPHeaderOffset(27u) +# define FBL_DIAG_TOKEN_PARAM_CMD_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 35u : FblDiagCalcDynamicSyncPHeaderOffset(35u) +# define FBL_DIAG_TOKEN_PARAM_KEY_INDEX_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 36u : FblDiagCalcDynamicSyncPHeaderOffset(36u) +# define FBL_DIAG_TOKEN_PARAM_NAME_LENGTH_INDEX_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 37u : FblDiagCalcDynamicSyncPHeaderOffset(37u) +# define FBL_DIAG_TOKEN_PARAM_NAME_INDEX_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 38u : FblDiagCalcDynamicSyncPHeaderOffset(38u) +# define FBL_DIAG_TOKEN_PARAM_PAYLOAD_FESN_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 80u : FblDiagCalcDynamicSyncPHeaderOffset(80u) +# define FBL_DIAG_TOKEN_PARAM_DEVKEY_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 107u : FblDiagCalcDynamicSyncPHeaderOffset(107u) +# define FBL_DIAG_TOKEN_PARAM_PRODKEY_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 619u : FblDiagCalcDynamicSyncPHeaderOffset(619u) +# define FBL_DIAG_TOKEN_PARAM_TOKENKEY_OFFSET(token) FblDiagIsTokenFesnRequired(token) ? 1131u : FblDiagCalcDynamicSyncPHeaderOffset(1131u) + +/* Generic Defines for token handling */ +# define FBL_DIAG_TOKEN_RESBITS_REQ 0x03u +# define FBL_DIAG_TOKEN_KEYID_REQ 0x04u +# define FBL_DIAG_TOKEN_FESN_REQ 0x08u +# define FBL_DIAG_TOKEN_FESN_SHIFT 0x03u +# define FBL_DIAG_TOKEN_FESN_LEN 8u +# define FBL_DIAG_TOKEN_MSGID_REQ 0x10u +# define FBL_DIAG_TOKEN_MOD5_FESN_LEN 3u +# define FBL_DIAG_TOKEN_CPU_DEST 0u +# define FBL_DIAG_TOKEN_PROTOCOL_VERSION 0x20u +# define FBL_DIAG_TOKEN_PROTOCOL_VERSION_MASK 0xE0u +# define FBL_DIAG_TOKEN_NAME_LENGTH 0x0Bu +# define FBL_DIAG_TOKEN_NAME "APP_SIGN_SW" +# define FBL_DIAG_TOKEN_SERVICE_TYPE 0x110u +# define FBL_DIAG_TOKEN_CRYPTOTYPE 0x0Fu /* Only RSA supported */ +# define FBL_DIAG_TOKEN_PAYLOAD_SIZE_MODE0_4 43u +# define FBL_DIAG_TOKEN_PAYLOAD_SIZE_MODE5 1606u + +# define FBL_DIAG_TOKEN_KEY_INDEX_0 0u /* Used for mode 5 tokens */ +# define FBL_DIAG_TOKEN_KEY_INDEX_1 1u /* Used for mode 0-4 tokens */ +# define FBL_DIAG_TOKEN_KEY_EXP_MAX 256u + +/* Defines Token Handling Commands */ +# define FBL_DIAG_TOKEN_CMD_REVERTPROD 0u +# define FBL_DIAG_TOKEN_CMD_USEDEVPERM 1u +# define FBL_DIAG_TOKEN_CMD_USEDEVTEMP 2u +# define FBL_DIAG_TOKEN_CMD_USEDEVDATE 3u +# define FBL_DIAG_TOKEN_CMD_USEDEVIGNI 4u +# define FBL_DIAG_TOKEN_CMD_PROGKEY 5u + +/* Defines Token Handling Macro */ +# define FblDiagIsTokenProtocolVersionCorrect(token) (((token)[FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET] & FBL_DIAG_TOKEN_PROTOCOL_VERSION_MASK) == FBL_DIAG_TOKEN_PROTOCOL_VERSION) +# define FblDiagIsTokenKeyIDRequired(token) (((token)[FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET] & FBL_DIAG_TOKEN_KEYID_REQ) == FBL_DIAG_TOKEN_KEYID_REQ) +# define FblDiagIsTokenMsgIDRequired(token) (((token)[FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET] & FBL_DIAG_TOKEN_MSGID_REQ) == FBL_DIAG_TOKEN_MSGID_REQ) +# define FblDiagIsTokenFesnRequired(token) (((token)[FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET] & FBL_DIAG_TOKEN_FESN_REQ) == FBL_DIAG_TOKEN_FESN_REQ) +# define FblDiagIsTokenReserverdBitsSet(token) (((token)[FBL_DIAG_TOKEN_PARAM_SYNCP_ENC_DATA_OFFSET] & FBL_DIAG_TOKEN_RESBITS_REQ) != 0u) +# define FblDiagGetTokenCPUDestination(token) ((token)[FBL_DIAG_TOKEN_PARAM_CPU_DEST_OFFSET]) +# define FblDiagGetTokenServiceType(token) (((vuint16)(token)[FBL_DIAG_TOKEN_PARAM_SERVICE_TYPE_OFFSET] << 8u) | \ + (vuint16)(token)[FBL_DIAG_TOKEN_PARAM_SERVICE_TYPE_OFFSET + 1u] ) +# define FblDiagGetTokenCryptoType(token) ((token)[FBL_DIAG_TOKEN_PARAM_CRYPTOTYPE_OFFSET]) +# define FblDiagGetTokenCommandType(token) ((token)[FBL_DIAG_TOKEN_PARAM_CMD_OFFSET(token)]) +# define FblDiagGetTokenPayloadSize(token) (((vuint32)(token)[FBL_DIAG_TOKEN_PARAM_PAYLOAD_SIZE_OFFSET] << 24u) | \ + ((vuint32)(token)[FBL_DIAG_TOKEN_PARAM_PAYLOAD_SIZE_OFFSET + 1u] << 16u) | \ + ((vuint32)(token)[FBL_DIAG_TOKEN_PARAM_PAYLOAD_SIZE_OFFSET + 2u] << 8u) | \ + (vuint32)(token)[FBL_DIAG_TOKEN_PARAM_PAYLOAD_SIZE_OFFSET + 3u]) +# define FblDiagGetTokenTokenNameLength(token) ((vuint8)(token)[FBL_DIAG_TOKEN_PARAM_NAME_LENGTH_INDEX_OFFSET(token)]) +# define FblDiagGetTokenTokenName(token) (&(token)[FBL_DIAG_TOKEN_PARAM_NAME_INDEX_OFFSET(token)]) +# define FblDiagGetTokenFesn(token) (&(token)[FBL_DIAG_TOKEN_PARAM_FESN_OFFSET]) +# define FblDiagGetTokenServerMsgIdPtr(token) (&(token)[FBL_DIAG_TOKEN_PARAM_SERVERMESSAGEID_OFFSET(token)]) +# define FblDiagGetTokenPayloadFesn(token) (&(token)[FBL_DIAG_TOKEN_PARAM_PAYLOAD_FESN_OFFSET(token)]) +# define FblDiagGetTokenKeyIndex(token) ((token)[FBL_DIAG_TOKEN_PARAM_KEY_INDEX_OFFSET(token)]) +/* Define to get the key index from the token */ +# define FblDiagGetTokenDevKeyIndex(token) (&(token)[FBL_DIAG_TOKEN_PARAM_DEVKEY_OFFSET(token)]) +# define FblDiagGetTokenProdKeyIndex(token) (&(token)[FBL_DIAG_TOKEN_PARAM_PRODKEY_OFFSET(token)]) +# define FblDiagGetTokenTokenKeyIndex(token) (&(token)[FBL_DIAG_TOKEN_PARAM_TOKENKEY_OFFSET(token)]) + +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + + +/*****************************************************************************/ +/* State handling ************************************************************/ +/*****************************************************************************/ + +#define SPLIT_SHORT(id) ((vuint8)(((id) >> 8u) & 0xFFu)), ((vuint8)((id) & 0xFFu)) + +# define STATE_CHECK_COUNT 2u +# define STATE_ADDCLR_COUNT 3u +#define STATE_COUNT (STATE_CHECK_COUNT + STATE_ADDCLR_COUNT) + +/* State array build macros */ +#define STATE_ARRAYENTRY(mask, idx) ((tStateBitmap)(((mask) >> ((idx) * STATE_BITS)) & kDiagStateMaskAll)) +#if ( STATECHECK_ARRAYSIZE == 1u ) +# define STATE_BUILDARRAYENTRIES(mask) STATE_ARRAYENTRY(mask, 0u) +#endif +#if ( STATECHECK_ARRAYSIZE == 2u ) +# define STATE_BUILDARRAYENTRIES(mask) STATE_ARRAYENTRY(mask, 0u), STATE_ARRAYENTRY(mask, 1u) +#endif +#if ( STATECHECK_ARRAYSIZE == 3u ) +# define STATE_BUILDARRAYENTRIES(mask) STATE_ARRAYENTRY(mask, 0u), STATE_ARRAYENTRY(mask, 1u), STATE_ARRAYENTRY(mask, 2u) +#endif +#if ( STATECHECK_ARRAYSIZE == 4u ) +# define STATE_BUILDARRAYENTRIES(mask) STATE_ARRAYENTRY(mask, 0u), STATE_ARRAYENTRY(mask, 1u), STATE_ARRAYENTRY(mask, 2u), STATE_ARRAYENTRY(mask, 3u) +#endif +#if ( STATECHECK_ARRAYSIZE > 4u ) +# error "Invalid array size for state check!" +#endif + +#define STATE_BUILDARRAY(mask) { STATE_BUILDARRAYENTRIES(mask) } + +/* State masks and access macros */ +#define kDiagStateMaskAllLong STATE_MULTIMASKLONG(0u, ((STATECHECK_ARRAYSIZE * STATE_BITS) - 1u)) + +#define kDiagStateMask(state) STATE_MASKLONG(state) + +#define SetDiagState(state) STATE_SET(fblStates, state) +#define ClrDiagState(state) STATE_CLR(fblStates, state) + +#define kDiagStateNone (0x00uL) + +#define ClrDiagSession() STATE_MULTICLR(fblStates, kDiagStateIdxSessionDefault, kDiagStateIdxSessionProgramming) + +#define kDiagStateSessionDefault kDiagStateMask(kDiagStateIdxSessionDefault) +#define SetDiagDefaultDiagSession() { \ + ClrDiagSession(); \ + SetDiagState(kDiagStateIdxSessionDefault); \ + SetDiagSessionType(kDiagSubDefaultSession); \ + } + +#define kDiagStateSessionProgramming kDiagStateMask(kDiagStateIdxSessionProgramming) +#define SetDiagProgrammingSession() { \ + ClrDiagSession(); \ + SetDiagState(kDiagStateIdxSessionProgramming); \ + SetDiagSessionType(kDiagSubProgrammingSession); \ + } + +#define kDiagStateSessionDefaultProgramming (kDiagStateSessionDefault | kDiagStateSessionProgramming) +#define kDiagStateSessionAll kDiagStateSessionDefaultProgramming + +#define kDiagStateSecurityKey01 kDiagStateMask(kDiagStateIdxSecurityKey01) +#define GetSecurityKeyAllowed() GetDiagState(kDiagStateIdxSecurityKey01) +#define SetSecurityKeyAllowed() SetDiagState(kDiagStateIdxSecurityKey01) +#define ClrSecurityKeyAllowed() ClrDiagState(kDiagStateIdxSecurityKey01) + +#define kDiagStateSecurityKeyAll (kDiagStateSecurityKey01) + +#define kDiagStateSecurityAccess01 kDiagStateMask(kDiagStateIdxSecurityAccess01) +#define GetSecurityAccess01() GetDiagState(kDiagStateIdxSecurityAccess01) +#define SetSecurityAccess01() SetDiagState(kDiagStateIdxSecurityAccess01) +#define ClrSecurityAccess01() ClrDiagState(kDiagStateIdxSecurityAccess01) +#define SetCurrentSecLvl(secLvl) diagCurrentSecLvl = (secLvl) + +#define kDiagStateSecurityAccessAll (kDiagStateSecurityAccess01) + +/* Security access states are used in state machine definition */ +#define kDiagStateSecurityAccessDelay01 kDiagStateNone + +#define kDiagStateSecurityAccessDelayAll (kDiagStateSecurityAccessDelay01) +#if !defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +# define kServiceCheckListSubFctSecCheck kServiceCheckListSubFctCheck +#endif + +#define kDiagStateFunctionalRequest kDiagStateMask(kDiagStateIdxFunctionalRequest) +#define GetFunctionalRequest() GetDiagState(kDiagStateIdxFunctionalRequest) +#define SetFunctionalRequest() SetDiagState(kDiagStateIdxFunctionalRequest) +#define ClrFunctionalRequest() ClrDiagState(kDiagStateIdxFunctionalRequest) + + +#define kDiagStateServiceInProgress kDiagStateMask(kDiagStateIdxServiceInProgress) +#define SetServiceInProgress() SetDiagState(kDiagStateIdxServiceInProgress) +#define ClrServiceInProgress() ClrDiagState(kDiagStateIdxServiceInProgress) + +#define kDiagStateTpConfirmationFlag kDiagStateMask(kDiagStateIdxTpConfirmationFlag) +#define GetTpConfirmationFlag() GetDiagState(kDiagStateIdxTpConfirmationFlag) +#define SetTpConfirmationFlag() SetDiagState(kDiagStateIdxTpConfirmationFlag) +#define ClrTpConfirmationFlag() ClrDiagState(kDiagStateIdxTpConfirmationFlag) + +#define kDiagStateDiagIndication kDiagStateMask(kDiagStateIdxDiagIndication) +#define GetDiagIndication() GetDiagState(kDiagStateIdxDiagIndication) +#define SetDiagIndication() SetDiagState(kDiagStateIdxDiagIndication) +#define ClrDiagIndication() ClrDiagState(kDiagStateIdxDiagIndication) + +#define kDiagStateSuppressPosRspMsg kDiagStateMask(kDiagStateIdxSuppressPosRspMsg) +#define GetSuppressPosRspMsg() GetDiagState(kDiagStateIdxSuppressPosRspMsg) +#define SetSuppressPosRspMsg() SetDiagState(kDiagStateIdxSuppressPosRspMsg) +#define ClrSuppressPosRspMsg() ClrDiagState(kDiagStateIdxSuppressPosRspMsg) + +#define kDiagStateResponseProcessing kDiagStateMask(kDiagStateIdxResponseProcessing) +#define SetResponseProcessing() SetDiagState(kDiagStateIdxResponseProcessing) +#define ClrResponseProcessing() ClrDiagState(kDiagStateIdxResponseProcessing) + +#define kDiagStateRcrRpInProgress kDiagStateMask(kDiagStateIdxRcrRpInProgress) +#define SetRcrRpInProgress() SetDiagState(kDiagStateIdxRcrRpInProgress) +#define ClrRcrRpInProgress() ClrDiagState(kDiagStateIdxRcrRpInProgress) + +#define kDiagStateWaitForRcrRpConf kDiagStateMask(kDiagStateIdxWaitForRcrRpConf) +#define GetWaitForRcrRpConf() GetDiagState(kDiagStateIdxWaitForRcrRpConf) +#define SetWaitForRcrRpConf() SetDiagState(kDiagStateIdxWaitForRcrRpConf) +#define ClrWaitForRcrRpConf() ClrDiagState(kDiagStateIdxWaitForRcrRpConf) + +#define kDiagStateMemDriverInitialized kDiagStateMask(kDiagStateIdxMemDriverInitialized) +#define SetMemDriverInitialized() SetDiagState(kDiagStateIdxMemDriverInitialized) +#define ClrMemDriverInitialized() ClrDiagState(kDiagStateIdxMemDriverInitialized) + +#define kDiagStateTransferDataAllowed kDiagStateMask(kDiagStateIdxTransferDataAllowed) +#define GetTransferDataAllowed() GetDiagState(kDiagStateIdxTransferDataAllowed) +#define SetTransferDataAllowed() SetDiagState(kDiagStateIdxTransferDataAllowed) +#define ClrTransferDataAllowed() ClrDiagState(kDiagStateIdxTransferDataAllowed) + +#define kDiagStateTransferDataSucceeded kDiagStateMask(kDiagStateIdxTransferDataSucceeded) +#define GetTransferDataSucceeded() GetDiagState(kDiagStateIdxTransferDataSucceeded) +#define SetTransferDataSucceeded() SetDiagState(kDiagStateIdxTransferDataSucceeded) +#define ClrTransferDataSucceeded() ClrDiagState(kDiagStateIdxTransferDataSucceeded) + +#define kDiagStateFirstDownloadReq kDiagStateMask(kDiagStateIdxFirstDownloadReq) +#define GetFirstDownloadReq() GetDiagState(kDiagStateIdxFirstDownloadReq) +#define SetFirstDownloadReq() SetDiagState(kDiagStateIdxFirstDownloadReq) +#define ClrFirstDownloadReq() ClrDiagState(kDiagStateIdxFirstDownloadReq) + +#define kDiagStateEraseMemorySucceeded kDiagStateMask(kDiagStateIdxEraseMemorySucceeded) +#define GetEraseMemorySucceeded() GetDiagState(kDiagStateIdxEraseMemorySucceeded) +#define SetEraseMemorySucceeded() SetDiagState(kDiagStateIdxEraseMemorySucceeded) +#define ClrEraseMemorySucceeded() ClrDiagState(kDiagStateIdxEraseMemorySucceeded) + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +#define kDiagStateTransferDataUpload kDiagStateMask(kDiagStateIdxTransferDataUpload) +#define GetTransferDataUpload() GetDiagState(kDiagStateIdxTransferDataUpload) +#define SetTransferDataUpload() SetDiagState(kDiagStateIdxTransferDataUpload) +#define ClrTransferDataUpload() ClrDiagState(kDiagStateIdxTransferDataUpload) +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + + +#define kDiagStateResetMsgConfirmed kDiagStateMask(kDiagStateIdxResetMsgConfirmed) +#define GetResetMsgConfirmed() GetDiagState(kDiagStateIdxResetMsgConfirmed) +#define SetResetMsgConfirmed() SetDiagState(kDiagStateIdxResetMsgConfirmed) +#define ClrResetMsgConfirmed() ClrDiagState(kDiagStateIdxResetMsgConfirmed) + +#define kDiagStateEcuResetFctFinished kDiagStateMask(kDiagStateIdxEcuResetFctFinished) +#define GetEcuResetFctFinished() GetDiagState(kDiagStateIdxEcuResetFctFinished) +#define SetEcuResetFctFinished() SetDiagState(kDiagStateIdxEcuResetFctFinished) +#define ClrEcuResetFctFinished() ClrDiagState(kDiagStateIdxEcuResetFctFinished) + +#define kDiagStateWaitEcuReset kDiagStateMask(kDiagStateIdxWaitEcuReset) +#define SetWaitEcuReset() { \ + SetDiagState(kDiagStateIdxWaitEcuReset); \ + ResetEcuResetTimeout(); \ + } +#define ClrWaitEcuReset() { \ + ClrDiagState(kDiagStateWaitEcuReset); \ + ClrDiagState(kDiagStateResetMsgConfirmed); \ + ClrDiagState(kDiagStateEcuResetFctFinished); \ + StopEcuResetTimeout(); \ + } + +#define kDiagStateDiagBufferLocked kDiagStateMask(kDiagStateIdxDiagBufferLocked) +#define SetDiagBufferLocked() SetDiagState(kDiagStateIdxDiagBufferLocked) +#define ClrDiagBufferLocked() ClrDiagState(kDiagStateIdxDiagBufferLocked) + + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# define kDiagStateDiagDevelopmentKey kDiagStateMask(kDiagStateIdxDiagDevelopmentKey) +# define SetDiagDevelopmentKey() SetDiagState(kDiagStateIdxDiagDevelopmentKey) +# define ClrDiagDevelopmentKey() ClrDiagState(kDiagStateIdxDiagDevelopmentKey) +#endif + +#define kDiagStateProcessingDone kDiagStateMask(kDiagStateIdxProcessingDone) +#define GetProcessingDone() GetDiagState(kDiagStateIdxProcessingDone) +#define SetProcessingDone() SetDiagState(kDiagStateIdxProcessingDone) +#define ClrProcessingDone() ClrDiagState(kDiagStateIdxProcessingDone) + +#define kDiagStateLockedByInit kDiagStateMask(kDiagStateIdxLockedByInit) +#define GetLockedByInit() GetDiagState(kDiagStateIdxLockedByInit) +#define SetLockedByInit() SetDiagState(kDiagStateIdxLockedByInit) +#define ClrLockedByInit() ClrDiagState(kDiagStateIdxLockedByInit) + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +# define SetDiagSessionType(type) (currentDiagSessionIndex = FblDiagGetSessionIndex(type)) +# define GetDiagSessionType() (kDiagSessionParameters[currentDiagSessionIndex].sessionType) +# define GetDiagSessionTimingP2() (kDiagSessionParameters[currentDiagSessionIndex].p2Timing) +# define GetDiagSessionTimingP2Star() (kDiagSessionParameters[currentDiagSessionIndex].p2StarTiming) +#else +# define SetDiagSessionType(type) (currentDiagSessionType = (type)) +# define GetDiagSessionType() (currentDiagSessionType) +# define GetDiagSessionTimingP2() (kDiagSessionTimingP2) +# define GetDiagSessionTimingP2Star() (kDiagSessionTimingP2Star) +#endif /* FBL_DIAG_ENABLE_SESSION_PARAMETERS */ + + +/* Helper macro to get number of array entries */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +/*****************************************************************************/ +/* Definitions for the state machine *****************************************/ +/*****************************************************************************/ + +#define kDiagRqlUnlimited (0xFFFFu) + +#define kDiagNoSubServices (V_MEMROM1 tServiceList V_MEMROM2 V_MEMROM3 *)V_NULL +#define kDiagNoCheckList (tServiceCheckList *)V_NULL + +#define kDiagNoServiceProp (ptServiceProp)V_NULL + +/* Typedefs and structures for internal use **********************************/ + +/* State machine */ +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +typedef V_MEMRAM1 struct tagServiceProp V_MEMRAM2 V_MEMRAM3 * ptServiceProp; +#else +typedef V_MEMROM1 struct tagServiceProp V_MEMROM2 V_MEMROM3 * ptServiceProp; +#endif + +typedef struct tagServiceCheck +{ + vuint8 checkHandlerIdx; + vuint8 NRC; + vuint8 errorHandlerIdx; +} tServiceCheck; + +typedef struct +{ + V_MEMROM1 struct tagServiceCheck V_MEMROM2 V_MEMROM3 * list; + vuint8 count; +} tServiceCheckList; + +typedef struct tagServiceList +{ + ptServiceProp list; + tCwDataLengthType bufPos; + vuint8 idSize; + vuint8 count; +} tServiceList; + +#if defined( FBL_DIAG_STATE_ARRAYS ) +# define FBL_DIAG_STATE_SET 0 +# define FBL_DIAG_STATE_UNSET 1 +# define FBL_DIAG_STATE_ADD 2 +# define FBL_DIAG_STATE_CLR 3 +# define FBL_DIAG_STATE_CLRFAIL 4 + +# define stateSet states[FBL_DIAG_STATE_SET] +# define stateUnset states[FBL_DIAG_STATE_UNSET] +# define stateAdd states[FBL_DIAG_STATE_ADD] +# define stateClr states[FBL_DIAG_STATE_CLR] +# define stateClrFail states[FBL_DIAG_STATE_CLRFAIL] +#endif + +typedef struct tagServiceProp +{ + V_MEMROM1 struct tagServiceList V_MEMROM2 V_MEMROM3 * subServices; + V_MEMROM1 vuint8 V_MEMROM2 V_MEMROM3 * serviceId; +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) +#else + V_MEMROM1 tServiceCheckList V_MEMROM2 V_MEMROM3 * checks; +#endif + vuint16 minLength; + vuint16 maxLength; +#if defined( FBL_DIAG_STATE_ARRAYS ) && \ + ( STATE_COUNT > 0 ) + tStateBitmap states[STATE_COUNT][STATECHECK_ARRAYSIZE]; +#else + tStateBitmap stateSet[STATECHECK_ARRAYSIZE]; + tStateBitmap stateUnset[STATECHECK_ARRAYSIZE]; + tStateBitmap stateAdd[STATECHECK_ARRAYSIZE]; + tStateBitmap stateClr[STATECHECK_ARRAYSIZE]; + tStateBitmap stateClrFail[STATECHECK_ARRAYSIZE]; +#endif + vuint8 mainHandlerIdx; +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) + vuint8 checkListIdx; +#endif +} tServiceProp; + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +typedef struct +{ +# if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) +# else + V_MEMROM1 struct tagServiceList V_MEMROM2 V_MEMROM3 * subServices; +# endif + V_MEMROM1 vuint8 V_MEMROM2 V_MEMROM3 * serviceId; +# if defined( FBL_DIAG_CHECK_LIST_HANDLES ) +# else + V_MEMROM1 tServiceCheckList V_MEMROM2 V_MEMROM3 * checks; +# endif + vuint16 minLength; + vuint16 maxLength; + vuint8 stateUsage; + vuint8 mainHandlerIdx; +# if defined( FBL_DIAG_CHECK_LIST_HANDLES ) + vuint8 checkListIdx; +# endif +# if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) + vuint8 subServicesHandler; +# endif +} tServicePropROM; +#endif + +#define FBL_DIAG_CHECK_HANDLER(name) tFblResult name( const V_MEMRAM1 tServiceProp V_MEMRAM2 V_MEMRAM3 * properties, \ + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, \ + tCwDataLengthType length, tCwDataLengthType position, \ + V_MEMRAM1 ptServiceProp V_MEMRAM2 V_MEMRAM3 * result ) +#define FBL_DIAG_ERROR_HANDLER(name) tFblResult name( const V_MEMRAM1 tServiceProp V_MEMRAM2 V_MEMRAM3 *properties, \ + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, \ + tCwDataLengthType diagReqDataLen ) +#define FBL_DIAG_MAIN_HANDLER(name) tFblResult name( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, \ + tCwDataLengthType diagReqDataLen ) + +typedef FBL_DIAG_CHECK_HANDLER((*tFblDiagCheckHandler)); +typedef FBL_DIAG_ERROR_HANDLER((*tFblDiagErrorHandler)); +typedef FBL_DIAG_MAIN_HANDLER((*tFblDiagMainHandler)); + +/* Check handler */ + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +typedef struct +{ + vuint8 sessionType; /* Diagnostic Session Type */ + vuint16 p2Timing; /* P2 Timing Value [ms] */ + vuint16 p2StarTiming; /* P2* Timing Value [ms] / 10 */ +} tDiagSessionParameters; +#endif /* FBL_ENABLE_SESSION_PARAMETERS */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Data buffer for diagnostic data */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * V_MEMRAM1 V_MEMRAM2 DiagBuffer; +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 diagErrorCode; /* Diagnostic error code */ +V_MEMRAM0 V_MEMRAM1 tCwDataLengthType V_MEMRAM2 DiagDataLength; /* Stores number of received data */ +V_MEMRAM0 V_MEMRAM1_NEAR vuint16 V_MEMRAM2_NEAR P2Timeout; /* P2 timeout value */ +V_MEMRAM0 V_MEMRAM1_NEAR vuint16 V_MEMRAM2_NEAR testerPresentTimeout; /* Timer value for TesterPresent timeout */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 diagResponseFlag; /* Flag to enable/suppress diagnostic response */ +V_MEMRAM0 V_MEMRAM1_NEAR vuint8 V_MEMRAM2_NEAR diagServiceCurrent; /* Currently processed diag service ID */ +V_MEMRAM0 V_MEMRAM1_NEAR tStateBitmap V_MEMRAM2_NEAR fblStates[STATE_INDEX(kDiagNumberOfStates - 1u) + 1u]; /* State bitmap array */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 diagCurrentSecLvl; /* Current security level */ +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 diagRequestedSecLvlIdx; /* Table index of currently requested security level */ +#endif +#if defined( FBL_ENABLE_SLEEPMODE ) +V_MEMRAM0 V_MEMRAM1 vuint32 V_MEMRAM2 sleepCounter; /* Counter, determines when to sleep */ +#endif + +#if defined( FBL_ENABLE_DEBUG_STATUS ) +/* Variables for error status reporting */ /* PRQA S 1514 6 */ /* MD_FblDiag_1514 */ +V_MEMRAM0 V_MEMRAM1 vuint16 V_MEMRAM2 errStatErrorCode; /* Error status */ +V_MEMRAM0 V_MEMRAM1 vuint16 V_MEMRAM2 errStatFblStates; /* FBL state flag */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 errStatLastServiceId; /* Last received service identifier */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 errStatFlashDrvVersion[3]; /* Flash driver version information */ +V_MEMRAM0 V_MEMRAM1 vuint16 V_MEMRAM2 errStatFlashDrvErrorCode; /* Flash driver error code */ +V_MEMRAM0 V_MEMRAM1 tBlockDescriptor V_MEMRAM2 errStatDescriptor; /* Error status block descriptor */ +#endif + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + +# define FBLDIAG_START_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMROM0 V_MEMROM1 tDiagSecAccessParams V_MEMROM2 kDiagSecAccessParams[] = +{ + { kDiagSecLevelFlash, kSecSeedLength, kSecKeyLength } +}; + +# define FBLDIAG_STOP_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_ENABLE_SEC_ADDITIONAL_LEVELS */ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* PRQA S 3218 TAG_FblDiag_3218_1 */ /* MD_FblDiag_3218 */ + +/* Temporary data used during download in TransferData */ +V_MEMRAM0 static V_MEMRAM1 tDiagSegmentList V_MEMRAM2 diagSegmentList; /* Complete list of download segments */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 currentSegment; /* Index of currently processed download segment */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 currentBlock; /* Index of currently processed download block */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 lastErasedBlock; +V_MEMRAM0 static V_MEMRAM1 tBlockHeader V_MEMRAM2 blockHeader[FBL_LBT_BLOCK_COUNT]; /* Structure with runtime information about logical blocks */ +V_MEMRAM0 static V_MEMRAM1 tFblDiagAddr V_MEMRAM2 transferAddress; /* Actual transfer address */ +V_MEMRAM0 static V_MEMRAM1 tFblLength V_MEMRAM2 transferRemainder; /* Number of remaining transfer bytes */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 transferType; /* Download into RAM/Flash or upload */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 expectedSequenceCnt; /* Block sequence counter */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 currentSequenceCnt; /* Current Block sequence counter */ +V_MEMRAM0 static V_MEMRAM1_NEAR vuint16 V_MEMRAM2_NEAR ecuResetTimeout; /* Timeout for EcuReset request (CW) */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 dataFormatId; /* Combined encryption and compression method */ +V_MEMRAM0 static V_MEMRAM1 tFblLength V_MEMRAM2 totalProgramLength; /* Total number of programmed bytes */ + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 diagRequestedSecLvl; /* Currently requested security level (via seed) */ +#endif + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +/* Internal index of the active diagnostic session (table kDiagSessionParameters) */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 currentDiagSessionIndex; +#else +/* Type of the active diagnostic session according to the SessionControl sub-function parameter */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 currentDiagSessionType; +#endif + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* State check masks */ +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskSessions[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateSessionAll); +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskFunctional[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateFunctionalRequest); +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskSecurityAccess[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateSecurityAccess01); +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskSequenceError[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateSecurityKey01 | kDiagStateTransferDataAllowed); + /* PRQA S 2790, 3494 1 */ /* MD_FblDiag_2790_kDiagStateMaskAllLong, MD_FblDiag_ConstValue */ +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskGeneralConditions[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateMaskAllLong); +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateMaskReset[STATECHECK_ARRAYSIZE] = STATE_BUILDARRAY(kDiagStateNone); + +#define FBLDIAG_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Concatenation of service properties */ +V_MEMRAM0 static V_MEMRAM1_NEAR tServiceProp V_MEMRAM2_NEAR serviceProperties; +/* Result of service execution */ +V_MEMRAM0 static V_MEMRAM1_NEAR tFblResult V_MEMRAM2_NEAR serviceResult; + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +/* maxNumberOfBlockLength is a 12 bit value that determines the maximum size */ +/* of a block of data that can be transferred */ +V_MEMRAM0 static V_MEMRAM1 vuint16 V_MEMRAM2 maxNumberOfBlockLength; +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +V_MEMROM0 static V_MEMROM1 tDiagSessionParameters V_MEMROM2 kDiagSessionParameters[] = +{ + /* Default Session */ + { kDiagSubDefaultSession, 50, 500 }, + /* Programming Session */ + { kDiagSubProgrammingSession, kDiagSessionTimingP2, kDiagSessionTimingP2Star } +}; + +V_MEMROM0 static V_MEMROM1 vuint8 V_MEMROM2 kDiagNumberOfSessions = sizeof(kDiagSessionParameters) / sizeof(tDiagSessionParameters); +#endif /* FBL_DIAG_ENABLE_SESSION_PARAMETERS */ + +#define FBLDIAG_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +/* SHA256 + CRC16 */ +# define FBL_DIAG_VERIFY_BUFFER_SIZE (SEC_VERIFY_CLASS_DDD_DIGEST_SIZE + SEC_SIZE_CHECKSUM_CRC) +# define FBL_DIAG_CRC_OFFSET SEC_VERIFY_CLASS_DDD_CHECKSUM_OFFSET +#else +/* CRC16 */ +# define FBL_DIAG_VERIFY_BUFFER_SIZE (SEC_VERIFY_CLASS_DDD_DIGEST_SIZE) +# define FBL_DIAG_CRC_OFFSET 0u +#endif + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/* Parameters for pipelined signature calculation */ +V_MEMRAM0 static V_MEMRAM1 SecM_SignatureParamType V_MEMRAM2 pipeVerifyParam; +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +V_MEMRAM0 static V_MEMRAM1 SecM_SignatureParamType V_MEMRAM2 pipeVerifyParamCrc; +# endif +/* Used to store hash value and optionally security module context */ /* PRQA S 3678 1 */ /* MD_FblDiag_3678 */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 pipeVerifyBuf[FBL_DIAG_VERIFY_BUFFER_SIZE]; +V_MEMRAM0 static V_MEMRAM1 vuint32 V_MEMRAM2 pipeVerifyLength; +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +V_MEMRAM0 static V_MEMRAM1 SecM_CRCParamType V_MEMRAM2 pipeVerifyCrc; +V_MEMRAM0 static V_MEMRAM1 vuint32 V_MEMRAM2 pipeVerifyLengthCrc; +# endif +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +V_MEMRAM0 static V_MEMRAM1 SecM_VerifyParamType V_MEMRAM2 verifyParam; +V_MEMRAM0 static V_MEMRAM1 FL_SegmentInfoType V_MEMRAM2 verifySegmentInfo[1]; +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +V_MEMRAM0 static V_MEMRAM1 vuint16 V_MEMRAM2 verifyTokenSignLength; +#endif + +/* Output buffer which keeps the verification result from FblMemBlockVerify (RequestTransferExit, CheckProgDep) */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 verifyOutputBuf[FBL_DIAG_VERIFY_BUFFER_SIZE]; + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +/*********************************************************************************************************************** + * PROTOTYPES + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static void FblDiagSegmentInit( void ); +static vuint8 FblDiagSegmentNext( tFblDiagAddr segAddr, tFblLength segLength, vuint8 blockIdx ); +static tCwDataLengthType FblDiagGetMaxTransferDataBlockLength(void); +static void DiagDiscardReception( void ); +static tFblResult FblInitMemoryDriver( void ); +static void FblDeinitMemoryDriver( void ); +static void FblDiagDeinit( void ); + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +static void DiagResetResponseHandling( void ); +#define FBLDIAG_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * FblDiagMemGetActiveBuffer(void); + +/*-- Service property functions ---------------------------------------------*/ +static void FblDiagSetState (const V_MEMRAM1 tStateBitmap V_MEMRAM2 V_MEMRAM3 * state); +static void FblDiagClrState (const V_MEMRAM1 tStateBitmap V_MEMRAM2 V_MEMRAM3 * state); +static void FblDiagRetainState (V_MEMROM1 tStateBitmap V_MEMROM2 V_MEMROM3 * state); +static void FblDiagInitStateTables ( void ); +static void FblDiagSetProperties(ptServiceProp source, tServiceProp * destination); +static void FblDiagMergeProperties(ptServiceProp source, tServiceProp * merge); +static void FblDiagDispatch ( void ); + +static tFblResult FblDiagSecAccessSeed(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen, vuint8 secLevel); +static tFblResult FblDiagSecAccessKey(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen, vuint8 secLevel); + +/*-- Service check functions ------------------------------------------------*/ +static FBL_DIAG_CHECK_HANDLER(FblDiagSearchService); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSession); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckLength); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckFunctional); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSuppressPosRsp); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecurityAccess); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSequenceError); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckGeneralConditions); +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckTransferMode); +#endif +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +static FBL_DIAG_CHECK_HANDLER(FblDiagSearchSecService); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecLength); +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecSequenceError); +#endif + +/*-- Diagnostic error handler service functions -----------------------------*/ +#if defined( FBL_ENABLE_USERSERVICE ) +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerServiceNotFound); +#endif +#if defined( FBL_ENABLE_USERSUBFUNCTION ) +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerSubFunctionNotFound); +#endif +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerExecMainHandler); + +/*-- Diagnostic main handler service functions ------------------------------*/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerDefaultSession); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerProgrammingSession); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTesterPresent); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerEcuReset); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcEraseMemory); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcCheckProgDep); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcActivateSbl); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcCheckValidApp); +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcTokenDownload); +# endif +#endif +#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcUpdateSecBytes); +#endif +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerSecAccessSeed); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerSecAccessKey); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestDownload); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTransferDataDownload); +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestUpload); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTransferDataUpload); +#endif +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestTransferExit); +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerReadDataById); +#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER ) +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerWriteDataById); +#endif +#if defined( FBL_ENABLE_USERROUTINE ) +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRoutineControl); +#endif + +/*-- Ford specific functions --------------------------------------------*/ +static void FblDiagInitDownloadSequence( void ); +static tFblResult FblDiagPrepareDidResponse( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pbDiagBuffer, vuint16 reqDid, tDidDataPtr didData, vuint16 didLen ); +static tFblResult FblDiagCheckState( const V_MEMRAM1 tServiceProp V_MEMRAM2 V_MEMRAM3 *properties, V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pbDiagBuffer, tCwDataLengthType length, tCwDataLengthType position, V_MEMROM1 tStateBitmap V_MEMROM2 * stateMask, ptServiceProp * result); +static tFblResult FblDiagSessionTransition( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen ); +static void FblDiagSessionControlParamInit( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen ); +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +static vuint8 FblDiagGetSessionIndex( vuint8 diagnosticSessionType ); +#endif +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +static SecM_StatusType FblDiagVerification( V_MEMRAM1 SecM_VerifyParamType V_MEMRAM2 V_MEMRAM3 * verifyPar ); +#endif +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) && ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +static SecM_StatusType FblDiagVerifySignature( V_MEMRAM1 SecM_SignatureParamType V_MEMRAM2 V_MEMRAM3 * pVerifyParam ); +#endif +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +static tTokenHdlResult FblDiagTokenLengthCheck(vuint8 cmdType, vuint16 tokenLength); +static tTokenHdlResult FblDiagTokenKeyProcessing(vuint8 cmdType, V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBufferPtr); +static tTokenHdlResult FblDiagValidateToken( const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf ); +static tFblResult FblDiagCheckServerMessageId( const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf ); +static tTokenHdlResult FblDiagTokenCallout( vuint8 cmdType, const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf, vuint16 tokenLength ); +# endif +#endif + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*****************************************************************************/ +/*** State machine configuration *********************************************/ +/*****************************************************************************/ + +/* The handler tables */ +enum +{ + kServiceCheckHandlerSearchService + ,kServiceCheckHandlerCheckSession + ,kServiceCheckHandlerCheckLength + ,kServiceCheckHandlerCheckFunctional + ,kServiceCheckHandlerCheckSuppressPosRsp + ,kServiceCheckHandlerCheckSecurityAccess + ,kServiceCheckHandlerCheckSequenceError + ,kServiceCheckHandlerCheckGeneralConditions +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,kServiceCheckHandlerTransferMode +#endif +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + ,kServiceCheckHandlerSearchSecService + ,kServiceCheckHandlerCheckSecLength + ,kServiceCheckHandlerCheckSecSequenceError +#endif +}; + +#define FBLDIAG_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMROM0 static V_MEMROM1 tFblDiagCheckHandler V_MEMROM2 kServiceCheckHandlerFctTable[] = +{ + &FblDiagSearchService + ,&FblDiagCheckSession + ,&FblDiagCheckLength + ,&FblDiagCheckFunctional + ,&FblDiagCheckSuppressPosRsp + ,&FblDiagCheckSecurityAccess + ,&FblDiagCheckSequenceError + ,&FblDiagCheckGeneralConditions +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,&FblDiagCheckTransferMode +#endif +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + ,&FblDiagSearchSecService + ,&FblDiagCheckSecLength + ,&FblDiagCheckSecSequenceError +#endif +}; + +enum +{ + kServiceErrorHandlerExecMainHandler +#if defined( FBL_ENABLE_USERSERVICE ) + ,kServiceErrorHandlerServiceNotFound +#endif +#if defined( FBL_ENABLE_USERSUBFUNCTION ) + ,kServiceErrorHandlerSubFunctionNotFound +#endif + /*----------------------*/ + ,kServiceErrorHandlerNone +}; + +V_MEMROM0 static V_MEMROM1 tFblDiagErrorHandler V_MEMROM2 kServiceErrorHandlerFctTable[] = +{ + &FblDiagErrorHandlerExecMainHandler +#if defined( FBL_ENABLE_USERSERVICE ) + ,&FblDiagErrorHandlerServiceNotFound +#endif +#if defined( FBL_ENABLE_USERSUBFUNCTION ) + ,&FblDiagErrorHandlerSubFunctionNotFound +#endif +}; + +enum +{ + kServiceMainHandlerDefaultSession + ,kServiceMainHandlerProgrammingSession + ,kServiceMainHandlerTesterPresent + ,kServiceMainHandlerEcuReset + ,kServiceMainHandlerRcEraseMemory + ,kServiceMainHandlerRcCheckProgDep + ,kServiceMainHandlerRcActivateSbl + ,kServiceMainHandlerRcCheckValidApp +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) + ,kServiceMainHandlerRcTokenDownload +# endif +#endif +#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) + ,kServiceMainHandlerRcUpdateSecBytes +#endif + ,kServiceMainHandlerSecAccessSeed + ,kServiceMainHandlerSecAccessKey + ,kServiceMainHandlerRequestDownload + ,kServiceMainHandlerTransferDataDownload +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,kServiceMainHandlerRequestUpload + ,kServiceMainHandlerTransferDataUpload +#endif + ,kServiceMainHandlerRequestTransferExit + ,kServiceMainHandlerReadDataById +#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER ) + ,kServiceMainHandlerWriteDataById +#endif +#if defined( FBL_ENABLE_USERROUTINE ) + ,kServiceMainHandlerRoutineControl +#endif + /*----------------------*/ + ,kServiceMainHandlerNone +}; + +V_MEMROM0 static V_MEMROM1 tFblDiagMainHandler V_MEMROM2 kServiceMainHandlerFctTable[] = { + &FblDiagMainHandlerDefaultSession + ,&FblDiagMainHandlerProgrammingSession + ,&FblDiagMainHandlerTesterPresent + ,&FblDiagMainHandlerEcuReset + ,&FblDiagMainHandlerRcEraseMemory + ,&FblDiagMainHandlerRcCheckProgDep + ,&FblDiagMainHandlerRcActivateSbl + ,&FblDiagMainHandlerRcCheckValidApp +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) + ,&FblDiagMainHandlerRcTokenDownload +# endif +#endif +#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) + ,&FblDiagMainHandlerRcUpdateSecBytes +#endif + ,&FblDiagMainHandlerSecAccessSeed + ,&FblDiagMainHandlerSecAccessKey + ,&FblDiagMainHandlerRequestDownload + ,&FblDiagMainHandlerTransferDataDownload +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,&FblDiagMainHandlerRequestUpload + ,&FblDiagMainHandlerTransferDataUpload +#endif + ,&FblDiagMainHandlerRequestTransferExit + ,&FblDiagMainHandlerReadDataById +#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER ) + ,&FblDiagMainHandlerWriteDataById +#endif +#if defined( FBL_ENABLE_USERROUTINE ) + ,&FblDiagMainHandlerRoutineControl +#endif +}; + + + +/*****************************************************************************/ +/* Service checks */ +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagServiceChecks[] = +{ + { + kServiceCheckHandlerSearchService + ,kDiagNrcServiceNotSupported +# if defined( FBL_ENABLE_USERSERVICE ) + ,kServiceErrorHandlerServiceNotFound +# else + ,kServiceErrorHandlerNone +# endif + } + ,{ + kServiceCheckHandlerCheckFunctional + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSession + ,kDiagNrcServiceNotSupportedInActiveSession + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckLength + ,kDiagNrcIncorrectMessageLengthOrInvalidFormat + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecurityAccess + ,kDiagNrcSecurityAccessDenied + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSequenceError + ,kDiagNrcRequestSequenceError + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagServiceCheckTable = +{ + kDiagServiceChecks + ,(sizeof(kDiagServiceChecks)/sizeof(kDiagServiceChecks[0])) +}; + +/*****************************************************************************/ + +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagSubFctChecks[] = +{ + /* No real check, but only needs to be set once here */ + { + kServiceCheckHandlerCheckSuppressPosRsp + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerSearchService + ,kDiagNrcSubFunctionNotSupported +# if defined( FBL_ENABLE_USERSUBFUNCTION ) + ,kServiceErrorHandlerSubFunctionNotFound +# else + ,kServiceErrorHandlerNone +# endif + } + ,{ + kServiceCheckHandlerCheckFunctional + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSession + ,kDiagNrcSubfunctionNotSupportedInActiveSession + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckLength + ,kDiagNrcIncorrectMessageLengthOrInvalidFormat + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecurityAccess + ,kDiagNrcSecurityAccessDenied + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSequenceError + ,kDiagNrcRequestSequenceError + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagSubFctCheckTable = +{ + kDiagSubFctChecks + ,(sizeof(kDiagSubFctChecks)/sizeof(kDiagSubFctChecks[0])) +}; + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +/*****************************************************************************/ +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagSubFctSecChecks[] = +{ + /* No real check, but only needs to be set once here */ + { + kServiceCheckHandlerCheckSuppressPosRsp + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerSearchSecService + ,kDiagNrcSubFunctionNotSupported +# if defined( FBL_ENABLE_USERSUBFUNCTION ) + ,kServiceErrorHandlerSubFunctionNotFound +# else + ,kServiceErrorHandlerNone +# endif + } + ,{ + kServiceCheckHandlerCheckFunctional + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSession + ,kDiagNrcSubfunctionNotSupportedInActiveSession + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecLength + ,kDiagNrcIncorrectMessageLengthOrInvalidFormat + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecSequenceError + ,kDiagNrcRequestSequenceError + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagSubFctSecCheckTable = +{ + kDiagSubFctSecChecks + ,(sizeof(kDiagSubFctSecChecks)/sizeof(kDiagSubFctSecChecks[0])) +}; +#endif /* FBL_ENABLE_SEC_ADDITIONAL_LEVELS */ + +/*****************************************************************************/ + +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagRcTypeChecks[] = +{ + /* No real check, but only needs to be set once here */ + { + kServiceCheckHandlerCheckSuppressPosRsp + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerSearchService + ,kDiagNrcSubFunctionNotSupported + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckFunctional + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSession + ,kDiagNrcSubfunctionNotSupportedInActiveSession + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckLength + ,kDiagNrcIncorrectMessageLengthOrInvalidFormat + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecurityAccess + ,kDiagNrcSecurityAccessDenied + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSequenceError + ,kDiagNrcRequestSequenceError + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagRcTypeCheckTable = +{ + kDiagRcTypeChecks + ,(sizeof(kDiagRcTypeChecks)/sizeof(kDiagRcTypeChecks[0])) +}; + +/*****************************************************************************/ + +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagNonSubFctChecks[] = +{ + { + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagNonSubFctCheckTable = +{ + kDiagNonSubFctChecks + ,(sizeof(kDiagNonSubFctChecks)/sizeof(kDiagNonSubFctChecks[0])) +}; + +/*****************************************************************************/ + +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagSubRoutineChecks[] = +{ + { + kServiceCheckHandlerSearchService + ,kDiagNrcRequestOutOfRange + ,kServiceErrorHandlerExecMainHandler + } + ,{ + kServiceCheckHandlerCheckFunctional + ,kDiagNrcNoResponse + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSession + ,kDiagNrcRequestOutOfRange + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecurityAccess + ,kDiagNrcSecurityAccessDenied + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagSubRoutineCheckTable = +{ + kDiagSubRoutineChecks + ,(sizeof(kDiagSubRoutineChecks)/sizeof(kDiagSubRoutineChecks[0])) +}; + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +/*****************************************************************************/ +/* TransferData checks */ +V_MEMROM0 static V_MEMROM1 tServiceCheck V_MEMROM2 kDiagTransferDataChecks[] = +{ + { + kServiceCheckHandlerTransferMode + ,kDiagErrorNone + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckLength + ,kDiagNrcIncorrectMessageLengthOrInvalidFormat + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckSecurityAccess + ,kDiagNrcSecurityAccessDenied + ,kServiceErrorHandlerNone + } + ,{ + kServiceCheckHandlerCheckGeneralConditions + ,kDiagNrcConditionsNotCorrect + ,kServiceErrorHandlerNone + } + +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 kDiagTransferDataCheckTable = +{ + kDiagTransferDataChecks + ,(sizeof(kDiagTransferDataChecks)/sizeof(kDiagTransferDataChecks[0])) +}; +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +/*****************************************************************************/ + +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) +/* The check list tables */ +enum +{ + kServiceCheckListServiceCheck + ,kServiceCheckListSubFctCheck +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + ,kServiceCheckListSubFctSecCheck +#endif + ,kServiceCheckListNonSubFctCheck + ,kServiceCheckListSubRoutineCheck + ,kServiceCheckListRcTypeCheck +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,kServiceCheckListTransferDataCheck +#endif + /*----------------------*/ + ,kServiceCheckListNone +}; + +V_MEMROM0 static V_MEMROM1 tServiceCheckList V_MEMROM2 V_MEMROM3 * V_MEMROM1 V_MEMROM2 kServiceCheckListTable[] = +{ + &kDiagServiceCheckTable + ,&kDiagSubFctCheckTable +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + ,&kDiagSubFctSecCheckTable +#endif + ,&kDiagNonSubFctCheckTable + ,&kDiagSubRoutineCheckTable + ,&kDiagRcTypeCheckTable +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,&kDiagTransferDataCheckTable +#endif +}; +#endif + +/* Service handlers **********************************************************/ +/* PRQA S 0342 TAG_FblDiag_0342_1 */ /* MD_MSR_Rule20.10_0342 */ +/* PRQA S 0841 TAG_FblDiag_0841_1 */ +enum +{ +#define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) kDiagService ## name +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_OUTPUT +#define FBL_DIAG_IMPL_OUTPUT FBL_DIAG_STATE_RESULT, + +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ + +#undef FBL_DIAG_STATE_DEF +#undef FBL_DIAG_IMPL_TYPE +#undef FBL_DIAG_IMPL_OUTPUT + + kDiagNumberOfServices +}; + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +/* State Bitmaps ************************************************************/ +V_MEMROM0 static V_MEMROM1 tStateBitmap V_MEMROM2 kDiagStateBitmaps[] = +{ +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_STATEBITMAP +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ +#undef FBL_DIAG_IMPL_TYPE +}; + +#endif +/* Service IDs ***************************************************************/ + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +V_MEMRAM0 static V_MEMRAM1 tServiceProp V_MEMRAM2 kDiagServiceProperties[kDiagNumberOfServices]; +#else +V_MEMROM0 static V_MEMROM1 tServiceProp V_MEMROM2 kDiagServiceProperties[kDiagNumberOfServices]; +#endif + +/* Service IDs ***************************************************************/ +#define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) \ + V_MEMROM0 static V_MEMROM1 vuint8 V_MEMROM2 kDiagSrvId_ ## name [] = { id } +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_OUTPUT +#define FBL_DIAG_IMPL_OUTPUT FBL_DIAG_STATE_RESULT; + +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ + +#undef FBL_DIAG_STATE_DEF +#undef FBL_DIAG_IMPL_TYPE +#undef FBL_DIAG_IMPL_OUTPUT + +/* Service Lists *************************************************************/ + +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_SERVICELIST +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ +#undef FBL_DIAG_IMPL_TYPE + +#if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) +enum +{ +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_SERVICELIST_ENUM +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ +#undef FBL_DIAG_IMPL_TYPE + kDiagServiceListHandler_None +}; + +V_MEMROM0 static V_MEMROM1 tServiceList V_MEMROM2 V_MEMROM3 * V_MEMROM1 V_MEMROM2 kDiagSubFctTblHandler[] = +{ +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_SERVICELIST_HANDLER +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ +#undef FBL_DIAG_IMPL_TYPE + kDiagNoSubServices +}; +#endif + +/* Service Properties ********************************************************/ + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +V_MEMROM0 static V_MEMROM1 tServicePropROM V_MEMROM2 kDiagServicePropertiesROM[] = +#else +V_MEMROM0 static V_MEMROM1 tServiceProp V_MEMROM2 kDiagServiceProperties[] = +#endif +{ +#define FBL_DIAG_IMPL_TYPE FBL_DIAG_IMPL_TYPE_SERVICEPROPERTY +#include "fbl_diag.def" /* PRQA S 5087 */ /* MD_FblDiag_5087_DiagDef */ +#undef FBL_DIAG_IMPL_TYPE +}; +/* PRQA L:TAG_FblDiag_0342_1 */ +/* PRQA L:TAG_FblDiag_0881_1 */ +/* PRQA L:TAG_FblDiag_0841_1 */ +/* PRQA L:TAG_FblDiag_3410_1 */ +/* PRQA L:TAG_FblDiag_3412_1 */ +/* PRQA L:TAG_FblDiag_3431_1 */ +/* PRQA L:TAG_FblDiag_3453_2 */ +/* PRQA L:TAG_FblDiag_3218_1 */ + +#define FBLDIAG_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_ENABLE_USERSERVICE ) +/*********************************************************************************************************************** + * FblDiagErrorHandlerServiceNotFound + **********************************************************************************************************************/ +/*! \brief Execute callback for user specific service implementations + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] diagReqDataLen Request length + * \return User service found + **********************************************************************************************************************/ +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerServiceNotFound) +{ + tFblResult result; +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)properties; +#endif + + ApplDiagUserService(&pbDiagBuffer[kDiagFmtRoutineIdHigh], diagReqDataLen); + + result = kFblFailed; + if (DiagGetError() == kDiagErrorNone) + { + result = kFblOk; + } + + return result; +} +#endif /* FBL_ENABLE_USERSERVICE */ + +#if defined( FBL_ENABLE_USERSUBFUNCTION ) +/*********************************************************************************************************************** + * FblDiagErrorHandlerSubFunctionNotFound + **********************************************************************************************************************/ +/*! \brief Execute callback for user specific subfunction implementations + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] diagReqDataLen Request length + * \return User subfunction found + **********************************************************************************************************************/ +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerSubFunctionNotFound) +{ + tFblResult result; +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)properties; +#endif + + ApplDiagUserSubFunction(&pbDiagBuffer[kDiagFmtRoutineIdHigh], diagReqDataLen); + + result = kFblFailed; + if (DiagGetError() == kDiagErrorNone) + { + result = kFblOk; + } + + return result; +} +#endif /* FBL_ENABLE_USERSUBFUNCTION */ + +/*********************************************************************************************************************** + * FblDiagErrorHandlerExecMainHandler + **********************************************************************************************************************/ +/*! \brief Execute main handler of parent service + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] diagReqDataLen Request length + * \return Main handler execution result + **********************************************************************************************************************/ +static FBL_DIAG_ERROR_HANDLER(FblDiagErrorHandlerExecMainHandler) +{ + tFblResult result; + + result = kFblFailed; + if (properties->mainHandlerIdx != (vuint8)kServiceMainHandlerNone) + { + result = (kServiceMainHandlerFctTable[properties->mainHandlerIdx])(pbDiagBuffer, diagReqDataLen); + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagSearchService + **********************************************************************************************************************/ +/*! \brief Search the subservice table using the id at the current request position + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Search successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Search failed + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_CHECK_HANDLER(FblDiagSearchService) +{ + V_MEMROM1 tServiceList V_MEMROM2 V_MEMROM3 * localSubServices; + ptServiceProp subSrvLst = V_NULL; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + ptServiceProp subService = V_NULL; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + + vuint8 curPos; + vuint8 subSrvIdx; + tFblResult valid; + tFblResult found; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)length; +#endif + + localSubServices = properties->subServices; + subSrvLst = localSubServices->list; + + found = kFblFailed; + for (subSrvIdx = 0; subSrvIdx < localSubServices->count; subSrvIdx++) + { + subService = &subSrvLst[subSrvIdx]; + + valid = kFblOk; + for (curPos = 0; curPos < localSubServices->idSize; curPos++) + { + if (subService->serviceId[curPos] != pbDiagBuffer[position + curPos]) + { + valid = kFblFailed; + /* Code size optimization, single break in loop allowed by MISRA */ + break; + } + } + + if (valid == kFblOk) + { + found = kFblOk; + *result = subService; + /* Code size optimization, single break in loop allowed by MISRA */ + break; + } + } + + return found; +} + +/*********************************************************************************************************************** + * FblDiagCheckState + **********************************************************************************************************************/ +/*! \brief Check if the masked state matches the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in] stateMask State mask + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +/* PRQA S 3673, 6060 1 */ /* MD_MSR_Rule8.13, MD_MSR_STPAR */ +static tFblResult FblDiagCheckState( const V_MEMRAM1 tServiceProp V_MEMRAM2 V_MEMRAM3 *properties, V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pbDiagBuffer, tCwDataLengthType length, tCwDataLengthType position, V_MEMROM1 tStateBitmap V_MEMROM2 * stateMask, ptServiceProp * result) +{ + vuint8 idx, valid; + tStateBitmap maskedState; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 4 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)length; + (void)position; + (void)result; +#endif + valid = kFblOk; + +#if ( STATECHECK_ARRAYSIZE == 1u ) + idx = 0u; +#else + for (idx = 0u; (idx < STATECHECK_ARRAYSIZE) && (valid == kFblOk); idx++) +#endif + { + /* Separate the state bits which have to be set */ + maskedState = properties->stateSet[idx] & stateMask[idx]; + + /* Check if all of the required "Set" states are set */ + if ((maskedState != kDiagStateMaskNone) && ((maskedState & fblStates[idx]) != maskedState)) + { + /* At least one of the required states is not set */ + valid = kFblFailed; + } + else + { + /* Separate the state bits which must not be set */ + maskedState = properties->stateUnset[idx] & stateMask[idx]; + + /* Check if all of the required "Unset" states are cleared */ + if ((maskedState != kDiagStateMaskNone) && ((maskedState & fblStates[idx]) != kDiagStateMaskNone)) + { + /* At least one of the required states is set */ + valid = kFblFailed; + } + } + } + + /* + Positive check result: + - All of the required "Set" states are set + - All of the required "Unset" states are cleared + */ + return valid; +} + +/*********************************************************************************************************************** + * FblDiagCheckSession + **********************************************************************************************************************/ +/*! \brief Check if the session states match the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSession) +{ + return FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskSessions, result); +} + +/*********************************************************************************************************************** + * FblDiagCheckFunctional + **********************************************************************************************************************/ +/*! \brief Check if the functional request state matches the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckFunctional) +{ + return FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskFunctional, result); +} + +/*********************************************************************************************************************** + * FblDiagCheckSecurityAccess + **********************************************************************************************************************/ +/*! \brief Check if the security access states match the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecurityAccess) +{ + return FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskSecurityAccess, result); +} + +/*********************************************************************************************************************** + * FblDiagCheckSequenceError + **********************************************************************************************************************/ +/*! \brief Check if the states leading to request sequence errors match the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSequenceError) +{ + return FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskSequenceError, result); +} + +/*********************************************************************************************************************** + * FblDiagCheckGeneralConditions + **********************************************************************************************************************/ +/*! \brief Check if all possible session states match the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckGeneralConditions) +{ + return FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskGeneralConditions, result); +} + +/*********************************************************************************************************************** + * FblDiagCheckLength + **********************************************************************************************************************/ +/*! \brief Check if the request length matches the service requirements + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckLength) +{ + vuint8 valid; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 3 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)position; + (void)result; +#endif + valid = kFblOk; + + if ((properties->minLength > 0u) && (length < properties->minLength)) + { + valid = kFblFailed; + } + + if (length > properties->maxLength) + { + valid = kFblFailed; + } + + return valid; +} + +/*********************************************************************************************************************** + * FblDiagCheckSuppressPosRsp + **********************************************************************************************************************/ +/*! \brief Evaluate the suppress positive response message bit for subfunction requests + * \details No real check, but should only be executed for services with subfunctions + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSuppressPosRsp) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 3 */ /* MD_MSR_DummyStmt */ + (void)properties; + (void)length; + (void)result; +#endif + + CheckSuppressPosRspMsgIndication(&pbDiagBuffer[position]); + + return kFblOk; +} + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +/*********************************************************************************************************************** + * FblDiagCheckTransferMode + **********************************************************************************************************************/ +/*! \brief Evaluate the requested transfer mode. This check is used to switch between download and upload transfers. + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckTransferMode) +{ + V_MEMROM1 tServiceList V_MEMROM2 * localSubServices; + ptServiceProp subSrvLst = V_NULL; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + ptServiceProp subService = V_NULL; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + vuint8 subSrvIdx; + vuint8 found; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 3 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)length; + (void)position; +#endif + + localSubServices = properties->subServices; + subSrvLst = localSubServices->list; + + found = kFblFailed; + for (subSrvIdx = 0; (subSrvIdx < localSubServices->count) && (found != kFblOk); subSrvIdx++) + { + subService = &subSrvLst[subSrvIdx]; + if (STATE_TEST(subService->stateSet, kDiagStateIdxTransferDataUpload) == GetTransferDataUpload()) + { + found = kFblOk; + } + } + + if (found == kFblOk) + { + *result = subService; + } + + return found; +} +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +/*********************************************************************************************************************** + * FblDiagSearchSecService + **********************************************************************************************************************/ +/*! \brief Search the sub service table using the id at the current request position. Special use case for security access + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Search successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Search failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagSearchSecService) +{ + V_MEMROM1 tServiceList V_MEMROM2 * localSubServices; + ptServiceProp subSrvLst; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + ptServiceProp subService; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + + vuint8 subSrvIdx; + vuint8 found; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)length; +#endif + + localSubServices = properties->subServices; + subSrvLst = localSubServices->list; + subService = kDiagNoServiceProp; + diagRequestedSecLvlIdx = kDiagInvalidSecLvlIdx; + + found = kFblFailed; + + /* Check if level is supported */ + for (subSrvIdx = 0; subSrvIdx < (sizeof(kDiagSecAccessParams)/sizeof(kDiagSecAccessParams[0])); subSrvIdx++) + { + if (kDiagSecAccessParams[subSrvIdx].secLevel == pbDiagBuffer[position] ) + { + /* Level supported - Seed request */ + subService = &subSrvLst[0]; + found = kFblOk; + break; + } + if (kDiagSecAccessParams[subSrvIdx].secLevel == (pbDiagBuffer[position] - 1u)) + { + /* Level supported - Key request */ + subService = &subSrvLst[1]; + found = kFblOk; + break; + } + } + + if (found == kFblOk) + { + /* Cache index of identified table entry for later usage */ + diagRequestedSecLvlIdx = subSrvIdx; + + *result = subService; + } + + return found; +} + +/*********************************************************************************************************************** + * FblDiagCheckSecLength + **********************************************************************************************************************/ +/*! \brief Check if the request length matches the service requirements + * \details Special version for security access. + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecLength) +{ + vuint8 valid; + + assertFblInternal(diagRequestedSecLvlIdx != kDiagInvalidSecLvlIdx, kFblOemAssertInvalidSecLvlIdx); + + valid = kFblFailed; + + if (kDiagSecAccessParams[diagRequestedSecLvlIdx].secLevel == pbDiagBuffer[position]) + { + /* Seed request -> use standard check + * This works because pbDiagBuffer is not evaluated any more */ + valid = FblDiagCheckLength(properties, pbDiagBuffer, length, position, result); + } + if (kDiagSecAccessParams[diagRequestedSecLvlIdx].secLevel == (pbDiagBuffer[position] - 1u)) + { + /* Key request */ + if ((kDiagSecAccessParams[diagRequestedSecLvlIdx].keyLength + 1u) == length) + { + valid = kFblOk; + } + } + + return valid; +} + +/*********************************************************************************************************************** + * FblDiagCheckSecSequenceError + **********************************************************************************************************************/ +/*! \brief Check if the states leading to request sequence errors match the service requirements for security access + * \param[in] properties Dispatching properties + * \param[in] pbDiagBuffer Diagnostic buffer + * \param[in] length Request length + * \param[in] position Current request position + * \param[in,out] result Resulting properties + * \return Possible return values: + * - kFblOk: Check successful. If applicable, changed properties are returned via parameter 'result' + * - kFblFailed: Check failed + **********************************************************************************************************************/ +static FBL_DIAG_CHECK_HANDLER(FblDiagCheckSecSequenceError) +{ + vuint8 tmpSecLvl; + tFblResult valid; + + assertFblInternal(diagRequestedSecLvlIdx != kDiagInvalidSecLvlIdx, kFblOemAssertInvalidSecLvlIdx); + + valid = kFblOk; + + if ((pbDiagBuffer[position] & 0x01u) == 0x01u) + { + /* Seed request: sub service equals security level */ + tmpSecLvl = pbDiagBuffer[position]; + if ((kDiagSecLevelNone != GetCurrentSecLvl()) && (tmpSecLvl != GetCurrentSecLvl())) + { + valid = kFblFailed; + } + } + else + { + /* Key request: (sub service - 1) equals security level */ + tmpSecLvl = pbDiagBuffer[position] - 1; + if (diagRequestedSecLvl != tmpSecLvl) + { + valid = kFblFailed; + } + } + + if ((kFblOk == valid ) && (kFblOk == ApplFblGetSecLvlSupport(tmpSecLvl))) + { + valid = FblDiagCheckState(properties, pbDiagBuffer, length, position, kDiagStateMaskSequenceError, result); + } + else + { + valid = kFblFailed; + } + + return valid; +} + +#endif /* FBL_ENABLE_SEC_ADDITIONAL_LEVELS */ + +/*********************************************************************************************************************** + * FblDiagSetState + **********************************************************************************************************************/ +/*! \brief Set states according to mask + * \param[in] state State mask + **********************************************************************************************************************/ +static void FblDiagSetState (const V_MEMRAM1 tStateBitmap V_MEMRAM2 V_MEMRAM3 * state) +{ + vuint8 idx; + +#if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +#else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +#endif + { + fblStates[idx] |= state[idx]; + } +} + +/*********************************************************************************************************************** + * FblDiagClrState + **********************************************************************************************************************/ +/*! \brief Clear states according to mask + * \param[in] state State mask + **********************************************************************************************************************/ +static void FblDiagClrState (const V_MEMRAM1 tStateBitmap V_MEMRAM2 V_MEMRAM3 * state) +{ + vuint8 idx; + +#if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +#else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +#endif + { + fblStates[idx] &= FblInvertBits(state[idx], tStateBitmap); + } +} + +/*********************************************************************************************************************** + * FblDiagRetainState + **********************************************************************************************************************/ +/*! \brief Retain the value of all masked states, clear all others including the internal states + * \param[in] state State mask + **********************************************************************************************************************/ +static void FblDiagRetainState (V_MEMROM1 tStateBitmap V_MEMROM2 V_MEMROM3 * state) +{ + vuint8 idx; + + /* Retain values of masked dispatcher states */ +#if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +#else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +#endif + { + fblStates[idx] &= state[idx]; + } + + /* Clear all additional internal flags */ + for ( ; idx < ARRAY_SIZE(fblStates); idx++) + { + fblStates[idx] = 0; + } +} + +#if defined( FBL_DIAG_ENABLE_SESSION_PARAMETERS ) +/*********************************************************************************************************************** + * FblDiagGetSessionIndex + **********************************************************************************************************************/ +/*! \brief Search the diagnostic session table for the requested session type and return the internal session index + * \param[in] diagnosticSessionType SessionControl parameter + * \return Session index + **********************************************************************************************************************/ +static vuint8 FblDiagGetSessionIndex(vuint8 diagnosticSessionType) +{ + vuint8 sessionIdx; + + for (sessionIdx = 0u; sessionIdx < kDiagNumberOfSessions; sessionIdx++) + { + if (kDiagSessionParameters[sessionIdx].sessionType == diagnosticSessionType) + { + /* Found valid session */ + break; + } + } + + if (sessionIdx == kDiagNumberOfSessions) + { + /* + * Config error: this error can only appear if the dispatcher knows more + * diagnostic session types than the session parameter table. + */ + assertFblInternal(0u, kFblOemAssertSessionIndexNotFound); /* PRQA S 2214 */ /* MD_FblDiag_2214 */ + sessionIdx = kDiagSessionNotFound; + } + + return sessionIdx; +} +#endif /* FBL_DIAG_ENABLE_SESSION_PARAMETERS */ + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Diagnostic standard functions ********************************************/ + +#define FBLDIAG_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * DiagResetResponseHandling + **********************************************************************************************************************/ +/*! \brief Reset the status for service handling + * \pre Service response shall be finished + **********************************************************************************************************************/ +static void DiagResetResponseHandling( void ) +{ + DiagClrError(); + + /* Restart the tester present timer if not in default session */ + if (!GetDiagDefaultDiagSession()) + { + ResetTesterTimeout(); + } + + /* Buffer is now available */ + ClrDiagBufferLocked(); + + /* Reset flag for functional request after processing */ + ClrFunctionalRequest(); + +} + +/*********************************************************************************************************************** + * DiagExRCRResponsePending + **********************************************************************************************************************/ +/*! \brief Transmit a busy message if timer expires + * (forceSend == kNotForceSendResponsePending) or if kForceSendResponsePending is passed. + * \param[in] forceSend Determines if a message is sent independently from timer state. + **********************************************************************************************************************/ +void DiagExRCRResponsePending( vuint8 forceSend ) +{ + static vuint8 rcrrpDiagBuffer[3]; + + if (GetServiceInProgress()) + { + if (((GetP2Timeout() > 0x00u) && (GetP2Timer() < (GetP2Timeout()))) || (forceSend == kForceSendResponsePending)) + { + /* Prepare and transmit RCRRP buffer */ + rcrrpDiagBuffer[0] = kDiagRidNegativeResponse; + rcrrpDiagBuffer[1] = diagServiceCurrent; + rcrrpDiagBuffer[2] = kDiagNrcRcrResponsePending; + FblCwTransmitRP(rcrrpDiagBuffer); + + /* Restart P2-Timer to P2* */ + SetP2Timer(kFblDiagTimeP2Star); + SetP2Timeout(kFblDiagTimeP2Star); /* PRQA S 3493 */ /* MD_FblDiag_3493 */ + + /* If response pending is transmitted and no response + * is set, a positive response has to be transmitted anyway. */ + ClrSuppressPosRspMsg(); + + /* Prepare parameter for the confirmation function */ + SetRcrRpInProgress(); + } + } +} +#define FBLDIAG_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FblDiagMemGetActiveBuffer + **********************************************************************************************************************/ +/*! \brief Function updates Diagnostic buffer (DiagBuffer) and returns updated pbDiagData to handler + * \return updated pbDiagData buffer used by diagnostic handler functions * + **********************************************************************************************************************/ +static V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * FblDiagMemGetActiveBuffer(void) +{ + DiagBuffer = FblMemGetActiveBuffer(); + return DiagBuffer; +} + +/*********************************************************************************************************************** + * DiagDiscardReception + **********************************************************************************************************************/ +/*! \brief Received diagnostic messages are discarded + **********************************************************************************************************************/ +static void DiagDiscardReception( void ) +{ + SetResponseProcessing(); /* Set flag for running response procedure */ + + FblCwDiscardReception(); + + ClrResponseProcessing(); +} + +/*********************************************************************************************************************** + * DiagResponseProcessor + **********************************************************************************************************************/ +/*! \brief Send diagnostic response message + * \pre List of preconditions: + * - Current SID must be in DiagBuffer[0] + * - diagErrorCode must be initialized + * \param[in] dataLength Data length to be transmitted. + **********************************************************************************************************************/ +void DiagResponseProcessor( tCwDataLengthType dataLength ) +{ + ClrServiceInProgress(); + ClrRcrRpInProgress(); + ClrP2Timer(); + ClrP2Timeout(); + DiagDiscardReception(); + FblErrStatSetSId(diagServiceCurrent); + + if (DiagGetError() != kDiagErrorNone) + { + if (GetFunctionalRequest() + && ((DiagGetError() == kDiagNrcServiceNotSupported) + || (DiagGetError() == kDiagNrcServiceNotSupportedInActiveSession) + || (DiagGetError() == kDiagNrcSubFunctionNotSupported) + || (DiagGetError() == kDiagNrcSubfunctionNotSupportedInActiveSession) + || (DiagGetError() == kDiagNrcRequestOutOfRange) + )) + { + /* + No response for functionally addressed requests if + service or subfunction not supported. + */ + DiagResetResponseHandling(); + FblCwResetRxBlock(); + } + else + { + /* Prepare response message */ + DiagBuffer[kDiagFmtSubparam] = diagServiceCurrent; + DiagBuffer[kDiagFmtServiceId] = kDiagRidNegativeResponse; + DiagBuffer[kDiagFmtNegResponse] = DiagGetError(); + + /* Send response in communication wrapper */ + FblCwTransmit(DiagBuffer, 3, kFblCwTxCallNegResponse ); + } + /* Clear 'pending' error */ + DiagClrError(); + } + else if (diagResponseFlag == kDiagPutResponse) + { + if (!GetSuppressPosRspMsg()) + { + /* Transmit positive response if not suppressed */ + DiagBuffer[kDiagFmtServiceId] = (vuint8)(diagServiceCurrent + 0x40u); + + /* Send response in communication wrapper */ + FblCwTransmit(DiagBuffer, (tCwDataLengthType)(dataLength + 1u), kFblCwTxCallPosResponse); + } + else + { + DiagResetResponseHandling(); + FblCwResetRxBlock(); + ClrSuppressPosRspMsg(); + + /* Check if a reset shall be generated without message transmission */ + if (GetWaitEcuReset()) + { + /* If so, generate the reset immediately */ + SetResetMsgConfirmed(); + } + } + } + else + { + /* Do not send a response, just reset internal state */ + DiagResetResponseHandling(); + FblCwResetRxBlock(); + ClrSuppressPosRspMsg(); + + /* Check if a reset shall be generated without message transmission */ + if (GetWaitEcuReset()) + { + /* If so, generate the reset immediately */ + SetResetMsgConfirmed(); + } + } + + /* Response processing executed */ + SetProcessingDone(); +} + +/*********************************************************************************************************************** + * FblRealTimeSupport + **********************************************************************************************************************/ +/*! \brief Transmit busy messages and triggers the watchdog according to system timer + * \pre P2Timer must be initialized + * \return Return code of FblLookForWatchdog + **********************************************************************************************************************/ +vuint8 FblRealTimeSupport( void ) +{ + vuint8 returnCode; + + returnCode = FblLookForWatchdog(); + + DiagExRCRResponsePending(kNotForceSendResponsePending); + + return returnCode; +} + +/*********************************************************************************************************************** + * FblRealTimeSupportVoid + **********************************************************************************************************************/ +/*! \brief Transmit busy messages and triggers the watchdog according to system timer. + * \pre Diagnosis and communication stack must be initialized, diagnostic request has to be received. + * \return None + **********************************************************************************************************************/ +void FblRealTimeSupportVoid( void ) +{ + FblLookForWatchdogVoid(); + DiagExRCRResponsePending(kNotForceSendResponsePending); +} + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +/*********************************************************************************************************************** + * FblDiagInitStateTables + **********************************************************************************************************************/ +/*! \brief Expand condensed service property tables from ROM to RAM + **********************************************************************************************************************/ +static void FblDiagInitStateTables ( void ) +{ + vuint8 idx; + vuint16 bitmapIdx; + vuint8 stateIdx; + vuint8 stateArrIdx; + vuint8 stateMask; + static V_MEMROM1 tStateBitmap V_MEMROM2 V_MEMROM3 * sourceState; + static V_MEMRAM1 tStateBitmap V_MEMRAM2 V_MEMRAM3 * targetState; + + bitmapIdx = 0; + + for (idx = 0; idx < (sizeof(kDiagServicePropertiesROM)/sizeof(kDiagServicePropertiesROM[0])); idx++) + { +# if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) + kDiagServiceProperties[idx].subServices = kDiagSubFctTblHandler[kDiagServicePropertiesROM[idx].subServicesHandler]; +# else + kDiagServiceProperties[idx].subServices = kDiagServicePropertiesROM[idx].subServices; +# endif + kDiagServiceProperties[idx].serviceId = kDiagServicePropertiesROM[idx].serviceId; +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) +#else + kDiagServiceProperties[idx].checks = kDiagServicePropertiesROM[idx].checks; +#endif + kDiagServiceProperties[idx].minLength = kDiagServicePropertiesROM[idx].minLength; + kDiagServiceProperties[idx].maxLength = kDiagServicePropertiesROM[idx].maxLength; + kDiagServiceProperties[idx].mainHandlerIdx = kDiagServicePropertiesROM[idx].mainHandlerIdx; +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) + kDiagServiceProperties[idx].checkListIdx = kDiagServicePropertiesROM[idx].checkListIdx; +#endif + +#if defined( FBL_DIAG_STATE_ARRAYS ) + stateMask = 0x01; +#endif + + for (stateArrIdx = 0; stateArrIdx < STATE_COUNT; stateArrIdx++) + { +#if defined( FBL_DIAG_STATE_ARRAYS ) + targetState = kDiagServiceProperties[idx].states[stateArrIdx]; +#else + switch (stateArrIdx) + { + case 0: + targetState = kDiagServiceProperties[idx].stateSet; + stateMask = 0x01; + break; + case 1: + targetState = kDiagServiceProperties[idx].stateUnset; + stateMask = 0x02; + break; + case 2: + targetState = kDiagServiceProperties[idx].stateAdd; + stateMask = 0x04; + break; + case 3: + targetState = kDiagServiceProperties[idx].stateClr; + stateMask = 0x08; + break; + case 4: + targetState = kDiagServiceProperties[idx].stateClrFail; + stateMask = 0x10; + break; + } +#endif + + if ((kDiagServicePropertiesROM[idx].stateUsage & stateMask) == stateMask) + { + sourceState = &kDiagStateBitmaps[bitmapIdx]; + bitmapIdx += STATECHECK_ARRAYSIZE; + } + else + { + sourceState = kDiagStateMaskReset; + } + +# if ( STATECHECK_ARRAYSIZE == 1u) + stateIdx = 0; +# else + for (stateIdx = 0; stateIdx < STATECHECK_ARRAYSIZE; stateIdx++) +# endif + { + targetState[stateIdx] = sourceState[stateIdx]; + } + + stateMask <<= 1; + } + } +} +#endif + +/*********************************************************************************************************************** + * FblDiagInitDownloadSequence + **********************************************************************************************************************/ +/*! \brief (Re-)initialize download sequence (initialization and session transition) + **********************************************************************************************************************/ +static void FblDiagInitDownloadSequence( void ) +{ + vuint8 blockIdx; + + /* (Re-)initialize download sequence */ + transferRemainder = 0u; + transferType = DOWNLOAD_RAM; + expectedSequenceCnt = 0u; + lastErasedBlock = kBlockNrInvalid; + + /* Initialize download information structure */ + FblDiagSegmentInit(); + + /* Initialize block information */ + currentBlock = kBlockNrInvalid; + + for (blockIdx = 0u; blockIdx < FBL_LBT_BLOCK_COUNT; blockIdx++) + { + blockHeader[blockIdx].state = kBlockState_Init; + blockHeader[blockIdx].nrOfSegments = 0u; + } + + /* Initialize security module */ + (void)ApplFblSecurityInit(); + SetCurrentSecLvl(kDiagSecLevelNone); +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + /* Initialize security access variables */ + diagRequestedSecLvl = kDiagSecLevelNone; + diagRequestedSecLvlIdx = kDiagInvalidSecLvlIdx; +#endif +} + +/*********************************************************************************************************************** + * FblDiagInitPowerOn + **********************************************************************************************************************/ +/*! \brief Initialize module variables + **********************************************************************************************************************/ +void FblDiagInitPowerOn( void ) +{ + vuint8 idx; + + for (idx = 0u; idx < (sizeof(fblStates)/sizeof(fblStates[0])); idx++) + { + fblStates[idx] = (tStateBitmap)0x00u; + } + + transferRemainder = 0u; + transferType = DOWNLOAD_RAM; + expectedSequenceCnt = 0u; + memSegment = -1; + diagResponseFlag = kDiagPutResponse; + + + /* Initialize variables of lib Lbt */ + FblLbtInitPowerOn(); + + DiagClrError(); + /* Set diagnostic session (default session) */ + SetDiagDefaultDiagSession(); + + /* Stop tester present timer */ + StopTesterTimeout(); + + /* Clear timer for response pending transmission */ + ClrP2Timer(); + /* Clear P2 timeout to prevent erroneous sending of RCR-RP */ + ClrP2Timeout(); + + ApplFblResetVfp(); + + /* Initialize security module */ + (void)SecM_InitPowerOn(V_NULL); + +#if defined( FBL_ENABLE_DEBUG_STATUS ) + /* Initialize error status */ + ApplFblInitErrStatus(); +#endif +} + +/*********************************************************************************************************************** + * FblDiagInit + **********************************************************************************************************************/ +/*! \brief Initialize module variables + **********************************************************************************************************************/ +/* PRQA S 6050 1 */ /* MD_MSR_STCAL */ +void FblDiagInit( void ) +{ + tCwDataLengthType requestLength = 0u; + + /* Get aligned diag buffer pointer from memory library */ + DiagBuffer = FblMemInitPowerOn(); + +#if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) + FblDiagInitStateTables(); +#endif + + /* Reset service properties */ + FblDiagSetProperties(&kDiagServiceProperties[0], &serviceProperties); + + StopEcuResetTimeout(); + + /* If FBL was started from application, already lock diagnostic buffer here */ + if (FblMainGetStartFromAppl()) + { + + requestLength = kDiagRqlDiagnosticSessionControl + 1u; + } + + /* Release the buffer to be able to respond to request receiv ed by application */ + ClrDiagBufferLocked(); + + if (FblDiagRxGetPhysBuffer(requestLength) == DiagBuffer) + { + SetLockedByInit(); + /* Lock the TP buffer, because service buffer is allocated for pos. response */ + FblCwSetRxBlock(); + } + + /* Initialize communication wrapper */ + FblCwSetTxInit(); + +#if defined( FBL_CW_ENABLE_MULTIPLE_CONNECTIONS ) + FblCwResetResponseAddress(); +#endif /* FBL_CW_ENABLE_MULTIPLE_CONNECTIONS */ + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# if defined( FBL_DIAG_MULTIPLE_KEY ) + /* Initialized the correct software signing key */ + (void)FblDiagCopyUsedPersKeyToUsedNotPersKey(); +# endif /* FBL_DIAG_MULTIPLE_KEY */ +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + + /* Initialize verification component */ + (void)SecM_InitVerification(V_NULL); + +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) + /* Assign segment list array */ + verifyParam.segmentList.segmentInfo = verifySegmentInfo; +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + + (void)RamDriver_InitSync(V_NULL); + + + FblDiagInitDownloadSequence(); + +} + +/*********************************************************************************************************************** + * FblDiagGetLastErasedBlock + **********************************************************************************************************************/ +/*! \brief Returns last erased logical block or kBlockNrInvalid if no block has been erased yet. + **********************************************************************************************************************/ +vuint8 FblDiagGetLastErasedBlock( void ) +{ + return lastErasedBlock; +} + +/*********************************************************************************************************************** + * FblDiagSetLastErasedBlock + **********************************************************************************************************************/ +/*! \brief Sets last erased logical block. + * \param[in] blockNr Block number of last erased logical block + **********************************************************************************************************************/ +void FblDiagSetLastErasedBlock( vuint8 blockNr ) +{ + lastErasedBlock = blockNr; +} + +/*********************************************************************************************************************** + * CheckSuppressPosRspMsgIndication + **********************************************************************************************************************/ +/*! \brief This functions checks if a diagnostic response has to be sent and resets the positive response + * message indication bit if necessary + * \param[in,out] subparam Diagnostic subparameter + **********************************************************************************************************************/ +void CheckSuppressPosRspMsgIndication( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *subparam ) +{ + if (((*(subparam)) & (kDiagSuppressPosRspMsgIndicationBit)) != 0u) + { + SetSuppressPosRspMsg(); /* Set internal flag for response processor */ + (*(subparam)) &= FblInvertBits(kDiagSuppressPosRspMsgIndicationBit, vuint8); /* Clear indication bit */ + } +} + +/*********************************************************************************************************************** + * FblDiagSegmentInit + **********************************************************************************************************************/ +/*! \brief Initialize the download segment table + **********************************************************************************************************************/ +static void FblDiagSegmentInit( void ) +{ + currentSegment = kDiagSegmentOutOfRange; + diagSegmentList.nrOfSegments = 0u; +} + +/*********************************************************************************************************************** + * FblDiagSegmentNext + **********************************************************************************************************************/ +/*! \brief The parameters of a download section (received by the RequestDownload handler) will be copied into + * the segment table. + * \param[in] segAddr Start address of download segment + * \param[in] segLength Length of download segment + * \param[in] blockIdx Index of the logical block which is the target of the download segment + * \return Index of current list entry + **********************************************************************************************************************/ +static vuint8 FblDiagSegmentNext( tFblDiagAddr segAddr, tFblLength segLength, vuint8 blockIdx ) +{ + vuint8 result; + + /* Compare currently used number of address regions against configured max. value */ + if (diagSegmentList.nrOfSegments < SWM_DATA_MAX_NOAR) + { + currentSegment = diagSegmentList.nrOfSegments; + + /* Store segment address, length and logical block index for later use */ + diagSegmentList.segmentInfo[currentSegment].targetAddress = FblDiagGetMemAddr(segAddr); + diagSegmentList.segmentInfo[currentSegment].length = segLength; + + /* Store reference to this segment in blockHeader */ + blockHeader[blockIdx].segmentIdx[blockHeader[blockIdx].nrOfSegments] = currentSegment; + + /* Increment segment counters */ + diagSegmentList.nrOfSegments++; + blockHeader[blockIdx].nrOfSegments++; + + /* Return index of current list entry */ + result = currentSegment; + } + else + { + /* Segment list full, reject creation of new entry */ + result = kDiagSegmentOutOfRange; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagGetMaxTransferDataBlockLength + **********************************************************************************************************************/ +/*! \brief Evaluate maximum TransferData block length for active connection + * \details Length is the minimum of link payload length and configured diagnostic buffer size + * \return TransferData block length applicable for active connection + **********************************************************************************************************************/ +static tCwDataLengthType FblDiagGetMaxTransferDataBlockLength(void) +{ + tCwDataLengthType maxBlockLength; + + /* Get payload limit of active communication link */ + maxBlockLength = FblCwGetPayloadLimit(); + + /* Limit block length to available diagnostic buffer size */ + if (FBL_DIAG_BUFFER_LENGTH < maxBlockLength) + { + maxBlockLength = FBL_DIAG_BUFFER_LENGTH; + } + +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +#else + /* Align length to maximum memory segment size */ + maxBlockLength = (tCwDataLengthType)(((maxBlockLength - 2u) & FblInvert32Bit(FBL_MAX_SEGMENT_SIZE - 1u)) + 2u); +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ + + return maxBlockLength; +} + +/*********************************************************************************************************************** + * FblDiagPostInit + **********************************************************************************************************************/ +/*! \brief This function is called from FblInit() + * \details The diagnostic buffer is prepared to be able to handle the diagnostic request. + **********************************************************************************************************************/ +void FblDiagPostInit( void ) +{ + + if (GetLockedByInit()) + { + if (kFblOk == FblCwPrepareResponseAddress()) + { + /* Clear state if programming session request "simulation" could be done */ + ClrLockedByInit(); + /* Prepare diag buffer */ + diagServiceCurrent = kDiagSidDiagnosticSessionControl; + DiagBuffer[kDiagFmtServiceId] = kDiagSidDiagnosticSessionControl; + DiagBuffer[kDiagFmtSubparam] = kDiagSubProgrammingSession; + /* Omit response for programming request */ + DiagBuffer[kDiagFmtSubparam] |= 0x80u; + DiagDataLength = kDiagRqlDiagnosticSessionControl; + + + /* Simulate data indication */ + FblDiagRxStartIndication(); + FblDiagRxIndication(DiagBuffer, DiagDataLength + 1u); + } + else + { + /* Do the same as if a functional tester present with SPRMB was received in order to unlock/free + * the diagnostic buffer for new requests */ + DiagResetResponseHandling(); + FblCwResetRxBlock(); + } + } +} + + + +/*********************************************************************************************************************** + * FblDiagSessionTransition + **********************************************************************************************************************/ +/*! \brief Common tasks which shall be executed during session transition + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return kFblOk: Session transition completed successfully + * kFblFailed: Session transition failed + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static tFblResult FblDiagSessionTransition(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pbDiagBuffer, tCwDataLengthType diagReqDataLen) +{ + tFblResult result = kFblOk; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)diagReqDataLen; +#endif + + /* Reset internal states */ + ClrSecurityKeyAllowed(); + ClrTransferDataAllowed(); + ClrTransferDataSucceeded(); + + FblDiagInitDownloadSequence(); + + + return result; +} + +/*********************************************************************************************************************** + * FblDiagSessionControlParamInit + **********************************************************************************************************************/ +/*! \brief General initialization of response parameter and download preparation. + * \pre All other conditions for a successful session transition have been fulfilled. + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + **********************************************************************************************************************/ +static void FblDiagSessionControlParamInit(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pbDiagBuffer, tCwDataLengthType diagReqDataLen) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* + * Save the requested session type and adapt the P2 timing (if required). + * Note: the SPRMIB has been cleared by CheckSuppressPosRspMsgIndication() + * before and doesn't have to be considered here. + */ + SetDiagSessionType(pbDiagBuffer[kDiagFmtSubparam]); + + /* Diagnostic session timing */ + pbDiagBuffer[kDiagFmtSubparam + 1u] = (vuint8)(GetDiagSessionTimingP2() >> 8u); + pbDiagBuffer[kDiagFmtSubparam + 2u] = (vuint8) GetDiagSessionTimingP2(); + pbDiagBuffer[kDiagFmtSubparam + 3u] = (vuint8)(GetDiagSessionTimingP2Star() >> 8u); + pbDiagBuffer[kDiagFmtSubparam + 4u] = (vuint8) GetDiagSessionTimingP2Star(); +} + +/* Diagnostic service handlers *********************************************/ + +/*********************************************************************************************************************** + * FblDiagMainHandlerDefaultSession + **********************************************************************************************************************/ +/*! \brief Switch to default session, issue reset if necessary + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerDefaultSession) +{ + /* Switch to default session by issuing a reset */ + + /* Initialize parameters for SessionControl response */ + FblDiagSessionControlParamInit(pbDiagBuffer, diagReqDataLen); + + /* The response will be sent by FblDiagEcuReset */ + FblDiagEcuReset(kDiagResetPutResponse, RESET_RESPONSE_SDS_REQUIRED); + + /* Shutdown is performed in main loop */ + + return kFblOk; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerProgrammingSession + **********************************************************************************************************************/ +/*! \brief Switch to programming session + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerProgrammingSession) +{ + tFblResult result; + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * localPbDiagBuffer; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; +#endif + + /* ESCAN00067433: Stop background operations of FblLib_Mem */ + DiagBuffer = FblMemInit(); + localPbDiagBuffer = DiagBuffer; + + /* Deinitialize loaded memory driver(s) */ + FblDeinitMemoryDriver(); + + /* Initialize parameters for SessionControl response */ + FblDiagSessionControlParamInit(localPbDiagBuffer, diagReqDataLen); + + /* + * ESCAN00042572: switch session immediately to ensure correct S3 timer + * handling in DiagResponseProcessor()/FblDiagTpConfirmation(). + */ + SetDiagProgrammingSession(); + + /* Send response */ + DiagProcessingDone(kDiagRslDiagnosticSessionControl); + + /* Execute common (post) session transition tasks */ + result = FblDiagSessionTransition(localPbDiagBuffer, diagReqDataLen); + + + return result; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerTesterPresent + **********************************************************************************************************************/ +/*! \brief TesterPresent service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTesterPresent) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)diagReqDataLen; +#endif + + /* Simply transmit a positive response message */ + DiagProcessingDone(kDiagRslTesterPresent); + + return kFblOk; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerEcuReset + **********************************************************************************************************************/ +/*! \brief Issue reset + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerEcuReset) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)pbDiagBuffer; + (void)diagReqDataLen; +#endif + + FblDiagEcuReset(kDiagResetPutResponse, RESET_RESPONSE_ECURESET_REQUIRED); + + /* Shutdown is performed in main loop */ + return kFblOk; +} + +#if defined( FBL_ENABLE_USERROUTINE ) +/*********************************************************************************************************************** + * FblDiagMainHandlerRoutineControl + **********************************************************************************************************************/ +/*! \brief RoutineControl - No (predefined) routine found + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRoutineControl) +{ + tFblResult result; + + result = kFblOk; + + /* + * Call user function to process user specific routine(s). Pass pointer to + * diag buffer which points after the SID. + */ + ApplDiagRoutineControl(&(pbDiagBuffer[kDiagFmtSubparam]), diagReqDataLen); + + if (DiagGetError() == kDiagErrorNone) + { + /* No NRC returned, send the response */ + DiagProcessingDone(DiagDataLength); + } + else + { + result = kFblFailed; + } + + return result; +} +#endif /* FBL_ENABLE_USERROUTINE */ + +/*********************************************************************************************************************** + * FblDiagMainHandlerRcActivateSbl + **********************************************************************************************************************/ +/*! \brief RoutineControl - Activate Secondary Bootloader subroutine + * \pre SBL has been downloaded + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 6050 1 */ /* MD_MSR_STCAL */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcActivateSbl) +{ + tFblResult result; + tBlockDescriptor blockDescriptor; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Send a RCRRP to avoid a timeout during SBL verification and activation */ + DiagExRCRResponsePending(kForceSendResponsePending); + + result = FblLbtGetBlockDescriptorByNr(FBL_LBT_SBL_BLOCK_NUMBER, &blockDescriptor); + + if (kFblOk == result) + { + /* Perform SBL block verification */ + result = ApplFblValidateBlock(blockDescriptor); + } + + if (kFblOk == result) + { + /* Set SBL block state to 'verified' */ + blockHeader[FBL_MTAB_SBL_BLOCK_NUMBER].state = kBlockState_Verified; + result = FblInitMemoryDriver(); + } + + if (result == kFblOk) + { + /* All following download requests are directed to non-volatile memory */ + transferType = DOWNLOAD_FLASH; + /* Activation of SBL (and other memory drivers) succeeded, prepare positive response */ + pbDiagBuffer[kDiagFmtSubRoutineInfo] = (vuint8)((kDiagSubRoutineType1_Sync << 4u) | kDiagSubRoutineStatusCompleted); + } + else + { + /* ESCAN00066098: Activation of SBL failed, send negative response */ + DiagNRCConditionsNotCorrect(); + } + + /* Send response */ + DiagProcessingDone(kDiagRslRcActivateSbl); + + return result; +} + + +/*********************************************************************************************************************** + * FblDiagMainHandlerRcCheckValidApp + **********************************************************************************************************************/ +/*! \brief RoutineControl - Check Valid Application subroutine + * \pre Application software has been downloaded + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcCheckValidApp) +{ + tFblResult result; + tFblLbtBlockFilter blockFilter; + tBlockDescriptor iterBlock; + tDiagSegmentList localSegmentList; + FL_SegmentListType localSegmentListSB; + FL_SegmentInfoType segListPerBlock[SWM_DATA_MAX_NOAR]; + vuint8 idxSeg; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Initialize return value */ + result = kFblOk; + /* Initialize localSegmentList */ + localSegmentList.nrOfSegments = 0u; + for(idxSeg = 0u; idxSeg < SWM_DATA_MAX_NOAR; idxSeg++) + { + localSegmentList.segmentInfo[idxSeg].targetAddress = 0u; + localSegmentList.segmentInfo[idxSeg].length = 0u; + } + + /* Check if any data was downloaded besides the SBL */ + if ((kBlockNrInvalid != currentBlock) && (FBL_MTAB_SBL_BLOCK_NUMBER != currentBlock)) + { + /* Send RCRRP message to avoid a P2 timeout during validation */ + DiagExRCRResponsePending(kForceSendResponsePending); + + /* Iterate over logical blocks to determine the validity of the downloaded software/data */ + FblLbtBlockFilterInit(&blockFilter); + FblLbtBlockFilterSetBlockType(&blockFilter, kBlockTypeApplication); + iterBlock = FblLbtBlockFirst(&blockFilter); + while (FblLbtBlockDone() == FALSE) + { + { + /* Check validity of logical block by calling ApplFblValidateBlock() */ + if (ApplFblValidateBlock(iterBlock) == kFblOk) + { + { + if (blockHeader[iterBlock.blockNr].state == kBlockState_Erased) + { + /* Get the segment list */ + (void)FblDiagGetSegmentList(iterBlock.blockNr, &localSegmentList); + + for(idxSeg = 0u; idxSeg < localSegmentList.nrOfSegments; idxSeg++) + { + segListPerBlock[idxSeg].transferredAddress = localSegmentList.segmentInfo[idxSeg].targetAddress; + segListPerBlock[idxSeg].targetAddress = localSegmentList.segmentInfo[idxSeg].targetAddress; + segListPerBlock[idxSeg].length = localSegmentList.segmentInfo[idxSeg].length; + } + + localSegmentListSB.nrOfSegments = localSegmentList.nrOfSegments; /* PRQA S 2983 */ /* MD_FblDiag_2983_2985_RedundantAssignment */ + localSegmentListSB.segmentInfo = segListPerBlock; /* PRQA S 2983 */ /* MD_FblDiag_2983_2985_RedundantAssignment */ + + /* Update MAC for Secure Boot */ + if (ApplFblUpdateBlockMac(&iterBlock, &localSegmentListSB) == kFblOk) /* PRQA S 2741 */ /* MD_FblDiag_2741 */ + { + /* Set block state to 'verified' */ + blockHeader[iterBlock.blockNr].state = kBlockState_Verified; + } + else + { + /* Check logical block assignment */ + if (iterBlock.mandatoryType == TRUE) /* PRQA S 2880 */ /* MD_FblDiag_2880_UnreachableCode */ + { + /* MAC calculation on mandatory Block failed, set overall verification result to 'failed' */ + result = kFblFailed; + } + } + } + else + { + /* Set block state to 'verified' */ + blockHeader[iterBlock.blockNr].state = kBlockState_Verified; + } + } + } + else + { + /* Check logical block assignment */ + if (iterBlock.mandatoryType == TRUE) + { + /* Mandatory Block not valid, set overall verification result to 'failed' */ + result = kFblFailed; + } + } + } + /* Prepare next cycle */ + iterBlock = FblLbtBlockNext(); + } + + if (kFblOk == result) + { + /* + * All mandatory logical blocks are valid. Let the user do the overall validity check (e.g. compatibility check, + * multi-processor configurations). The result has to be persisted inside the user function and can be + * evaluated during startup in ApplFblIsValidApp(). + */ + result = ApplFblValidateApp(); + } + + /* + * There are three valid return states of the validation function: + * + * result | DiagGetError() | state + * ------------|-----------------|--------------------------------------- + * kFblOk | kDiagErrorNone | download valid, pattern written + * kFblFailed | kDiagErrorNone | download invalid, pattern not written + * kFblFailed | !kDiagErrorNone | download valid, pattern write error + */ + + /* Catch invalid combinations of return value and NRC state */ + assertFblUser(((result == kFblOk) && (DiagGetError() == kDiagErrorNone)) || + ((result != kFblOk) && (DiagGetError() == kDiagErrorNone)) || + ((result != kFblOk) && (DiagGetError() != kDiagErrorNone)), + kFblOemAssertIllegalReturnValue); + + } + + /* Proceed only if no NRC has been set in the user functions */ + if (DiagGetError() == kDiagErrorNone) + { + /* Check if all necessary files are present/compatible for the application to be considered valid */ + if (ApplFblIsValidApp() != kApplValid) + { + pbDiagBuffer[kDiagFmtSubRoutineCheckValidAppStatus] = kDiagSubRoutineApplInvalid; + /* Send positive response */ + DiagProcessingDone(kDiagRslRcCheckValidApp); + } + else + { + { + pbDiagBuffer[kDiagFmtSubRoutineCheckValidAppStatus] = kDiagSubRoutineApplValid; + /* Routine is complete */ + pbDiagBuffer[kDiagFmtSubRoutineInfo] = (vuint8)((kDiagSubRoutineType1_Sync << 4u) | kDiagSubRoutineStatusCompleted); + + /* Send positive response */ + DiagProcessingDone(kDiagRslRcCheckValidApp); + } + } + } + else + { + /* Assure correct return value */ + result = kFblFailed; + } + + + + return result; +} + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +/*********************************************************************************************************************** + * FblDiagTokenLengthCheck + **********************************************************************************************************************/ +/*! \brief Check whether that the token length is consistent with the received command + * \param[in] cmdType The Token mode from TokenCommandType + * \param[in] tokenLength The token length + * \return Possible return values: + * - tTokenHdlResult: result of the validation operation + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static tTokenHdlResult FblDiagTokenLengthCheck(vuint8 cmdType, vuint16 tokenLength) +{ + tTokenHdlResult resultTkn = kTokenHdlrOk; + + /* Check that the token length is consistent with the received command */ + if (cmdType == FBL_DIAG_TOKEN_CMD_REVERTPROD) + { + /* Mode 0 tokens are supported with and without signature */ + if ((tokenLength != FBL_DIAG_TOKEN_MIN_SIZE) && + (tokenLength != (FBL_DIAG_TOKEN_MIN_SIZE + SEC_SIZE_SIG_RSA2048))) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + resultTkn = kTokenHdlrInternalFailed; + } + } + else if (cmdType == FBL_DIAG_TOKEN_CMD_PROGKEY) + { + /* Mode 5 tokens */ + if (tokenLength != FBL_DIAG_TOKEN_MAX_SIZE) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + resultTkn = kTokenHdlrInternalFailed; + } + } + else + { + /* Mode 1-4 tokens always require a signature */ + if (tokenLength != (FBL_DIAG_TOKEN_MIN_SIZE + SEC_SIZE_SIG_RSA2048)) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + resultTkn = kTokenHdlrInternalFailed; + } + } + + return resultTkn; +} + +/*********************************************************************************************************************** + * FblDiagTokenKeyProcessing + **********************************************************************************************************************/ + /*! \brief Function is used to perform key switching or key programming based on the received cmdType + * \param[in] cmdType The Token mode from TokenCommandType + * \param[in] tokenBufferPtr Pointer to the token + * \return Possible return values: + * - tTokenHdlResult: result of the validation operation + **********************************************************************************************************************/ + /* PRQA S 3673, 6010, 6030, 6080 1 */ /* MD_MSR_Rule8.13, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static tTokenHdlResult FblDiagTokenKeyProcessing(vuint8 cmdType, V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBufferPtr) +{ + tTokenHdlResult resultTkn = kTokenHdlrOk; + + switch (cmdType) + { +#if defined( FBL_DIAG_MULTIPLE_KEY ) + /* Multiple Key Use Case */ + case FBL_DIAG_TOKEN_CMD_REVERTPROD: + { + /* Revert back to production key */ + if (FblDiagCopyProductionKeyToUsedPersKey() != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagCopyUsedPersKeyToUsedNotPersKey() != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else + { + /* MISRA */ + } + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVPERM: + { + /* Use development key until further request */ + if (FblDiagCopyDevelopmentKeyToUsedNotPersKey() != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagCopyDevelopmentKeyToUsedPersKey() != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else + { + /* MISRA */ + } + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVTEMP: + { + /* Use development key until next reset or Cmd 0 */ + if (FblDiagCopyDevelopmentKeyToUsedNotPersKey() != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + break; + } + case FBL_DIAG_TOKEN_CMD_PROGKEY: + { + vuint8 pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH + FBL_DIAG_KEY_EXP_LENGTH]; + + /* Program the new keys contained in the token. */ + if (ApplFblTokenParseKey(FblDiagGetTokenDevKeyIndex(tokenBufferPtr), pubKeyBuffer) != kTokenHdlrOk) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetDevelopmentModKey(pubKeyBuffer, FBL_DIAG_KEY_MOD_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetDevelopmentExpKey(&pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH], FBL_DIAG_KEY_EXP_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (ApplFblTokenParseKey(FblDiagGetTokenTokenKeyIndex(tokenBufferPtr), pubKeyBuffer) != kTokenHdlrOk) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetTokenModKey(pubKeyBuffer, FBL_DIAG_KEY_MOD_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetTokenExpKey(&pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH], FBL_DIAG_KEY_EXP_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (ApplFblTokenParseKey(FblDiagGetTokenProdKeyIndex(tokenBufferPtr), pubKeyBuffer) != kTokenHdlrOk) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetProductionModKey(pubKeyBuffer, FBL_DIAG_KEY_MOD_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetProductionExpKey(&pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH], FBL_DIAG_KEY_EXP_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetUsedPersModKey(pubKeyBuffer, FBL_DIAG_KEY_MOD_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetUsedPersExpKey(&pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH], FBL_DIAG_KEY_EXP_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetUsedNotPersModKey(pubKeyBuffer, FBL_DIAG_KEY_MOD_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else if (FblDiagSetUsedNotPersExpKey(&pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH], FBL_DIAG_KEY_EXP_LENGTH) != SECM_OK) + { + resultTkn = kTokenHdlrInternalFailed; + } + else + { + /* MISRA */ + } + break; + } + default: + { + resultTkn = kTokenHdlrInternalFailed; + break; + } +#else /* FBL_DIAG_MULTIPLE_KEY */ + /* Single Key Use Case */ + case FBL_DIAG_TOKEN_CMD_REVERTPROD: + { + /* Revert back to production key */ + ClrDiagDevelopmentKey(); + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVPERM: + { + /* Use development key permanently (Not possible to revert to production key) */ + SetDiagDevelopmentKey(); + if (ApplFblWriteVerificationKey(V_NULL) != kFblOk) + { + resultTkn = kTokenHdlrKeyChangeFailed; + /* Revert back to production key, in case of failure */ + ClrDiagDevelopmentKey(); + } + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVTEMP: + { + /* Use development key until next reset or Cmd 0 */ + SetDiagDevelopmentKey(); + break; + } + case FBL_DIAG_TOKEN_CMD_PROGKEY: + { + vuint8 isDevKeyActive = 0u; + vuint8 pubKeyBuffer[FBL_DIAG_KEY_MOD_LENGTH + FBL_DIAG_KEY_EXP_LENGTH]; + + /* Program the production key contained in the token (Not possible to revert to development key) */ + if (GetDiagDevelopmentKey()) + { + isDevKeyActive = 1u; + } + + ClrDiagDevelopmentKey(); + + if (ApplFblTokenParseKey(FblDiagGetTokenProdKeyIndex(tokenBufferPtr), pubKeyBuffer) == kTokenHdlrOk) + { + /* The Production Key modulo contains sequentially also the exponent */ + if (ApplFblWriteVerificationKey(pubKeyBuffer) != kFblOk) + { + resultTkn = kTokenHdlrKeyChangeFailed; + if (isDevKeyActive == 1u) + { + SetDiagDevelopmentKey(); + } + } + } + else + { + resultTkn = kTokenHdlrInternalFailed; + } + break; + } + default: + { + resultTkn = kTokenHdlrInternalFailed; + break; + } +#endif /* FBL_DIAG_MULTIPLE_KEY */ + } + + return resultTkn; +} +/*********************************************************************************************************************** + * FblDiagMainHandlerRcTokenDownload + **********************************************************************************************************************/ +/*! \brief RoutineControl - Download a Token from the tester into internal RAM + * \pre Diagnostic module shall be initialized + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcTokenDownload) +{ + SecM_SignatureParamType verifyToken; + SecM_AsymKeyType keyChangeKey; + vuint8 *tokenBufferPtr; + tTokenHdlResult resultTkn = kTokenHdlrOk;; + tFblResult result; + vuint8 cmdType; + vuint16 tokenLength; + + /* Check programming mode - if the SBL is not present and activated, send NRC and do not process token further */ + if (!GetMemDriverInitialized()) + { + DiagNRCRequestSequenceError(); + } + else + { + tokenLength = diagReqDataLen - 3u; + tokenBufferPtr = &pbDiagBuffer[kDiagFmtRoutineIdDataRecord]; + /* Token shall be verified with respective key */ + verifyTokenSignLength = tokenLength - SEC_SIZE_SIG_RSA2048; + /* Extract command */ + cmdType = FblDiagGetTokenCommandType(tokenBufferPtr); + + /* Check that the token length is consistent with the received command */ + resultTkn = FblDiagTokenLengthCheck(cmdType, tokenLength); + + /* Signature verification shall not be done for revert to production command */ + if ((cmdType != FBL_DIAG_TOKEN_CMD_REVERTPROD) && (resultTkn == kTokenHdlrOk)) + { + /* Here the Token signature will be verified */ + /* This verification shall be in common between MKU and SKU */ + /* Forcing the usage of an internal workspace */ + verifyToken.currentHash.sigResultBuffer = (SecM_ResultBufferType)SEC_DEFAULT_WORKSPACE; /* PRQA S 0306 */ /* MD_FblDiag_0306 */ + verifyToken.currentHash.length = SEC_DEFAULT_WORKSPACE_SIZE; + verifyToken.currentDataLength = V_NULL; + verifyToken.sigSourceBuffer = tokenBufferPtr; + verifyToken.sigByteCount = verifyTokenSignLength; + verifyToken.wdTriggerFct = &FblRealTimeSupportVoid; + + if (FblDiagGetTokenKeyIndex(tokenBufferPtr) == FBL_DIAG_TOKEN_KEY_INDEX_0) + { + resultTkn = ApplFblGetTokenVerificationKey(&keyChangeKey); + verifyToken.key = (SecM_VerifyKeyType)&keyChangeKey; /* PRQA S 0314 */ /* MD_FblDiag_0314_KeyPtr */ + } + else + { + /* For mode 1-4 use default internally configured key */ + verifyToken.key = V_NULL; + } + } + + if ((cmdType != FBL_DIAG_TOKEN_CMD_REVERTPROD) && (resultTkn == kTokenHdlrOk)) + { + verifyToken.sigState = SEC_HASH_INIT; + resultTkn = kTokenHdlrSignatureFailed; + + if (FblDiagVerifyTokenSignature(&verifyToken) == SECM_VER_OK) + { + verifyToken.sigState = SEC_HASH_COMPUTE; + if (FblDiagVerifyTokenSignature(&verifyToken) == SECM_VER_OK) + { + verifyToken.sigState = SEC_HASH_FINALIZE; + if (FblDiagVerifyTokenSignature(&verifyToken) == SECM_VER_OK) + { + verifyToken.sigState = SEC_SIG_VERIFY; + verifyToken.sigSourceBuffer = &tokenBufferPtr[verifyTokenSignLength]; + verifyToken.sigByteCount = SEC_SIZE_SIG_RSA2048; + if (FblDiagVerifyTokenSignature(&verifyToken) == SECM_VER_OK) + { + resultTkn = kTokenHdlrOk; + } + } + } + } + } + + /* Do token validation */ + if (resultTkn == kTokenHdlrOk) + { + resultTkn = ApplFblPreValidateToken(tokenBufferPtr); + + if(resultTkn == kTokenHdlrOk) + { + resultTkn = FblDiagValidateToken(tokenBufferPtr); + } + } + + /* Do token copy into NVM after validation successfull */ + if (resultTkn == kTokenHdlrOk) + { + /* Token shall be stored into the NVM */ + if (ApplFblWriteToken(tokenBufferPtr, tokenLength) != kFblOk) + { + resultTkn = kTokenHdlrInternalFailed; + } + } + + /* For mode 3 and 4 perform only Token validation, other modes perform key switch or key reprogramming */ + if ((cmdType != FBL_DIAG_TOKEN_CMD_USEDEVDATE) && (cmdType != FBL_DIAG_TOKEN_CMD_USEDEVIGNI) && (resultTkn == kTokenHdlrOk)) + { + resultTkn = FblDiagTokenKeyProcessing(cmdType, tokenBufferPtr); + } + + /* Call callouts for every mode */ + if (resultTkn == kTokenHdlrOk) + { + resultTkn = FblDiagTokenCallout(cmdType, tokenBufferPtr, tokenLength); + } + } + + if (DiagGetError() == kDiagErrorNone) + { + /* Send positive response */ + pbDiagBuffer[kDiagFmtSubRoutineInfo] = (vuint8)resultTkn; + DiagProcessingDone(kDiagRslRcTokenDownload); + result = kFblOk; + } + else + { + result = kFblFailed; + } + + return result; +} +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + +#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) +/*********************************************************************************************************************** + * FblDiagMainHandlerRcUpdateSecBytes + **********************************************************************************************************************/ +/*! \brief RoutineControl - Update Security Bytes subroutine (0x0305) + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcUpdateSecBytes) +{ + tFblResult result = kFblOk; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Check programming mode - is the SBL present and activated? */ + if (!GetMemDriverInitialized()) + { + DiagNRCConditionsNotCorrect(); + } + else + { + /* Check if write request is targeted at the correct security level */ + if (pbDiagBuffer[kDiagFmtSubRoutineUpdateSecBytesLevel] != kDiagSecLevelFlash) + { + /* Invalid security level */ + DiagNRCRequestOutOfRange(); + } + else + { + /* Write security bytes to non-volatile memory */ + result = ApplFblWriteSecurityBytes(&pbDiagBuffer[kDiagFmtSubRoutineUpdateSecBytesValue], kSecSecretKeyLength); + } + } + + /* Send response immediately if no NRC has been set */ + if (DiagGetError() == kDiagErrorNone) + { + /* No NRC has been set, prepare positive response */ + pbDiagBuffer[kDiagFmtSubRoutineIdPar] = (vuint8)((kDiagSubRoutineType1_Sync << 4) | kDiagSubRoutineStatusCompleted ); + + /* Send positive response */ + DiagProcessingDone(kDiagRslRcUpdateSecBytes); + } + else + { + /* NRC has been set, set correct return value */ + result = kFblFailed; + } + + return result; +} +#endif /* FBL_DIAG_ENABLE_UPDATE_SEC_BYTES */ + +/*********************************************************************************************************************** + * FblDiagMainHandlerRcEraseMemory + **********************************************************************************************************************/ +/*! \brief RoutineControl - EraseMemory subroutine + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcEraseMemory) +{ + tFblResult result = kFblOk; + tBlockDescriptor eraseBlockDescriptor = {0}; + tFblMemBlockInfo blockInfo = {0}; + tFblAddress eraseAddress = 0u; + tFblLength eraseLength = 0u; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Initialize return value */ + { + ClrEraseMemorySucceeded(); + + /* Extract erase region information from the diag buffer */ + eraseAddress = (tFblAddress)FblMemGetInteger(kDiagRqlRcEraseMemoryAddress, &pbDiagBuffer[kDiagFmtSubRoutineEraseMemoryAddress]); + eraseLength = (tFblLength)FblMemGetInteger(kDiagRqlRcEraseMemoryLength, &pbDiagBuffer[kDiagFmtSubRoutineEraseMemorySize]); + + /* Check if the memory driver has been downloaded and initialized */ + if (!GetMemDriverInitialized()) + { + /* Routine not supported in PBL */ + DiagNRCConditionsNotCorrect(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /* Retrieve index of logical block (blockNr is kBlockNrInvalid in case of failure) */ + result = FblLbtGetBlockDescriptorByAddressLength(eraseAddress, eraseLength, &eraseBlockDescriptor); + if ((result != kFblOk) + /* Check exact match of requested erase area with logical block */ + || (eraseBlockDescriptor.blockStartAddress != eraseAddress) + || (eraseBlockDescriptor.blockLength != eraseLength) + ) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /* Check type of requested block */ + if (eraseBlockDescriptor.blockNr == FBL_MTAB_SBL_BLOCK_NUMBER) + { + /* Reject all erase requests which are directed to the SBL block */ + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { +#if defined( FBL_ENABLE_FLASH_ERASED_DETECTION ) + if (ApplFblGetBlockErased(eraseBlockDescriptor) == kFlashErased) + { + result = kFblOk; + } + else +#endif /* FBL_ENABLE_FLASH_ERASED_DETECTION */ + { + /* Avoid P2 timeout during invalidation */ + DiagExRCRResponsePending(kForceSendResponsePending); + + /* Invalidate application before erase procedure */ + result = ApplFblInvalidateBlock(eraseBlockDescriptor); + + /* Catch invalid combinations of return value and NRC state */ + assertFblUser(((result == kFblOk) && (DiagGetError() == kDiagErrorNone)) || + ((result != kFblOk) && (DiagGetError() != kDiagErrorNone)), + kFblOemAssertIllegalReturnValue); + + /* Proceed only if all entry conditions and block invalidation succeeded */ + if (result == kFblOk) + { + /* Start erase procedure */ + blockInfo.targetAddress = eraseBlockDescriptor.blockStartAddress; + blockInfo.targetLength = eraseBlockDescriptor.blockLength; + blockInfo.logicalAddress = eraseBlockDescriptor.blockStartAddress; + blockInfo.logicalLength = eraseBlockDescriptor.blockLength; + /* Additional members are not used for erase indication */ + + result = FblMemRemapStatus(FblMemBlockEraseIndication(&blockInfo)); + } + + if (result == kFblOk) + { +#if defined( FBL_ENABLE_FLASH_ERASED_DETECTION ) + (void)ApplFblSetBlockErased(eraseBlockDescriptor); +#endif + } + } + } + + if (result == kFblOk) + { + /* Remember erased state */ + SetEraseMemorySucceeded(); + lastErasedBlock = eraseBlockDescriptor.blockNr; + blockHeader[eraseBlockDescriptor.blockNr].state = kBlockState_Erased; + } + + /* Send response immediately if no NRC has been set */ + if (DiagGetError() == kDiagErrorNone) + { + /* No NRC has been set, prepare positive response */ + if (result == kFblOk) + { + pbDiagBuffer[kDiagFmtSubRoutineIdPar] = (vuint8)((kDiagSubRoutineType1_Sync << 4) | kDiagSubRoutineStatusCompleted ); + /* Send positive response */ + DiagProcessingDone(kDiagRslRcEraseMemory); + } + else + { + /* ESCAN00066098: Erase procedure failed, send negative response */ + DiagNRCGeneralProgrammingFailure(); + } + } + else + { + /* NRC has been set, set correct return value */ + result = kFblFailed; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerRcCheckProgDep + **********************************************************************************************************************/ +/*! \brief RoutineControl - CheckProgrammingDependencies subroutine + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRcCheckProgDep) +{ + tFblAddress checkStartAddress; + tFblLength checkLength; + tFblResult result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Extract check address range */ + checkStartAddress = FblMemGetInteger(kDiagRqlRcCheckProgDepMemoryAddress, &pbDiagBuffer[kDiagFmtSubRoutineCheckMemoryAddress]); + checkLength = FblMemGetInteger(kDiagRqlRcCheckProgDepMemorySize, &pbDiagBuffer[kDiagFmtSubRoutineCheckMemorySize]); + + if (checkLength < kDiagCheckProgDepAdressMinLength) + { + /* Address length is under the minimal length */ + result = kFblFailed; + } + else if (FblMemSegmentNrGet(checkStartAddress) < 0) + { + /* Address start is not located in the Flash Block Table */ + result = kFblFailed; + } + else if (FblMemSegmentNrGet(checkStartAddress + checkLength - 1u) < 0) + { + /* Address end is not located in the Flash Block Table */ + result = kFblFailed; + } + else + { + result = kFblOk; + } + + /* Ensure that a valid address */ + if (result != kFblOk) + { + /* Requested download region does not meet requirements; abort service handling */ + DiagNRCRequestOutOfRange(); + } + else + { + /* Setup segment information */ + verifySegmentInfo[0].targetAddress = checkStartAddress; + verifySegmentInfo[0].transferredAddress = checkStartAddress; + verifySegmentInfo[0].length = checkLength; + verifyParam.segmentList.nrOfSegments = 1; + + /* Trigger checksum calculation */ + verifyParam.blockStartAddress = checkStartAddress; + verifyParam.blockLength = checkLength; + /* No actual verification data included in request */ + verifyParam.verificationData = verifyOutputBuf; + verifyParam.wdTriggerFct = &FblRealTimeSupportVoid; + /* Routine is restricted to ROM access */ + verifyParam.readMemory = (FL_ReadMemoryFctType)&FblReadProm; + + /* Call HIS verification interface to calculate CRC */ + if (SECM_VER_OK == FblDiagVerification(&verifyParam)) + { + /* RoutineInfo */ + pbDiagBuffer[kDiagFmtSubRoutineInfo] = (vuint8)((kDiagSubRoutineType1_Sync << 4) | kDiagSubRoutineStatusCompleted); + + /* CRC value is stored in last two byte of buffer */ /* PRQA S 0314 1 */ /* MD_FblDiag_0314_MemCpy */ + (void)MEMCPY(&pbDiagBuffer[kDiagFmtSubRoutineCrcHigh], &verifyOutputBuf[FBL_DIAG_CRC_OFFSET], SEC_SIZE_CHECKSUM_CRC); + + /* Send positive response */ + DiagProcessingDone(kDiagRslRcCheckProgDep); + } + else + { + /* ESCAN00066098: Verification failed (most likely memory read error), send negative response */ + DiagNRCGeneralReject(); + result = kFblFailed; + } + } + + return result; +} + + +/*********************************************************************************************************************** + * FblDiagSecAccessSeed + **********************************************************************************************************************/ +/*! \brief Process security seed request + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \param[in] secLevel Requested security level + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static tFblResult FblDiagSecAccessSeed(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen, vuint8 secLevel ) +{ + vuint8 returnCode; + vuint8 i; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; + (void)secLevel; +# if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +# else + (void)pbDiagBuffer; /* PRQA S 3112 */ /* MD_MSR_DummyStmt */ +# endif +#endif + +#if ( SYSSERVICE_SECMODHIS_VERSION >= 0x0300u ) + /* Cancel all SecM jobs if security access is performed anew, for example if the download is restarted */ + SecM_CancelAllJobs(); +#endif + + /* Get currently unlocked level */ + if (GetCurrentSecLvl() != kDiagSecLevelNone) + { + /* ECU is already unlocked, send zero seed */ + for (i = 0; i < GetRequestedSeedLength(); i++) + { + pbDiagBuffer[kDiagFmtSeedKeyStart + i] = 0x00u; + } + + /* Security access already granted. Don't allow a key to be submitted. */ + ClrSecurityKeyAllowed(); + returnCode = kFblFailed; + } + else + { + /* Generate seed by application function */ + if (ApplFblSecuritySeed() == kFblOk) + { + /* Accept security key next */ + returnCode = kFblOk; +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + /* Remember security level */ + diagRequestedSecLvl = pbDiagBuffer[kDiagFmtSubparam]; +#endif + } + else + { + /* Error occurred during seed computation */ + FblErrStatSetError(FBL_ERR_SEED_GENERATION_FAILED); + DiagNRCConditionsNotCorrect(); + returnCode = kFblFailed; + } + } + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) + if (returnCode != kFblOk) + { + /* Invalidate requested security level */ + diagRequestedSecLvlIdx = kDiagInvalidSecLvlIdx; + } +#endif + + /* Set response length used by fbl_diag: (SID +) sub parameter + seed length */ + DiagProcessingDone(1u + GetRequestedSeedLength()); + + return returnCode; +} + +/*********************************************************************************************************************** + * FblDiagSecAccessKey + **********************************************************************************************************************/ +/*! \brief Process security key request + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \param[in] secLevel Requested security level + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static tFblResult FblDiagSecAccessKey(V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType diagReqDataLen, vuint8 secLevel) +{ + vuint8 returnCode; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; + (void)secLevel; +#endif + + /* + * Clearing the SecurityKeyAllowed state cannot be done automatically + * (by the dispatcher) because errors other than key comparison (e.g. + * length check) should not reset the state. + */ + ClrSecurityKeyAllowed(); + + /* Check security access key in application function */ + returnCode = ApplFblSecurityKey(); + + if (returnCode != kFblOk) + { + /* Set NRC */ + DiagNRCInvalidKey(); + } + else + { + SetCurrentSecLvl((vuint8)(pbDiagBuffer[kDiagFmtSubparam] - 1u)); + DiagProcessingDone(kDiagRslSecurityAccessKey); + } + + return returnCode; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerSecAccessSeed + **********************************************************************************************************************/ +/*! \brief SecurityAccess - Seed handling for security level "Flash" + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerSecAccessSeed) +{ + return FblDiagSecAccessSeed(pbDiagBuffer, diagReqDataLen, kDiagSecLevelFlash); +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerSecAccessKey + **********************************************************************************************************************/ +/*! \brief SecurityAccess - Key handling for security level "Flash Programming" + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerSecAccessKey) +{ + return FblDiagSecAccessKey(pbDiagBuffer, diagReqDataLen, kDiagSecLevelFlash); +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerRequestDownload + **********************************************************************************************************************/ +/*! \brief RequestDownload service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 2889, 6010, 6030, 6050, 6080 1 */ /* MD_FblDiag_2889, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestDownload) +{ + vuint8 lengthFormat = 0u; + vuint8 addrFormat = 0u; + tFblLbtBlockNr requestedDownloadBlock = 0u; + tBlockDescriptor logicalBlockDescriptor = {0}; + tFblLength transferLength = 0u; + tFblMemSegmentInfo segInfo; + tFblMemBlockInfo blockInfo; + tFblResult result = kFblOk; + tCwDataLengthType maxBlockLength; + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * localPbDiagBuffer = V_NULL; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) +# if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +# endif +#endif + +/* Initialize return value */ + { + localPbDiagBuffer = pbDiagBuffer; + + /* Get encryption and compression method */ + dataFormatId = localPbDiagBuffer[kDiagFmtSubparam]; + +#if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) + if (localPbDiagBuffer[kDiagFmtFormatOffset] != ((vuint8)(kDiagSubMaxLengthFormat << 4u) | kDiagSubMaxAddrFormat)) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + + lengthFormat = kDiagSubMaxLengthFormat; + addrFormat = kDiagSubMaxAddrFormat; +#else + /* Get address- and length format */ + lengthFormat = (vuint8)((localPbDiagBuffer[kDiagFmtFormatOffset] & kDiagFmtLengthMask) >> 4u); + addrFormat = (vuint8)(localPbDiagBuffer[kDiagFmtFormatOffset] & kDiagFmtAddrMask); + + if ((lengthFormat < kDiagSubMinLengthFormat) + || (lengthFormat > kDiagSubMaxLengthFormat) + || (addrFormat < kDiagSubMinAddrFormat) + || (addrFormat > kDiagSubMaxAddrFormat)) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + + if (result == kFblOk) + { + if (diagReqDataLen != (kDiagRqlRequestDownload + lengthFormat + addrFormat)) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + result = kFblFailed; + } + } +#endif /* FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI */ + } + + if (result == kFblOk) + { +#if defined( FBL_ENABLE_DATA_PROCESSING ) +# if defined( FBL_ENABLE_ENCRYPTION_MODE ) +# else + /* No encrypted data supported */ + if (FblDiagGetEncryptionMode(dataFormatId) != kDiagSubNoEncryption) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } +# endif /* FBL_ENABLE_ENCRYPTION_MODE */ +# if defined( FBL_ENABLE_COMPRESSION_MODE ) +# else + /* No compressed data supported */ + if (FblDiagGetCompressionMode(dataFormatId) != kDiagSubNoCompression) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } +# endif /* FBL_ENABLE_COMPRESSION_MODE */ +#else + if (dataFormatId != kDiagSubNoDataProcessing) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } +#endif /* FBL_ENABLE_DATA_PROCESSING */ + } + + if (result == kFblOk) + { + /* Init expected sequence counter for TransferData */ + expectedSequenceCnt = kDiagInitSequenceNum; + /* Init current sequence counter for TransferData */ + currentSequenceCnt = kDiagInitSequenceNum; + + /* Extract address and length from request */ + transferAddress = (tFblAddress)FblMemGetInteger(addrFormat, &localPbDiagBuffer[kDiagFmtAddrOffset]); + transferRemainder = (tFblLength)FblMemGetInteger(lengthFormat, &localPbDiagBuffer[kDiagFmtAddrOffset + addrFormat]); + + /* Check if length is equal to zero */ + if (transferRemainder == 0u) + { + /* Length zero is unaccepted */ + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* + * If the requested download contains compressed or encrypted data, the requested download length refers to the + * size of the transfer data (i.e. the length of the processed (decrypted/decompressed) data may differ from the + * requested download length). + */ + if (dataFormatId != kDiagSubNoDataProcessing) + { + /* + * Check the start address only. Flash boundary check not possible here because the resulting length of the + * processed data is not known. Additional check performed in programming routine. + */ + transferLength = 1u; + } + else +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + { + transferLength = transferRemainder; + } + + /* Retrieve block descriptor of requested logical block */ + result = FblLbtGetBlockDescriptorByAddressLength(transferAddress, transferLength, &logicalBlockDescriptor); + + /* Ensure that a valid block is set */ + if (result != kFblOk) + { + /* Requested download region is outside of the configured logical blocks; abort service handling */ + DiagNRCRequestOutOfRange(); + } + } + + if (result == kFblOk) + { + requestedDownloadBlock = logicalBlockDescriptor.blockNr; + + if (transferType == DOWNLOAD_FLASH) + { + /* Check state flags */ + if (!GetMemDriverInitialized()) + { + DiagNRCConditionsNotCorrect(); + result = kFblFailed; + } + } + else /* transferType == DOWNLOAD_RAM */ + { + assertFbl(!GetMemDriverInitialized(), kFblOemAssertIllegalExecutionPath); + + /* Check type of requested block */ + if (requestedDownloadBlock != FBL_MTAB_SBL_BLOCK_NUMBER) + { + /* Still in PBL: reject all downloads which are not directed to the SBL block */ + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + + if (result == kFblOk) + { + /* Restrict execution sequence and perform auto-erase */ + if (blockHeader[requestedDownloadBlock].state == kBlockState_Init) + { + /* "Erase" flash code array (remove spurious code in buffer, support writing of presence pattern) */ + /* Note: since the block state is reset in SessionControl, this will also clean up the flashcode buffer */ + assertFbl(FLASH_SIZE == logicalBlockDescriptor.blockLength, kFblSysAssertParameterOutOfRange); + if (kFblMemStatus_Ok == FblMemEraseRegion(logicalBlockDescriptor.blockStartAddress, logicalBlockDescriptor.blockLength)) + { + blockHeader[requestedDownloadBlock].state = kBlockState_Erased; + } + } + } + } + } + + if (result == kFblOk) + { + /* Check if the respective logical block has been erased */ + if (blockHeader[requestedDownloadBlock].state != kBlockState_Erased) + { + /* Requested download region has not been erased; abort service handling */ + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + (void)ApplFblAdjustLbtBlockData(&logicalBlockDescriptor); + + /* Check if requested download block overwrites presence pattern (or exceeds logical block) */ + if ((transferAddress + transferLength) > (logicalBlockDescriptor.blockStartAddress + logicalBlockDescriptor.blockLength)) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /* Copy data and address of segment to initialize diagSegmentList */ + if (FblDiagSegmentNext(transferAddress, transferRemainder, requestedDownloadBlock) == kDiagSegmentOutOfRange) + { + FblErrStatSetError(FBL_ERR_TOO_MANY_SEGMENTS_IN_MODULE); + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /*** Download request has been accepted ***/ + + /* Initialize block data used by FblLib_Mem */ + blockInfo.targetAddress = logicalBlockDescriptor.blockStartAddress; + blockInfo.targetLength = logicalBlockDescriptor.blockLength; + blockInfo.logicalAddress = blockInfo.targetAddress; + blockInfo.logicalLength = blockInfo.targetLength; + blockInfo.verifyRoutineInput.function = V_NULL; + blockInfo.verifyRoutineInput.param = V_NULL; + blockInfo.segmentList = &verifyParam.segmentList; + blockInfo.maxSegments = 1u; /* Only a single segment per block */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Check if a customer function is configured for this logical block */ + if (SecM_Default != logicalBlockDescriptor.verifyOutput) + { + /* Switch to output verification (customer function will be set in FblDiagVerification() */ + blockInfo.verifyRoutineOutput.function = &FblDiagVerification; + blockInfo.verifyRoutineOutput.param = &verifyParam; + blockInfo.verifyRoutinePipe.function = V_NULL; + blockInfo.verifyRoutinePipe.param = V_NULL; + } + else + { + /* Initialize the calculation (CCC: SHA256, DDD: CRC16) */ + pipeVerifyParam.currentHash.sigResultBuffer = (vuint32)pipeVerifyBuf; /* PRQA S 0306 */ /* MD_FblDiag_0306 */ + pipeVerifyParam.currentHash.length = sizeof(pipeVerifyBuf); + pipeVerifyParam.currentDataLength = &pipeVerifyLength; +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) + /* Initialize the calculation (CCC: CRC16) */ + pipeVerifyParamCrc.currentHash.sigResultBuffer = (vuint32)&pipeVerifyCrc; /* PRQA S 0306 */ /* MD_FblDiag_0306 */ + pipeVerifyParamCrc.currentHash.length = sizeof(pipeVerifyCrc); + pipeVerifyParamCrc.currentDataLength = &pipeVerifyLengthCrc; + blockInfo.verifyRoutinePipe.function = &FblDiagVerifySignature; +# else + blockInfo.verifyRoutinePipe.function = &SecM_VerifyClassDDD; +# endif /* SEC_ENABLE_SECURITY_CLASS_CCC */ + blockInfo.verifyRoutinePipe.param = &pipeVerifyParam; + blockInfo.verifyRoutineOutput.function = V_NULL; + blockInfo.verifyRoutineOutput.param = V_NULL; + } +#else + blockInfo.verifyRoutineOutput.function = &FblDiagVerification; + blockInfo.verifyRoutineOutput.param = &verifyParam; + blockInfo.verifyRoutinePipe.function = V_NULL; + blockInfo.verifyRoutinePipe.param = V_NULL; +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + blockInfo.readFct = &FblReadProm; /* FblWrapperRam required! */ + + /* Indicate the start of a new download block */ + result = FblMemRemapStatus(FblMemBlockStartIndication(&blockInfo)); + (void)FblDiagMemGetActiveBuffer(); + if (result != kDiagErrorNone) + { + DiagSetError(result); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /* Initialize segment data */ + segInfo.targetAddress = transferAddress; + segInfo.targetLength = transferRemainder; + segInfo.logicalAddress = segInfo.targetAddress; + segInfo.logicalLength = segInfo.targetLength; + segInfo.type = kFblMemType_ROM; /* FblWrapperRam required! */ + segInfo.dataFormat = dataFormatId; + + /* Indicate start of new segment */ + result = FblMemRemapStatus(FblMemSegmentStartIndication(&segInfo)); + localPbDiagBuffer = FblDiagMemGetActiveBuffer(); + + if (result != kDiagErrorNone) + { + DiagSetError(result); + result = kFblFailed; + } + } + + if (result == kFblOk) + { + /* Download of segment accepted: set logical block as "active" */ + currentBlock = requestedDownloadBlock; + +#if defined( FBL_ENABLE_FLASH_ERASED_DETECTION ) + (void)ApplFblClrBlockErased(logicalBlockDescriptor); +#endif + + /* Evaluate maximum block length for TransferData requests */ + maxBlockLength = FblDiagGetMaxTransferDataBlockLength(); + + /* Length format dependent on maximum block length */ + /* PRQA S 2880, 2992, 2996 TAG_FblDiag_ConstValue_1 */ /* MD_FblDiag_ConstValue */ + if (maxBlockLength > 0xFFFFFFuL) + { + lengthFormat = 4u; + } + else if (maxBlockLength > 0xFFFFu) + { + lengthFormat = 3u; + } + else + { + /* Use at least two length bytes */ + lengthFormat = 2u; + } + /* PRQA L:TAG_FblDiag_ConstValue_1 */ + + /* Set length format and maximum block length */ + localPbDiagBuffer[kDiagFmtSubparam] = lengthFormat << 4u; + FblMemSetInteger(lengthFormat, maxBlockLength, &localPbDiagBuffer[kDiagFmtMaxBlockLengthHigh]); + + DiagProcessingDone(kDiagRslRequestDownload + lengthFormat); + + } + else + { + /* In case this was the RD for the SBL, and OTA is enable, revert the current partition in case of failure */ + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerTransferDataDownload + **********************************************************************************************************************/ +/*! \brief TransferData service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 2889, 3673 1 */ /* MD_FblDiag_2889, MD_MSR_Rule8.13 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTransferDataDownload) +{ + tFblResult result; + + /* Check if the requested sequence number is expected */ + if (pbDiagBuffer[kDiagFmtSubparam] != expectedSequenceCnt ) + { + /* Check if sequence number corresponds to a retry */ + if (pbDiagBuffer[kDiagFmtSubparam] == currentSequenceCnt) + { + /* Handle the retries here */ + + /* Repetition of last transferData request */ + /* Simply send a positive response without loading data to memory */ + DiagProcessingDone(kDiagRslTransferData); + + return kFblOk; + } + else /* Sequence number is not for a retry */ + { + /* Send a WrongSequenceError */ + DiagNRCWrongBlockSequenceCounter(); + return kFblFailed; + } + } + + result = FblMemRemapStatus(FblMemDataIndication(DiagBuffer, kDiagFmtDataOffset, (tFblLength)diagReqDataLen - 1u)); + (void)FblDiagMemGetActiveBuffer(); + if (result != kDiagErrorNone) + { + DiagSetError(result); + ClrTransferDataAllowed(); + return kFblFailed; + } + + transferRemainder -= ((tFblLength)diagReqDataLen - 1u); + + if (transferRemainder == 0u) + { + /* Finalize writing the data */ + result = FblMemRemapStatus(FblMemSegmentEndIndication(&totalProgramLength)); + (void)FblDiagMemGetActiveBuffer(); + + if (result != kDiagErrorNone) + { + DiagSetError(result); + return kFblFailed; + } + + result = FblMemRemapStatus(FblMemBlockEndIndication()); + if (result != kDiagErrorNone) + { + DiagSetError(result); + return kFblFailed; + } + + } + + /* Memorize current counter */ + currentSequenceCnt = expectedSequenceCnt; + + /* Sequence counter value of next transferData request */ + expectedSequenceCnt++; + + DiagProcessingDone(kDiagRslTransferData); + return kFblOk; +} + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +/*********************************************************************************************************************** + * FblDiagMainHandlerRequestUpload + **********************************************************************************************************************/ +/*! \brief RequestUpload service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 2889 1 */ /* MD_FblDiag_2889 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestUpload) +{ + vuint8 lengthFormat, addrFormat; + vuint8 requestedUploadBlock; + tFblResult result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) +# if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +# endif +#endif + + +#if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) + if (pbDiagBuffer[kDiagFmtFormatOffset] != ((vuint8)(kDiagSubMaxLengthFormat << 4) | kDiagSubMaxAddrFormat)) + { + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + lengthFormat = kDiagSubMaxLengthFormat; + addrFormat = kDiagSubMaxAddrFormat; +#else + /* Get address- and length format */ + lengthFormat = (vuint8)((pbDiagBuffer[kDiagFmtFormatOffset] & kDiagFmtLengthMask) >> 4); + addrFormat = pbDiagBuffer[kDiagFmtFormatOffset] & kDiagFmtAddrMask; + + if ((lengthFormat < kDiagSubMinLengthFormat) || (lengthFormat > kDiagSubMaxLengthFormat) || (addrFormat < kDiagSubMinAddrFormat) || (addrFormat > kDiagSubMaxAddrFormat)) + { + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + if (diagReqDataLen != (kDiagRqlRequestDownload + lengthFormat + addrFormat)) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + return kFblFailed; + } +#endif /* FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI */ + + /* Get encryption and compression method */ + dataFormatId = pbDiagBuffer[kDiagFmtSubparam]; + + /* No encrypted or compressed data supported */ + if (dataFormatId != kDiagSubNoDataProcessing) + { + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + /* Extract address and length from request */ + transferAddress = (tFblAddress)FblMemGetInteger(addrFormat, &pbDiagBuffer[kDiagFmtAddrOffset]); + transferRemainder = (tFblLength)FblMemGetInteger(lengthFormat, &pbDiagBuffer[kDiagFmtAddrOffset + addrFormat]); + + /* Check if length is equal to zero */ + if (transferRemainder == 0u) + { + /* Length zero is unaccepted */ + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + /* Retrieve index of logical block (result is kBlockNrInvalid in case of failure) */ + result = FblLbtGetBlockNrByAddressLength(transferAddress, transferRemainder, &requestedUploadBlock); + + /* Ensure that a valid block number is set */ + if (result != kFblOk) + { + /* Requested download region is outside of the configured logical blocks; abort service handling */ + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + /* Save data and address of segment for CRC calculation in TransferExit */ + if (FblDiagSegmentNext(transferAddress, transferRemainder, requestedUploadBlock) == kDiagSegmentOutOfRange) + { + FblErrStatSetError(FBL_ERR_TOO_MANY_SEGMENTS_IN_MODULE); + DiagNRCRequestOutOfRange(); + return kFblFailed; + } + + /* Check programming mode - is the SBL present and activated? */ + if (!GetMemDriverInitialized()) + { + DiagNRCConditionsNotCorrect(); + return kFblFailed; + } + + /* Init expected sequence counter for TransferData */ + expectedSequenceCnt = kDiagInitSequenceNum; + /* Init current sequence counter for TransferData */ + currentSequenceCnt = kDiagInitSequenceNum; + + /* Use whole diag buffer size as block length for TransferDataUpload */ + maxNumberOfBlockLength = (vuint16)FBL_DIAG_BUFFER_LENGTH; + + /* Number of bytes reserved for maximum block length */ + pbDiagBuffer[kDiagFmtSubparam] = kDiagMaxNumberOfBlockLengthLength << 4u; + + /* Report block length which will be used in TransferDataUpload */ + pbDiagBuffer[kDiagFmtMaxBlockLengthHigh] = (vuint8)((maxNumberOfBlockLength >> 8) & 0xFFu); + pbDiagBuffer[kDiagFmtMaxBlockLengthLow] = (vuint8)(maxNumberOfBlockLength & 0xFFu); + + DiagProcessingDone(kDiagRslRequestUpload + kDiagMaxNumberOfBlockLengthLength); + + return kFblOk; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerTransferDataUpload + **********************************************************************************************************************/ +/*! \brief TransferData service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 2889 1 */ /* MD_FblDiag_2889 */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerTransferDataUpload) +{ + /* The transfer data length is static to account for potential retries */ + static tCwDataLengthType transferDataUpLength; + /* Temporary buffer used to backup data from the diag buffer that is */ + /* overwritten by a retry upload request */ + static vuint8 tmpUploadBuffer[kDiagFmtTransferDataUploadRetryBackupSize]; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +#endif + + /* Check if the requested sequence number is expected */ + if (DiagBuffer[kDiagFmtSequenceCnt] != expectedSequenceCnt ) + { + /* Check if sequence number corresponds to a retry */ + if (DiagBuffer[kDiagFmtSequenceCnt] == currentSequenceCnt) + { + vuintx i; + + /* + * Repetition of last TransferData request: retrieve the saved data + * from temporary buffer. + */ + for (i = 0u; i < kDiagFmtTransferDataUploadRetryBackupSize; i++) + { + pbDiagBuffer[kDiagFmtDataOffset + i] = tmpUploadBuffer[i]; + } + + /* Re-upload the data that is still in the buffer */ + DiagProcessingDone(transferDataUpLength + 1u); + return kFblOk; + } + else /* Sequence number is not for a retry */ + { + /* Send a WrongSequenceError */ + DiagNRCWrongBlockSequenceCounter(); + return kFblFailed; + } + } + else /* Sequence number is equal to the one expected */ + { + /* Check if anymore data is expected */ + if (transferRemainder == 0u) + { + /* Send NRC TransferDataSuspended and abort, no more data expected! */ + DiagNRCTransferDataSuspended(); + ClrTransferDataAllowed(); + return kFblFailed; + } + } + + /* Memorize current counter */ + currentSequenceCnt = expectedSequenceCnt; + + /* Sequence counter value of next TransferData request */ + expectedSequenceCnt++; + + /* + * Check if the requested length exceeds the diag buffer size. + * kDiagFmtDataOffset accounts for service ID and block sequence counter. + */ + if (transferRemainder > ((tFblLength)maxNumberOfBlockLength - kDiagFmtDataOffset)) + { + transferDataUpLength = ((tCwDataLengthType)maxNumberOfBlockLength - kDiagFmtDataOffset); + } + else + { + transferDataUpLength = (tCwDataLengthType)transferRemainder; + } + + transferRemainder -= transferDataUpLength; + + /* + * Address being passed is either within flash boundaries or within some + * other type of memory supported by the application. + */ + if (FblReadProm(transferAddress, &pbDiagBuffer[kDiagFmtDataOffset], transferDataUpLength) != transferDataUpLength) + { + /* Tried accessing non supported memory location */ + DiagNRCConditionsNotCorrect(); + return kFblFailed; + } + else /* Success */ + { + vuintx i; + + transferAddress += transferDataUpLength; + + /* + * Backup the DATA bytes in the diag buffer which might be overwritten + * by the single frame reception with a retry upload request. + */ + for (i = 0u; i < kDiagFmtTransferDataUploadRetryBackupSize; i++) + { + tmpUploadBuffer[i] = pbDiagBuffer[kDiagFmtDataOffset + i]; + } + } + + DiagProcessingDone(transferDataUpLength + 1u); + + return kFblOk; +} +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +/*********************************************************************************************************************** + * FblDiagMainHandlerRequestTransferExit + **********************************************************************************************************************/ +/*! \brief RequestTransferExit service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 3673, 2889, 6010, 6030, 6050 1 */ /* MD_MSR_Rule8.13, MD_FblDiag_2889, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerRequestTransferExit) +{ + tFblResult result; + tFblMemVerifyStatus verifyResult; + tFblMemBlockVerifyData verifyData = {0}; +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + tExportFct exportFct; +#endif + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)diagReqDataLen; +# if defined( FBL_DIAG_ENABLE_UPLOAD ) +# else + (void)pbDiagBuffer; /* PRQA S 3112 */ /* MD_MSR_DummyStmt */ +# endif /* FBL_DIAG_ENABLE_UPLOAD */ +#endif + + assertFblInternal(currentSegment != kDiagSegmentOutOfRange, kFblOemAssertIllegalParameter); + assertFblInternal(currentBlock != kBlockNrInvalid, kFblOemAssertIllegalParameter); + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + if (GetTransferDataUpload()) + { + /* This service is allowed after all bytes of the segment are transferred */ + if (transferRemainder != 0u) + { + DiagNRCRequestSequenceError(); + return kFblFailed; + } + } +#endif + + /* Send an initial response pending message */ + DiagExRCRResponsePending(kForceSendResponsePending); + + /* Calculate CRC16-CITT value of the given memory area */ +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + if (GetTransferDataUpload()) + { + result = kFblOk; + + /* Setup segment information */ + verifySegmentInfo[0].targetAddress = diagSegmentList.segmentInfo[currentSegment].targetAddress; + verifySegmentInfo[0].transferredAddress = diagSegmentList.segmentInfo[currentSegment].targetAddress; + verifySegmentInfo[0].length = diagSegmentList.segmentInfo[currentSegment].length; + verifyParam.segmentList.nrOfSegments = 1u; + + /* Trigger checksum calculation */ + verifyParam.blockStartAddress = diagSegmentList.segmentInfo[currentSegment].targetAddress; + verifyParam.blockLength = diagSegmentList.segmentInfo[currentSegment].length; + /* No actual verification data included in request; result of CRC calculation will be stored here */ + verifyParam.verificationData = verifyOutputBuf; + verifyParam.wdTriggerFct = &FblRealTimeSupportVoid; + /* Upload is restricted to ROM content */ + verifyParam.readMemory = (FL_ReadMemoryFctType)&FblReadProm; + + if (SECM_VER_OK != FblDiagVerification(&verifyParam)) + { + /* An error occurred during checksum calculation */ + return kFblFailed; + } + + /* Restore the segmentInfo entry for download purposes */ + diagSegmentList.nrOfSegments--; + } + else +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + { +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Update segment information with actually programmed length */ + diagSegmentList.segmentInfo[currentSegment].length = totalProgramLength; +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + + verifyData.verifyDataInput.length = 0u; + verifyData.verifyDataInput.data = V_NULL; +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) && !defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Output and pipelined verification use the same data as they are used exclusively */ + /* No actual verification data included in request */ + verifyData.verifyDataOutput.length = FBL_DIAG_VERIFY_BUFFER_SIZE; + verifyData.verifyDataOutput.data = verifyOutputBuf; + verifyData.verifyDataPipe.length = 0u; + verifyData.verifyDataPipe.data = V_NULL; +#else /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + /* Check if customer verification function is configured for this block */ + result = FblLbtGetBlockVerifyOutputFuncByNr(currentBlock, &exportFct); + if (result == kFblOk) + { + if (SecM_Default == exportFct) + { + verifyData.verifyDataOutput.length = 0u; + verifyData.verifyDataOutput.data = V_NULL; + verifyData.verifyDataPipe.length = FBL_DIAG_VERIFY_BUFFER_SIZE; + verifyData.verifyDataPipe.data = verifyOutputBuf; + } + else + { + /* Customer verification function: switch to output verification */ + verifyData.verifyDataOutput.length = FBL_DIAG_VERIFY_BUFFER_SIZE; + verifyData.verifyDataOutput.data = verifyOutputBuf; + verifyData.verifyDataPipe.length = 0u; + verifyData.verifyDataPipe.data = V_NULL; + } + } + else + { + /* Should never happen */ + DiagNRCRequestOutOfRange(); + return kFblFailed; + } +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + /* Handle LibMem state flags and perform state checks */ + result = FblMemRemapStatus(FblMemBlockVerify(&verifyData, &verifyResult)); + if (result == kDiagErrorNone) + { + /* Store segment checksum for later verification in routine CheckValidApp */ /* PRQA S 0314 1 */ /* MD_FblDiag_0314_MemCpy */ + (void)MEMCPY(diagSegmentList.segmentInfo[currentSegment].checksum, verifyOutputBuf, SEC_VERIFY_CLASS_DDD_DIGEST_SIZE); + } + else + { + DiagSetError(result); + return kFblFailed; + } + } + + if (DiagGetError() == kDiagErrorNone) + { + /* No NRC returned, send the response */ + + /* CRC value is stored in last two byte of buffer */ /* PRQA S 0314 1 */ /* MD_FblDiag_0314_MemCpy */ + (void)MEMCPY(&pbDiagBuffer[kDiagFmtRoutineIdHigh], &verifyOutputBuf[FBL_DIAG_CRC_OFFSET], SEC_SIZE_CHECKSUM_CRC); + + { + DiagProcessingDone(kDiagRslRequestTransferExit); + } + } + else + { + result = kFblFailed; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagPrepareDidResponse + **********************************************************************************************************************/ +/*! \brief ReadDataByIdentifier service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] reqDid Requested DID + * \param[in] didData Pointer to DID data + * \param[in] didLength Data length of the DID + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static tFblResult FblDiagPrepareDidResponse ( vuint8 *pbDiagBuffer, vuint16 reqDid, tDidDataPtr didData, vuint16 didLen ) +{ + vuint16 dataIdx; + tFblResult result = kFblOk; + + /* Check if data fits into diag buffer */ + if ((DiagDataLength + didLen) < FBL_DIAG_BUFFER_LENGTH) + { + /* Write DID to the diag buffer */ + pbDiagBuffer[0] = (vuint8)(reqDid >> 8u); + pbDiagBuffer[1] = (vuint8)(reqDid & 0xFFu); + + if (didData != kDiagComplexDidData) + { + /* Extract the requested information from DID table */ + for (dataIdx = 0u; dataIdx < (didLen - kDiagFmtDataIdSize); dataIdx++) + { + pbDiagBuffer[kDiagFmtDataIdSize + dataIdx] = didData[dataIdx]; + } + } + else + { + /* User callback provides the requested information */ + result = ApplFblReadDataByIdentifier(pbDiagBuffer, didLen - kDiagFmtDataIdSize); + } + } + else + { + /* Requested data doesn't fit into diag buffer */ + DiagNRCResponseTooLong(); + result = kFblFailed; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagMainHandlerReadDataById + **********************************************************************************************************************/ +/*! \brief ReadDataByIdentifier service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +/* PRQA S 2889, 6010, 6030, 6080 1 */ /* MD_FblDiag_2889, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerReadDataById) +{ + tFblResult result = kFblFailed; + + /* Check if the length is an odd value. */ + if ((diagReqDataLen % 2u) == 1u) + { + DiagNRCIncorrectMessageLengthOrInvalidFormat(); + } + else + { + vuint16 reqDid[FBL_MAX_DID_COUNT]; + vuint16 didLen = 0u; + vuint8 numberOfDids, didIdx, tableIdx; + /* Get pointer to upper byte of first DID */ + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * localPbDiagBuffer = &pbDiagBuffer[1u]; + /* Reset response length */ + DiagDataLength = 0u; + + /* Extract DIDs from diag buffer, do while in order to always initialize reqDid */ + numberOfDids = 0u; + do + { + reqDid[numberOfDids] = (vuint16)FblMemGetInteger(2u, &localPbDiagBuffer[numberOfDids * 2u]); + numberOfDids++; + } while (numberOfDids < (diagReqDataLen / 2u)); + + /* Process requested DIDs */ + for (didIdx = 0u; (didIdx < numberOfDids) && (DiagGetError() == kDiagErrorNone); didIdx++) + { + /* Handle watchdog but omit transmission of RCRRP (REQPROD 74147) */ + (void)FblLookForWatchdog(); + + result = kFblFailed; + switch (reqDid[didIdx]) + { + /* Active Diagnostic Session */ + case kDiagDataIdActiveDiagnosticSession: + { + /* Bootloader supports programming session only */ + vuint8 diagSessionType = GetDiagSessionType(); + didLen = kDiagFmtDataIdSize + kDiagFmtDataIdActiveDiagnosticSessionSize; + result = FblDiagPrepareDidResponse(localPbDiagBuffer, reqDid[didIdx], (tDidDataPtr)&diagSessionType, didLen); + break; + } + /* Software Download Specification Version */ + case kDiagDataIdSwdlVersion: + { + /* SWDL issue kDiagSwdlVersion */ + vuint8 swdlVersion = kDiagSwdlVersion; + didLen = kDiagFmtDataIdSize + kDiagFmtDataIdSwdlVersionSize; + result = FblDiagPrepareDidResponse(localPbDiagBuffer, reqDid[didIdx], (tDidDataPtr)&swdlVersion, didLen); + break; + } + #if defined( FBL_DIAG_ENABLE_DID_CURRENT_DIAG_APP ) + /* DID 0xD021: Current Diagnostic Application */ + case kDiagDataIdBootloaderCurrentDiagnosticApp: + { + vuint8 currentDiagnosticApp = kFblDiagAppUnknown; + didLen = kDiagFmtDataIdSize + kDiagFmtDataIdBootloaderCurrentDiagAppSize; + if (GetMemDriverInitialized()) + { + currentDiagnosticApp = kFblDiagAppSbl; + } + else + { + currentDiagnosticApp = kFblDiagAppPbl; + } + result = FblDiagPrepareDidResponse(localPbDiagBuffer, reqDid[didIdx], (tDidDataPtr)¤tDiagnosticApp, didLen); + break; + } + #endif + /* User handles the other DIDs */ + default: + { + /* Search table of supported DIDs */ + for (tableIdx = 0; tableIdx < kNrOfDids; tableIdx++) + { + if (fblDidTable[tableIdx].did == reqDid[didIdx]) + { + /* Calculate overall data length for range check and pointer handling */ + didLen = kDiagFmtDataIdSize + fblDidTable[tableIdx].size; + result = FblDiagPrepareDidResponse(localPbDiagBuffer, reqDid[didIdx], fblDidTable[tableIdx].ptr, didLen); + break; + } + } + break; + } + } + + if (result == kFblOk) + { + /* Adjust response length and pointer to diag buffer */ + DiagDataLength += didLen; + localPbDiagBuffer = &localPbDiagBuffer[didLen]; + } + } + + if (DiagGetError() == kDiagErrorNone) + { + /* Check if at least one DID has been found */ + if (DiagDataLength == 0u) + { + DiagNRCRequestOutOfRange(); + result = kFblFailed; + } + else + { + /* No NRC returned, send the response */ + DiagProcessingDone(DiagDataLength); + } + } + else + { + result = kFblFailed; + } + } + + return result; +} + +#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER ) +/*********************************************************************************************************************** + * FblDiagMainHandlerWriteDataById + **********************************************************************************************************************/ +/*! \brief WriteDataByIdentifier service handling + * \param[in] pbDiagBuffer Pointer to the data in the pbDiagBuffer (without SID) + * \param[in] diagReqDataLen Length of data (without SID) + * \return Possible return values: + * - kFblOk: Service processed successfully (goto next state) + * - kFblFailed: Service processing failed. + **********************************************************************************************************************/ +static FBL_DIAG_MAIN_HANDLER(FblDiagMainHandlerWriteDataById) +{ + tFblResult result; + + + /* Pass pointer to diag buffer which points after the SID. */ + result = ApplFblWriteDataByIdentifier(&(pbDiagBuffer[kDiagFmtDataIdHigh]), diagReqDataLen); + + /* Catch invalid combinations of return value and NRC state */ + assertFblUser(((result == kFblOk) && (DiagGetError() == kDiagErrorNone)) || + ((result != kFblOk) && (DiagGetError() != kDiagErrorNone)), + kFblOemAssertIllegalReturnValue); + + if (DiagGetError() == kDiagErrorNone) + { + /* No NRC returned, send the response */ + DiagProcessingDone(kDiagRslWriteDataByIdentifier); + } + else + { + result = kFblFailed; + } + + return result; +} +#endif + +/* Diagnostic service functions *********************************************/ + +/*********************************************************************************************************************** + * FblDiagEcuReset + **********************************************************************************************************************/ +/*! \brief Initiate ECU reset + * \param[in] resetOptions OR combination of: + * - kDiagResetNoResponse (timeout of TesterPresent) + * - kDiagResetPutResponse (service EcuReset received) + * - kDiagResetStayInBoot (do not reset active boot mode) + * \param[in] responseFlag Value written to reset response flag + **********************************************************************************************************************/ +void FblDiagEcuReset(vuint8 resetOptions, vuint8 responseFlag) +{ +#if defined( FBL_ENABLE_ECURESET_DELAY ) + vuint8 tmpFuncReq = GetFunctionalRequest(); +#endif + + /* Disable tester present timeout monitoring */ + StopTesterTimeout(); + + /* ESCAN00067433: Stop background operations of FblLib_Mem */ + FblMemDeinit(); + + /* Check if a response is required */ + if (GetResetOptionPutResponse(resetOptions) && (!GetSuppressPosRspMsg())) + { + /* Request for reset/FBL-shutdown */ + SetWaitEcuReset(); + + /* Check if response address has been stored successfully */ + if (kFblOk == FblCwSaveResponseAddress()) /* PRQA S 2741 */ /* MD_FblDiag_ConstValue */ + { + /* Transmit response if required */ + switch (responseFlag) + { + case RESET_RESPONSE_SDS_REQUIRED: + { + DiagProcessingDone(kDiagRslDiagnosticSessionControl); + break; + } + case RESET_RESPONSE_ECURESET_REQUIRED: + { + DiagProcessingDone(kDiagRslEcuReset); + break; + } + default: + { + /* Invalid combination of reset option and response flag */ + assertFblInternal(0u, kFblOemAssertParameterOutOfRange); + break; + } + } + } + else + { /* PRQA S 2880 1 */ /* MD_FblDiag_ConstValue */ + DiagNRCGeneralReject(); + } + SetEcuResetFctFinished(); + } + else + { + /* Do not transmit response message */ + DiagSetNoResponse(); + DiagProcessingDone(0u); + FblDiagDeinit(); + } + +#if defined( FBL_ENABLE_ECURESET_DELAY ) + /* Functionally addressed request: wait for a pre-defined time for + * responses from the sub nodes */ + if (tmpFuncReq != 0) + { + vuint16 i = FBL_ECURESET_DELAY_TIME; + + + while (i != 0) + { + /* Watchdog function calls FblCw polling tasks */ + if ((FblLookForWatchdog() & FBL_TM_TRIGGERED) == FBL_TM_TRIGGERED) + { + i--; + } + } + } +#endif /* FBL_ENABLE_ECURESET_DELAY */ + +} + +/*********************************************************************************************************************** + * FblDiagSetProperties + **********************************************************************************************************************/ +/*! \brief Copy service properties from source to target + * \param[in] source Source service properties + * \param[out] target Target service properties + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static void FblDiagSetProperties(ptServiceProp source, tServiceProp * destination) +{ + vuint8 idx; + vuint8 stateIdx; + + destination->serviceId = source->serviceId; + destination->minLength = source->minLength; + destination->maxLength = source->maxLength; + destination->mainHandlerIdx = source->mainHandlerIdx; + destination->subServices = source->subServices; + +#if defined( FBL_DIAG_STATE_ARRAYS ) + for (stateIdx = 0u; stateIdx < STATE_COUNT; stateIdx++) + { +#if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0; +#else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +#endif + { + destination->states[stateIdx][idx] = source->states[stateIdx][idx]; + } + } +#else +#if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +#else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +#endif + { + destination->stateSet[idx] = source->stateSet[idx]; + destination->stateUnset[idx] = source->stateUnset[idx]; + destination->stateAdd[idx] = source->stateAdd[idx]; + destination->stateClr[idx] = source->stateClr[idx]; + destination->stateClrFail[idx] = source->stateClrFail[idx]; + } +#endif +} + +/*********************************************************************************************************************** + * FblDiagMergeProperties + **********************************************************************************************************************/ +/*! \brief Merge existing contents of target service properties with the one from source. + * \details Service ID, subservices and handlers will be overwritten if present. Length will be updated if values + * are more restrictive. Resulting states are the OR concatenation of the inputs. + * \param[in] source Source service properties + * \param[out] merge Input service properties, merged with source + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +static void FblDiagMergeProperties(ptServiceProp source, tServiceProp * merge) +{ + vuint8 idx; +#if defined( FBL_DIAG_STATE_ARRAYS ) + vuint8 stateIdx; +#endif + + /* PRQA S 2916 TAG_FblDiag_2916_1 */ /* MD_FblDiag_2916 */ + merge->serviceId = source->serviceId; + if (source->minLength > merge->minLength) + { + merge->minLength = source->minLength; + } + if (source->maxLength < merge->maxLength) + { + merge->maxLength = source->maxLength; + } + if (source->mainHandlerIdx != (vuint8)kServiceMainHandlerNone) + { + merge->mainHandlerIdx = source->mainHandlerIdx; + } + merge->subServices = source->subServices; + /* PRQA L: TAG_FblDiag_2916_1 */ + +#if defined( FBL_DIAG_STATE_ARRAYS ) + for (stateIdx = 0u; stateIdx < STATE_COUNT; stateIdx++) + { +# if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +# else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +# endif + { + merge->states[stateIdx][idx] |= source->states[stateIdx][idx]; + } + } +#else +# if ( STATECHECK_ARRAYSIZE == 1u) + idx = 0u; +# else + for (idx = 0u; idx < STATECHECK_ARRAYSIZE; idx++) +# endif + { + merge->stateSet[idx] |= source->stateSet[idx]; + merge->stateUnset[idx] |= source->stateUnset[idx]; + merge->stateAdd[idx] |= source->stateAdd[idx]; + merge->stateClr[idx] |= source->stateClr[idx]; + merge->stateClrFail[idx] |= source->stateClrFail[idx]; + } +#endif +} + +/*********************************************************************************************************************** + * FblDiagDispatch + **********************************************************************************************************************/ +/*! \brief Dispatch the current request in the diagnostic buffer + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static void FblDiagDispatch ( void ) +{ + /* Variables to traverse the service tables */ + ptServiceProp prevProp; /* PRQA S 3679 */ /* MD_MSR_Rule8.13 */ + ptServiceProp currProp; + V_MEMROM1 tServiceList V_MEMROM2 V_MEMROM3 * localSubServices; + V_MEMROM1 tServiceCheckList V_MEMROM2 V_MEMROM3 * checkList; + V_MEMROM1 tServiceCheck V_MEMROM2 V_MEMROM3 * checkFct; + + vuint8 chkFctIdx; + tCwDataLengthType bufferPos; + + tFblResult done; + + /* Set service table entry point */ + FblDiagSetProperties(&kDiagServiceProperties[0], &serviceProperties); + + /* Init traversal variables */ + currProp = (ptServiceProp)&kDiagServiceProperties[0]; + prevProp = currProp; + + localSubServices = currProp->subServices; +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) + checkList = kServiceCheckListTable[currProp->checkListIdx]; +#else + checkList = currProp->checks; +#endif + bufferPos = localSubServices->bufPos; + + checkFct = (V_MEMROM1 tServiceCheck V_MEMROM2 V_MEMROM3 *)0; + + done = kFblFailed; + + /* Run until service was found or error occurred */ + while (done != kFblOk) + { + /* Assume operation finished */ + done = kFblOk; + + /* Run over all check functions of current service */ + for (chkFctIdx = 0; chkFctIdx < checkList->count; chkFctIdx++) + { + /* Execute check function */ + checkFct = &(checkList->list)[chkFctIdx]; + + if ((kServiceCheckHandlerFctTable[checkFct->checkHandlerIdx])(&serviceProperties, DiagBuffer, DiagDataLength, bufferPos, &currProp) == kFblOk) + { + /* Current service has potentially changed */ + if (currProp != prevProp) + { + /* Merge new properties with existing one */ + FblDiagMergeProperties(currProp, &serviceProperties); + prevProp = currProp; + + /* Not finished yet */ + done = kFblFailed; + } + } + else + { + /* Invalidate service */ + currProp = kDiagNoServiceProp; + break; + } + } + + /* Service property has changed */ + if (done != kFblOk) + { + /* Assume operation finished */ + done = kFblOk; + + /* Valid service found */ + if (currProp != kDiagNoServiceProp) + { + /* Get new check functions */ +#if defined( FBL_DIAG_CHECK_LIST_HANDLES ) + if (currProp->checkListIdx != (vuint8)kServiceCheckListNone) + { + checkList = kServiceCheckListTable[currProp->checkListIdx]; +#else + checkList = currProp->checks; + if (checkList != (void *)0) + { +#endif + /* Initialize check function */ + checkFct = (V_MEMROM1 tServiceCheck V_MEMROM2 V_MEMROM3 *)0; + + /* Not finished yet, new check functions present */ + done = kFblFailed; + } + + /* Get subservices of current service */ + localSubServices = currProp->subServices; + if (localSubServices != (void *)0) + { + /* Move to next buffer position */ + bufferPos = localSubServices->bufPos; + } + } + } + } + + /* Assume dispatching failed */ + serviceResult = kFblFailed; + + /* No valid subservice found */ + if (currProp == kDiagNoServiceProp) + { + /* Failed check function is known */ + if (checkFct != (void *)0) + { + /* Execute error handler */ + if (checkFct->errorHandlerIdx != (vuint8)kServiceErrorHandlerNone) + { + /* Result of error handler changes execution state */ + serviceResult = (kServiceErrorHandlerFctTable[checkFct->errorHandlerIdx])(&serviceProperties, DiagBuffer, DiagDataLength); + } + + /* Error handler wasn't successful and NRC was not set directly */ + if ((serviceResult != kFblOk) && (DiagGetError() == kDiagErrorNone)) + { + /* Set NRC according to check function configuration */ + if (checkFct->NRC == kDiagNrcNoResponse) + { + /* Quiet failure */ + DiagSetNoResponse(); + DiagProcessingDone(0); + } + else + { + /* Set NRC */ + DiagSetError(checkFct->NRC); + } + } + } + else + { + /* + Operation failed but check function is unknown + Set generic NRC + */ + DiagNRCGeneralReject(); + } + } + else + { + /* Execute main handler */ + if (serviceProperties.mainHandlerIdx != (vuint8)kServiceMainHandlerNone) + { + serviceResult = (kServiceMainHandlerFctTable[serviceProperties.mainHandlerIdx])(DiagBuffer, DiagDataLength); + } + } + + /* Set and clear state flags according to execution result */ + if (serviceResult == kFblOk) + { + FblDiagClrState(serviceProperties.stateClr); + FblDiagSetState(serviceProperties.stateAdd); + } + else + { + FblDiagClrState(serviceProperties.stateClrFail); + } +} + +/*********************************************************************************************************************** + * FblDiagTimerTask + **********************************************************************************************************************/ +/*! \brief This function handles the surveillance of the tester present timer. When a timeout occurs, a reset + * is executed. + * \pre FblDiagInit has to be executed + **********************************************************************************************************************/ +void FblDiagTimerTask( void ) +{ + /* Tester present timing */ + if (TimeoutTesterValue() != 0u) + { + DecTimeoutTesterValue(); + if (TimeoutTesterValue() == 0u) + { + /* + * Tester present timer expired: + * Exit bootloader via reset, but force no response!! + */ + FblDiagEcuReset(kDiagResetNoResponse, RESET_RESPONSE_NOT_REQUIRED); + } + } + + /* ECU reset is pending */ + if (TimeoutEcuResetValue() != 0u) + { + DecTimeoutEcuResetValue(); + if (TimeoutEcuResetValue() == 0u) + { + /* ECU reset timer expired */ + /* Exit bootloader via Reset, but force no response!! */ + FblDiagEcuReset(kDiagResetNoResponse, RESET_RESPONSE_NOT_REQUIRED); + } + } + +} + +/*********************************************************************************************************************** + * FblDiagStateTask + **********************************************************************************************************************/ +/*! \brief Handle diagnostic indications. + * \pre FblDiagInit has to be executed + **********************************************************************************************************************/ +void FblDiagStateTask( void ) +{ + + /* Diagnostic request pending */ + if (GetDiagIndication()) + { + /* Setup state flags */ + ClrDiagIndication(); + ClrSuppressPosRspMsg(); + ClrProcessingDone(); + DiagClrError(); + + /* Indicate an ongoing service processing */ + SetServiceInProgress(); + + /* Dispatch request */ + FblDiagDispatch(); + + /* Call response processor in case of NRC */ + if (DiagGetError() != kDiagErrorNone) + { + DiagResponseProcessor(0); + } + + /* Reset internal state in case no response was sent */ + if ((!GetProcessingDone()) && (!GetWaitForRcrRpConf())) + { + DiagSetNoResponse(); + DiagResponseProcessor(0); + } + } + + /* Check for reset request */ + /* The following preconditions have to be fulfilled: + * Reset message confirmed + * Pre-reset function (e.g. flag written to NV-memory) has finished + */ + if (GetWaitEcuReset() && GetResetMsgConfirmed() && GetEcuResetFctFinished()) + { + { + FblDiagDeinit(); + } + } + + /* ESCAN00061727: Resume suspended LibMem operation */ + FblMemResumeIndication(); +} + +/*********************************************************************************************************************** + * FblDiagDeinit + **********************************************************************************************************************/ +/*! \brief Function prepares for FBL shutdown on diagnostic service request. + **********************************************************************************************************************/ +static void FblDiagDeinit(void) +{ + /* Deinitialize verification component */ + (void)SecM_DeinitVerification(V_NULL); + + /* Deinitialize loaded memory driver(s) */ + FblDeinitMemoryDriver(); + + /* Reset internal FBL states */ + FblDiagRetainState(kDiagStateMaskReset); + + /* Clear negative response indicator */ + DiagClrError(); + + /* Request shutdown from communication wrapper */ + FblCwShutdownRequest(kFblCwResetEcuRegularCase); +} + +/*********************************************************************************************************************** + * FblInitMemoryDriver + **********************************************************************************************************************/ +/*! \brief Initializes the flash driver for usage + * \pre Flash driver must be verified + * \return kFblOk = initialization successful, kFblFailed = otherwise + **********************************************************************************************************************/ +static tFblResult FblInitMemoryDriver( void ) +{ + tFblResult result = kFblFailed; + IO_ErrorType memErrorCode; + + if (!GetMemDriverInitialized()) + { + /* Initialize flash driver version */ + FblErrStatSetFlashDrvVersion(); + + /* Turn on programming voltage (if necessary) */ + ApplFblSetVfp(); + + /* ApplFbl[Set|Reset]Vfp() are not allowed to set a NRC */ + assertFblUser((DiagGetError() == kDiagErrorNone), kFblOemAssertIllegalReturnValue); + + /* Check version and initialize flash driver */ + FblCwSetOfflineMode(); + memErrorCode = MemDriver_InitSync(V_NULL); + FblCwSetOnlineMode(); + + /* + * ESCAN00041016: Require all memory drivers to be correctly initialized + * at this point (i.e. non-downloadable drivers, too). + */ + if (memErrorCode == IO_E_OK) + { + /* Set Flash driver initialization flag */ + SetMemDriverInitialized(); + result = kFblOk; + } + else + { + /* Flash driver initialization failure */ + FblErrStatSetError(FBL_ERR_FLASHCODE_INIT_FAILED); + FblErrStatSetFlashDrvError(memErrorCode); + + /* Reset programming voltage */ + ApplFblResetVfp(); + + /* ApplFbl[Set|Reset]Vfp() are not allowed to set a NRC */ + assertFblUser((DiagGetError() == kDiagErrorNone), kFblOemAssertIllegalReturnValue); + } + } + else + { + /* Flash driver already initialized */ + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDeinitMemoryDriver + **********************************************************************************************************************/ +/*! \brief Deinitialize memory driver if present + **********************************************************************************************************************/ +static void FblDeinitMemoryDriver( void ) +{ + if (GetDiagProgrammingSession()) + { + if (GetMemDriverInitialized()) + { + /* Deinitialize memory driver flash */ + ClrMemDriverInitialized(); + + /* Remove memory driver from RAM-buffer */ + FblCwSetOfflineMode(); + { + (void)MemDriver_DeinitSync(V_NULL); + } + FblCwSetOnlineMode(); + } + + /* Turn off programming voltage */ + ApplFblResetVfp(); + } +} + +/* Ford specific functions **********************************************/ +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +/*********************************************************************************************************************** + * FblDiagVerification - Ford specific + **********************************************************************************************************************/ +/*! \brief This function calls the HIS verification interface to calculate the CRC16 value over the requested + * address region in non-volatile memory. + * \pre Address region check has been performed (FblDiagAddressRegionCheck) + * \param[in] verifyParam Parameter structure for verification + * \return Result of operation + **********************************************************************************************************************/ +static SecM_StatusType FblDiagVerification(V_MEMRAM1 SecM_VerifyParamType V_MEMRAM2 V_MEMRAM3 * verifyPar) +{ + tBlockDescriptor blockDescriptor; + tFblMemVerifyFctOutput verifyFct; + + /* Set default verification function */ + verifyFct = &SecM_VerificationClassDDD; + + /* + * Note: general address region check is expected to be performed before this + * function is called (e.g. in FblDiagMainHandlerRequestDownload/Upload, FblDiagMainHandlerRcCheckProgDep). + */ + if (FblLbtGetBlockDescriptorByAddressLength(verifyPar->blockStartAddress, verifyPar->blockLength, &blockDescriptor) == kFblOk) + { + if (SecM_Default != blockDescriptor.verifyOutput) + { + /* Logical block no. has been determined successfully: assign block specific verification function */ + verifyFct = (tFblMemVerifyFctOutput)blockDescriptor.verifyOutput; /* PRQA S 0313 */ /* MD_FblDiag_0313_VerifyFctOutput */ + } + } + + /* Perform verification */ + return verifyFct(verifyPar); +} +#endif + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) && ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +/*********************************************************************************************************************** + * FblDiagVerifySignature + **********************************************************************************************************************/ +/*! \brief This function calls the HIS verification interface to calculate the CRC16 value over the requested + * address region in non-volatile memory (pipelined mode). + * \pre Address region check has been performed (FblDiagAddressRegionCheck) + * \param[in] pVerifyParam Parameter structure for verification + * \return Result of operation + **********************************************************************************************************************/ +static SecM_StatusType FblDiagVerifySignature( V_MEMRAM1 SecM_SignatureParamType V_MEMRAM2 V_MEMRAM3 * pVerifyParam ) +{ + SecM_StatusType result; + SecM_LengthType byteCount; + + result = SECM_VER_ERROR; + + pipeVerifyParamCrc.sigState = pVerifyParam->sigState; + pipeVerifyParamCrc.sigSourceBuffer = pVerifyParam->sigSourceBuffer; + pipeVerifyParamCrc.sigByteCount = pVerifyParam->sigByteCount; + pipeVerifyParamCrc.wdTriggerFct = pVerifyParam->wdTriggerFct; + + switch (pVerifyParam->sigState) + { + case SEC_HASH_INIT: + case SEC_HASH_COMPUTE: + case SEC_HASH_FINALIZE: + { + result = SecM_VerifyClassDDD(pVerifyParam); + (void)SecM_VerifyChecksumCrc(&pipeVerifyParamCrc); + + break; + } + case SEC_SIG_VERIFY: + { + result = SecM_VerifyClassDDD(pVerifyParam); + + byteCount = pVerifyParam->sigByteCount; + pipeVerifyParamCrc.sigSourceBuffer = &pVerifyParam->sigSourceBuffer[byteCount]; + pipeVerifyParamCrc.sigByteCount -= byteCount; + + (void)SecM_VerifyChecksumCrc(&pipeVerifyParamCrc); + + pVerifyParam->sigByteCount += pipeVerifyParamCrc.sigByteCount; + + break; + } + default: + { + /* Nothing to do */ + break; + } + } + + return result; +} +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED && ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) */ + + +#if defined( FBL_ENABLE_STAY_IN_BOOT ) +/*********************************************************************************************************************** + * FblDiagCheckStartMsg - Ford Specific + **********************************************************************************************************************/ +/*! \brief Check if the OEM specific start message has been received + * \pre Start message reception has to be verified by ComWrapper + * \param[in] pData Pointer to received data + * \param[in] length Length of received data + * \return Possible return values: + * - kFblOk: OEM specific start message has been identified + * - kFblFailed: Received message doesn't equal the OEM specific start message + **********************************************************************************************************************/ +vuint8 FblDiagCheckStartMsg(const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pData, vuintx length) +{ + vuint8 result; + + /* Initialize variables */ + result = kFblFailed; + + /* Check if received data is long enough */ + if (length >= (kDiagRqlDiagnosticSessionControl + 2u)) + { + /* Check complete message contents for Stay-In-Boot */ + /* For Ford, this is: 0x02 0x10 0x02 (DiagnosticSessionControl/ProgrammingSession) */ + if ( ( pData[0] == (kDiagRqlDiagnosticSessionControl + 1u)) /* Add the service ID */ + && ( pData[kDiagFmtServiceId + 1u] == kDiagSidDiagnosticSessionControl) + && ((pData[kDiagFmtSubparam + 1u] & 0x7Fu) == kDiagSubProgrammingSession)) /* Suppressed bit may be true or false */ + { + /* Start message received */ + result = kFblOk; + } + } + + return result; +} +#endif /* FBL_ENABLE_STAY_IN_BOOT */ + +/*********************************************************************************************************************** + * FblDiagGetSegmentList + **********************************************************************************************************************/ +/*! \brief Returns a list of download segments which have been programmed into a certain logical block + * \param[in] blockIdx Index of the logical block for which the associated download segments shall be returned + * \param[out] blockSegList Pointer to local segment list which shall keep the respective download segments + * \return Number of download segment which are associated with the requested logical block + **********************************************************************************************************************/ +vuint8 FblDiagGetSegmentList(vuint8 blockIdx, V_MEMRAM1 tDiagSegmentList V_MEMRAM2 V_MEMRAM3 * blockSegList) +{ + vuint8 listIdx; + + blockSegList->nrOfSegments = 0u; + + for (listIdx = 0u; listIdx < blockHeader[blockIdx].nrOfSegments; listIdx++) + { + blockSegList->segmentInfo[blockSegList->nrOfSegments] = diagSegmentList.segmentInfo[blockHeader[blockIdx].segmentIdx[listIdx]]; + blockSegList->nrOfSegments++; + } + + return blockSegList->nrOfSegments; +} + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Communication wrapper callback functions **********************************/ +#define FBLDIAG_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblDiagTxErrorIndication + **********************************************************************************************************************/ +/*! \brief Indicates that an error has occurred during transmission. + * \details According to ISO-14229, now the S3 timer must be restarted. + * \pre TP must been initialized + * \param[in] cwMsgType Message type of indication (defined in CW layer): + * - kFblCwMsgTypeRcrRp: Request correctly received/response pending message + * - kFblCwMsgTypeNormal: Normal request message + **********************************************************************************************************************/ +void FblDiagTxErrorIndication( vuint8 cwMsgType ) +{ + /* Do not reset states for RCR-RP confirmation */ + if (cwMsgType != kFblCwMsgTypeRcrRp) + { + DiagResetResponseHandling(); + } +} + +/*********************************************************************************************************************** + * FblDiagRxStartIndication + **********************************************************************************************************************/ +/*! \brief Data reception call-back function to start diagnostic service processing. + * \details Valid TesterPresent requests will simply start the S3 timer and will not be processed. + * \pre TP reception successful + **********************************************************************************************************************/ +void FblDiagRxStartIndication( void ) +{ + /* Halts the S3 timer while receiving a diagnostic message */ + StopTesterTimeout(); +} + +/*********************************************************************************************************************** + * FblDiagRxErrorIndication + **********************************************************************************************************************/ +/*! \brief Indicates that an error has occurred during reception. + * \details According to ISO-14229, now the S3 timer must be restarted. + * \pre TP must been initialized + **********************************************************************************************************************/ +void FblDiagRxErrorIndication( void ) +{ + DiagResetResponseHandling(); +} + +/*********************************************************************************************************************** + * FblDiagRxIndication + **********************************************************************************************************************/ +/*! \brief Data reception call-back function to start diagnostic service processing. + * \details Valid TesterPresent requests will simply start the S3 timer and will not be processed. + * \pre TP reception successful + * \param[in] pbDiagBuffer Pointer to diagnostic buffer + * \param[in] rxDataLength Number of bytes to be received + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +void FblDiagRxIndication( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType rxDataLength ) +{ + /* Check for functionally addressed valid TesterPresent message with SuppressPosRsp */ + if ((kDiagSidTesterPresent == pbDiagBuffer[kDiagFmtServiceId]) + && (kDiagSuppressPosRspMsgIndicationBit == pbDiagBuffer[kDiagFmtSubparam]) + && (kDiagRqlTesterPresent == (rxDataLength - 1u)) + && GetFunctionalRequest() + ) + { + /* Bypass logic for this TesterPresent message */ + DiagResetResponseHandling(); /* Reset tester timeout */ + FblCwResetRxBlock(); + } + else + { + /* Start regular service processing */ + DiagClrError(); + diagResponseFlag = kDiagPutResponse; + diagServiceCurrent = pbDiagBuffer[kDiagFmtServiceId]; + + SetP2Timer(kFblDiagTimeP2); /* Reset P2 timer (initial timing) */ + SetP2Timeout(kFblDiagTimeP2); /* PRQA S 3493 */ /* MD_FblDiag_3493 */ + DiagDataLength = rxDataLength - 1u; + SetDiagIndication(); + +#if defined( FBL_MEM_ENABLE_PIPELINING ) + if (FblMemTaskIsPending()) + { + FblMemRxNotification(); + } +#endif + } + + /* Initialize security seed */ + (void)ApplFblSecuritySeedInit(); + +#if defined( FBL_ENABLE_SLEEPMODE ) + /* Request received - reload sleep counter */ + FblSleepCounterReload(); +#endif +} + +/*********************************************************************************************************************** + * FblDiagTxConfirmation + **********************************************************************************************************************/ +/*! \brief TP transmission call-back function. + * \pre TP transmission successful + * \param[in] cwMsgType Message type of indication (defined in CW layer): + * - kFblCwMsgTypeRcrRp: Request correctly received/response pending message + * - kFblCwMsgTypeNormal: Normal request message + **********************************************************************************************************************/ +void FblDiagTxConfirmation( vuint8 cwMsgType ) +{ + /* Do not reset states for RCR-RP confirmation */ + if (cwMsgType != kFblCwMsgTypeRcrRp) + { + DiagResetResponseHandling(); + } + + /* Diag wants to reset FBL after sending an RCR-RP */ + if (GetWaitEcuReset()) + { + SetResetMsgConfirmed(); + } +} + +/*********************************************************************************************************************** + * FblDiagRxGetPhysBuffer + **********************************************************************************************************************/ +/*! \brief Diagnostic buffer management function for physical requests. + * \param[in] rxDataLength Number of bytes to be received + * \return Possible return values: + * - Pointer to diagnostic buffer + * - V_NULL in case no buffer is available + **********************************************************************************************************************/ +vuint8* FblDiagRxGetPhysBuffer( tCwDataLengthType rxDataLength ) +{ + vuint8* result; + + /* Check request length and if buffer is free */ + if ((rxDataLength > 0u ) + && (FBL_DIAG_BUFFER_LENGTH >= rxDataLength) + && (!GetDiagBufferLocked())) + { + /* Initialize state variables */ + ClrFunctionalRequest(); + + /* Lock buffer */ + SetDiagBufferLocked(); + + /* Return diagnostic buffer */ + result = DiagBuffer; + } + else + { + /* Illegal buffer request, return null pointer */ + result = V_NULL; + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagRxGetFuncBuffer + **********************************************************************************************************************/ +/*! \brief Diagnostic buffer management function for functional requests. + * \param[in] rxDataLength Number of bytes to be received + * \return Possible return values: + * - Pointer to diagnostic buffer + * - V_NULL in case no buffer is available + **********************************************************************************************************************/ +vuint8* FblDiagRxGetFuncBuffer( tCwDataLengthType rxDataLength ) +{ + /* Process functional request like physical request */ + vuint8* diagnosticBuffer = FblDiagRxGetPhysBuffer(rxDataLength); + + /* Set functional request indication */ + if (V_NULL != diagnosticBuffer) + { + SetFunctionalRequest(); + } + + return diagnosticBuffer; +} +#define FBLDIAG_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FblDiagMemPreWrite + **********************************************************************************************************************/ +/*! \brief Function performs actions before FblLib_Mem calls the memory driver write function. + * \return Possible return values: + * - kFblOk: Pre-write operations are successful + * - kFblFailed: Pre-write operations failed + **********************************************************************************************************************/ +tFblResult FblDiagMemPreWrite( void ) +{ + FblCwSetOfflineMode(); + + return kFblOk; + +} + +/*********************************************************************************************************************** + * FblDiagMemPostWrite + **********************************************************************************************************************/ +/*! \brief Checks if message is the platform message or not + * \return Possible return values: + * - kFblOk: Post-write operations are successful + * - kFblFailed: Post-write operations failed + **********************************************************************************************************************/ +tFblResult FblDiagMemPostWrite( void ) +{ + FblCwSetOnlineMode(); + + return kFblOk; +} + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +/*********************************************************************************************************************** + * FblDiagValidateToken + **********************************************************************************************************************/ +/*! \brief Validate the token against main validity rules + * \return Possible return values: + * - tTokenHdlResult: result of the validation operation + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static tTokenHdlResult FblDiagValidateToken( const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf ) +{ + tTokenHdlResult result; + vuintx idx; + vuint8 const *fesnPtr = FblDiagGetFesn(); + + result = kTokenHdlrInternalFailed; + + /* Check if Server Message ID is required and valid */ + if (FblDiagIsTokenMsgIDRequired(tokenBuf)) + { + if (FblDiagCheckServerMessageId(tokenBuf) == kFblOk) + { + result = kTokenHdlrOk; + } + } + + /* Is KeyID present? */ + if ( (result == kTokenHdlrOk) && + (FblDiagIsTokenKeyIDRequired(tokenBuf)) ) + { + /* KeyID must not be present */ + result = kTokenHdlrInternalFailed; + } + + /* Are reserved bits set? */ + if ( (result == kTokenHdlrOk) && + (FblDiagIsTokenReserverdBitsSet(tokenBuf)) ) + { + /* Reserved bits must not be set */ + result = kTokenHdlrInternalFailed; + } + + /* Is FESN present? */ + if ( (result == kTokenHdlrOk) && + FblDiagIsTokenFesnRequired(tokenBuf) && + (FblDiagGetTokenCommandType(tokenBuf) != FBL_DIAG_TOKEN_CMD_PROGKEY) ) + { + /* Check if FESN match */ + for (idx = 0u; idx < FBL_DIAG_TOKEN_FESN_LEN; idx++) + { + if (FblDiagGetTokenFesn(tokenBuf)[idx] != fesnPtr[idx]) + { + result = kTokenHdlrFesnFailed; + } + } + } + + /* For Mode 5 check the first three characters of the FESN */ + if ( (result == kTokenHdlrOk) && + (FblDiagGetTokenCommandType(tokenBuf) == FBL_DIAG_TOKEN_CMD_PROGKEY) ) + { + if (FblDiagIsTokenFesnRequired(tokenBuf)) + { + /* FESN required bit must not be set for mode 5 token */ + result = kTokenHdlrFesnFailed; + } + else + { + /* Check if the first 3 character of the FESN match */ + for (idx = 0u; idx < FBL_DIAG_TOKEN_MOD5_FESN_LEN; idx++) + { + if (FblDiagGetTokenPayloadFesn(tokenBuf)[idx] != fesnPtr[idx]) + { + result = kTokenHdlrFesnFailed; + } + } + } + } + + /* Check if CPU destination match */ + if ((result == kTokenHdlrOk) + && (FblDiagGetTokenCPUDestination(tokenBuf) != FBL_DIAG_TOKEN_CPU_DEST)) + { + result = kTokenHdlrInternalFailed; + } + + /* Check if service type match */ + if ((result == kTokenHdlrOk) + && (FblDiagGetTokenServiceType(tokenBuf) != FBL_DIAG_TOKEN_SERVICE_TYPE)) + { + result = kTokenHdlrInternalFailed; + } + + /* Check if crypto type match */ + if ((result == kTokenHdlrOk) + && (FblDiagGetTokenCryptoType(tokenBuf) != FBL_DIAG_TOKEN_CRYPTOTYPE)) + { + result = kTokenHdlrInternalFailed; + } + + /* Check if payload size match */ + if (result == kTokenHdlrOk) + { + if (FblDiagGetTokenCommandType(tokenBuf) == FBL_DIAG_TOKEN_CMD_PROGKEY) + { + if (FblDiagGetTokenPayloadSize(tokenBuf) != FBL_DIAG_TOKEN_PAYLOAD_SIZE_MODE5) + { + result = kTokenHdlrInternalFailed; + } + } + else + { + if (FblDiagGetTokenPayloadSize(tokenBuf) != FBL_DIAG_TOKEN_PAYLOAD_SIZE_MODE0_4) + { + result = kTokenHdlrInternalFailed; + } + } + } + + /* Check if correct key index match the token public key */ + if (result == kTokenHdlrOk) + { + if (FblDiagGetTokenCommandType(tokenBuf) == FBL_DIAG_TOKEN_CMD_PROGKEY) + { + if (FblDiagGetTokenKeyIndex(tokenBuf) != FBL_DIAG_TOKEN_KEY_INDEX_0) + { + result = kTokenHdlrInternalFailed; + } + } + else + { + if (FblDiagGetTokenKeyIndex(tokenBuf) != FBL_DIAG_TOKEN_KEY_INDEX_1) + { + result = kTokenHdlrInternalFailed; + } + } + } + + /* Check protocol version */ + if ( (result == kTokenHdlrOk) && + (!FblDiagIsTokenProtocolVersionCorrect(tokenBuf))) + { + result = kTokenHdlrProtocolFailed; + } + + /* Check token name length */ + if ( (result == kTokenHdlrOk) && + (FblDiagGetTokenTokenNameLength(tokenBuf) != FBL_DIAG_TOKEN_NAME_LENGTH) ) + { + result = kTokenHdlrInternalFailed; + } + + /* Check token name */ + if (result == kTokenHdlrOk) + { + vuint8 const tokenName[(FBL_DIAG_TOKEN_NAME_LENGTH + 1u)] = FBL_DIAG_TOKEN_NAME; + + for (idx = 0u; idx < FBL_DIAG_TOKEN_NAME_LENGTH; idx++) + { + if (FblDiagGetTokenTokenName(tokenBuf)[idx] != tokenName[idx]) + { + result = kTokenHdlrInternalFailed; + } + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagCheckServerMessageId + **********************************************************************************************************************/ +/*! \brief Check if Server Message ID is valid + * \return Possible return values: + * - kFblOk: Server Message ID is valid + * - kFblFailed: Server Message ID is not valid + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static tFblResult FblDiagCheckServerMessageId( const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf ) +{ + tFblResult result = kFblOk; + tFblResult srvMsgIdCompareFinished = kFblFailed; + vuint8 lastServerMessageId[8] = {0}; + vuint8 srvMsgIdFlag; + vuintx idx; + + /* Check if Server Message ID was stored before */ + if (ApplFblReadSrvMsgIDFlag(&srvMsgIdFlag) == kFblOk) + { + if (srvMsgIdFlag == (vuint8)FBL_DIAG_SRVMSGID_STORED) + { + /* Read last Server Message ID from NV Memory */ + result = ApplFblReadLastServerMsgId(lastServerMessageId); + } + else + { + /* Initialize last Server Message ID */ + result = ApplFblWriteLastServerMsgId(lastServerMessageId); + + if (result == kFblOk) + { + /* Set Server Message ID Flag so next time it will be read from NV Memory */ + srvMsgIdFlag = (vuint8)FBL_DIAG_SRVMSGID_STORED; + result = ApplFblWriteSrvMsgIDFlag(&srvMsgIdFlag); + } + } + } + else + { + result = kFblFailed; + } + + if (result == kFblOk) + { + /* Read current Server Message ID from token buffer and compare with last Server Message ID */ + const vuint8 *currentServerMessageId = FblDiagGetTokenServerMsgIdPtr(tokenBuf); + result = kFblFailed; + + /* Check each byte, starting from MSB (index 0 due to network byte order) */ + for (idx = 0u; idx < 8u; idx++) + { + if (currentServerMessageId[idx] > lastServerMessageId[idx]) + { + /* Received server message ID is higher than last server message ID */ + result = kFblOk; + srvMsgIdCompareFinished = kFblOk; + } + else if (currentServerMessageId[idx] < lastServerMessageId[idx]) + { + /* Received server message ID is lower than last server message ID. Break loop so result + * cannot be ok if a byte with lower significance has a higher value in the current server + * message ID */ + srvMsgIdCompareFinished = kFblOk; + } + else + { + /* Values are the same, continue with check */ + } + + if (srvMsgIdCompareFinished == kFblOk) + { + break; + } + } + + if (result == kFblOk) + { + result = ApplFblWriteLastServerMsgId(currentServerMessageId); + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblDiagTokenCallout + **********************************************************************************************************************/ +/*! \brief Calls for each Token mode the related Callout + * \param[in] cmdType The Token mode from TokenCommandType + * \return Possible return values: + * - tTokenHdlResult: result of the callout function + **********************************************************************************************************************/ +static tTokenHdlResult FblDiagTokenCallout( vuint8 cmdType, const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tokenBuf, vuint16 tokenLength ) +{ + tTokenHdlResult result; + + switch (cmdType) + { + case FBL_DIAG_TOKEN_CMD_REVERTPROD: + { + result = ApplFblTokenRevertKey(tokenBuf, tokenLength); + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVPERM: + { + result = ApplFblTokenUseDevPermKey(tokenBuf, tokenLength); + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVTEMP: + { + result = ApplFblTokenUseDevTempKey(tokenBuf, tokenLength); + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVDATE: + { + result = ApplFblTokenUseDevDateKey(tokenBuf, tokenLength); + break; + } + case FBL_DIAG_TOKEN_CMD_USEDEVIGNI: + { + result = ApplFblTokenUseDevIgniKey(tokenBuf, tokenLength); + break; + } + case FBL_DIAG_TOKEN_CMD_PROGKEY: + { + result = ApplFblTokenProgKey(tokenBuf, tokenLength); + break; + } + default: + { + result = kTokenHdlrInternalFailed; + break; + } + } + + return result; +} +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblDiag_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation-defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. The correctness of the respective implementation is verified by runtime tests. + + MD_FblDiag_0313_VerifyFctOutput: + Reason: Signature/checksum verification functions are stored as void pointers as actual type is not known at + configuration time. + Risk: Function signature not compatible with expected type. + Prevention: Integrator has to take care the configured functions match with the expected signature. + + MD_FblDiag_0314_MemCpy: + Reason: The copy function have a void pointer as a function parameter. + Risk: No risk, because the underlying vuint8 pointer type is known. + Prevention: No prevention necessary. + + MD_FblDiag_0314_KeyPtr: + Reason: The verification parameter structure has a void pointer member for the key to support different + key types for different use cases + Risk: No risk, because the underlying key pointer type is known. + Prevention: No prevention necessary. + + MD_FblDiag_0883: + Reason: This file has to be included multiple times explicitly, due to creation of multiple structures via fbl_diag.def. + Risk: No identifiable risk because defines are undefined in fbl_diag.imp + Prevention: No prevention required. + + MD_FblDiag_1514: + Reason: The variable is used by other modules and can't be declared static. + Risk: Name conflicts. + Prevention: Compile and link of the different variants in the component and integration test. + + MD_FblDiag_2214: + Reason: Assertion macros have to be disabled in production code and are used only for development. + Risk: Assertion code may be enabled in production code unintentionally. If a assertion condition is unexpectedly + false, the code is active. A problem may occur if the Macro is additionally changed from single statement + to multiple statement. + Prevention: Macro is not allowed to be changed without review. Development code is automatically disabled via + configuration of project state "Production". + + MD_FblDiag_2741: + Reason: Some if conditions seems to be static only on certain compiling conditions. + Risk: A condition is always false or true independently from the compiling configuration. + Prevention: Code inspection and test of the different variants in the component test. + + MD_FblDiag_2790_kDiagStateMaskAllLong: + Reason: Create a mask where all bits are set. Generic implementation shifts therefore too many bytes. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblDiag_2880_UnreachableCode: + Reason: A code section can be executed only based on some static compile time configurations. + Risk: A code section is never executed independently from the compiling configuration. + Prevention: Code inspection and test of the different variants in the component test. + + MD_FblDiag_2889: + Reason: Multiple return paths are used to reduce code complexity, increase readability and reducing nesting level. + Risk: Some operations intended to conclude the function (e.g. states cleaning) can be unintentionally jumped. + Prevention: Code inspection and runtime tests. + + MD_FblDiag_2916: + Reason: Assignment to pointer is done within a function to make code more readable. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblDiag_2983_2985_RedundantAssignment: + Reason: Assignments are redundant only on certain configurations + Risk: Some code part can be really redundant in all possible configurations. + Prevention: Code review. + + MD_FblDiag_3218: + Reason: The local data of this module is kept at a central location for a better overview and maintenance. + Risk: Scope is larger than required (whole file instead of one function). Some other function could access + the variable. + Prevention: Restrict the functionality in this module to the intended purpose. Don't add functions which shall not + be able to access the local data. + + MD_FblDiag_3415: + Reason: Side effect (conditional execution) is intended. + Risk: Unintended side effects. + Prevention: Code is checked for unintended side effects by code inspection. + + MD_FblDiag_3493: + Reason: Depending on the configuration the value is not always true. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblDiag_3678: + Reason: The buffer is actually modified and can therefore not be a const buffer. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblDiag_5087_DiagDef: + Reason: Multiple includes of fbl_diag.def are required for building the configuration tables of the diagnostic layer. + Risk: Resulting code is difficult to understand and maintain. + Prevention: All changes to the affected code parts have to be reviewed by the module responsible. On a mid term + view, the respective implementation will be replaced by generated code. + + MD_FblDiag_ConstValue: + Reason: Value is constant depending on configuration aspects or platform specific implementation. This leads to + constant control expressions, unreachable code or redundant operations. + Risk: Wrong or missing functionality. + Prevention: Code inspection and test of the different variants in the component test. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_DIAG.C + **********************************************************************************************************************/ + diff --git a/Source/bsw/Fbl/fbl_diag.def b/Source/bsw/Fbl/fbl_diag.def new file mode 100644 index 0000000..222454f --- /dev/null +++ b/Source/bsw/Fbl/fbl_diag.def @@ -0,0 +1,251 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Diagnostic services supported in boot mode + * Definition of services and subfunctions for state machine + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 Make FBL SWDL 008 Compliant + * ESCAN00113919 RoutineControl Routines are protected by security access even + * though it's not required + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 RID 7013 (token download) is always supported + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ +#if ( FBLDIAG_14229_FORD_VERSION != 0x0507u ) || \ + ( FBLDIAG_14229_FORD_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_diag.def: State machine definition and source are inconsistent!" +#endif + +#ifndef FBL_DIAG_DEF +#define FBL_DIAG_DEF + +/* PRQA S 0883 EOF */ /* MD_FblDiag_0883 */ + +/* Some preprocessors don't like undefined (but unused) macro parameters */ +#if !defined( FBL_DIAG_DISABLE_DUMMY_MACRO_PARAMETERS ) +# define Root 0u +# define DiagnosticSessionControl 0u +# define EcuReset 0u +# define SecurityAccess 0u +# define TesterPresent 0u +# define ReadDataByIdentifier 0u +# define ReadDataById 0u +# define WriteDataByIdentifier 0u +# define WriteDataById 0u +# define RoutineControl 0u +# define RequestDownload 0u +# define RequestUpload 0u +# define TransferData 0u +# define RequestTransferExit 0u +# define DefaultSession 0u +# define ProgrammingSession 0u +# define HardReset 0u +# define RequestSeed 0u +# define SendKey 0u +# define SecAccessSeed 0u +# define SecAccessKey 0u +# define ZeroSubFunction 0u +# define StartRoutine 0u +# define EraseMemory 0u +# define RcEraseMemory 0u +# define CheckProgDep 0u +# define RcCheckProgDep 0u +# define ActivateSbl 0u +# define RcActivateSbl 0u +# define CheckValidApp 0u +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# define TokenDownload 0u +#endif +# define RcCheckValidApp 0u +# if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) +# define UpdateSecBytes 0u +# define RcUpdateSecBytes 0u +# endif +# if defined( FBL_DIAG_ENABLE_UPLOAD ) +# define TransferDataDownload 0u +# define TransferDataUpload 0u +# endif +# define ServiceCheck 0u +# define SubFctCheck 0u +# define TransferDataCheck 0u +# define SubRoutineCheck 0u +# define NonSubFctCheck 0u +# define RcTypeCheck 0u +#endif +#endif /* FBL_DIAG_DEF */ + +/* Increase compatibility with certain preprocessors */ +#if defined( None ) +#else +# define None 0xFFu +#endif + +/* LEVEL 0 Name Parent First Child Last Child Buffer Position ID Main Handler Index Checks Set Unset Add Clear Clear Fail Minimum Request Length Maximum Request Length */ +/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( Root , None , DiagnosticSessionControl , RequestTransferExit , kDiagFmtServiceId , 0x00 , None , ServiceCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , 0u , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + +/* LEVEL 1 Name Parent First Child Last Child Buffer Position ID Main Handler Index Checks Set Unset Add Clear Clear Fail Minimum Request Length Maximum Request Length */ +/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( DiagnosticSessionControl , Root , DefaultSession , ProgrammingSession , kDiagFmtSubparam , kDiagSidDiagnosticSessionControl , None , SubFctCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateFirstDownloadReq) , (kDiagStateSecurityKeyAll | kDiagStateSecurityAccessAll) , (kDiagStateNone) , kDiagRqlSubfunctionService , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( EcuReset , Root , HardReset , HardReset , kDiagFmtSubparam , kDiagSidEcuReset , None , SubFctCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlSubfunctionService , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( SecurityAccess , Root , RequestSeed , SendKey , kDiagFmtSubparam , kDiagSidSecurityAccess , None , SubFctSecCheck , (kDiagStateNone) , (kDiagStateSessionDefault) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateSecurityKeyAll) , kDiagRqlSubfunctionService , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TesterPresent , Root , ZeroSubFunction , ZeroSubFunction , kDiagFmtSubparam , kDiagSidTesterPresent , None , SubFctCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlSubfunctionService , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( ReadDataByIdentifier , Root , None , None , kDiagFmtDataIdHigh , kDiagSidReadDataByIdentifier , ReadDataById , NonSubFctCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlMinReadDataByIdentifier , kDiagRqlMaxReadDataByIdentifier ) +#include "fbl_diag.imp" + +#if defined( FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( WriteDataByIdentifier , Root , None , None , kDiagFmtDataIdHigh , kDiagSidWriteDataByIdentifier , WriteDataById , NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlWriteDataByIdentifier , kDiagRqlUnlimited ) +# include "fbl_diag.imp" +#endif /* FBL_DIAG_ENABLE_WRITE_DATA_BY_IDENTIFIER */ + +#if defined( FBL_ENABLE_USERROUTINE ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RoutineControl , Root , ActivateSbl , CheckProgDep , kDiagFmtSubRoutineIdHigh, kDiagSidRoutineControl , RoutineControl , SubRoutineCheck , (kDiagStateSessionProgramming) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRoutineControl , kDiagRqlUnlimited ) +#else +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RoutineControl , Root , ActivateSbl , CheckProgDep , kDiagFmtSubRoutineIdHigh, kDiagSidRoutineControl , None , SubRoutineCheck , (kDiagStateSessionProgramming) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRoutineControl , kDiagRqlUnlimited ) +#endif /* FBL_ENABLE_USERROUTINE */ +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RequestDownload , Root , None , None , kDiagFmtSubparam , kDiagSidRequestDownload , RequestDownload , NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01) , (kDiagStateNone) , (kDiagStateTransferDataAllowed) , (kDiagStateFirstDownloadReq | kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded) , kDiagRqlRequestDownload + kDiagSubMinLengthFormat + kDiagSubMinAddrFormat, kDiagRqlRequestDownload + kDiagSubMaxLengthFormat + kDiagSubMaxAddrFormat ) +#include "fbl_diag.imp" + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RequestUpload , Root , None , None , kDiagFmtSubparam , kDiagSidRequestUpload , RequestUpload , NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateSecurityAccess01) , (kDiagStateTransferDataAllowed) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataUpload), (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlRequestUpload + kDiagSubMinLengthFormat + kDiagSubMinAddrFormat , kDiagRqlRequestUpload + kDiagSubMaxLengthFormat + kDiagSubMaxAddrFormat ) +# include "fbl_diag.imp" + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferData , Root , TransferDataDownload , TransferDataUpload , kDiagFmtSequenceCnt , kDiagSidTransferData , None , TransferDataCheck, (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlTransferDataUpload , kDiagRqlUnlimited ) +# include "fbl_diag.imp" + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RequestTransferExit , Root , None , None , kDiagFmtSubparam , kDiagSidRequestTransferExit , RequestTransferExit , NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed) , (kDiagStateNone) , (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded | kDiagStateTransferDataUpload), kDiagRqlRequestTransferExit , kDiagRqlRequestTransferExit ) +# include "fbl_diag.imp" +#else +# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferData , Root , None , None , kDiagFmtSubparam , kDiagSidTransferData , TransferDataDownload, NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded) , kDiagRqlTransferDataDownload , (FBL_DIAG_BUFFER_LENGTH - 1u) ) +# else +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferData , Root , None , None , kDiagFmtSubparam , kDiagSidTransferData , TransferDataDownload, NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded) , kDiagRqlTransferDataDownload , ((kDiagRqlTransferDataDownload - 1u) + ((FBL_DIAG_BUFFER_LENGTH - 2u) & (~(FBL_MAX_SEGMENT_SIZE - 1u))))) +# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +# include "fbl_diag.imp" + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RequestTransferExit , Root , None , None , None , kDiagSidRequestTransferExit , RequestTransferExit , NonSubFctCheck , (kDiagStateSessionProgramming | kDiagStateTransferDataAllowed) , (kDiagStateNone) , (kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded) , (kDiagStateTransferDataAllowed | kDiagStateTransferDataSucceeded) , kDiagRqlRequestTransferExit , kDiagRqlRequestTransferExit ) +# include "fbl_diag.imp" +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +/* LEVEL 2 Name Parent First Child Last Child Buffer Position ID Main Handler Index Checks Set Unset Add Clear Clear Fail Minimum Request Length Maximum Request Length */ +/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( DefaultSession , DiagnosticSessionControl, None , None , None , kDiagSubDefaultSession , DefaultSession , None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlDiagnosticSessionControl , kDiagRqlDiagnosticSessionControl ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( ProgrammingSession , DiagnosticSessionControl, None , None , None , kDiagSubProgrammingSession , ProgrammingSession , None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlDiagnosticSessionControl , kDiagRqlDiagnosticSessionControl ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( HardReset , EcuReset , None , None , None , kDiagSubHardReset , EcuReset , None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlEcuReset , kDiagRqlEcuReset ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( RequestSeed , SecurityAccess , None , None , None , kDiagSubRequestSeed , SecAccessSeed , None , (kDiagStateNone) , (kDiagStateSecurityAccessDelay01), (kDiagStateSecurityKey01) , (kDiagStateSecurityKeyAll) , (kDiagStateNone) , kDiagRqlSecurityAccessSeed , kDiagRqlSecurityAccessSeed ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( SendKey , SecurityAccess , None , None , None , kDiagSubSendKey , SecAccessKey , None , (kDiagStateSecurityKey01) , (kDiagStateSecurityAccessDelay01), (kDiagStateSecurityAccess01) , (kDiagStateSecurityKeyAll | kDiagStateSecurityAccessAll) , (kDiagStateNone) , kDiagRqlSecurityAccessKey , kDiagRqlSecurityAccessKey ) +#include "fbl_diag.imp" + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( ZeroSubFunction , TesterPresent , None , None , None , kDiagSubZeroSubFunction , TesterPresent , None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlTesterPresent , kDiagRqlTesterPresent ) +#include "fbl_diag.imp" + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( ActivateSbl , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdActivateSbl) , RcActivateSbl , RcTypeCheck , (kDiagStateSecurityAccess01) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRcActivateSbl , kDiagRqlRcActivateSbl ) +#include "fbl_diag.imp" + + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( CheckValidApp , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdCheckValidApp), RcCheckValidApp , RcTypeCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateFirstDownloadReq) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRcCheckValidApp , kDiagRqlRcCheckValidApp ) +#include "fbl_diag.imp" + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TokenDownload , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdTokenDownload), RcTokenDownload , RcTypeCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRcTokenDownloadMin , kDiagRqlRcTokenDownloadMax ) +# include "fbl_diag.imp" +# endif +#endif + + +#if defined( FBL_DIAG_ENABLE_UPDATE_SEC_BYTES ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( UpdateSecBytes , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdUpdateSecBytes), RcUpdateSecBytes , RcTypeCheck , (kDiagStateSecurityAccess01) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRcUpdateSecBytes , kDiagRqlRcUpdateSecBytes ) +# include "fbl_diag.imp" +#endif /* FBL_DIAG_ENABLE_UPDATE_SEC_BYTES */ + +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( EraseMemory , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdEraseMemory) , RcEraseMemory , RcTypeCheck , (kDiagStateSecurityAccess01) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateFirstDownloadReq) , (kDiagStateNone) , kDiagRqlRcEraseMemory , kDiagRqlRcEraseMemory ) +#include "fbl_diag.imp" +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( CheckProgDep , RoutineControl , StartRoutine , StartRoutine , kDiagFmtSubparam , SPLIT_SHORT(kDiagRoutineIdCheckProgDep) , RcCheckProgDep , RcTypeCheck , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRcCheckProgDep , kDiagRqlRcCheckProgDep ) +#include "fbl_diag.imp" + +/* LEVEL 3 Name Parent First Child Last Child Buffer Position ID Main Handler Index Checks Set Unset Add Clear Clear Fail Minimum Request Length Maximum Request Length */ +/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ +#define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( StartRoutine , None , None , None , None , kDiagSubStartRoutine , None , None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlRoutineControl , kDiagRqlUnlimited ) +#include "fbl_diag.imp" + + +#if defined( FBL_DIAG_ENABLE_UPLOAD ) +# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferDataDownload , TransferData , None , None , None , kDiagSidTransferData , TransferDataDownload, None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlTransferDataDownload , (FBL_DIAG_BUFFER_LENGTH - 1u) ) +# else +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferDataDownload , TransferData , None , None , None , kDiagSidTransferData , TransferDataDownload, None , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlTransferDataDownload , ((kDiagRqlTransferDataDownload - 1u) + ((FBL_DIAG_BUFFER_LENGTH - 2u) & (~(FBL_MAX_SEGMENT_SIZE - 1u))))) +# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +# include "fbl_diag.imp" + +# define FBL_DIAG_STATE_RESULT FBL_DIAG_STATE_DEF( TransferDataUpload , TransferData , None , None , None , kDiagSidTransferData , TransferDataUpload , None , (kDiagStateTransferDataUpload) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , (kDiagStateNone) , kDiagRqlTransferDataUpload , kDiagRqlTransferDataUpload ) +# include "fbl_diag.imp" +#endif /* FBL_DIAG_ENABLE_UPLOAD */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_DIAG.DEF + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_diag.h b/Source/bsw/Fbl/fbl_diag.h new file mode 100644 index 0000000..63588a5 --- /dev/null +++ b/Source/bsw/Fbl/fbl_diag.h @@ -0,0 +1,1046 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Diagnostic services supported in boot mode + * Declaration of functions, variables and constants + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 Make FBL SWDL 008 Compliant + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 RID 7013 (token download) is always supported + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 Bootloader does not enter programming session when + * started from application + * 05.03.02 2024-07-16 erizk ESCAN00117344 Compiler error: FblRealTimeSupportVoid undefined, assuming + * extern returning int + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 Support App Signing Specification 2.1.3 + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 Add support for NXP DSP firmware update + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +#ifndef FBL_DIAG_H +#define FBL_DIAG_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblDiag_14229_Ford CQComponent : Implementation */ +#define FBLDIAG_14229_FORD_VERSION 0x0507u +#define FBLDIAG_14229_FORD_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#ifndef kDiagCallCycle +# define kDiagCallCycle TpCallCycle /* Same call cycle as TP */ +#endif + +#define kDiagPutResponse ((vuint8) 0x01u) + +/* -- Defines of diag services -- */ +#define kDiagSidDiagnosticSessionControl ((vuint8) 0x10u) +#define kDiagSidEcuReset ((vuint8) 0x11u) +#define kDiagSidReadDataByIdentifier ((vuint8) 0x22u) +#define kDiagSidSecurityAccess ((vuint8) 0x27u) +#define kDiagSidWriteDataByIdentifier ((vuint8) 0x2Eu) +#define kDiagSidRoutineControl ((vuint8) 0x31u) +#define kDiagSidRequestDownload ((vuint8) 0x34u) +#define kDiagSidRequestUpload ((vuint8) 0x35u) +#define kDiagSidTransferData ((vuint8) 0x36u) +#define kDiagSidRequestTransferExit ((vuint8) 0x37u) +#define kDiagSidTesterPresent ((vuint8) 0x3Eu) + +/* -- Defines for address and length format identifier -- */ +/* Not more than 4 byte addresses and lengths can be handled */ +#if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) +#define kDiagSubMinLengthFormat ((vuint8) 0x04u) +#else +#define kDiagSubMinLengthFormat ((vuint8) 0x01u) +#endif +#define kDiagSubMaxLengthFormat ((vuint8) 0x04u) +/* Includes memory identifier */ +#if defined( FBL_DIAG_ENABLE_FIXED_TRANSFER_ALFI ) +#define kDiagSubMinAddrFormat ((vuint8) 0x04u) +#else +#define kDiagSubMinAddrFormat ((vuint8) 0x02u) +#endif +#define kDiagSubMaxAddrFormat ((vuint8) 0x04u) +#define kDiagSubMemType ((vuint8) 0x00u) +#define kDiagSubFlashDrvMemType ((vuint8) 0x02u) + +#define kDiagSubNoEncryption ((vuint8) 0x00u) +#define kDiagSubNoCompression ((vuint8) 0x00u) +#define kDiagSubNoDataProcessing ((vuint8) ((kDiagSubNoCompression << 4u) | kDiagSubNoEncryption)) +#define kDiagSubDefaultCompression ((vuint8) 0x01u) + +/* -- Defines of diag subservices -- */ +#define kDiagSuppressPosRspMsgIndicationBit ((vuint8) 0x80u) + +/* DiagnosticSessionControl */ +#define kDiagSubDefaultSession ((vuint8) 0x01u) +#define kDiagSubProgrammingSession ((vuint8) 0x02u) + +/* ECUReset */ +#define kDiagSubHardReset ((vuint8) 0x01u) + +/* TesterPresent */ +#define kDiagSubZeroSubFunction ((vuint8) 0x00u) + +/* RoutineControl request, routineControlType */ +#define kDiagSubStartRoutine ((vuint8) 0x01u) +#define kDiagSubStopRoutine ((vuint8) 0x02u) +#define kDiagSubRequestRoutineResults ((vuint8) 0x03u) + +/* RoutineControl response, RoutineType (Ford specific) */ +#define kDiagSubRoutineType1_Sync ((vuint8) 0x01u) +#define kDiagSubRoutineType2_AsyncFiniteNoStop ((vuint8) 0x02u) +#define kDiagSubRoutineType3_AsyncFiniteOrStop ((vuint8) 0x03u) + +/* RoutineControl response, RoutineStatus (Ford specific) */ +#define kDiagSubRoutineStatusCompleted ((vuint8) 0x00u) +#define kDiagSubRoutineStatusAborted ((vuint8) 0x01u) +#define kDiagSubRoutineStatusActive ((vuint8) 0x02u) +#define kDiagSubRoutineApplInvalid ((vuint8) 0x01u) +#define kDiagSubRoutineApplValid ((vuint8) 0x02u) + +/* RoutineControl, RoutineIdentifier */ +#define kDiagRoutineIdEraseMemory ((vuint16) 0xFF00u) +#define kDiagRoutineIdCheckProgDep ((vuint16) 0xFF01u) +#define kDiagRoutineIdActivateSbl ((vuint16) 0x0301u) +#define kDiagRoutineIdCheckValidApp ((vuint16) 0x0304u) +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define kDiagRoutineIdTokenDownload ((vuint16) 0x7013u) +# endif +#endif +#define kDiagRoutineIdUpdateSecBytes ((vuint16) 0x0305u) + +/* -- Response Identifier -- */ +/* Negative response SID */ +#define kDiagRidNegativeResponse ((vuint8) 0x7Fu) + +/* Data identifier for ReadDataByIdentifier service */ +#if !defined( kDiagDataIdActiveDiagnosticSession ) +# define kDiagDataIdActiveDiagnosticSession ((vuint16) 0xD100u) +#endif +#define kDiagDataIdSwdlVersion ((vuint16) 0xF162u) +#if defined( FBL_DIAG_ENABLE_DID_CURRENT_DIAG_APP ) +# if !defined( kDiagDataIdBootloaderCurrentDiagnosticApp ) +# define kDiagDataIdBootloaderCurrentDiagnosticApp ((vuint16) 0xD021u) +# endif +#endif +#if !defined( kDiagSwdlVersion ) +# define kDiagSwdlVersion ((vuint8) 0x08u) +#endif + +/* -- Negative Response Codes -- */ +#define kDiagErrorNone ((vuint8) 0x00u) +#define kDiagNrcGeneralReject ((vuint8) 0x10u) +#define kDiagNrcServiceNotSupported ((vuint8) 0x11u) +#define kDiagNrcSubFunctionNotSupported ((vuint8) 0x12u) +#define kDiagNrcIncorrectMessageLengthOrInvalidFormat ((vuint8) 0x13u) +#define kDiagNrcResponseTooLong ((vuint8) 0x14u) +#define kDiagNrcBusyRepeatRequest ((vuint8) 0x21u) +#define kDiagNrcConditionsNotCorrect ((vuint8) 0x22u) +#define kDiagNrcRequestSequenceError ((vuint8) 0x24u) +#define kDiagNrcRequestOutOfRange ((vuint8) 0x31u) +#define kDiagNrcSecurityAccessDenied ((vuint8) 0x33u) +#define kDiagNrcInvalidKey ((vuint8) 0x35u) +#define kDiagNrcExceedNumberOfAttempts ((vuint8) 0x36u) +#define kDiagNrcRequiredTimeDelayNotExpired ((vuint8) 0x37u) +#define kDiagNrcUploadDownloadNotAccepted ((vuint8) 0x70u) +#define kDiagNrcTransferDataSuspended ((vuint8) 0x71u) +#define kDiagNrcGeneralProgrammingFailure ((vuint8) 0x72u) +#define kDiagNrcWrongBlockSequenceCounter ((vuint8) 0x73u) +#define kDiagNrcRcrResponsePending ((vuint8) 0x78u) +#define kDiagNrcSubfunctionNotSupportedInActiveSession ((vuint8) 0x7Eu) +#define kDiagNrcServiceNotSupportedInActiveSession ((vuint8) 0x7Fu) +#define kDiagNrcNoResponse ((vuint8) 0xFFu) + +/* Length (number of bytes) of the maxNumberOfBlockLength parameter in the RequestDownload/-Upload response */ +#define kDiagMaxNumberOfBlockLengthLength ((vuint8) 0x02u) + +/* Maximum supported DID requests */ +#if !defined( FBL_MAX_DID_COUNT ) +# define FBL_MAX_DID_COUNT 5u +#endif + +/* -- Macros for diag exceptions -- */ +#define DiagSetError(errorNo) (diagErrorCode = (errorNo)) +#define DiagClrError() (diagErrorCode = kDiagErrorNone) +#define DiagGetError() (diagErrorCode) +#define DiagNRCGeneralReject() DiagSetError(kDiagNrcGeneralReject) +#define DiagNRCServiceNotSupported() DiagSetError(kDiagNrcServiceNotSupported) +#define DiagNRCSubFunctionNotSupported() DiagSetError(kDiagNrcSubFunctionNotSupported) +#define DiagNRCIncorrectMessageLengthOrInvalidFormat() DiagSetError(kDiagNrcIncorrectMessageLengthOrInvalidFormat) +#define DiagNRCResponseTooLong() DiagSetError(kDiagNrcResponseTooLong) +#define DiagNRCBusyRepeatRequest() DiagSetError(kDiagNrcBusyRepeatRequest) +#define DiagNRCConditionsNotCorrect() DiagSetError(kDiagNrcConditionsNotCorrect) +#define DiagNRCRequestSequenceError() DiagSetError(kDiagNrcRequestSequenceError) +#define DiagNRCRequestOutOfRange() DiagSetError(kDiagNrcRequestOutOfRange) +#define DiagNRCSecurityAccessDenied() DiagSetError(kDiagNrcSecurityAccessDenied) +#define DiagNRCInvalidKey() DiagSetError(kDiagNrcInvalidKey) +#define DiagNRCExceedNumberOfAttempts() DiagSetError(kDiagNrcExceedNumberOfAttempts) +#define DiagNRCRequiredTimeDelayNotExpired() DiagSetError(kDiagNrcRequiredTimeDelayNotExpired) +#define DiagNRCUploadDownloadNotAccepted() DiagSetError(kDiagNrcUploadDownloadNotAccepted) +#define DiagNRCTransferDataSuspended() DiagSetError(kDiagNrcTransferDataSuspended) +#define DiagNRCGeneralProgrammingFailure() DiagSetError(kDiagNrcGeneralProgrammingFailure) +#define DiagNRCWrongBlockSequenceCounter() DiagSetError(kDiagNrcWrongBlockSequenceCounter) +#define DiagNRCRcrResponsePending() DiagSetError(kDiagNrcRcrResponsePending) +#define DiagNRCSubfunctionNotSupportedInActiveSession() DiagSetError(kDiagNrcSubfunctionNotSupportedInActiveSession) +#define DiagNRCServiceNotSupportedInActiveSession() DiagSetError(kDiagNrcServiceNotSupportedInActiveSession) + +/* Defines for length of service request parameters */ +#define kDiagRqlDiagnosticSessionControlParameter ((tCwDataLengthType) 0x00u) +#define kDiagRqlSecurityAccessSeedParameter ((tCwDataLengthType) 0x00u) +#define kDiagRqlSecurityAccessKeyParameter (kSecKeyLength) +#define kDiagRqlRcActivateSblMemoryAddress ((tCwDataLengthType) 0x04u) +#define kDiagRqlRcEraseMemoryMemoryId ((tCwDataLengthType) 0x00u) +#define kDiagRqlRcEraseMemoryAddress ((tCwDataLengthType) 0x04u) +#define kDiagRqlRcEraseMemoryLength ((tCwDataLengthType) 0x04u) +#define kDiagRqlRcCheckProgDepMemoryAddress ((tCwDataLengthType) 0x04u) +#define kDiagRqlRcCheckProgDepMemorySize ((tCwDataLengthType) 0x04u) +#define kDiagRqlRcUpdateSecBytesSecLevel ((tCwDataLengthType) 0x01u) +#define kDiagRqlRcUpdateSecBytesSecBytes ((tCwDataLengthType) 0x01u) + +/* Defines for length of service requests (excluding service ID) */ +#define kDiagRqlSubfunctionService ((tCwDataLengthType) 0x01u) +#define kDiagRqlDiagnosticSessionControl ((tCwDataLengthType) (0x01u+kDiagRqlDiagnosticSessionControlParameter)) +#define kDiagRqlEcuReset ((tCwDataLengthType) 0x01u) +#define kDiagRqlSecurityAccessSeed ((tCwDataLengthType) (0x01u+kDiagRqlSecurityAccessSeedParameter)) +#define kDiagRqlSecurityAccessKey ((tCwDataLengthType) (0x01u+kDiagRqlSecurityAccessKeyParameter)) +#define kDiagRqlMinReadDataByIdentifier ((tCwDataLengthType) 0x02u) +#define kDiagRqlMaxReadDataByIdentifier ((tCwDataLengthType) ((FBL_MAX_DID_COUNT) * 2u)) +#define kDiagRqlWriteDataByIdentifier ((tCwDataLengthType) 0x03u) /* DID + at least one additional data byte */ +#define kDiagRqlRoutineControl ((tCwDataLengthType) 0x03u) +#define kDiagRqlRcEraseMemory ((tCwDataLengthType) (kDiagRqlRoutineControl+kDiagRqlRcEraseMemoryMemoryId+kDiagRqlRcEraseMemoryAddress+kDiagRqlRcEraseMemoryLength)) +#define kDiagRqlRcCheckProgDep ((tCwDataLengthType) (kDiagRqlRoutineControl+kDiagRqlRcCheckProgDepMemoryAddress+kDiagRqlRcCheckProgDepMemorySize)) +#define kDiagRqlRcActivateSbl ((tCwDataLengthType) (kDiagRqlRoutineControl+kDiagRqlRcActivateSblMemoryAddress)) +#define kDiagRqlRcCheckValidApp ((tCwDataLengthType) (kDiagRqlRoutineControl)) +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define kDiagRqlRcTokenDownloadMin ((tCwDataLengthType) (kDiagRqlRoutineControl + FBL_DIAG_TOKEN_MIN_SIZE)) +# define kDiagRqlRcTokenDownloadMax ((tCwDataLengthType) (kDiagRqlRoutineControl + FBL_DIAG_TOKEN_MAX_SIZE)) +# endif +#endif +#define kDiagRqlRcUpdateSecBytes ((tCwDataLengthType) (kDiagRqlRoutineControl+kDiagRqlRcUpdateSecBytesSecLevel+kSecSecretKeyLength)) +#define kDiagRqlRequestDownload ((tCwDataLengthType) 0x02u) +#define kDiagRqlRequestUpload ((tCwDataLengthType) 0x02u) +#define kDiagRqlTransferDataDownload ((tCwDataLengthType) 0x02u) /* + Download data, at least one data byte mandatory */ +#define kDiagRqlTransferDataUpload ((tCwDataLengthType) 0x01u) /* Block sequence counter only, data in response message */ +#define kDiagRqlRequestTransferExit ((tCwDataLengthType) 0x00u) +#define kDiagRqlTesterPresent ((tCwDataLengthType) 0x01u) + +/* Defines for length of service response parameters */ +#define kDiagRslEcuResetParameter ((tCwDataLengthType) 0x00u) +#define kDiagRslDiagnosticSessionControlParameter ((tCwDataLengthType) 0x04u) +#define kDiagRslSecurityAccessSeedParameter (kSecSeedLength) +#define kDiagRslSecurityAccessKeyParameter ((tCwDataLengthType) 0x00u) +#define kDiagRslRcEraseMemoryParameter ((tCwDataLengthType) 0x01u) +#define kDiagRslRcCheckProgDepParameter ((tCwDataLengthType) 0x03u) +#define kDiagRslRcActivateSblParameter ((tCwDataLengthType) 0x01u) +#define kDiagRslRcCheckValidAppParameter ((tCwDataLengthType) 0x02u) +#if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define kDiagRslRcTokenDownloadParameter ((tCwDataLengthType) 0x01u) +#endif +#define kDiagRslRcUpdateSecBytesParameter ((tCwDataLengthType) 0x01u) +#define kDiagRslTransferDataParameter ((tCwDataLengthType) 0x00u) +#define kDiagRslRequestTransferExitParameter ((tCwDataLengthType) (kSecCrcLength)) + +/* Defines for length of service responses (excluding service ID) */ +#define kDiagRslDiagnosticSessionControl ((tCwDataLengthType) (0x01u+kDiagRslDiagnosticSessionControlParameter)) +#define kDiagRslEcuReset ((tCwDataLengthType) (0x01u+kDiagRslEcuResetParameter)) +#define kDiagRslSecurityAccessSeed ((tCwDataLengthType) (0x01u+kDiagRslSecurityAccessSeedParameter)) +#define kDiagRslSecurityAccessKey ((tCwDataLengthType) (0x01u+kDiagRslSecurityAccessKeyParameter)) +#define kDiagRslReadDataByIdentifier ((tCwDataLengthType) 0x02u) +#define kDiagRslWriteDataByIdentifier ((tCwDataLengthType) 0x02u) +#define kDiagRslRcEraseMemory ((tCwDataLengthType) (0x03u+kDiagRslRcEraseMemoryParameter)) +#define kDiagRslRcCheckProgDep ((tCwDataLengthType) (0x03u+kDiagRslRcCheckProgDepParameter)) +#define kDiagRslRcActivateSbl ((tCwDataLengthType) (0x03u+kDiagRslRcActivateSblParameter)) +#define kDiagRslRcCheckValidApp ((tCwDataLengthType) (0x03u+kDiagRslRcCheckValidAppParameter)) +#if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +# define kDiagRslRcTokenDownload ((tCwDataLengthType) (0x03u+kDiagRslRcTokenDownloadParameter)) +#endif +#define kDiagRslRcUpdateSecBytes ((tCwDataLengthType) (0x03u+kDiagRslRcUpdateSecBytesParameter)) +#define kDiagRslRequestDownload ((tCwDataLengthType) 0x01u) /* + maxNumberOfBlockLength */ +#define kDiagRslRequestUpload ((tCwDataLengthType) 0x01u) /* + maxNumberOfBlockLength */ +#define kDiagRslTransferData ((tCwDataLengthType) (0x01u+kDiagRslTransferDataParameter)) +#define kDiagRslRequestTransferExit ((tCwDataLengthType) (0x00u+kDiagRslRequestTransferExitParameter)) +#define kDiagRslTesterPresent ((tCwDataLengthType) 0x01u) + +/* Diagnostic service format definitions */ +#define kDiagFmtSequenceCnt ((tCwDataLengthType) (kDiagFmtServiceId+0x01u)) /* Position of sequence counter */ +#define kDiagFmtDataOffset ((tCwDataLengthType) (kDiagFmtSequenceCnt+0x01u)) /* Offset to download data in TransferData frame */ +#define kDiagFmtSeedKeyStart ((tCwDataLengthType) (kDiagFmtSubparam+0x01u)) /* Start index of seed/key value */ +#define kDiagFmtAddrOffset ((tCwDataLengthType) 0x03u) +#define kDiagFmtFormatOffset ((tCwDataLengthType) 0x02u) +#define kDiagFmtServiceId ((tCwDataLengthType) 0x00u) +#define kDiagFmtSubparam ((tCwDataLengthType) (kDiagFmtServiceId+0x01u)) +#define kDiagFmtRoutineIdHigh ((tCwDataLengthType) (kDiagFmtServiceId+0x01u)) +#define kDiagFmtRoutineIdLow ((tCwDataLengthType) (kDiagFmtRoutineIdHigh+0x01u)) +#define kDiagFmtRoutineIdPar ((tCwDataLengthType) (kDiagFmtRoutineIdLow+0x01u)) +#define kDiagFmtRoutineIdDataRecord ((tCwDataLengthType) (kDiagFmtRoutineIdPar+0x01u)) +#define kDiagFmtSubRoutineIdHigh ((tCwDataLengthType) (kDiagFmtSubparam+0x01u)) +#define kDiagFmtSubRoutineIdLow ((tCwDataLengthType) (kDiagFmtSubRoutineIdHigh+0x01u)) +#define kDiagFmtSubRoutineIdPar ((tCwDataLengthType) (kDiagFmtSubRoutineIdLow+0x01u)) +#define kDiagFmtSubRoutineIdDataRecord ((tCwDataLengthType) (kDiagFmtSubRoutineIdPar+0x01u)) +#define kDiagFmtSubRoutineEraseMemoryAddress ((tCwDataLengthType) (kDiagFmtSubRoutineIdPar)) +#define kDiagFmtSubRoutineEraseMemorySize ((tCwDataLengthType) (kDiagFmtSubRoutineEraseMemoryAddress+kDiagRqlRcEraseMemoryAddress)) +#define kDiagFmtSubRoutineCheckMemoryAddress ((tCwDataLengthType) (kDiagFmtSubRoutineIdPar)) +#define kDiagFmtSubRoutineCheckMemorySize ((tCwDataLengthType) (kDiagFmtSubRoutineCheckMemoryAddress+kDiagRqlRcCheckProgDepMemoryAddress)) +#define kDiagFmtSubRoutineInfo ((tCwDataLengthType) (kDiagFmtSubRoutineIdPar)) +#define kDiagFmtSubRoutineCheckValidAppStatus ((tCwDataLengthType) (kDiagFmtSubRoutineInfo+0x01u)) +#define kDiagFmtSubRoutineCrcHigh ((tCwDataLengthType) (kDiagFmtSubRoutineInfo+0x01u)) +#define kDiagFmtSubRoutineCrcLow ((tCwDataLengthType) (kDiagFmtSubRoutineCrcHigh+0x01u)) +#define kDiagFmtSubRoutineUpdateSecBytesLevel ((tCwDataLengthType) (kDiagFmtSubRoutineIdPar)) +#define kDiagFmtSubRoutineUpdateSecBytesValue ((tCwDataLengthType) (kDiagFmtSubRoutineUpdateSecBytesLevel+kDiagRqlRcUpdateSecBytesSecLevel)) +#define kDiagFmtNegResponse ((tCwDataLengthType) (kDiagFmtSubparam+0x01u)) /* Position of negative response code */ +#define kDiagFmtLengthMask ((vuint8) 0xF0u) +#define kDiagFmtAddrMask ((vuint8) 0x0Fu) +#define kDiagFmtEncryptionMask ((vuint8) 0x0Fu) +#define kDiagFmtCompressionMask ((vuint8) 0xF0u) +#define kDiagFmtMaxBlockLengthHigh ((vuint8) (kDiagFmtSubparam+0x01u)) +#define kDiagFmtMaxBlockLengthLow ((vuint8) (kDiagFmtMaxBlockLengthHigh+0x01u)) +#define kDiagFmtDataIdHigh ((vuint8) (kDiagFmtSubparam)) +#define kDiagFmtDataIdLow ((vuint8) (kDiagFmtDataIdHigh+0x01u)) +#define kDiagFmtDataIdDataRecord ((vuint8) (kDiagFmtDataIdLow+0x01u)) +#define kDiagFmtDataIdActiveDiagnosticSessionSize ((vuint8) 0x01u) +#define kDiagFmtDataIdSwdlVersionSize ((vuint8) 0x01u) +#if defined( FBL_DIAG_ENABLE_DID_CURRENT_DIAG_APP ) +# define kDiagFmtDataIdBootloaderCurrentDiagAppSize ((vuint8) 0x01u) +#endif +#define kDiagFmtDataIdSize ((vuint8) 0x02u) +#define kDiagFmtTransferDataUploadRetryBackupSize ((vuint8) 0x05u) + +/* Diagnostic session timing */ +#define kDiagSessionTimingP2 ((vuint16) (kFblDiagTimeP2 * FBL_REPEAT_CALL_CYCLE)) +#define kDiagSessionTimingP2Star ((vuint16) ((vuint32)(kFblDiagTimeP2Star * FBL_REPEAT_CALL_CYCLE) / 10u)) + +/* Macros for P2 timeout */ +#define GetP2Timeout() (P2Timeout) +#define SetP2Timeout(val) (P2Timeout = (((val) > 0x01u) ? ((val) / 0x02u) : 0x01u)) +#define ClrP2Timeout() (P2Timeout = 0x00u) + +/* State machine states */ +#if defined( FBL_DIAG_ENABLE_ENUMS_IDX ) +enum +{ + kDiagStateIdxSessionDefault + ,kDiagStateIdxSessionProgramming + ,kDiagStateIdxSecurityKey01 + ,kDiagStateIdxSecurityAccess01 + ,kDiagStateIdxFunctionalRequest + ,kDiagStateIdxTransferDataAllowed + ,kDiagStateIdxTransferDataSucceeded +#if defined( FBL_DIAG_ENABLE_UPLOAD ) + ,kDiagStateIdxTransferDataUpload +#endif + ,kDiagStateIdxFirstDownloadReq + ,kDiagStateIdxSuppressPosRspMsg + /* States below are not relevant for service dispatching */ + ,kDiagStateIdxServiceInProgress + ,kDiagStateIdxTpConfirmationFlag + ,kDiagStateIdxDiagIndication + ,kDiagStateIdxResponseProcessing + ,kDiagStateIdxRcrRpInProgress + ,kDiagStateIdxMemDriverInitialized + ,kDiagStateIdxEraseMemorySucceeded + ,kDiagStateIdxWaitForRcrRpConf + ,kDiagStateIdxWaitEcuReset + ,kDiagStateIdxResetMsgConfirmed + ,kDiagStateIdxEcuResetFctFinished + ,kDiagStateIdxDiagBufferLocked +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) + ,kDiagStateIdxDiagDevelopmentKey +#endif + ,kDiagStateIdxProcessingDone + ,kDiagStateIdxLockedByInit + /*----------------------*/ + , kDiagNumberOfStates +}; +#else +# define kDiagStateIdxSessionDefault (0u) +# define kDiagStateIdxSessionProgramming (kDiagStateIdxSessionDefault + 1u) +# define kDiagStateIdxSecurityKey01 (kDiagStateIdxSessionProgramming + 1u) +# define kDiagStateIdxSecurityAccess01 (kDiagStateIdxSecurityKey01 + 1u) +# define kDiagStateIdxFunctionalRequest (kDiagStateIdxSecurityAccess01 + 1u) +# define kDiagStateIdxTransferDataAllowed (kDiagStateIdxFunctionalRequest + 1u) +# define kDiagStateIdxTransferDataSucceeded (kDiagStateIdxTransferDataAllowed + 1u) +# if defined( FBL_DIAG_ENABLE_UPLOAD ) +# define kDiagStateIdxTransferDataUpload (kDiagStateIdxTransferDataSucceeded + 1u) +# define kDiagStateIdxFirstDownloadReq (kDiagStateIdxTransferDataUpload + 1u) +# else +# define kDiagStateIdxFirstDownloadReq (kDiagStateIdxTransferDataSucceeded + 1u) +# endif /* FBL_DIAG_ENABLE_UPLOAD */ +# define kDiagStateIdxSuppressPosRspMsg (kDiagStateIdxFirstDownloadReq + 1u) +/*----------------------*/ +# define kDiagNumberOfDispatchStates (kDiagStateIdxSuppressPosRspMsg + 1u) +/*----------------------*/ +/* States below are not relevant for service dispatching */ +# define kDiagStateIdxServiceInProgress (kDiagStateIdxSuppressPosRspMsg + 1u) +# define kDiagStateIdxTpConfirmationFlag (kDiagStateIdxServiceInProgress + 1u) +# define kDiagStateIdxDiagIndication (kDiagStateIdxTpConfirmationFlag + 1u) +# define kDiagStateIdxResponseProcessing (kDiagStateIdxDiagIndication + 1u) +# define kDiagStateIdxRcrRpInProgress (kDiagStateIdxResponseProcessing + 1u) +# define kDiagStateIdxMemDriverInitialized (kDiagStateIdxRcrRpInProgress + 1u) +# define kDiagStateIdxEraseMemorySucceeded (kDiagStateIdxMemDriverInitialized + 1u) +# define kDiagStateIdxWaitForRcrRpConf (kDiagStateIdxEraseMemorySucceeded + 1u) +# define kDiagStateIdxWaitEcuReset (kDiagStateIdxWaitForRcrRpConf + 1u) +# define kDiagStateIdxResetMsgConfirmed (kDiagStateIdxWaitEcuReset + 1u) +# define kDiagStateIdxEcuResetFctFinished (kDiagStateIdxResetMsgConfirmed + 1u) +# define kDiagStateIdxDiagBufferLocked (kDiagStateIdxEcuResetFctFinished + 1u) +# define kDiagStateIdxDiagDevelopmentKey (kDiagStateIdxDiagBufferLocked + 1u) +# define kDiagStateIdxProcessingDone (kDiagStateIdxDiagDevelopmentKey + 1u) +# define kDiagStateIdxLockedByInit (kDiagStateIdxProcessingDone + 1u) +# define kDiagStateDisableFlashDriverDeinit (kDiagStateIdxLockedByInit + 1u) +# define kDiagStateEcuResetReasonSwupUpdate (kDiagStateDisableFlashDriverDeinit + 1u) +/*----------------------*/ +# define kDiagNumberOfStates (kDiagStateEcuResetReasonSwupUpdate + 1u) +/*----------------------*/ +#endif + +/* State array settings */ +#define STATE_BITS FBL_STATE_BITS + +#if ( STATE_BITS == 32u ) +typedef vuint32 tStateBitmap; + +#define kDiagStateMaskNone (tStateBitmap)(0x00000000uL) +#define kDiagStateMaskAll (tStateBitmap)(0xFFFFFFFFuL) +#endif + +#if ( STATE_BITS == 16u ) +typedef vuint16 tStateBitmap; + +#define kDiagStateMaskNone (tStateBitmap)(0x0000uL) +#define kDiagStateMaskAll (tStateBitmap)(0xFFFFuL) +#endif + +#if ( STATE_BITS == 8u ) +typedef vuint8 tStateBitmap; + +#define kDiagStateMaskNone (tStateBitmap)(0x00uL) +#define kDiagStateMaskAll (tStateBitmap)(0xFFuL) +#endif + +#if defined( FBL_DIAG_ENABLE_ENUMS_IDX ) +/* + Size of service state array + This has to be set manually, + because the state enum constants + can not be evaluated at preprocess time +*/ +# if ( STATE_BITS == 32u ) +# define STATECHECK_ARRAYSIZE (0x01u) +# endif + +# if ( STATE_BITS == 16u ) +# define STATECHECK_ARRAYSIZE (0x01u) +# endif + +# if ( STATE_BITS == 8u ) +# define STATECHECK_ARRAYSIZE (0x02u) +# endif +#else +# define STATECHECK_ARRAYSIZE (((kDiagNumberOfDispatchStates - 1u) / STATE_BITS) + 1u) +#endif + +#if !defined( STATECHECK_ARRAYSIZE ) +# error "Invalid STATE_BITS value" +#endif + +/* State mask build macros */ +#define STATE_MASK(bit) ((tStateBitmap)(1uL << ((bit) % STATE_BITS))) +#define STATE_MULTIMASK(min, max) ((((kDiagStateMaskAll) >> ((min) % STATE_BITS)) << ((min) % STATE_BITS)) ^ (((kDiagStateMaskAll) >> (((max) + 1u) % STATE_BITS)) << (((max) + 1u) % STATE_BITS))) +#define STATE_MASKLONG(bit) (1uL << (bit)) +#define STATE_MULTIMASKLONG(min, max) ((((~0uL) >> (min)) << (min)) ^ (((max) < (STATE_BITS - 1u)) ? (((~0uL) >> ((max) + 1u)) << ((max) + 1u)) : 0uL)) +#define STATE_INDEX(bit) ((bit) / STATE_BITS) +#define STATE_SET(arr, bit) ((arr)[STATE_INDEX(bit)] |= STATE_MASK(bit)) +#define STATE_CLR(arr, bit) ((arr)[STATE_INDEX(bit)] &= FblInvertBits(STATE_MASK(bit), tStateBitmap)) +#define STATE_MULTICLR(arr, min, max) ((arr)[STATE_INDEX(min)] &= FblInvertBits(STATE_MULTIMASK((min), (max)), tStateBitmap)) +#define STATE_TEST(arr, bit) (((arr)[STATE_INDEX(bit)] & STATE_MASK(bit)) == STATE_MASK(bit)) + +/* State access macros */ +#define GetDiagState(state) STATE_TEST(fblStates, (state)) + +#define GetDiagDefaultDiagSession() GetDiagState(kDiagStateIdxSessionDefault) +#define GetDiagProgrammingSession() GetDiagState(kDiagStateIdxSessionProgramming) +#define GetResponseProcessing() GetDiagState(kDiagStateIdxResponseProcessing) +#define GetRcrRpInProgress() GetDiagState(kDiagStateIdxRcrRpInProgress) +#define GetMemDriverInitialized() GetDiagState(kDiagStateIdxMemDriverInitialized) +#define GetServiceInProgress() GetDiagState(kDiagStateIdxServiceInProgress) +#define GetWaitEcuReset() GetDiagState(kDiagStateIdxWaitEcuReset) +#define GetDiagBufferLocked() GetDiagState(kDiagStateIdxDiagBufferLocked) +/* Flash driver restore handling */ +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# define GetDiagDevelopmentKey() GetDiagState(kDiagStateIdxDiagDevelopmentKey) +#endif +#define GetCurrentSecLvl() diagCurrentSecLvl + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +/* Macros and defines for token handling */ +# define FBL_DIAG_TOKEN_MIN_SIZE 80u /* Used for mode 0 token without signature */ +# define FBL_DIAG_TOKEN_MAX_SIZE 1891u /* Used for mode 5 token */ +/* Compatibility define */ +# define FBL_DIAG_TOKEN_SIZE FBL_DIAG_TOKEN_MAX_SIZE + +/* Defines for enabling Ford key handling */ +# if defined (FBL_DIAG_SINGLE_KEY) +# define FBL_DIAG_ENABLE_PRODKEY_UPDATE +# define FBL_DIAG_ENABLE_DEVKEY_UPDATE +# define FBL_DIAG_ENABLE_DEVKEY +# endif +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + + +/* Compatibility defines */ +#define FblDiagGetDefaultSession() GetDiagDefaultSession() +#define FblDiagGetProgrammingSession() GetDiagProgrammingSession() +#define FblDiagGetExtendedSession() GetDiagExtendedSession() +#define FblDiagGetBufferLocked() GetDiagBufferLocked() +#define FblDiagGetRcrRpInProgress() GetRcrRpInProgress() +#define FblDiagGetMemDriverInitialized() GetMemDriverInitialized() + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +# define GetRequestedSeedLength() kDiagSecAccessParams[diagRequestedSecLvlIdx].seedLength +# define GetRequestedKeyLength() kDiagSecAccessParams[diagRequestedSecLvlIdx].keyLength +#else +# define GetRequestedSeedLength() kSecSeedLength +# define GetRequestedKeyLength() kSecKeyLength +#endif + + +#if defined( FBL_ENABLE_DEBUG_STATUS ) +/* Error codes for error status reporting */ +# define FBL_ERR_NONE ((vuint8) 0x00u) + +# define FBL_ERR_FLASH_ERASE_ERROR ((vuint8) 0x10u) +# define FBL_ERR_FLASH_PROG_ERROR ((vuint8) 0x11u) +# define FBL_ERR_FLASH_PROG_CONDITIONS ((vuint8) 0x12u) + +# define FBL_ERR_APPL_OVERLAPPING ((vuint8) 0x20u) +# define FBL_ERR_APPL_NOT_ALIGNED ((vuint8) 0x21u) +# define FBL_ERR_TOO_MANY_SEGMENTS_IN_MODULE ((vuint8) 0x22u) +# define FBL_ERR_NO_MEMORY_REGION_FOUND ((vuint8) 0x23u) +# define FBL_ERR_SEED_GENERATION_FAILED ((vuint8) 0x24u) +# define FBL_ERR_GAP_FILL ((vuint8) 0x25u) +# define FBL_ERR_VERIFICATION ((vuint8) 0x26u) + +# define FBL_ERR_FLASHCODE_INIT_FAILED ((vuint8) 0x30u) +# define FBL_ERR_FLASHCODE_EXCEEDS_MEMORY ((vuint8) 0x31u) +# define FBL_ERR_FLASHCODE_NOT_ACCEPTED ((vuint8) 0x32u) + +# define FBL_ERR_LBT_MISSING_INVALID_FORMAT ((vuint8) 0x40u) +# define FBL_ERR_LBT_ADDR_MISMATCH ((vuint8) 0x41u) +# define FBL_ERR_LBT_BLOCK_INDEX_EXCEEDED ((vuint8) 0x42u) +# define FBL_ERR_LBT_NOT_REPROGRAMMABLE ((vuint8) 0x43u) +# define FBL_ERR_LBT_BLOCK_INDEX_ILLEGAL ((vuint8) 0x44u) + +# define FBL_ERR_DATA_OVERFLOW ((vuint8) 0x50u) + +/* Macros for error status reporting */ +# define FblErrStatSetSId(id) (errStatLastServiceId = (id)) +# define FblErrStatSetState(state) (errStatFblStates = (state)) +# define FblErrStatSetFlashDrvError(error) (errStatFlashDrvErrorCode = (error)) +# define FblErrStatSetFlashDrvVersion() {\ + errStatFlashDrvVersion[0] = flashCode[0];\ + errStatFlashDrvVersion[1] = flashCode[1];\ + errStatFlashDrvVersion[2] = flashCode[3];\ + } +# define FblErrStatSetError(error) (errStatErrorCode = (error)) +# define FblErrStatSetBlockNr(blockNumber) (errStatDescriptor.blockNr = (blockNumber)) +# define FblErrStatSetAddress(address) (errStatDescriptor.blockStartAddress = (address)) +#else +# define FblErrStatSetSId(id) +# define FblErrStatSetState(state) +# define FblErrStatSetFlashDrvError(error) +# define FblErrStatSetFlashDrvVersion() +# define FblErrStatSetError(error) +# define FblErrStatSetBlockNr(blockNr) +# define FblErrStatSetAddress(address) +#endif + +#define DIAG_CALL_CYCLE kDiagCallCycle + +#if !defined( TESTER_PRESENT_TIMEOUT ) +#define TESTER_PRESENT_TIMEOUT ((vuint32) 5000u) +#endif + +#if !defined( TESTER_PRESENT_TIMEOUT_LONG ) +#define TESTER_PRESENT_TIMEOUT_LONG ((vuint32) 30000u) +#endif + +#define TimeoutTesterValue() testerPresentTimeout +#define DecTimeoutTesterValue() (testerPresentTimeout--) +#define ResetTesterTimeout() (testerPresentTimeout = (vuint16)(TESTER_PRESENT_TIMEOUT/DIAG_CALL_CYCLE)) +#define InitTesterTimeoutLong() (testerPresentTimeout = (vuint16)(TESTER_PRESENT_TIMEOUT_LONG/DIAG_CALL_CYCLE)) +#define StopTesterTimeout() (testerPresentTimeout = 0) + +/* Parameter to the function FblDiagEcuReset() */ +#define kDiagResetNoResponse ((vuint8) 0x00u) +#define kDiagResetPutResponse ((vuint8) 0x01u) +#define kDiagResetStayInBoot ((vuint8) 0x02u) + +/* Macros for access of reset options */ +#define GetResetOptionPutResponse(var) (((var) & kDiagResetPutResponse) == kDiagResetPutResponse) +#define GetResetOptionStayInBoot(var) (((var) & kDiagResetStayInBoot) == kDiagResetStayInBoot) + +/* Parameters for busy response handling function */ +#define kNotForceSendResponsePending ((vuint8) 0x00u) +#define kForceSendResponsePending ((vuint8) 0x01u) + +#define DiagProcessingDone(len) DiagResponseProcessor(len) +#define DiagSetNoResponse() (diagResponseFlag = 0) + +/* Error state function, removed if not defined */ +#if !defined( FblErrStatSetAddress ) +# define FblErrStatSetAddress(address) +#endif +#if !defined( FblErrStatSetError ) +# define FblErrStatSetError(errNo) +#endif +#if !defined( FblErrStatSetSId ) +# define FblErrStatSetSId(SId) +#endif + +/* Security levels */ +#define kDiagSecLevelNone ((vuint8) 0x00u) +#define kDiagSecLevelFlash ((vuint8) 0x01u) + +/* Macros for security access */ +#define kDiagNrOfSecurityLevels (0x01u) + +#if !defined( kDiagSubSecTypeMask ) +# define kDiagSubSecTypeMask ((vuint8) 0x7Fu) +#endif + +#if !defined( kDiagSubRequestSeed ) +# define kDiagSubRequestSeed ((vuint8) 0x01u) +#endif + +#if !defined( kDiagSubSendKey ) +# define kDiagSubSendKey ((vuint8) 0x02u) +#endif + +/* Map length defines used by fbl_diag to SecModHis */ +#if !defined( kSecSeedLength ) +# define kSecSeedLength (SEC_SEED_LENGTH) +#endif + +#if !defined( kSecKeyLength ) +# define kSecKeyLength (SEC_KEY_LENGTH) +#endif + +#if !defined( kSecSecretKeyLength ) +# define kSecSecretKeyLength (SEC_SECRET_KEY_LENGTH) +#endif + +#if !defined( kSecCrcLength ) +# define kSecCrcLength (SEC_SIZE_CHECKSUM_CRC) +#endif + +/* Access macros for user diagnostic call-backs */ +#define DiagPutResponseSId(a) (DiagBuffer[0] = (a)) +#define DiagGetRequestSId() (DiagBuffer[0]) + +/* Read memory function for flash driver validation */ +#define FblReadRam FblReadBlock + +/* Internal segment size as used by the diagnostic layer */ +#if !defined( FBL_DIAG_SEGMENT_SIZE ) +# define FBL_DIAG_SEGMENT_SIZE (FBL_MAX_SEGMENT_SIZE) +#endif + +/* Special values for indices into logical block table */ +#define kBlockNrInvalid 0xFFu + +/* Access macros for combined memory identifier/address type */ +#define FblDiagGetMemId(var) +#define FblDiagGetMemAddr(var) ((var)) + +#define FblDiagSetMemId(var, value) +#define FblDiagSetMemAddr(var, value) ((var) = (value)) + +#define FblDiagAddMemAddr(var, value) ((var) += (value)) + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +/* Extract encryption/compression mode from the data format identifier */ +#define FblDiagGetEncryptionMode(dfi) ((vuint8)((dfi) & kDiagFmtEncryptionMask)) +#define FblDiagGetCompressionMode(dfi) ((vuint8)(((dfi) & kDiagFmtCompressionMask) >> 4)) +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_ENABLE_SLEEPMODE ) +/* Sleep mode handling */ +# define kFblSleepDelayTime ((vuint32)(FBL_SLEEP_TIME / FBL_REPEAT_CALL_CYCLE)) +# define FblSleepCounterClear() (sleepCounter = 0x00u) +# define FblSleepCounterReload() (sleepCounter = kFblSleepDelayTime) +# define FblDecSleepCounter() (sleepCounter--) +# define FblGetSleepCounter() ((vuint32) sleepCounter) +#endif +/* PRQA L:TAG_FblDiag_3453_2 */ + +/* Minimum length of address parameter to Check Programming Dependencies */ +#define kDiagCheckProgDepAdressMinLength 0x80u + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/* Security access levels */ +typedef struct tagSecurityLevel +{ + vuint8 accessType; + vuint8 stateIdxKey; + vuint8 stateIdxAccess; +} tSecurityLevel; + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +typedef struct tagDiagSecAccessParams +{ + vuint8 secLevel; /** Security Level = sub function parameter of seed request */ + vuint16 seedLength; /** Size of seed parameter */ + vuint16 keyLength; /** Size of key parameter */ +} tDiagSecAccessParams; +#endif /* FBL_ENABLE_SEC_ADDITIONAL_LEVELS */ + +/* Combined data type for memory identifier and address */ +typedef tFblAddress tFblDiagAddr; + +/* Logical block state definition */ +typedef enum +{ + kBlockState_Init, + kBlockState_Erased, + kBlockState_Verified +} tBlockState; + +/* Header with runtime information about logical block */ +typedef struct +{ + tBlockState state; + vuint8 nrOfSegments; + vuint8 segmentIdx[SWM_DATA_MAX_NOAR]; +} tBlockHeader; + +/** Structure for address and length information of segments */ +typedef struct +{ + tFblAddress targetAddress; + tFblLength length; + vuint8 checksum[SEC_VERIFY_CLASS_DDD_VERIFY_SIZE]; +} tDiagSegmentInfo; + +/** Segment data structure */ +typedef struct +{ + vuint8 nrOfSegments; + tDiagSegmentInfo segmentInfo[SWM_DATA_MAX_NOAR]; +} tDiagSegmentList; + + + +#if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# if defined( FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING ) +/* Return values for token handling */ +typedef enum +{ + kTokenHdlrOk = 0, + kTokenHdlrProtocolFailed = 1, + kTokenHdlrSyncPKeyValFailed = 2, + kTokenHdlrFesnFailed = 3, + kTokenHdlrTimeTokenFailed = 4, +# if defined (FBL_DIAG_SINGLE_KEY) + kTokenHdlrKeyChangeFailed = 5, +# endif + kTokenHdlrSignatureFailed = 6, + kTokenHdlrTokenApplPassed = 7, + kTokenHdlrTokenSignFailed = 8, + kTokenHdlrInternalFailed = 9 +} tTokenHdlResult; + +typedef enum +{ + FBL_DIAG_SRVMSGID_NOTSTORED = 0, + FBL_DIAG_SRVMSGID_STORED = 1 +} tFblDiagSrvMsgIdStoreStatus; + +# endif /* FBL_ENABLE_TOKEN_DOWNLOAD_HANDLING */ +#endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + +/*********************************************************************************************************************** + * PROTOTYPES + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +void FblDiagTimerTask( void ); +void FblDiagStateTask( void ); +vuint8 FblRealTimeSupport( void ); +void FblRealTimeSupportVoid( void ); + +void FblDiagPostInit( void ); +void FblDiagEcuReset(vuint8 resetOptions, vuint8 responseFlag); +void FblDiagInitPowerOn( void ); +void FblDiagInit( void ); +vuint8 FblDiagGetLastErasedBlock( void ); +void FblDiagSetLastErasedBlock( vuint8 blockNr ); + +void DiagResponseProcessor( tCwDataLengthType dataLength ); + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +void DiagExRCRResponsePending( vuint8 forceSend ); + +void FblDiagTxErrorIndication( vuint8 cwMsgType ); +void FblDiagRxIndication( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * pbDiagBuffer, tCwDataLengthType rxDataLength ); +void FblDiagTxConfirmation( vuint8 cwMsgType ); +vuint8* FblDiagRxGetPhysBuffer( tCwDataLengthType rxDataLength ); +vuint8* FblDiagRxGetFuncBuffer( tCwDataLengthType rxDataLength ); +void FblDiagRxStartIndication( void ); +void FblDiagRxErrorIndication( void ); +#define FBLDIAG_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +vuint8 FblDiagCheckStartMsg(const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *pData, vuintx length); +vuint8 FblDiagGetSegmentList(vuint8 blockIdx, V_MEMRAM1 tDiagSegmentList V_MEMRAM2 V_MEMRAM3 * blockSegList); + +/* Response suppression (exported for user service/routine functions) */ +void CheckSuppressPosRspMsgIndication( V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 *subparam ); + +tFblResult FblDiagMemPreWrite( void ); +tFblResult FblDiagMemPostWrite( void ); + + +#define FBLDIAG_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* -- 14229 based -- */ +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * V_MEMRAM1 V_MEMRAM2 DiagBuffer; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 diagErrorCode; +V_MEMRAM0 extern V_MEMRAM1 tCwDataLengthType V_MEMRAM2 DiagDataLength; +V_MEMRAM0 extern V_MEMRAM1_NEAR vuint16 V_MEMRAM2_NEAR P2Timeout; +V_MEMRAM0 extern V_MEMRAM1_NEAR vuint16 V_MEMRAM2_NEAR testerPresentTimeout; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 diagResponseFlag; +V_MEMRAM0 extern V_MEMRAM1_NEAR vuint8 V_MEMRAM2_NEAR diagServiceCurrent; +V_MEMRAM0 extern V_MEMRAM1_NEAR tStateBitmap V_MEMRAM2_NEAR fblStates[STATE_INDEX(kDiagNumberOfStates - 1u) + 1u]; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 diagCurrentSecLvl; + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_ENABLE_SEC_ADDITIONAL_LEVELS ) +#define FBLDIAG_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMROM0 extern V_MEMROM1 tDiagSecAccessParams V_MEMROM2 kDiagSecAccessParams[]; + +#define FBLDIAG_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 diagRequestedSecLvlIdx; + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif + +#define FBLDIAG_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +#if defined( FBL_ENABLE_DEBUG_STATUS ) +/* Variables for error status reporting */ +V_MEMRAM0 extern V_MEMRAM1 vuint16 V_MEMRAM2 errStatErrorCode; +V_MEMRAM0 extern V_MEMRAM1 vuint16 V_MEMRAM2 errStatFblStates; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 errStatLastServiceId; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 errStatFlashDrvVersion[3]; +V_MEMRAM0 extern V_MEMRAM1 vuint16 V_MEMRAM2 errStatFlashDrvErrorCode; +V_MEMRAM0 extern V_MEMRAM1 tBlockDescriptor V_MEMRAM2 errStatDescriptor; +#endif + +#if defined( FBL_ENABLE_SLEEPMODE ) +V_MEMRAM0 extern V_MEMRAM1 vuint32 V_MEMRAM2 sleepCounter; +#endif + +#define FBLDIAG_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ + +#if ( kFblOk != 0x00 ) +# error "Error in fbl_def.h: use kFblOk as 0x00" +#endif + +#if !( defined( FBL_ENABLE_SYSTEM_CHECK ) || defined( FBL_DISABLE_SYSTEM_CHECK ) ) +# error "Error in fbl_cfg.h: Usage of system check not defined" +#endif + +#if !( defined( FBL_ENABLE_APPL_TASK ) || defined( FBL_DISABLE_APPL_TASK ) ) +# error "Error in fbl_cfg.h: Usage of application task function not defined" +#endif + +#if !( defined( FBL_ENABLE_USERSUBFUNCTION ) || defined( FBL_DISABLE_USERSUBFUNCTION ) ) +# error "Error in fbl_cfg.h: Usage of diag user-subfunction call not defined" +#endif + +#if !( defined( FBL_ENABLE_ENCRYPTION_MODE ) || defined( FBL_DISABLE_ENCRYPTION_MODE ) ) +# error "Error in fbl_cfg.h: Usage of decryption interface not defined" +#endif + +#if !( defined( FBL_WATCHDOG_ON ) || defined( FBL_WATCHDOG_OFF ) ) +# error "Error in fbl_cfg.h: Usage of watchdog support not defined" +#endif + +#if defined( FBL_WATCHDOG_ON ) && !defined( FBL_WATCHDOG_TIME ) +# error "Error in fbl_cfg.h: Watchdog trigger period not defined" +#endif + +#if !( defined( FBL_ENABLE_FBL_START ) || defined( FBL_DISABLE_FBL_START ) ) +# error "Error in fbl_cfg.h: Usage of FblStart function not defined" +#endif + +#if !defined( SWM_DATA_MAX_NOAR ) +# error "Error in fbl_cfg.h: Number of supported download segments (SWM_DATA_MAX_NOAR) not defined" +#endif + +#if !defined( FBL_HEADER_ADDRESS ) +# error "Error in fbl_cfg.h: Start address of bootblock header not defined" +#endif + +#if !defined( FBL_DIAG_BUFFER_LENGTH ) +# error "Error in fbl_cfg.h: FBL_DIAG_BUFFER_LENGTH not defined" +#endif + +#if ( FBL_DIAG_BUFFER_LENGTH < (FBL_DIAG_SEGMENT_SIZE+0x01u) ) +# error "Error in fbl_cfg.h: DiagBuffer size too small - modify FBL_DIAG_BUFFER_LENGTH" +#endif + +# if ( FBL_DIAG_BUFFER_LENGTH > 4095u ) +# error "Error in fbl_cfg.h: DiagBuffer size larger than supported by TP" +# endif +# if ( FBL_DIAG_BUFFER_LENGTH != kFblTpBufferSize ) +# error "Error in fbl_cfg.h: Inconsistent configuration of diag buffer size (see ftp_cfg.h)" +# endif + +#if !defined( FBL_DIAG_TIME_P3MAX ) +# error "Error in fbl_cfg.h: P2Star time not defined" +#endif + +#if !defined( FLASH_SIZE ) +# error "Error in fbl_cfg.h: Size of flash code buffer not defined" +#endif + +#if !defined( FBL_MAX_SEGMENT_SIZE ) +# error "Error in fbl_mio.h: Maximum device segment size not defined" +#endif + +#if defined( FBL_ENABLE_DATA_PROCESSING ) ||\ + defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +# if defined( FBL_ENABLE_COMPRESSION_MODE ) && !defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) +/* Ford specific: tester/download tool transmits always the compressed data length */ +# error "Error in fbl_cfg.h: Support for compressed data length not activated" +# endif +#endif +#if defined( FBL_ENABLE_COMPRESSION_MODE ) && !defined( FBL_ENABLE_DATA_PROCESSING ) +# error "Error in fbl_cfg.h: Compression/Encryption Mode requires the data processing interface" +#endif + + +#if defined( FBL_ENABLE_PRESENCE_PATTERN ) && !defined( FBL_ENABLE_USE_LOGICAL_BLOCKS ) +# error "Error in fbl_cfg.h: Presence pattern implementation requires the usage of logical blocks" +#endif + +#if !defined( FBL_ENABLE_SEED_KEY_MODULE ) && ( FBL_PROJECT_STATE != FBL_INTEGRATION ) +# error "Error in fbl_cfg.h: Usage of seed/key module is mandatory for production ECUs" +#endif + +#if ((FBL_MAX_DID_COUNT < 1) || (FBL_MAX_DID_COUNT > 255)) +# error "Error in fbl_cfg.h: Unsupported value for maximum amount of read DIDs" +#endif + + +#if (SEC_SECURITY_CLASS != SEC_CLASS_CCC) && (SEC_SECURITY_CLASS != SEC_CLASS_DDD) +# error "Error in SecM_cfg.h: Unsupported security class selected" +#endif + +#if !defined( FBL_MTAB_SBL_BLOCK_NUMBER ) +# error "Error in fbl_mtab.h: Logical block for SBL not defined or wrong name (required: SBL)" +#endif + +/* Warn if legacy configuration switches are used */ +#if defined( FBL_ENABLE_DIAG_SESSION_PARAMETERS ) || \ + defined( FBL_ENABLE_FIXED_TRANSFER_ALFI ) || \ + defined( FBL_ENABLE_UPLOAD ) || \ + defined( FBL_ENABLE_WRITE_DATA_BY_IDENTIFIER ) +# error "Error in fbl_cfg.h: Legacy configuration switches detected. Please update GenTool/PreConfig!" +#endif + +#endif /* FBL_DIAG_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_DIAG.H + **********************************************************************************************************************/ + diff --git a/Source/bsw/Fbl/fbl_diag.imp b/Source/bsw/Fbl/fbl_diag.imp new file mode 100644 index 0000000..ef8e88f --- /dev/null +++ b/Source/bsw/Fbl/fbl_diag.imp @@ -0,0 +1,355 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Diagnostic services supported in boot mode + * Data structure creation for state machine + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLDIAG_14229_FORD_VERSION != 0x0507u ) || \ + ( FBLDIAG_14229_FORD_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_diag.imp: State machine implementation and source are inconsistent!" +#endif + +/* PRQA S 0342 EOF */ /* MD_MSR_Rule20.10_0342 */ +/* PRQA S 0883 EOF */ /* MD_FblDiag_0883 */ + +/* --------------------------------------------------------------------------- */ +/* Implementation type: Output */ +/* --------------------------------------------------------------------------- */ +/* Output according to FBL_DIAG_STATE_DEF and FBL_DIAG_IMPL_OUTPUT */ +/* , e.g. FBL_DIAG_STATE_DEF = kDiagService ## name, */ +/* FBL_DIAG_IMPL_OUTPUT = FBL_DIAG_STATE_RESULT, */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_OUTPUT ) +FBL_DIAG_IMPL_OUTPUT +#endif + +/* --------------------------------------------------------------------------- */ +/* Implementation type: State bitmap */ +/* --------------------------------------------------------------------------- */ +/* Generate state bitmap entries */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_STATEBITMAP ) +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) set +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) + STATE_BUILDARRAYENTRIES(FBL_DIAG_STATE_RESULT), +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) unset +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) + STATE_BUILDARRAYENTRIES(FBL_DIAG_STATE_RESULT), +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) add +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) + STATE_BUILDARRAYENTRIES(FBL_DIAG_STATE_RESULT), +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) clear +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) + STATE_BUILDARRAYENTRIES(FBL_DIAG_STATE_RESULT), +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) clearFail +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) + STATE_BUILDARRAYENTRIES(FBL_DIAG_STATE_RESULT), +# endif +# undef FBL_DIAG_STATE_DEF +#endif + +/* --------------------------------------------------------------------------- */ +/* Implementation type: Service property */ +/* --------------------------------------------------------------------------- */ +/* Generate the service properties, including service IDs, references to child */ +/* node lists and handler functions */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_SERVICEPROPERTY ) +# if defined( None ) +# undef None +# endif +# define None 0xFFFFFFFFu + +# if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) set +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) +# define USAGE_MASK_SET 0x01u +# else +# define USAGE_MASK_SET 0x00u +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) unset +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) +# define USAGE_MASK_UNSET 0x02u +# else +# define USAGE_MASK_UNSET 0x00u +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) add +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) +# define USAGE_MASK_ADD 0x04u +# else +# define USAGE_MASK_ADD 0x00u +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) clear +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) +# define USAGE_MASK_CLEAR 0x08u +# else +# define USAGE_MASK_CLEAR 0x00u +# endif +# undef FBL_DIAG_STATE_DEF + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) clearFail +# if (FBL_DIAG_STATE_RESULT != kDiagStateNone) +# define USAGE_MASK_CLEARFAIL 0x10u +# else +# define USAGE_MASK_CLEARFAIL 0x00u +# endif +# undef FBL_DIAG_STATE_DEF +# endif + + { + +# if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) +# else +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) firstChild +# if (FBL_DIAG_STATE_RESULT != None) +# undef FBL_DIAG_STATE_DEF +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) &kDiagSubFctTbl_ ## name + + FBL_DIAG_STATE_RESULT, +# else + kDiagNoSubServices, +# endif +# undef FBL_DIAG_STATE_DEF +# endif + +# if defined( FBL_DIAG_STATE_ARRAYS ) +# if !defined( STATE_PREFIX ) +# define STATE_PREFIX { +# endif +# if !defined( STATE_POSTFIX ) +# define STATE_POSTFIX } +# endif +# else +# if !defined( STATE_PREFIX ) +# define STATE_PREFIX +# endif +# if !defined( STATE_POSTFIX ) +# define STATE_POSTFIX +# endif +# endif + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) checks +# if defined( FBL_DIAG_CHECK_LIST_HANDLES ) +# define FBL_DIAG_STATE_DEF_CHECKIDX(checks) ,checks +# define FBL_DIAG_STATE_DEF_CHECKS(checks) +# else +# if (FBL_DIAG_STATE_RESULT != None) +# define FBL_DIAG_STATE_DEF_CHECKIDX(checks) +# define FBL_DIAG_STATE_DEF_CHECKS(checks) ,&checks +# else +# define FBL_DIAG_STATE_DEF_CHECKIDX(checks) +# define FBL_DIAG_STATE_DEF_CHECKS(checks) ,kDiagNoCheckList +# endif +# endif +# undef FBL_DIAG_STATE_DEF + +# if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) \ + kDiagSrvId_ ## name \ + FBL_DIAG_STATE_DEF_CHECKS( kDiag ## checks ## Table ) \ + ,rqlMin \ + ,rqlMax \ + ,(USAGE_MASK_SET | USAGE_MASK_UNSET | USAGE_MASK_ADD | USAGE_MASK_CLEAR | USAGE_MASK_CLEARFAIL) \ + ,kServiceMainHandler ## handler \ + FBL_DIAG_STATE_DEF_CHECKIDX( kServiceCheckList ## checks ) +# else +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) \ + kDiagSrvId_ ## name \ + FBL_DIAG_STATE_DEF_CHECKS( kDiag ## checks ## Table ) \ + ,rqlMin \ + ,rqlMax \ + ,STATE_PREFIX \ + STATE_BUILDARRAY(set) \ + ,STATE_BUILDARRAY(unset) \ + ,STATE_BUILDARRAY(add) \ + ,STATE_BUILDARRAY(clear) \ + ,STATE_BUILDARRAY(clearFail) \ + STATE_POSTFIX \ + ,kServiceMainHandler ## handler \ + FBL_DIAG_STATE_DEF_CHECKIDX( kServiceCheckList ## checks ) +# endif + +FBL_DIAG_STATE_RESULT + +# undef FBL_DIAG_STATE_DEF_CHECKIDX +# undef FBL_DIAG_STATE_DEF_CHECKS +# undef FBL_DIAG_STATE_DEF + +# if defined( FBL_DIAG_SERVICE_LIST_HANDLES ) +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) firstChild +# if (FBL_DIAG_STATE_RESULT != None) +# undef FBL_DIAG_STATE_DEF +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) kDiagServiceListHandler_ ## name + + ,FBL_DIAG_STATE_RESULT +# else + ,kDiagServiceListHandler_None +# endif +# undef FBL_DIAG_STATE_DEF +# endif + }, + +# if defined( FBL_DIAG_ENABLE_RAM_STATETABLES ) +# undef USAGE_MASK_SET +# undef USAGE_MASK_UNSET +# undef USAGE_MASK_ADD +# undef USAGE_MASK_CLEAR +# undef USAGE_MASK_CLEARFAIL +# endif +# undef None +#endif + +/* --------------------------------------------------------------------------- */ +/* Implementation type: Service list */ +/* --------------------------------------------------------------------------- */ +/* Generate list of all services, referencing the service properties */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_SERVICELIST ) +# if defined( None ) +# undef None +# endif +# define None 0xFFFFFFFFu + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) firstChild +# if (FBL_DIAG_STATE_RESULT != None) +# undef FBL_DIAG_STATE_DEF +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) \ + V_MEMROM0 static V_MEMROM1 tServiceList V_MEMROM2 kDiagSubFctTbl_ ## name = \ + { \ + &kDiagServiceProperties[kDiagService ## firstChild] \ + ,(bufPos) \ + ,(sizeof(kDiagSrvId_ ## firstChild)/sizeof(kDiagSrvId_ ## firstChild [0])) \ + ,((kDiagService ## lastChild - kDiagService ## firstChild) + 1) \ + } + +FBL_DIAG_STATE_RESULT; +# endif + +# undef None +# undef FBL_DIAG_STATE_DEF +#endif + +/* --------------------------------------------------------------------------- */ +/* Implementation type: Service list handler */ +/* --------------------------------------------------------------------------- */ +/* Generate list of child node references */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_SERVICELIST_HANDLER ) +# if defined( None ) +# undef None +# endif +# define None 0xFFFFFFFFu + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) firstChild +# if (FBL_DIAG_STATE_RESULT != None) +# undef FBL_DIAG_STATE_DEF +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) &kDiagSubFctTbl_ ## name + +FBL_DIAG_STATE_RESULT, +# endif + +# undef None +# undef FBL_DIAG_STATE_DEF +#endif + +/* --------------------------------------------------------------------------- */ +/* Implementation type: Service list enumeration */ +/* --------------------------------------------------------------------------- */ +/* Generate list of handles to access service list handlers */ +/* --------------------------------------------------------------------------- */ +#if ( FBL_DIAG_IMPL_TYPE == FBL_DIAG_IMPL_TYPE_SERVICELIST_ENUM ) +# if defined( None ) +# undef None +# endif +# define None 0xFFFFFFFFu + +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) firstChild +# if (FBL_DIAG_STATE_RESULT != None) +# undef FBL_DIAG_STATE_DEF +# define FBL_DIAG_STATE_DEF(name, parent, firstChild, lastChild, bufPos, id, handler, checks, set, unset, add, clear, clearFail, rqlMin, rqlMax) kDiagServiceListHandler_ ## name + +FBL_DIAG_STATE_RESULT, +# endif + +# undef None +# undef FBL_DIAG_STATE_DEF +#endif + +/* --------------------------------------------------------------------------- */ +/* Reset result define */ +/* --------------------------------------------------------------------------- */ +#undef FBL_DIAG_STATE_RESULT + +/*********************************************************************************************************************** + * END OF FILE: FBL_DIAG.IMP + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_flio.c b/Source/bsw/Fbl/fbl_flio.c new file mode 100644 index 0000000..e0126f6 --- /dev/null +++ b/Source/bsw/Fbl/fbl_flio.c @@ -0,0 +1,362 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Flash Driver wrapper functions using an Autosar Fls driver + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-08-15 vistbe - Initial version + * 01.01.00 2020-08-12 visrie FBL-1953 Add support for downloadable driver + * 01.02.00 2022-01-21 visjdn FBL-4535 Support secondary/tertiary use-case + * Added/adapted MemMap sections + **********************************************************************************************************************/ + +#define FBL_FLIO_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_flio.h" +#include "fbl_flio_cfg.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if (FBLWRAPPERFLASH_ASRFLSHIS_VERSION != 0x0102u) || \ + (FBLWRAPPERFLASH_ASRFLSHIS_RELEASE_VERSION != 0x00u) +# error "Error in fbl_flio.c: Source and header file are inconsistent!" +#endif + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/** Flash driver state handling */ +typedef enum +{ + kFlashInitState_Uninit = 0u, /**< Flash driver has not be initialized yet */ + kFlashInitState_ReadDriver, /**< Read-only flash driver is active/initialized */ + kFlashInitState_FullDriver /**< Full flash driver (read, write and erase) is active/initialized */ +} tFlashInitState; + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLFLIO_FLASHCODE_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 flashCode[FLASH_SIZE]; +#define FBLFLIO_FLASHCODE_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLFLIO_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** Current initialization state of the flash driver */ +V_MEMRAM0 static V_MEMRAM1 tFlashInitState V_MEMRAM2 initState; +#define FBLFLIO_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLFLIO_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +static IO_ErrorType FlashDriver_PollFls( void ); + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FlashDriver_PollFls + **********************************************************************************************************************/ +/*! \brief Executes operation and polls the status + * \details Calls the Fls main function and polls the status of the flash operation + * \pre Flash driver/Fls is initialized, operation has been started + * \return IO_E_OK in case of success, otherwise IO_E_NOT_OK + **********************************************************************************************************************/ +static IO_ErrorType FlashDriver_PollFls( void ) +{ + IO_ErrorType returnValue; + tFlashUint32 i; + + returnValue = IO_E_NOT_OK; + i = 0u; + + while (FBL_FLASHFLS_GETSTATUS() == MEMIF_BUSY) + { + /* Poll the watchdog frequently */ /* PRQA S 2991, 2995 1 */ /* MD_FblWrapperFlash_2991_2995 */ + if ((i & (FBL_FLASHFLS_WD_POLLING_INTERVAL - 1u)) == 0x00u) + { + FblLookForWatchdogVoid(); + } + i++; + FBL_FLASHFLS_MAINFUNCTION(); + } + + if (FBL_FLASHFLS_GETJOBRESULT() == MEMIF_JOB_OK) + { + returnValue = IO_E_OK; + } + + return returnValue; +} + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FlashDriver_InitPowerOnSync + **********************************************************************************************************************/ +/*! \brief Initialize modules variables and read-only driver + * \return The return code shows the success of the initialization + **********************************************************************************************************************/ +IO_ErrorType FlashDriver_InitPowerOnSync(void) +{ + IO_ErrorType returnValue; + + initState = kFlashInitState_Uninit; + returnValue = IO_E_NOT_OK; + + FBL_FLASHFLS_INITMEMORY(); + FBL_FLASHFLS_INIT(); + + if (FBL_FLASHFLS_GETJOBRESULT() == MEMIF_JOB_OK) + { + initState = kFlashInitState_ReadDriver; + returnValue = IO_E_OK; + } + + return returnValue; +} + +/*********************************************************************************************************************** + * FlashDriver_InitSync + **********************************************************************************************************************/ +/*! \brief Initializes the flash driver + * \details Initializes the Fls module + * \pre None + * \param[in] *address Unused parameter to implement HIS interface + * \return IO_E_OK in case of success, otherwise IO_E_NOT_OK + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +IO_ErrorType FlashDriver_InitSync( void* address ) +{ + IO_ErrorType returnValue; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)address; +#endif + + /* Verify if flashcode signature is correct */ /* PRQA S 0488 3 */ /* MD_FblWrapperFlash_0488 */ + if ( (FLASH_DRIVER_MCUTYPE(flashCode) != FLASH_DRIVER_VERSION_MCUTYPE) + || (FLASH_DRIVER_MASKTYPE(flashCode) != FLASH_DRIVER_VERSION_MASKTYPE) + || (FLASH_DRIVER_INTERFACE(flashCode) != FLASH_DRIVER_VERSION_INTERFACE) + ) + { + /* Flash driver signature mismatch, wrong flash driver */ + returnValue = IO_E_NOT_OK; + } + else + { + initState = kFlashInitState_FullDriver; + returnValue = IO_E_OK; + } + + return returnValue; +} + +/*********************************************************************************************************************** + * FlashDriver_DeinitSync + **********************************************************************************************************************/ +/*! \brief Deinitializes the flash driver + * \details No functionality, just to satisfy interface + * \pre None + * \param[in] *address Unused parameter to implement HIS interface + * \return Always IO_E_OK + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +IO_ErrorType FlashDriver_DeinitSync( void* address ) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 1 */ /* MD_MSR_DummyStmt */ + (void)address; +#endif + + return IO_E_OK; +} + +/*********************************************************************************************************************** + * FlashDriver_RWriteSync + **********************************************************************************************************************/ +/*! \brief Writes data to flash memory + * \details This function programs flash memory by calling the Fls write routine + * \pre Flash driver/Fls is initialized, memory to be programmed is erased + * \param[in] writeBuffer Pointer to input data buffer. + * \param[in] writeLength Data length + * \param[in] writeAddress Write target address + * \return IO_E_OK in case of success, otherwise IO_E_NOT_OK + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +IO_ErrorType FlashDriver_RWriteSync( IO_MemPtrType writeBuffer, IO_SizeType writeLength, IO_PositionType writeAddress ) +{ + IO_ErrorType returnValue; + + /* Verify if flashcode signature is correct */ /* PRQA S 0488 3 */ /* MD_FblWrapperFlash_0488 */ + if ( (FLASH_DRIVER_MCUTYPE(flashCode) != FLASH_DRIVER_VERSION_MCUTYPE) + || (FLASH_DRIVER_MASKTYPE(flashCode) != FLASH_DRIVER_VERSION_MASKTYPE) + || (FLASH_DRIVER_INTERFACE(flashCode) != FLASH_DRIVER_VERSION_INTERFACE) + ) + { + /* Flash driver signature mismatch, wrong flash driver */ + returnValue = IO_E_NOT_OK; + } + else + { + if (initState != kFlashInitState_FullDriver) + { + /* Driver was not initialized yet */ + returnValue = IO_E_NOT_OK; + } + else + { + if (FBL_FLASHFLS_WRITE(writeAddress, writeBuffer, writeLength) == E_OK) + { + returnValue = FlashDriver_PollFls(); + } + else + { + returnValue = IO_E_NOT_OK; + } + } + } + + return returnValue; +} + +/*********************************************************************************************************************** + * FlashDriver_REraseSync + **********************************************************************************************************************/ +/*! \brief Erases area in flash memory + * \details This function erases one or more logical sectors + * \pre Flash driver/Fls is initialized + * \param[in] eraseLength Length of memory to be erased. The length has to be aligned to the length + * of one or more flash sectors + * \param[in] eraseAddress Start address of erase area. The start address has to be the start + * address of a logical flash sector + * \return IO_E_OK in case of success, otherwise IO_E_NOT_OK + **********************************************************************************************************************/ +IO_ErrorType FlashDriver_REraseSync( IO_SizeType eraseLength, IO_PositionType eraseAddress ) +{ + IO_ErrorType returnValue; + + /* Verify if flashcode signature is correct */ /* PRQA S 0488 3 */ /* MD_FblWrapperFlash_0488 */ + if ( (FLASH_DRIVER_MCUTYPE(flashCode) != FLASH_DRIVER_VERSION_MCUTYPE) + || (FLASH_DRIVER_MASKTYPE(flashCode) != FLASH_DRIVER_VERSION_MASKTYPE) + || (FLASH_DRIVER_INTERFACE(flashCode) != FLASH_DRIVER_VERSION_INTERFACE) + ) + { + /* Flash driver signature mismatch, wrong flash driver */ + returnValue = IO_E_NOT_OK; + } + else + { + if (initState != kFlashInitState_FullDriver) + { + /* Driver was not initialized yet */ + returnValue = IO_E_NOT_OK; + } + else + { + if (FBL_FLASHFLS_ERASE(eraseAddress, eraseLength) == E_OK) + { + returnValue = FlashDriver_PollFls(); + } + else + { + /* Erase request failed */ + returnValue = IO_E_NOT_OK; + } + } + } + + return returnValue; +} + +/*********************************************************************************************************************** + * FlashDriver_RReadSync + **********************************************************************************************************************/ +/*! \brief Reads data from flash memory + * \details This function reads data from flash memory by calling the Fls Read function + * \pre Flash driver/Fls is initialized + * \param[out] readBuffer Pointer to read target buffer. The buffer size must be at least readLength Bytes + * \param[in] readLength Size of data to be read + * \param[in] readAddress Start address of data to be read + * \return IO_E_OK in case of success, otherwise IO_E_NOT_OK + **********************************************************************************************************************/ +IO_ErrorType FlashDriver_RReadSync( IO_MemPtrType readBuffer, IO_SizeType readLength, IO_PositionType readAddress ) +{ + IO_ErrorType returnValue; + + returnValue = IO_E_NOT_OK; + + if (initState != kFlashInitState_Uninit) + { + if (FBL_FLASHFLS_READ(readAddress, readBuffer, readLength) == E_OK) + { + returnValue = FlashDriver_PollFls(); + } + } + + return returnValue; +} + +#define FBLFLIO_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* module specific MISRA deviations: + + MD_FblWrapperFlash_0488 + Reason: Performing pointer arithmetic to get version information of flash driver from flash code buffer. + Risk: If "unsigned char" doesn't have a size of 1 Byte, the comparison will lead to wrong results. + Prevention: Check if "unsigned char" has a size of 1 Byte on used platform. + + MD_FblWrapperFlash_2991_2995: + Reason: The value of the if-controlling expression depends on the configuration. + Risk: No risk. + Prevention: No prevention necessary. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_FLIO.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_flio.h b/Source/bsw/Fbl/fbl_flio.h new file mode 100644 index 0000000..e64f8be --- /dev/null +++ b/Source/bsw/Fbl/fbl_flio.h @@ -0,0 +1,90 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Flash Driver wrapper functions using an Autosar FLS driver + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-08-15 vistbe - Initial version + * 01.01.00 2020-08-12 visrie FBL-1953 Add support for downloadable driver + * 01.02.00 2022-01-21 visjdn FBL-4535 Support secondary/tertiary use-case + * Added/adapted MemMap sections + **********************************************************************************************************************/ + +#ifndef FBLWRAPPERFLASH_ASRFLSHIS_H +#define FBLWRAPPERFLASH_ASRFLSHIS_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblWrapperFlash_AsrFlsHis CQComponent : Implementation */ +#define FBLWRAPPERFLASH_ASRFLSHIS_VERSION 0x0102u +#define FBLWRAPPERFLASH_ASRFLSHIS_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( FLASH_SIZE ) +#else +# define FLASH_SIZE 4u +#endif + +/** Determines I/O mode of driver (blocking/non-blocking) */ +#define IO_DRIVERMODUS SYNCRON +/** Type of the memory device */ +#define IO_DEVICETYPE RANDOM + +#define FlashDriver_GetVersionOfDriver() ((IO_U32)(FLASH_DRIVER_VERSION_MAJOR << 16u) |\ + (IO_U32)(FLASH_DRIVER_VERSION_MINOR << 8u) |\ + FLASH_DRIVER_VERSION_PATCH ) + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLFLIO_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +IO_ErrorType FlashDriver_InitPowerOnSync( void ); +IO_ErrorType FlashDriver_InitSync( void * address ); +IO_ErrorType FlashDriver_DeinitSync( void * address ); +IO_ErrorType FlashDriver_RWriteSync( IO_MemPtrType writeBuffer, IO_SizeType writeLength, IO_PositionType writeAddress ); +IO_ErrorType FlashDriver_REraseSync( IO_SizeType eraseLength, IO_PositionType eraseAddress ); +IO_ErrorType FlashDriver_RReadSync( IO_MemPtrType readBuffer, IO_SizeType readLength, IO_PositionType readAddress ); +#define FBLFLIO_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + **********************************************************************************************************************/ + +#define FBLFLIO_FLASHCODE_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 flashCode[FLASH_SIZE]; +#define FBLFLIO_FLASHCODE_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBLWRAPPERFLASH_ASRFLSHIS_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_FLIO.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_fsm.c b/Source/bsw/Fbl/fbl_fsm.c new file mode 100644 index 0000000..4bd4fe7 --- /dev/null +++ b/Source/bsw/Fbl/fbl_fsm.c @@ -0,0 +1,419 @@ +/********************************************************************************************************************** + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Event-driven hierarchical finite state machine implementation + * + * ------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/*********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-10-30 visjhg - First implementation + * 01.00.01 2012-12-10 visjhg - No changes + * 01.01.00 2013-12-11 visjhg ESCAN00071901 Renamed package to FblLib_Fsm + * visase - Performed MISRA checks + * 01.01.01 2019-01-24 visrie ESCAN00101864 No changes + * 01.02.00 2023-12-15 vistbe FBL-7986 Perform MISRA analysis + * Added/adapted MemMap sections + *********************************************************************************************************************/ + +#define FBL_FSM_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "fbl_fsm_inc.h" + +/********************************************************************************************************************** + * VERSION + *********************************************************************************************************************/ + +/* --- Version check --- */ +#if ( FBLLIB_FSM_VERSION != 0x0102u ) || \ + ( FBLLIB_FSM_RELEASE_VERSION != 0x00u ) +# error "Error in FBL_FSM.C: Source and header file are inconsistent!" +#endif + +#if ( FBLLIB_FSM_VERSION != _FBLLIB_FSM_VERSION ) || \ + ( FBLLIB_FSM_RELEASE_VERSION != _FBLLIB_FSM_RELEASE_VERSION ) +# error "Error in FBL_FSM.C: Source and v_ver.h are inconsistent!" +#endif + +/********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/** Type to select whether super-states should be iterated in case no matching event handler was found */ +typedef enum +{ + kFsmIterateHierarchy_Disabled, /**< Do not iterate super-states */ + kFsmIterateHierarchy_Enabled /**< Iterate super-states until matching event handler was found */ +} tFsmIterateHierarchy; + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLFSM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static void FblFsmHandleEvent( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event, tFsmIterateHierarchy iterate); +static vuint8 FblFsmGetStateHierachy( const V_MEMRAM1 tFblFsmContext V_MEMRAM2 V_MEMRAM3 * const pFsmContext, tFblFsmState state, + V_MEMRAM1 tFblFsmState V_MEMRAM2 V_MEMRAM3 * hierarchy ); +#define FBLFSM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#if defined( FBL_FSM_ENABLE_DEBUGGING ) +#define FBLFSM_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** Global state machine instance counter */ +static tFblFsmInstance g_Instance; +#define FBLFSM_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ +#define FBLFSM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/********************************************************************************************************************** + * FblFsmGetStateHierachy + *********************************************************************************************************************/ +/*! \brief Provides the state hierarchy starting with the given state + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] state The current state + * \param[out] hierarchy The returned state hierarchy + *********************************************************************************************************************/ +static vuint8 FblFsmGetStateHierachy( const V_MEMRAM1 tFblFsmContext V_MEMRAM2 V_MEMRAM3 * const pFsmContext, + tFblFsmState state, + V_MEMRAM1 tFblFsmState V_MEMRAM2 V_MEMRAM3 * hierarchy ) +{ + vuint8 index = 0u; + tFblFsmState localState = state; + + while (FBL_FSM_DEFAULT_STATE != localState) + { + /* Check for hierarchy depth and stateCount to prevent buffer overrun(s) */ + if ( (index >= FBL_FSM_MAX_HIERARCHY_DEPTH) + || (localState >= pFsmContext->stateCount)) + { + FBL_FSM_DEBUG_ERROR_PRINT(pFsmContext->instance); + + index = 0u; + localState = FBL_FSM_DEFAULT_STATE; + } + else + { + hierarchy[index] = localState; + index++; + + localState = pFsmContext->stateDefinitions[localState].superState; + } + } + + return index; +} + +/********************************************************************************************************************** + * FblFsmHandleEvent + *********************************************************************************************************************/ +/*! \brief Handles the given event + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event The event to be handled + * \param[out] iterate Indicates whether state hierarchy iteration is allowed + *********************************************************************************************************************/ +static void FblFsmHandleEvent( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event, tFsmIterateHierarchy iterate ) +{ + vuint16 index; + vuint16 hierarchy = 0u; + tFblFsmState state = pFsmContext->state; + tFblFsmGuard guard; + V_MEMROM1 tFblFsmStateDefinition V_MEMROM2 V_MEMROM3 * stateDef; + V_MEMROM1 tFblFsmEventEntry V_MEMROM2 V_MEMROM3 * triggers; + + FBL_FSM_DEBUG_PRINT2(pFsmContext->instance, event, state); + + while ( (FBL_FSM_DEFAULT_STATE != state) + && (state < pFsmContext->stateCount)) + { + stateDef = &pFsmContext->stateDefinitions[state]; + triggers = stateDef->triggers; + + /* Search for matching event handler */ + for (index = 0u; index < stateDef->triggerCount; index++) + { + if ( (triggers[index].trigger == event) + || (triggers[index].trigger == (tFblFsmEvent)kFblFsmDefaultEvent_Any) ) + { + /* Handler matching event found, now execute handler */ + guard = triggers[index].handler(pFsmContext, event); + + FBL_FSM_DEBUG_PRINT3(pFsmContext->instance, guard); + + if (kFblFsmGuard_False != guard) + { + if (kFblFsmGuard_True == guard) + { + /* Pending state may be "none" */ + pFsmContext->pendingState = triggers[index].nextState; + } + else /* kFblFsmGuard_Overwrite */ + { + /* Do not set pendingState, this is (has to be) done by the event handler */ + } + + /* Stop searching for event handlers as event was handled */ + state = FBL_FSM_DEFAULT_STATE; + break; + } + else /* kFblFsmGuard_False */ + { + /* State shall not be left, continue to search for other matching event handlers */ + } + } + } + + /* Check if event has been already handled */ + if (FBL_FSM_DEFAULT_STATE != state) + { + /* No matching event handler returning kFblFsmGuard_True could be found for current state, + * continue search in (encapsulating) super state, if possible */ + if (kFsmIterateHierarchy_Enabled == iterate) + { + hierarchy++; + + if (hierarchy < FBL_FSM_MAX_HIERARCHY_DEPTH) + { + state = stateDef->superState; + } + else + { + /* Abort search to avoid (potential) infinite loop */ + FBL_FSM_DEBUG_ERROR_PRINT(pFsmContext->instance); + + state = FBL_FSM_DEFAULT_STATE; + } + } + else + { + /* State traversing not allowed, abort search at this point */ + state = FBL_FSM_DEFAULT_STATE; + } + } + } + +#if defined( FBL_FSM_ENABLE_DEBUGGING ) + if ( (state >= pFsmContext->stateCount) + && (FBL_FSM_DEFAULT_STATE != state) ) + { + FBL_FSM_DEBUG_ERROR_PRINT(pFsmContext->instance); + } +#endif /* FBL_FSM_ENABLE_DEBUGGING */ +} + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/********************************************************************************************************************** + * FblFsmInitPowerOn + *********************************************************************************************************************/ +/*! \brief Module initialization + *********************************************************************************************************************/ +void FblFsmInitPowerOn( void ) +{ +#if defined( FBL_FSM_ENABLE_DEBUGGING ) + g_Instance = 0u; +#endif +} + +/********************************************************************************************************************** + * FblFsmInit + *********************************************************************************************************************/ +/*! \brief State machine initialization + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] initialState The initial state of the state machine + *********************************************************************************************************************/ +void FblFsmInit( tFblFsmContextPtr const pFsmContext, tFblFsmState initialState ) +{ +#if defined( FBL_FSM_ENABLE_DEBUGGING ) + pFsmContext->instance = g_Instance; + g_Instance++; +#endif + + /* Start with internal default state */ + pFsmContext->state = FBL_FSM_DEFAULT_STATE; + pFsmContext->pendingState = initialState; + pFsmContext->pendingEvent = (tFblFsmEvent)kFblFsmDefaultEvent_None; + + /* Enter provided initial state */ + FblFsmStateTask(pFsmContext); +} + +/********************************************************************************************************************** + * FblFsmDeinit + *********************************************************************************************************************/ +/*! \brief State machine deinitialization + * \param[in] pFsmContext Pointer to context of state machine + *********************************************************************************************************************/ +void FblFsmDeinit( tFblFsmContextPtr const pFsmContext ) +{ + /* Switch to internal default state to avoid further processing */ + pFsmContext->state = FBL_FSM_DEFAULT_STATE; + pFsmContext->pendingState = FBL_FSM_DEFAULT_STATE; + pFsmContext->pendingEvent = (tFblFsmEvent)kFblFsmDefaultEvent_None; +} + +/********************************************************************************************************************** + * FblFsmStateTask + *********************************************************************************************************************/ +/*! \brief State machine handling + * \details This function checks for pending events / state transitions and handles them appropriately. + * \param[in] pFsmContext Pointer to context of state machine + *********************************************************************************************************************/ +void FblFsmStateTask( tFblFsmContextPtr const pFsmContext ) +{ + tFblFsmState stateHierarchyExit[FBL_FSM_MAX_HIERARCHY_DEPTH]; + tFblFsmState stateHierarchyEntry[FBL_FSM_MAX_HIERARCHY_DEPTH]; + + tFblFsmState currentState; + tFblFsmState pendingState; + + vsint8 index; + vuint8 exitCount; + vuint8 entryCount; + vsint8 exitIndex; + vsint8 entryIndex; + + /* Check for pending event, which could cause state change */ + tFblFsmEvent event = pFsmContext->pendingEvent; + + if ((tFblFsmEvent)kFblFsmDefaultEvent_None != event) + { + /* Reset event */ + pFsmContext->pendingEvent = (tFblFsmEvent)kFblFsmDefaultEvent_None; + + /* Process event and trigger state change if necessary */ + FblFsmHandleEvent(pFsmContext, event, kFsmIterateHierarchy_Enabled); + } + + /* Check whether state has to be changed */ + while (FBL_FSM_DEFAULT_STATE != pFsmContext->pendingState) + { + currentState = pFsmContext->state; + pendingState = pFsmContext->pendingState; + + FBL_FSM_DEBUG_PRINT1(pFsmContext->instance, currentState, pendingState); + + /* Reset event which triggered state change */ + pFsmContext->pendingState = FBL_FSM_DEFAULT_STATE; + + /* Get state hierarchy of current state and pending state */ + exitCount = FblFsmGetStateHierachy(pFsmContext, currentState, stateHierarchyExit); + entryCount = FblFsmGetStateHierachy(pFsmContext, pendingState, stateHierarchyEntry); + + /* Check for re-entry of current state */ + if (currentState == pendingState) + { + exitIndex = 0; + entryIndex = 0; + } + else + { + exitIndex = ((vsint8)exitCount - 1); + entryIndex = ((vsint8)entryCount - 1); + + /* Search for common super state of current state and pending state */ + while ( (exitIndex >= 0) + && (stateHierarchyExit[exitIndex] == stateHierarchyEntry[entryIndex]) ) + { + exitIndex--; + entryIndex--; + } + + /* An exitIndex / entryIndex larger than 0 indicates that both state have a common super state */ + } + + /* Leave all super-states + * A state is always left, even if the pending state is the same (re-entry), + * but not if the target state is a sub-state of the current state. + * An exit handler is executed after the transition action has been executed */ + for (index = 0; index <= exitIndex; index++) + { + pFsmContext->state = stateHierarchyExit[index]; + + /* Leave previous state by calling exit handler */ + FblFsmHandleEvent(pFsmContext, (tFblFsmEvent)kFblFsmDefaultEvent_Exit, kFsmIterateHierarchy_Disabled); + } + + /* Enter all super-states + * A pending state is only entered if it is not a previous super-state */ + for (index = entryIndex; index >= 0; index--) + { + pFsmContext->state = stateHierarchyEntry[index]; + + /* Now enter new state by calling entry handler */ + FblFsmHandleEvent(pFsmContext, (tFblFsmEvent)kFblFsmDefaultEvent_Entry, kFsmIterateHierarchy_Disabled); + } + + /* Set final state, necessary if new state is super-state of previous state (no re-entry) */ + pFsmContext->state = pendingState; + } +} + +/********************************************************************************************************************** + * FblFsmTriggerEvent + *********************************************************************************************************************/ +/*! \brief Triggers event for given state machine + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event The event to be triggered + *********************************************************************************************************************/ +void FblFsmTriggerEvent( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ) +{ + pFsmContext->pendingEvent = event; +} + +/********************************************************************************************************************** + * FblFsmEventHandlerDefault + *********************************************************************************************************************/ +/*! \brief Default event handler + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event The event that triggered the handler execution + *********************************************************************************************************************/ +tFblFsmGuard FblFsmEventHandlerDefault( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ) /* PRQA S 3673 */ /* MD_MSR_Rule8.13 */ +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)pFsmContext; + (void)event; +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + /* Do nothing, but allow state transition */ + + return kFblFsmGuard_True; +} +#define FBLFSM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * END OF FILE: FBL_FSM.C + *********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_fsm.h b/Source/bsw/Fbl/fbl_fsm.h new file mode 100644 index 0000000..f1a4aa0 --- /dev/null +++ b/Source/bsw/Fbl/fbl_fsm.h @@ -0,0 +1,182 @@ +/********************************************************************************************************************** + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Event-driven hierarchical finite state machine interface + * + * ------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/*********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-10-30 visjhg - First implementation + * 01.00.01 2012-12-10 visjhg - Added "none" trigger + * 01.01.00 2013-12-11 visjhg ESCAN00071901 Renamed package to FblLib_Fsm + * visase - Performed MISRA checks + * 01.01.01 2019-01-24 visrie ESCAN00101864 No changes + * 01.02.00 2023-12-15 vistbe FBL-7986 Perform MISRA analysis + * Added/adapted MemMap sections + *********************************************************************************************************************/ + +#ifndef FBL_FSM_H +#define FBL_FSM_H + +/********************************************************************************************************************** + * VERSION + *********************************************************************************************************************/ + +/* --- Version --- */ +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_Fsm CQComponent : Implementation */ +#define FBLLIB_FSM_VERSION 0x0102u +#define FBLLIB_FSM_RELEASE_VERSION 0x00u + +/********************************************************************************************************************** + * DEFINES + *********************************************************************************************************************/ + +/** Default (invalid) state value */ +#define FBL_FSM_DEFAULT_STATE 0xFFFFu + +/********************************************************************************************************************** + * MACROS + *********************************************************************************************************************/ + +/** Dummy entry */ +#define FBL_FSM_TRIGGER_NONE() { FblFsmEventHandlerDefault, kFblFsmDefaultEvent_None, FBL_FSM_DEFAULT_STATE } +/** State entry handler */ +#define FBL_FSM_TRIGGER_ENTRY(action) { (action), kFblFsmDefaultEvent_Entry, FBL_FSM_DEFAULT_STATE } +/** State exit handler */ +#define FBL_FSM_TRIGGER_EXIT(action) { (action), kFblFsmDefaultEvent_Exit, FBL_FSM_DEFAULT_STATE } +/** Event handler for "any" event */ +#define FBL_FSM_TRIGGER_ANY(action, state) { (action), kFblFsmDefaultEvent_Any, (state) } +/** Internal event handler, no state transition */ +#define FBL_FSM_TRIGGER_INTERNAL(event, action) { (action), (event), FBL_FSM_DEFAULT_STATE } +/** State transition on event */ +#define FBL_FSM_TRIGGER_TRANSITION(event, state) { FblFsmEventHandlerDefault, (event), (state) } +/** State transition on event with additional action */ +#define FBL_FSM_TRIGGER_TRANSITION_ACTION(event, action, state) { (action), (event), (state) } +/** Switch state when guard condition is true */ +#define FBL_FSM_TRIGGER_CHOICE(guard, state) { (guard), kFblFsmDefaultEvent_Entry, (state) } +/** Else case of choice */ +#define FBL_FSM_TRIGGER_CHOICE_ELSE(state) { FblFsmEventHandlerDefault, kFblFsmDefaultEvent_Entry, (state) } +/** Unconditional state transition (any entry handler has to return negative guard result) */ +#define FBL_FSM_TRIGGER_UNCONDITIONAL(state) { FblFsmEventHandlerDefault, kFblFsmDefaultEvent_Entry, (state) } +/** Unconditional state transition with additional action (any entry handler has to return negative guard result) */ +#define FBL_FSM_TRIGGER_UNCONDITIONAL_ACTION(action, state) { (action), kFblFsmDefaultEvent_Entry, (state) } + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/** State type for state machine (the real states need to be defined by the component(s) using this module) */ +typedef vuint16 tFblFsmState; + +/** Event type for state machine (the real events need to be defined by the component(s) using this module) */ +typedef vuint16 tFblFsmEvent; + +#if defined( FBL_FSM_ENABLE_DEBUGGING ) +/** Instance number */ +typedef vuint8 tFblFsmInstance; +#endif /* FBL_FSM_ENABLE_DEBUGGING */ + +/** Event type (components using this module shall start to enumerate their events with kFblFsmDefaultEvent_Count) */ +typedef enum +{ + kFblFsmDefaultEvent_None, /**< No event */ + kFblFsmDefaultEvent_Entry, /**< State entry event */ + kFblFsmDefaultEvent_Exit, /**< State exit event */ + kFblFsmDefaultEvent_Any, /**< Don't care event */ + + kFblFsmDefaultEvent_Count /**< Decimal number of default events */ +} tFblFsmDefaultEvents; + +/** Guard type */ +typedef enum +{ + kFblFsmGuard_True, /**< True: State transition is allowed */ + kFblFsmGuard_False, /**< False: State transition is prohibited */ + kFblFsmGuard_Overwrite /**< Allow pending state to set next state (override state table configuration), defaults to no transition */ +} tFblFsmGuard; + +/** Forward declaration of context structure */ +typedef struct sFblFsmContext tFblFsmContext; + +/** Pointer to context structure */ +typedef V_MEMRAM1 tFblFsmContext V_MEMRAM2 V_MEMRAM3 * tFblFsmContextPtr; + +/** Event handler function pointer */ +typedef tFblFsmGuard (* tFblFsmEventHandler)( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ); + +typedef struct +{ + tFblFsmEventHandler handler; /**< Event handler */ + tFblFsmEvent trigger; /**< Event that triggers execution of handler */ + tFblFsmState nextState; /**< Next state if event handler returns kFblFsmGuard_True */ +} tFblFsmEventEntry; + +/** State definition */ +typedef struct +{ + tFblFsmState superState; /**< Super state (encapsulating state) */ + vuint16 triggerCount; /**< Size of array structure element 'triggers' points to */ + /** Array containing triggers (events) and the corresponding actions for state */ + V_MEMROM1 tFblFsmEventEntry V_MEMROM2 V_MEMROM3 * triggers; +} tFblFsmStateDefinition; + +/** Context structure */ +struct sFblFsmContext +{ + /** Pointer to array containing state definitions (set by component(s) using this module) */ + V_MEMROM1 tFblFsmStateDefinition V_MEMROM2 V_MEMROM3 * stateDefinitions; + vuint16 stateCount; /**< Number of elements in stateDefinitions (set by component(s) using this module) */ + tFblFsmState state; /**< Current state (intended for internal usage) */ + tFblFsmState pendingState; /**< Pending state (intended for internal usage) */ + tFblFsmEvent pendingEvent; /**< Pending event (intended for internal usage) */ +#if defined( FBL_FSM_ENABLE_DEBUGGING ) + tFblFsmInstance instance; /**< State machine instance number */ +#endif +}; + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#if defined( __cplusplus ) +extern "C" { +#endif +#define FBLFSM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +void FblFsmInitPowerOn( void ); +void FblFsmInit( tFblFsmContextPtr const pFsmContext, tFblFsmState initialState ); +void FblFsmDeinit( tFblFsmContextPtr const pFsmContext ); +void FblFsmStateTask( tFblFsmContextPtr const pFsmContext ); +void FblFsmTriggerEvent( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ); +tFblFsmGuard FblFsmEventHandlerDefault( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ); + +#define FBLFSM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( __cplusplus ) +} /* extern "C" */ +#endif + +#endif /* FBL_FSM_H */ + +/********************************************************************************************************************** + * END OF FILE: FBL_FSM.H + *********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_fsm_inc.h b/Source/bsw/Fbl/fbl_fsm_inc.h new file mode 100644 index 0000000..62f600e --- /dev/null +++ b/Source/bsw/Fbl/fbl_fsm_inc.h @@ -0,0 +1,49 @@ +/********************************************************************************************************************** + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Event-driven hierarchical finite state machine + * + * ------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/*********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-10-30 visjhg - First implementation + * 01.00.01 2012-12-10 visjhg - No changes + * 01.01.00 2013-12-11 visjhg ESCAN00071901 Renamed package to FblLib_Fsm + * visase - Performed MISRA checks + * 01.01.01 2019-01-24 visrie ESCAN00101864 Reworked include structure + * 01.02.00 2023-12-15 vistbe FBL-7986 Perform MISRA analysis + *********************************************************************************************************************/ + +#ifndef FBL_FSM_INC_H +#define FBL_FSM_INC_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_fsm_cfg.h" +#include "fbl_fsm.h" + +#endif /* __FBL_FSM_INC_H__ */ + +/********************************************************************************************************************** + * END OF FILE: FBL_FSM_INC.H + *********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_hw.c b/Source/bsw/Fbl/fbl_hw.c new file mode 100644 index 0000000..88e8e93 --- /dev/null +++ b/Source/bsw/Fbl/fbl_hw.c @@ -0,0 +1,236 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Provides hardware abstraction functions for ARM 32 systems + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-11-07 vistbe Initial version + * 01.00.01 2019-12-09 vistbe ESCAN00105142 No changes + * 01.01.00 2020-02-07 vistmo FBL-1452 Added support for S32G2xx + * 01.02.00 2020-11-03 vistmo FBL-2090 Added support for XMC4xxx + * 01.03.00 2020-12-09 visjdn FBL-2490 Added support for S32K3xx + * 01.04.00 2020-12-21 visrie FBL-2517 Added support for AWR1 + * 01.05.00 2021-01-28 visjdn FBL-2824 Added support for TPR12 + * 01.06.00 2021-05-19 visjdn FBL-3038 Added support for iMXRT1172 + * Added/adapted MemMap sections + * 01.07.00 2021-05-31 visjdn FBL-3545 Added support for AWR2 + * 01.08.00 2021-07-08 visjdn FBL-3694 Added support for Jacinto6 + * 01.09.00 2021-11-22 vistmo FBL-4275 Added support for Tayrona + * 01.10.00 2022-01-12 visjdn FBL-3720 Added support for Kinetis KW45B41Z + * 01.11.00 2022-03-09 visrie FBL-4770 No changes + * 01.12.00 2022-07-18 visjdn FBL-5115 Added support for SAF85xx + * 01.13.00 2023-02-09 fmenke FBL-6162 Added support for MSPM0 + * ESCAN00113692 Timer current value is too high after timer initialization + * 01.14.00 2023-04-20 jschmitding FBL-5733 Added support for TCC70xx + * 01.15.00 2023-07-12 fmenke FBL-6966 Add support for NCJ29D6 + * 01.16.00 2024-01-01 fmenke FBL-7559 No changes + * ESCAN00116504 No changes + * 01.17.00 2024-09-27 jschmitding FBL-9330 No changes + * 01.17.01 2024-10-22 visrie ESCAN00118141 No changes + * 01.18.00 2024-12-02 fmenke FBL-9747 Support StellarSr6 + * 01.19.00 2025-11-19 jostravsky FBL-11077 No changes + **********************************************************************************************************************/ + +#define FBL_HW_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLHAL_ARM32_VERSION != 0x0119u ) || \ + ( FBLHAL_ARM32_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_hw.c: Source and header file are inconsistent!" +#endif + +#if ( FBLHAL_ARM32_VERSION != _FBLHAL_ARM32_VERSION ) || \ + ( FBLHAL_ARM32_RELEASE_VERSION != _FBLHAL_ARM32_RELEASE_VERSION ) +# error "Error in fbl_hw.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ +#if !defined( FBL_MEMCPY_WD_POLLING_MASK) +# define FBL_MEMCPY_WD_POLLING_MASK 0x3Fu +#endif + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#if defined( FBL_USE_OWN_MEMCPY ) +# define FBLHW_MEMCPY_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblOwnMemcpy + **********************************************************************************************************************/ +/*! \brief Copies a given amount of bytes. + * \details This function copies a given amount of bytes. The Bootloader watchdog handling is called during + * copying. Can be used instead of a compiler library memcopy if watchdog handling is needed. + * \param[out] dest Pointer to destination + * \param[in] source Pointer to source + * \param[in] count Copy length in Byte + * \return Pointer to destination + **********************************************************************************************************************/ +void * FblOwnMemcpy (void * dest, const void * source, vuint32 count) +{ + vuint8 * localDest; + const vuint8 * localSource; + vuint32 i; + + /* Initialize variables */ + /* PRQA S 0316 2 */ /* MD_FblHw_0314_0316_0326_MemCpy */ + localDest = (vuint8 *)dest; + localSource = (const vuint8 *)source; + + for (i = 0u; i < count; i++) + { + if ((i & (FBL_MEMCPY_WD_POLLING_MASK )) == 0u) + { + FblLookForWatchdogVoid(); + } + localDest[i] = localSource[i]; + } + + return dest; +} +# define FBLHW_MEMCPY_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_USE_OWN_MEMCPY */ + +#define FBLHW_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblReadBlock + **********************************************************************************************************************/ +/*! \brief This function reads a given amount of bytes from an address. + * \param[in] address Memory address to read out + * \param[out] buffer Target buffer + * \param[in] length Number of bytes to read + * \return Number of actually copied bytes + **********************************************************************************************************************/ +tFblLength FblReadBlock( tFblAddress address, vuint8 *buffer, tFblLength length ) +{ + (void)MEMCPY(buffer, address, length); /* PRQA S 0314, 0326 */ /* MD_FblHw_0314_0316_0326_MemCpy */ + return length; +} + +/*********************************************************************************************************************** + * FblReadByte + **********************************************************************************************************************/ +/*! \brief This function can be used to read one byte from the given address. + * \param[in] Read address. + * \return Byte at memory location 'address' + **********************************************************************************************************************/ +vuint8 FblReadByte( tFblAddress address ) +{ + vuint8 buffer; + + (void)MEMCPY(&buffer, address, 1u); /* PRQA S 0314, 0326 */ /* MD_FblHw_0314_0316_0326_MemCpy */ + + return buffer; +} + +/*********************************************************************************************************************** + * FblTimerInit + **********************************************************************************************************************/ +/*! \brief Initialize system timer + **********************************************************************************************************************/ +/* PRQA S 0303 TAG_DrvFlash_0303_1 */ /* MD_FblHal_0303 */ +void FblTimerInit( void ) +{ + /* Disable both timers to make modifications */ + FBL_RTI_GCTRL &= FblInvert32Bit(FBL_RTI_GCTRL_TIMER_ENABLE); + /* Set prescaler: FRC=RTICLK/(prescaler+1) */ + FBL_RTI_CPUC(FBL_RTI_TIMER_MS) = FBL_TIMER_PRESCALER_VALUE; + /* Make sure Compare0 register is used for timer0 */ + FBL_RTI_COMPCTRL &= FblInvert32Bit(FBL_RTI_COMPCTRL_TIMER_SELECT); + /* Set Compare0 register (timer runs with half the frequency, see CPUC register) */ + FBL_RTI_COMP(0u) = FBL_TIMER_RELOAD_VALUE / (FBL_TIMER_PRESCALER_VALUE + 1uL); + FBL_RTI_UDCP(0u) = FBL_TIMER_RELOAD_VALUE / (FBL_TIMER_PRESCALER_VALUE + 1uL); + /* Make sure timer0 starts at 0 */ + FBL_RTI_FRC(FBL_RTI_TIMER_MS) = 0uL; + FBL_RTI_UC(FBL_RTI_TIMER_MS) = 0uL; + /* Enable both timers (millisecond and free running timer) */ + FBL_RTI_GCTRL |= FBL_RTI_GCTRL_TIMER_ENABLE; +} +/* PRQA L:TAG_DrvFlash_0303_1 */ + +/*********************************************************************************************************************** + * FblGetTimerValue + **********************************************************************************************************************/ +/*! \brief Returns free running timer value + * \pre Timer must be initialized + * \return Current timer value + **********************************************************************************************************************/ +/* PRQA S 0303 TAG_DrvFlash_0303_2 */ /* MD_FblHal_0303 */ +vuint16 FblGetTimerValue( void ) +{ + vuint32 timerValue; + + timerValue = FBL_RTI_FRC(FBL_RTI_TIMER_FREE); + + return (vuint16)(timerValue & 0xFFFFu); +} +/* PRQA L:TAG_DrvFlash_0303_2 */ + +/*********************************************************************************************************************** + * FblTimerStopp + **********************************************************************************************************************/ +/*! \brief Stops the system timer + **********************************************************************************************************************/ +/* PRQA S 0303 TAG_DrvFlash_0303_3 */ /* MD_FblHal_0303 */ +void FblTimerStopp( void ) +{ + FBL_RTI_GCTRL &= FblInvert32Bit(FBL_RTI_GCTRL_TIMER_ENABLE); +} +#define FBLHW_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/* PRQA L:TAG_DrvFlash_0303_3 */ + +/* Justification for module-specific MISRA deviations: + + MD_FblHal_0303: + Reason: Cast between a pointer to volatile object and an integral type. + Risk: No identifiable risk as casts are used to define SFRs here. + Prevention: No prevention required. + + MD_FblHw_0314_0316_0326_MemCpy: + Reason: The copy function have a void pointer as a function parameter. + Risk: No risk, because the underlying vuint8 pointer type is known. + Prevention: No prevention necessary. + + MD_FblHal_2741: + Reason: This is an assembler instruction that is not correctly interpreted during static code analysis. + Risk: No risk, because the assembler instruction will always return the value depending on the register. + Prevention: No prevention required. + +*/ +/*********************************************************************************************************************** + * END OF FILE: FBL_HW.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_hw.h b/Source/bsw/Fbl/fbl_hw.h new file mode 100644 index 0000000..120b3f3 --- /dev/null +++ b/Source/bsw/Fbl/fbl_hw.h @@ -0,0 +1,191 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Provides hardware abstraction functions for ARM 32 systems + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-11-07 vistbe Initial version + * 01.00.01 2019-12-09 vistbe ESCAN00105142 Compile Error in inline assembly + * 01.01.00 2020-02-07 vistmo FBL-1452 No changes + * 01.02.00 2020-11-03 vistmo FBL-2090 No changes + * 01.03.00 2020-12-09 visjdn FBL-2490 No changes + * 01.04.00 2020-12-21 visrie FBL-2517 Added support for AWR1 + * 01.05.00 2021-01-28 visjdn FBL-2824 Added support for TPR12 + * 01.06.00 2021-05-19 visjdn FBL-3038 Added/adapted MemMap sections + * 01.07.00 2021-05-31 visjdn FBL-3545 Added support for AWR2 + * 01.08.00 2021-07-08 visjdn FBL-3694 Added support for Jacinto6 + * 01.09.00 2021-11-22 vistmo FBL-4275 No changes + * 01.10.00 2022-01-12 visjdn FBL-3720 No changes + * 01.11.00 2022-03-09 visrie FBL-4770 Added support for ARM6 compiler + * 01.12.00 2022-07-18 visjdn FBL-5115 No changes + * 01.13.00 2023-02-09 fmenke FBL-6162 No changes + * ESCAN00113692 No changes + * 01.14.00 2023-04-20 jschmitding FBL-5733 Added support for TCC70xx + * 01.15.00 2023-07-12 fmenke FBL-6966 Add support for NCJ29D6 + * 01.16.00 2024-01-01 fmenke FBL-7559 No changes + * ESCAN00116504 No changes + * 01.17.00 2024-09-27 jschmitding FBL-9330 No changes + * 01.17.01 2024-10-22 visrie ESCAN00118141 Compiler error: missing brackets for JSR function parameter + * 01.18.00 2024-12-02 fmenke FBL-9747 Support StellarSr6 + * 01.19.00 2025-11-19 jostravsky FBL-11077 No changes + **********************************************************************************************************************/ + +#ifndef FBL_HW_H +#define FBL_HW_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#if defined( FBL_USE_OWN_MEMCPY ) +#else +# include +#endif /* FBL_USE_OWN_MEMCPY */ + +#if defined( V_COMP_ARM6 ) +# include +#endif + +#include "fbl_sfr.h" /* Special function register definition */ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblHal_Arm32 CQComponent : Implementation */ +#define FBLHAL_ARM32_VERSION 0x0119u +#define FBLHAL_ARM32_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + +/** Memcpy function */ +#if defined( FBL_USE_OWN_MEMCPY ) +# define MEMCPY(dst, src, len) FblOwnMemcpy((void *)(dst), (const void *)(src), (vuint32)(len)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +#else +# define MEMCPY(dst, src, len) memcpy((void *)(dst), (const void *)(src), (size_t)(len)) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ +#endif /* FBL_USE_OWN_MEMCPY */ + +/*********************************************************************************************************************** + * MACROS FOR JUMPS + **********************************************************************************************************************/ +#if !defined( APPLSTART ) +# define APPLSTART (*((vuint32 *)&ApplIntJmpTable[1u])) /**< Startup code of application */ +#endif + +#define JSR(x) (*((void(*)(void))(x)))() /**< Jump to subroutine */ /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +#define JSR_APPL() JSR(APPLSTART) /**< Application start */ + +#define FblCheckBootVectTableIsValid() (ApplIntJmpTable[0u] == APPLVECT_FROM_BOOT) + +/* Timer handling ----------------------------------------------------------*/ +# define FblTimerGet() ((FBL_RTI_INTFLAG & 1uL) == 1uL) +# define FblTimerReset() FBL_RTI_INTFLAG = 1uL + + /* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */ +#define FblFlashAddressGet3Bytes(array) (tFblAddress)( (tFblAddress)(((vuint8 *)array)[0u] << 16u) | \ + (tFblAddress)(((vuint8 *)array)[1u] << 8u) | \ + (tFblAddress)(((vuint8 *)array)[2u]) ) + +/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */ +#define FblDownloadLengthGet3Bytes(array) (tFblLength)( (tFblLength)(((vuint8 *)array)[0u] << 16u) | \ + (tFblLength)(((vuint8 *)array)[1u] << 8u) | \ + (tFblLength)(((vuint8 *)array)[2u]) ) +/* Read 4 bytes from diag buffer */ +/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */ +#define FblFlashAddressGet4Bytes(array) (tFblAddress)( (tFblAddress)(((vuint8 *)array)[0u] << 24u) | \ + (tFblAddress)(((vuint8 *)array)[1u] << 16u) | \ + (tFblAddress)(((vuint8 *)array)[2u] << 8u) | \ + (tFblAddress)(((vuint8 *)array)[3u]) ) + +/* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */ +#define FblDownloadLengthGet4Bytes(array) (tFblLength)( (tFblLength)(((vuint8 *)array)[0u] << 24u) | \ + (tFblLength)(((vuint8 *)array)[1u] << 16u) | \ + (tFblLength)(((vuint8 *)array)[2u] << 8u) | \ + (tFblLength)(((vuint8 *)array)[3u]) ) + +/* Interrupt handling ----------------------------------------------------------*/ +#if defined( V_COMP_TI ) +# define FblInterruptDisable() __asm(" CPSID I") +# define FblInterruptEnable() __asm(" CPSIE I") +#elif defined( V_COMP_ARM6 ) +# define FblInterruptDisable() __disable_irq() +# define FblInterruptEnable() __enable_irq() +#else +# define FblInterruptDisable() __asm("CPSID I") +# define FblInterruptEnable() __asm("CPSIE I") +#endif + +/* FblHwRestoreFblContext() definition -----------------------------------------*/ +#define FblHwRestoreFblContext() + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLHW_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +void FblTimerInit( void ); +vuint16 FblGetTimerValue( void ); +void FblTimerStopp( void ); + +/* Memory access functions */ +tFblLength FblReadBlock( tFblAddress address, vuint8 *buffer, tFblLength length ); +vuint8 FblReadByte( tFblAddress address ); +#define FBLHW_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_USE_OWN_MEMCPY ) +# define FBLHW_MEMCPY_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +void * FblOwnMemcpy (void * dest, const void * source, vuint32 count); +# define FBLHW_MEMCPY_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_USE_OWN_MEMCPY */ + +#endif /* FBL_HW_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_HW.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_lbt_access.c b/Source/bsw/Fbl/fbl_lbt_access.c new file mode 100644 index 0000000..3176256 --- /dev/null +++ b/Source/bsw/Fbl/fbl_lbt_access.c @@ -0,0 +1,1428 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Interface layer for accessing the logical block table (LBT) + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-05-24 visci - Initial version + * 01.01.00 2018-11-27 visshs ESCAN00101459 Add Support for Secure Boot + * 01.02.00 2019-02-26 visrie ESCAN00102278 Added additional getter functions + * 01.02.01 2019-09-05 visrcn ESCAN00103604 Modified memory qualifiers + * 01.03.00 2022-03-31 visstn FBL-4366 Perform MISRA 2012 migration + * 01.04.00 2022-10-17 visjns FBL-4925 Change LBT access to use RAM + * 01.04.01 2023-04-24 vismix ESCAN00113819 Incorrect assertion expression in FblLbtActivateLbtBlockByAddress() + * 01.05.00 2023-12-14 vistbe FBL-7967 Add new filename attribute for LBT + **********************************************************************************************************************/ + +#define FBL_LBT_ACCESS_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLLIB_LBT_VERSION != 0x0105u ) || \ + ( FBLLIB_LBT_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_lbt_access.c: Source and header file are inconsistent!" +#endif + +#if ( FBLLIB_LBT_VERSION != _FBLLIB_LBT_VERSION ) || \ + ( FBLLIB_LBT_RELEASE_VERSION != _FBLLIB_LBT_RELEASE_VERSION ) +# error "Error in fbl_lbt_access.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Access of LBT in RAM */ +#if defined(FBL_LBT_ENABLE_RAM_BUFFER) +# define FBL_LBT_RAM_BUF_SIZE sizeof(tLogicalBlockTable) +#endif /* FBL_LBT_ENABLE_RAM_BUFFER */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +#if defined(FBL_LBT_ENABLE_RAM_BUFFER) +typedef const V_MEMRAM1 tLogicalBlockTable V_MEMRAM2 V_MEMRAM3 * tLogicalBlockTableConstPointer; +#endif /* FBL_LBT_ENABLE_RAM_BUFFER */ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLLBT_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 static V_MEMRAM1 tFblLbtBlockNr V_MEMRAM2 fblLbtBlockIteratorNr; +V_MEMRAM0 static V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 fblLbtBlockIteratorFilter; +V_MEMRAM0 static V_MEMRAM1 boolean V_MEMRAM2 fblLbtBlockIteratorDone; +#if defined(FBL_LBT_ENABLE_RAM_BUFFER) +V_MEMRAM0 static V_MEMRAM1 tLogicalBlockTable V_MEMRAM2 fblLbtRamBuffer; +V_MEMROM0 static tLogicalBlockTableConstPointer V_MEMROM1 V_MEMROM2 fblLbtActive = &fblLbtRamBuffer; +#else +V_MEMRAM0 static V_MEMROM1 tLogicalBlockTable V_MEMROM2 V_MEMROM3 * V_MEMRAM1 V_MEMRAM2 fblLbtActive; +#endif /* FBL_LBT_ENABLE_RAM_BUFFER */ + +#define FBLLBT_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLLBT_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static boolean FblLbtBlockFilterHit(const V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +static tFblResult FblLbtBlockCompare(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * block1, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * block2); +static tFblResult FblLbtCheckReferences(void); +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblLbtBlockFilterHit + **********************************************************************************************************************/ +/*! \brief Check whether a certain block matches the filter settings + * \param[in] blockFilter Block filter settings + * \param[in] blockDescriptor Structure with block information + * \return Possible return values: + * - TRUE if the block matches the filter criteria + * - FALSE otherwise + **********************************************************************************************************************/ +static boolean FblLbtBlockFilterHit(const V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + /* Default setting: open filter */ + boolean result = TRUE; + + /* Check if mandatory/optional filter is enabled */ + if (blockFilter->mandatoryType.enabled == TRUE) + { + /* Check if this is a mandatory block */ + if (blockDescriptor->mandatoryType == TRUE) + { + /* Block is mandatory: compare against filter value */ + result = (blockFilter->mandatoryType.value == TRUE) ? TRUE : FALSE; + } + else + { + /* Block is optional: compare against filter value */ + result = (blockFilter->mandatoryType.value == FALSE) ? TRUE : FALSE; + } + } + +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) + /* Check if block type filter is enabled */ + if (blockFilter->blockType.enabled == TRUE) + { + /* AND logic: check if filter is still 'open' */ + if (result == TRUE) + { + result = (boolean)((blockDescriptor->blockType == blockFilter->blockType.value) ? TRUE : FALSE); + } + } +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + + return result; +} + +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +/*********************************************************************************************************************** + * FblLbtBlockCompare + **********************************************************************************************************************/ +/*! \brief Compare the parameters of two blocks (member-compare) + * \param[in] block1 Structure with parameters of first block + * \param[in] block2 Structure with parameters of second block + * \return Possible return values: + * - kFblOk if the two blocks are equal + * - kFblFailed otherwise + **********************************************************************************************************************/ +static tFblResult FblLbtBlockCompare(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * block1, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * block2) +{ + tFblResult result = kFblOk; + + if ( (block1->blockNr != block2->blockNr) + || (block1->mandatoryType != block2->mandatoryType) + || (block1->blockStartAddress != block2->blockStartAddress) + || (block1->blockLength != block2->blockLength) +#if defined( FBL_LBT_ENABLE_BLOCK_INDEX ) + || (block1->blockIndex != block2->blockIndex) +#endif +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) + || (block1->blockType != block2->blockType) +#endif +#if defined( FBL_LBT_ENABLE_HEADER_ADDRESS ) + || (block1->headerAddress != block2->headerAddress) +#endif +#if defined( FBL_LBT_ENABLE_BM_HEADER_ADDRESS ) + || (block1->bmHeaderAddress != block2->bmHeaderAddress) +#endif +#if defined( FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS ) + || (block1->maxProgAttempts != block2->maxProgAttempts) +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) + || (block1->verifyInput != block2->verifyInput) +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) + || (block1->verifyProcessed != block2->verifyProcessed) +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) + || (block1->verifyPipelined != block2->verifyPipelined) +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) + || (block1->verifyOutput != block2->verifyOutput) +#endif + ) + { + /* At least one of the block descriptor parameters doesn't match */ + result = kFblFailed; + } + + return result; +} + +/*********************************************************************************************************************** + * FblLbtCheckReferences + **********************************************************************************************************************/ +/*! \brief Check if the references which are used in the reprogrammable LBT are valid with the bootloader + * \return Possible return values: + * - kFblOk if all references are valid + * - kFblFailed otherwise + **********************************************************************************************************************/ +static tFblResult FblLbtCheckReferences(void) +{ + tFblResult result = kFblOk; + tFblLbtBlockFilter blockFilter = {0}; + tBlockDescriptor newLbtBlock = {0}; + vuint8 tableIdx = 0u; + + FblLbtBlockFilterInit(&blockFilter); + + newLbtBlock = FblLbtBlockFirst(&blockFilter); + while ( FblLbtBlockDone() == FALSE ) + { +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) + /* Compare actual block type against pre-defined list */ + result = kFblFailed; + for (tableIdx = 0u; tableIdx < fblLbtBlockTypes.typeCount; tableIdx++) + { + if (newLbtBlock.blockType == fblLbtBlockTypes.type[tableIdx]) + { + result = kFblOk; + break; + } + } +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +#if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) + if (result == kFblOk) + { + /* Compare actual verification function against pre-defined list */ + result = kFblFailed; + for (tableIdx = 0u; tableIdx < fblLbtVerificationFunc.funcCount; tableIdx++) + { + if (newLbtBlock.verifyInput == fblLbtVerificationFunc.func[tableIdx]) + { + result = kFblOk; + break; + } + } + } +#endif /* FBL_LBT_ENABLE_VERIFY_INPUT */ +#if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) + if (result == kFblOk) + { + /* Compare actual verification function against pre-defined list */ + result = kFblFailed; + for (tableIdx = 0u; tableIdx < fblLbtVerificationFunc.funcCount; tableIdx++) + { + if (newLbtBlock.verifyProcessed == fblLbtVerificationFunc.func[tableIdx]) + { + result = kFblOk; + break; + } + } + } +#endif /* FBL_LBT_ENABLE_VERIFY_PROCESSED */ +#if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) + if (result == kFblOk) + { + /* Compare actual verification function against pre-defined list */ + result = kFblFailed; + for (tableIdx = 0u; tableIdx < fblLbtVerificationFunc.funcCount; tableIdx++) + { + if (newLbtBlock.verifyPipelined == fblLbtVerificationFunc.func[tableIdx]) + { + result = kFblOk; + break; + } + } + } +#endif /* FBL_LBT_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) + if (result == kFblOk) + { + /* Compare actual verification function against pre-defined list */ + result = kFblFailed; + for (tableIdx = 0u; tableIdx < fblLbtVerificationFunc.funcCount; tableIdx++) + { + if (newLbtBlock.verifyOutput == fblLbtVerificationFunc.func[tableIdx]) + { + result = kFblOk; + break; + } + } + } +#endif /* FBL_LBT_ENABLE_VERIFY_OUTPUT */ + + if (result != kFblOk) + { + /* Unknown reference used: abort */ + break; + } + + newLbtBlock = FblLbtBlockNext(); + } + + return result; +} +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblLbtInitPowerOn + **********************************************************************************************************************/ +/*! \brief Power-on initialization of the LBT access module + **********************************************************************************************************************/ +void FblLbtInitPowerOn(void) +{ +#if defined(FBL_LBT_ENABLE_RAM_BUFFER) + /* Initialize pointer with built-in LBT copied into RAM buffer */ /* PRQA S 0306 1 */ /* MD_FblLib_Lbt_0306 */ + (void)FblReadBlock((tFblAddress)&FblLogicalBlockTable, (vuint8*)&fblLbtRamBuffer, FBL_LBT_RAM_BUF_SIZE); +#else + /* Initialize pointer with built-in LBT */ + fblLbtActive = &FblLogicalBlockTable; +#endif /* FBL_LBT_ENABLE_RAM_BUFFER */ +} + +/*********************************************************************************************************************** + * FblLbtBlockFilterInit + **********************************************************************************************************************/ +/*! \brief Initialize/reset the block filter structure + * \param[out] blockFilter Structure with block filter parameters + **********************************************************************************************************************/ +void FblLbtBlockFilterInit(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter) +{ + blockFilter->mandatoryType.enabled = FALSE; +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) + blockFilter->blockType.enabled = FALSE; +#endif +} + +/*********************************************************************************************************************** + * FblLbtBlockFilterSetMandatoryType + **********************************************************************************************************************/ +/*! \brief Set and enable the filter for the mandatory type + * \param[out] blockFilter Structure with block filter parameters + * \param[in] mandatoryType The mandatory type value which shall be filtered (optional/mandatory) + **********************************************************************************************************************/ +void FblLbtBlockFilterSetMandatoryType(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, + tFblLbtMandatoryType mandatoryType) +{ + blockFilter->mandatoryType.value = mandatoryType; + blockFilter->mandatoryType.enabled = TRUE; +} + +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +/*********************************************************************************************************************** + * FblLbtBlockFilterSetBlockType + **********************************************************************************************************************/ +/*! \brief Set and enable the filter for the block type + * \param[out] blockFilter Structure with block filter parameters + * \param[in] blockType The block type value which shall be filtered + **********************************************************************************************************************/ +void FblLbtBlockFilterSetBlockType(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, + tFblLbtBlockType blockType) +{ + blockFilter->blockType.value = blockType; + blockFilter->blockType.enabled = TRUE; +} +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +/*********************************************************************************************************************** + * FblLbtBlockFirst + **********************************************************************************************************************/ +/*! \brief Initialization/start function of the block iterator + * \param[in] blockFilter Structure with block filter parameters + * \return First block which matches the given filter settings + **********************************************************************************************************************/ +tBlockDescriptor FblLbtBlockFirst(const V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter) +{ + fblLbtBlockIteratorNr = 0u; + fblLbtBlockIteratorFilter = *blockFilter; + fblLbtBlockIteratorDone = FALSE; + + return FblLbtBlockNext(); +} + +/*********************************************************************************************************************** + * FblLbtBlockNext + **********************************************************************************************************************/ +/*! \brief Continue/next function of the block iterator + * \return Next block which matches the filter settings which have been passed to FblLbtBlockFirst + **********************************************************************************************************************/ +tBlockDescriptor FblLbtBlockNext(void) +{ + tBlockDescriptor blockDescriptor = {0}; + boolean filterResult = FALSE; + + /* Initialize block descriptor to avoid compiler warning (invalid descriptor will NOT be used, loop is aborted before) */ + blockDescriptor = FblLogicalBlockTable.logicalBlock[0u]; + + while (fblLbtBlockIteratorNr < fblLbtActive->noOfBlocks) + { + /* Retrieve next block from LBT */ + blockDescriptor = fblLbtActive->logicalBlock[fblLbtBlockIteratorNr]; + + /* Increment iterator */ + fblLbtBlockIteratorNr++; + + /* Test block descriptor against filter settings */ + filterResult = FblLbtBlockFilterHit(&fblLbtBlockIteratorFilter, &blockDescriptor); + if (filterResult == TRUE) + { + /* Current block descriptor matches the filter settings, return to caller */ + break; + } + } + + if ((fblLbtBlockIteratorNr >= fblLbtActive->noOfBlocks) && (filterResult == FALSE)) + { + /* No more blocks found, abort iteration */ + fblLbtBlockIteratorDone = TRUE; + } + + return blockDescriptor; +} + +/*********************************************************************************************************************** + * FblLbtBlockDone + **********************************************************************************************************************/ +/*! \brief Implementation of the exit condition of the block iterator + * \return Boolean value which reflects the exit condition + * - FALSE: Last block not reached yet + * - TRUE : Last block has been reached + **********************************************************************************************************************/ +boolean FblLbtBlockDone(void) +{ + return fblLbtBlockIteratorDone; +} + +/*********************************************************************************************************************** + * FblLbtGetBlockCount + **********************************************************************************************************************/ +/*! \brief Getter function for the actual block count of the active LBT + * \return Number of blocks in the active LBT + **********************************************************************************************************************/ +tFblLbtBlockCount FblLbtGetBlockCount(void) +{ + return (tFblLbtBlockCount)fblLbtActive->noOfBlocks; +} + +/*********************************************************************************************************************** + * FblLbtGetMagicFlag + **********************************************************************************************************************/ +/*! \brief Getter function to read the magic flag + * \return Magic flag value + **********************************************************************************************************************/ +tFblLbtMagicFlag FblLbtGetMagicFlag(void) +{ + return (tFblLbtMagicFlag)fblLbtActive->magicFlag; +} + +/*********************************************************************************************************************** + * FblLbtGetBlockNrByAddressLength + **********************************************************************************************************************/ +/*! \brief Look up and return the block number for a given memory range + * \param[in] address Start address of the memory range + * \param[in] length Length of the memory range + * \param[out] Block number of the respective block (if found) + * \return Possible return values: + * - kFblOk if block number could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockNrByAddressLength(tFblAddress address, tFblLength length, + V_MEMRAM1 tFblLbtBlockNr V_MEMRAM2 V_MEMRAM3 * blockNr) +{ + tFblResult result = kFblFailed; + tBlockDescriptor localBlockDescriptor = {0}; + tFblLbtBlockFilter blockFilter = {0}; + + /* Configure block filter (clear all filter settings) */ + FblLbtBlockFilterInit(&blockFilter); + + localBlockDescriptor = FblLbtBlockFirst(&blockFilter); + while (FblLbtBlockDone() == FALSE) + { + result = FblLbtCheckRangeContained(address, length, + localBlockDescriptor.blockStartAddress, + localBlockDescriptor.blockLength); + if (result == kFblOk) + { + *blockNr = localBlockDescriptor.blockNr; + break; + } + + localBlockDescriptor = FblLbtBlockNext(); + } + + return result; +} + +/*********************************************************************************************************************** + * FblLbtGetBlockDescriptorByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the block descriptor with a certain block number value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockDescriptor Parameter structure with the information of the respective block + * \return Possible return values: + * - kFblOk if descriptor could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockDescriptorByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + tFblResult result = kFblFailed; + + if (blockNr < fblLbtActive->noOfBlocks) + { + *blockDescriptor = fblLbtActive->logicalBlock[blockNr]; + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblLbtGetBlockDescriptorByAddressLength + **********************************************************************************************************************/ +/*! \brief Look up and return the block descriptor for a given memory range + * \param[in] address Start address of the memory range + * \param[in] length Length of the memory range + * \param[out] blockDescriptor Parameter structure with the information of the respective block + * \return Possible return values: + * - kFblOk if block descriptor could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockDescriptorByAddressLength(tFblAddress address, tFblLength length, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + tFblResult result = kFblFailed; + tFblLbtBlockNr localBlockNr = 0u; + + result = FblLbtGetBlockNrByAddressLength(address, length, &localBlockNr); + + if (result == kFblOk) + { + result = FblLbtGetBlockDescriptorByNr(localBlockNr, blockDescriptor); + } + + return result; +} + +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +/*********************************************************************************************************************** + * FblLbtGetBlockDescriptorByType + **********************************************************************************************************************/ +/*! \brief Look up and return the first block descriptor with a certain block type value + * \param[in] blockType Type value of the block to be retrieved + * \param[out] blockDescriptor Parameter structure with the information of the respective block + * \return Possible return values: + * - kFblOk if descriptor could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockDescriptorByType(tFblLbtBlockType blockType, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + tFblResult result = kFblFailed; + tBlockDescriptor localBlockDescriptor = {0}; + tFblLbtBlockFilter blockFilter = {0}; + + /* Configure block filter (clear all filter settings) */ + FblLbtBlockFilterInit(&blockFilter); + + localBlockDescriptor = FblLbtBlockFirst(&blockFilter); + while ( FblLbtBlockDone() == FALSE ) + { + if (localBlockDescriptor.blockType == blockType) + { + *blockDescriptor = localBlockDescriptor; + result = kFblOk; + break; + } + + localBlockDescriptor = FblLbtBlockNext(); + } + + return result; +} +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +/*********************************************************************************************************************** + * FblLbtGetBlockTypeByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the block type with a certain block index value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockType Type of the respective block + * \return Possible return values: + * - kFblOk if block type could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockTypeByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tFblLbtBlockType V_MEMRAM2 V_MEMRAM3 * blockType) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize block type to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.blockType = 0uL; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockType = blockDescriptor.blockType; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +#if defined( FBL_LBT_ENABLE_BLOCK_INDEX ) +/*********************************************************************************************************************** +* FblLbtGetBlockIndexByNr +**********************************************************************************************************************/ +/*! \brief Look up and return the block index with a certain block index value +* \param[in] blockNr Block number value of the block to be retrieved +* \param[out] blockIndex Index of the respective block +* \return Possible return values: +* - kFblOk if block type could be retrieved successfully +* - kFblFailed otherwise +**********************************************************************************************************************/ +tFblResult FblLbtGetBlockIndexByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblLbtBlockIndex V_MEMRAM2 V_MEMRAM3 * blockIndex) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize block type to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.blockIndex = 0uL; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockIndex = blockDescriptor.blockIndex; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_BLOCK_INDEX */ + +#if defined( FBL_LBT_ENABLE_HEADER_ADDRESS ) +/*********************************************************************************************************************** + * FblLbtGetBlockHeaderAddressByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the block header address with a certain block index value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockHeaderAddress Header address of the respective block + * \return Possible return values: + * - kFblOk if header address could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockHeaderAddressByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * blockHeaderAddress) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize header address to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.headerAddress = 0uL; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockHeaderAddress = blockDescriptor.headerAddress; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_BLOCK_HEADER_ADDRESS */ + +#if defined( FBL_LBT_ENABLE_BM_HEADER_ADDRESS ) +/*********************************************************************************************************************** + * FblLbtGetBlockBmHeaderAddressByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the bootmanager header address with a certain block index value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] bmHeaderAddress BM Header address of the respective block + * \return Possible return values: + * - kFblOk if header address could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockBmHeaderAddressByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * bmHeaderAddress) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize BM header address to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.bmHeaderAddress = 0uL; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *bmHeaderAddress = blockDescriptor.bmHeaderAddress; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_BM_HEADER_ADDRESS */ + +#if defined( FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS ) +/*********************************************************************************************************************** + * FblLbtGetBlockMaxProgAttemptsByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the maximum programming attempts with a certain block index value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] maxProgAttempts Maxmimum programming attempts of the respective block + * \return Possible return values: + * - kFblOk if maximum programming attempts could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockMaxProgAttemptsByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tFblLbtMaxProgAttempts V_MEMRAM2 V_MEMRAM3 * maxProgAttempts) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize maximum programming attempts to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.maxProgAttempts = 0u; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *maxProgAttempts = blockDescriptor.maxProgAttempts; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS */ + +#if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyInputFuncByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyInputFuncByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyInput = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyInput; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_VERIFY_INPUT */ + +#if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyProcessedFuncByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyProcessedFuncByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyProcessed = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyProcessed; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_VERIFY_PROCESSED */ + +#if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyPipelinedFuncByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyPipelinedFuncByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyPipelined = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyPipelined; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyOutputFuncByNr + **********************************************************************************************************************/ +/*! \brief Look up and return the block header address with a certain block index value + * \param[in] blockNr Block number value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyOutputFuncByNr(tFblLbtBlockNr blockNr, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyOutput = (tExportFct)0uL; + + if (FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyOutput; + result = kFblOk; + } + + return result; +} +#endif /* FBL_LBT_ENABLE_VERIFY_OUTPUT */ + +#if defined( FBL_LBT_ENABLE_BLOCK_INDEX ) +/*********************************************************************************************************************** + * FblLbtGetBlockDescriptorByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the block descriptor with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockDescriptor Parameter structure with the information of the respective block + * \return Possible return values: + * - kFblOk if descriptor could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockDescriptorByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + tFblResult result = kFblFailed; + tBlockDescriptor localBlockDescriptor = {0}; + tFblLbtBlockFilter blockFilter = {0}; + + /* Configure block filter (clear all filter settings) */ + FblLbtBlockFilterInit(&blockFilter); + + localBlockDescriptor = FblLbtBlockFirst(&blockFilter); + while ( FblLbtBlockDone() == FALSE ) + { + if (localBlockDescriptor.blockIndex == blockIndex) + { + *blockDescriptor = localBlockDescriptor; + result = kFblOk; + break; + } + + localBlockDescriptor = FblLbtBlockNext(); + } + + return result; +} + +/*********************************************************************************************************************** + * FblLbtGetBlockNrByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the block number with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockNr Number of the respective block + * \return Possible return values: + * - kFblOk if block number could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockNrByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tFblLbtBlockNr V_MEMRAM2 V_MEMRAM3 * blockNr) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize block number to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.blockNr = 0u; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockNr = blockDescriptor.blockNr; + result = kFblOk; + } + + return result; +} + +# if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +/*********************************************************************************************************************** + * FblLbtGetBlockTypeByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the block type with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockType Type of the respective block + * \return Possible return values: + * - kFblOk if block type could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockTypeByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tFblLbtBlockType V_MEMRAM2 V_MEMRAM3 * blockType) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize block type to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.blockType = 0uL; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockType = blockDescriptor.blockType; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +# if defined( FBL_LBT_ENABLE_HEADER_ADDRESS ) +/*********************************************************************************************************************** + * FblLbtGetBlockHeaderAddressByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the block header address with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockHeaderAddress Header address of the respective block + * \return Possible return values: + * - kFblOk if header address could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockHeaderAddressByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * blockHeaderAddress) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize header address to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.headerAddress = 0uL; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockHeaderAddress = blockDescriptor.headerAddress; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_BLOCK_HEADER_ADDRESS */ + +# if defined( FBL_LBT_ENABLE_BM_HEADER_ADDRESS ) +/*********************************************************************************************************************** + * FblLbtGetBlockBmHeaderAddressByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the bootmanager header address with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] bmHeaderAddress BM Header address of the respective block + * \return Possible return values: + * - kFblOk if header address could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockBmHeaderAddressByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * bmHeaderAddress) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize BM header address to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.bmHeaderAddress = 0uL; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *bmHeaderAddress = blockDescriptor.bmHeaderAddress; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_BM_HEADER_ADDRESS */ + +# if defined( FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS ) +/*********************************************************************************************************************** + * FblLbtGetBlockMaxProgAttemptsByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the maximum programming attempts with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] maxProgAttempts Maxmimum programming attempts of the respective block + * \return Possible return values: + * - kFblOk if maximum programming attempts could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockMaxProgAttemptsByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tFblLbtMaxProgAttempts V_MEMRAM2 V_MEMRAM3 * maxProgAttempts) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize maximum programming attempts to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.maxProgAttempts = 0u; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *maxProgAttempts = blockDescriptor.maxProgAttempts; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS */ + +# if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyInputFuncByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyInputFuncByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyInput = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyInput; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_VERIFY_INPUT */ + +# if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyProcessedFuncByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyProcessedFuncByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyProcessed = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyProcessed; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_VERIFY_PROCESSED */ + +# if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyPipelinedFuncByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the verification function + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyPipelinedFuncByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyPipelined = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyPipelined; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_VERIFY_PIPELINED */ + +# if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) +/*********************************************************************************************************************** + * FblLbtGetBlockVerifyOutputFuncByIndex + **********************************************************************************************************************/ +/*! \brief Look up and return the block header address with a certain block index value + * \param[in] blockIndex Index value of the block to be retrieved + * \param[out] blockVerifyFunc Address of the block specific verification function + * \return Possible return values: + * - kFblOk if verification function could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockVerifyOutputFuncByIndex(tFblLbtBlockIndex blockIndex, + V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc) +{ + tFblResult result = kFblFailed; + tBlockDescriptor blockDescriptor = {0}; + + /* Initialize verify function to resolve MISRA finding (blockDescriptor is only valid in case 'kFblOk' is returned) */ + blockDescriptor.verifyOutput = (tExportFct)0; + + if (FblLbtGetBlockDescriptorByIndex(blockIndex, &blockDescriptor) == kFblOk) + { + *blockVerifyFunc = blockDescriptor.verifyOutput; + result = kFblOk; + } + + return result; +} +# endif /* FBL_LBT_ENABLE_VERIFY_OUTPUT */ +#endif /* FBL_LBT_ENABLE_BLOCK_INDEX */ + +#if defined( FBL_LBT_ENABLE_FILE_NAME ) +/*********************************************************************************************************************** + * FblLbtGetBlockDescriptorByFilenameLength + **********************************************************************************************************************/ +/*! \brief Look up and return the block descriptor for a file name and length + * \param[in] fileName Name of the file + * \param[in] fileNameSize Size of the give file name +* \param[in] fileLength Length of the file to be downloaded + * \param[out] blockDescriptor Parameter structure with the information of the respective block + * \return Possible return values: + * - kFblOk if block descriptor could be retrieved successfully + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtGetBlockDescriptorByFilenameLength(const V_MEMRAM1 tFblLbtFileName V_MEMRAM2 V_MEMRAM3 * fileName, + tFblLbtFileNameSize fileNameSize, tFblLength fileLength, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor) +{ + tFblResult result = kFblFailed; + tBlockDescriptor localBlockDescriptor = {0}; + tFblLbtBlockFilter blockFilter = {0}; + + /* Configure block filter (clear all filter settings) */ + FblLbtBlockFilterInit(&blockFilter); + + localBlockDescriptor = FblLbtBlockFirst(&blockFilter); + while ( FblLbtBlockDone() == FALSE ) + { + /* Check if file name exists for checked block and if file name size matches. + Also allow a length with one byte less to support strings without zero termination */ + if ((localBlockDescriptor.fileName != V_NULL) && + (localBlockDescriptor.fileNameSize > 0u) && + ((localBlockDescriptor.fileNameSize == fileNameSize) || + ((localBlockDescriptor.fileNameSize - 1u) == fileNameSize )) && + (localBlockDescriptor.blockLength >= fileLength)) + { + vuintx i; + + /* Compare file name */ + for (i = 0u; i < fileNameSize; i++) + { + if (fileName[i] != localBlockDescriptor.fileName[i]) + { + /* Missmatch detected -> File name is not equal */ + break; + } + } + + if (i == fileNameSize) + { + *blockDescriptor = localBlockDescriptor; + result = kFblOk; + break; + } + } + + localBlockDescriptor = FblLbtBlockNext(); + } + + return result; +} +#endif /* FBL_LBT_ENABLE_FILE_NAME */ + +/*********************************************************************************************************************** + * FblLbtCheckAddressRange + **********************************************************************************************************************/ +/*! \brief Check whether an address lies within a specified address range + * \param[in] address Address to be checked + * \param[in] rangeStart Start of range + * \param[in] rangeLength Length of range + * \return Possible return values: + * - kFblOk if address lies within range + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtCheckAddressRange(tFblAddress address, tFblAddress rangeStart, tFblLength rangeLength) +{ + tFblResult result = kFblFailed; + + if ( (address >= rangeStart) + && ((address - rangeStart) < rangeLength) ) + { + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblLbtCheckRangeContained + **********************************************************************************************************************/ +/*! \brief Check whether an address range lies within another specified address range + * \param[in] address Start address of range to be checked + * \param[in] length Length of range to be checked + * \param[in] rangeStart Start of range + * \param[in] rangeLength Length of range + * \return Possible return values: + * - kFblOk if range lies within range + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtCheckRangeContained(tFblAddress address, tFblLength length, tFblAddress rangeStart, tFblLength rangeLength) +{ + tFblResult result = kFblFailed; + + if ((FblLbtCheckAddressRange(address, rangeStart, rangeLength) == kFblOk) + && (length <= rangeLength) + && ((address - rangeStart) <= (rangeLength - length)) ) + { + result = kFblOk; + } + + return result; +} + +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +/*********************************************************************************************************************** + * FblLbtCheckConsistency + **********************************************************************************************************************/ +/*! \brief Check consistency between the LBT which resides in the LBT block and the bootloader + * \return Possible return values: + * - kFblOk if the information in the new LBT is consistent with the bootloader + * - kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblLbtCheckConsistency(void) +{ + tFblResult result = kFblOk; + tFblLbtBlockNr localBlockNr = 0u; + tBlockDescriptor baseBlock = {0}; + tBlockDescriptor newBlock = {0}; + + /* Additional consistency checks should be performed by the generator which might be OEM/configuration specific, e.g.: + * - SBL and LBT block are unique and of type 'mandatory' + * - At least one logical block besides SBL/LBT is of type 'mandatory' + * - Block index of all blocks is unique + * - The configured logical blocks cover all blocks defined in the FBT + * - Block header address of all blocks lies inside the respective block area + * - Block header address has a reasonable distance from the presence pattern area + */ + + /* Temporarily switch to new LBT for consistency checks */ + FblLbtActivateLbtBlock(); + + /* Check if block count exceeds built-in maximum value */ + if (fblLbtActive->noOfBlocks > (tFblLbtBlockCount)FBL_LBT_BLOCK_COUNT) + { + result = kFblFailed; + } + + /* Check LBT against built-in FBT */ + if ((result == kFblOk) && (fblLbtActive->magicFlag != FblLogicalBlockTable.magicFlag)) + { + result = kFblFailed; + } + + /* Compare fixed blocks in built-in LBT against new LBT */ + if (result == kFblOk) + { + for (localBlockNr = 0u; localBlockNr < FblLogicalBlockTable.noOfBlocks; localBlockNr++) + { + baseBlock = FblLogicalBlockTable.logicalBlock[localBlockNr]; + result = FblLbtGetBlockDescriptorByNr(localBlockNr, &newBlock); + if (result == kFblOk) + { + result = FblLbtBlockCompare(&baseBlock, &newBlock); + } + if (result != kFblOk) + { + break; + } + } + } + + /* Check block type and verify functions against built-in values */ + if (result == kFblOk) + { + result = FblLbtCheckReferences(); + } + + /* Revert LBT pointer to built-in table */ + FblLbtInitPowerOn(); + + return result; +} + +/*********************************************************************************************************************** + * FblLbtActivateLbtBlock + **********************************************************************************************************************/ +/*! \brief Activate usage of the reprogrammable LBT + * \pre FblLbtCheckConsistency() has been executed with positive result + **********************************************************************************************************************/ +void FblLbtActivateLbtBlock(void) +{ + /* Switch to logical block table in LBT block */ +# if defined( FBL_LBT_ENABLE_RAM_BUFFER ) + FblLbtActivateLbtBlockByAddress(FblLogicalBlockTable.logicalBlock[FBL_MTAB_LBT_BLOCK_NUMBER].blockStartAddress); +# else + /* PRQA S 0306 1 */ /* MD_FblLib_Lbt_0306 */ + fblLbtActive = (V_MEMROM1 tLogicalBlockTable V_MEMROM2 V_MEMROM3 *)FblLogicalBlockTable.logicalBlock[FBL_MTAB_LBT_BLOCK_NUMBER].blockStartAddress; +# endif /* FBL_LBT_ENABLE_RAM_BUFFER */ +} +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + +/*********************************************************************************************************************** + * FblLbtActivateLbtBlockByAddress + **********************************************************************************************************************/ +/*! \brief Activate usage of the reprogrammable LBT + * \details CAUTION: The function will set the internal LBT pointer without further consistency checks. It's in + * the responsibility of the caller to check the LBT consistency before accessing the contained + * information! + * \param[in] address Address of the logical block table, which should now be used + **********************************************************************************************************************/ +void FblLbtActivateLbtBlockByAddress(tFblAddress address) +{ + /* Switch to logical block table in LBT block */ +#if defined(FBL_LBT_ENABLE_RAM_BUFFER) + tFblLength readCount = FblReadProm(address, (vuint8*)&fblLbtRamBuffer, FBL_LBT_RAM_BUF_SIZE); + /* PRQA S 3205 1 */ /* MD_FblLib_Lbt_3205 */ + assertFbl(readCount == FBL_LBT_RAM_BUF_SIZE, kFblSysAssertParameterOutOfRange); +#else + /* PRQA S 0306 1 */ /* MD_FblLib_Lbt_0306 */ + fblLbtActive = (V_MEMROM1 tLogicalBlockTable V_MEMROM2 V_MEMROM3 *)address; +#endif /* FBL_LBT_ENABLE_RAM_BUFFER */ +} +#define FBLLBT_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* module specific MISRA deviations: + + MD_FblLib_Lbt_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation-defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. The correctness of the respective implementation is verified by runtime tests. + + MD_FblLib_Lbt_3205: + Reason: Depending on the configuration some variables are not referenced by the code. For simplicity the + variables are kept. + Risk: No identifiable risk. + Prevention: No prevention required. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_LBT_ACCESS.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_lbt_access.h b/Source/bsw/Fbl/fbl_lbt_access.h new file mode 100644 index 0000000..ba47823 --- /dev/null +++ b/Source/bsw/Fbl/fbl_lbt_access.h @@ -0,0 +1,190 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Interface layer for accessing the logical block table (LBT) + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-05-24 visci - Initial version + * 01.01.00 2018-11-27 visshs ESCAN00101459 Add Support for Secure Boot + * 01.02.00 2019-02-26 visrie ESCAN00102278 Added additional getter functions + * 01.02.01 2019-09-05 visrcn ESCAN00103604 Modified memory qualifiers + * 01.03.00 2022-03-31 visstn FBL-4366 Perform MISRA 2012 migration + * 01.04.00 2022-10-17 visjns FBL-4925 No changes + * 01.04.01 2023-04-24 vismix ESCAN00113819 No changes + * 01.05.00 2023-12-14 vistbe FBL-7967 Add new filename attribute for LBT + **********************************************************************************************************************/ + +#ifndef FBL_LBT_ACCESS_H +#define FBL_LBT_ACCESS_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_Lbt CQComponent : Implementation */ +#define FBLLIB_LBT_VERSION 0x0105u +#define FBLLIB_LBT_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +/* Required due to usage of "boolean" type */ +#include "Platform_Types.h" + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/** Settings for mandatoryType sub-filter */ +typedef struct +{ + tFblLbtMandatoryType value; + boolean enabled; +} tFblLbtMandatoryFilter; + +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +/** Settings for blockType sub-filter */ +typedef struct +{ + tFblLbtBlockType value; + boolean enabled; +} tFblLbtTypeFilter; +#endif /* FBL_LBT_ENABLE_BLOCK_TYPE */ + +/** Global filter settings */ +typedef struct +{ + tFblLbtMandatoryFilter mandatoryType; +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) + tFblLbtTypeFilter blockType; +#endif +} tFblLbtBlockFilter; + +#define FBLLBT_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +void FblLbtInitPowerOn(void); + +/* Setter */ +void FblLbtBlockFilterInit(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter); +void FblLbtBlockFilterSetMandatoryType(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, tFblLbtMandatoryType mandatoryType); +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +void FblLbtBlockFilterSetBlockType(V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter, tFblLbtBlockType blockType); +#endif + +/* Getter */ +tFblLbtBlockCount FblLbtGetBlockCount(void); +tFblLbtMagicFlag FblLbtGetMagicFlag(void); +tFblResult FblLbtGetBlockNrByAddressLength(tFblAddress address, tFblLength length, V_MEMRAM1 tFblLbtBlockNr V_MEMRAM2 V_MEMRAM3 * blockNr); + +tFblResult FblLbtGetBlockDescriptorByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +tFblResult FblLbtGetBlockDescriptorByAddressLength(tFblAddress address, tFblLength length, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +tFblResult FblLbtGetBlockDescriptorByType(tFblLbtBlockType blockType, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +#endif +#if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +tFblResult FblLbtGetBlockTypeByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblLbtBlockType V_MEMRAM2 V_MEMRAM3 * blockType); +#endif +#if defined( FBL_LBT_ENABLE_BLOCK_INDEX ) +tFblResult FblLbtGetBlockIndexByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblLbtBlockIndex V_MEMRAM2 V_MEMRAM3 * blockIndex); +#endif +#if defined( FBL_LBT_ENABLE_HEADER_ADDRESS ) +tFblResult FblLbtGetBlockHeaderAddressByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * blockHeaderAddress); +#endif +#if defined( FBL_LBT_ENABLE_BM_HEADER_ADDRESS ) +tFblResult FblLbtGetBlockBmHeaderAddressByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * bmHeaderAddress); +#endif +#if defined( FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS ) +tFblResult FblLbtGetBlockMaxProgAttemptsByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tFblLbtMaxProgAttempts V_MEMRAM2 V_MEMRAM3 * maxProgAttempts); +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) +tFblResult FblLbtGetBlockVerifyInputFuncByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) +tFblResult FblLbtGetBlockVerifyProcessedFuncByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) +tFblResult FblLbtGetBlockVerifyPipelinedFuncByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +#endif +#if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) +tFblResult FblLbtGetBlockVerifyOutputFuncByNr(tFblLbtBlockNr blockNr, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +#endif + +#if defined( FBL_LBT_ENABLE_BLOCK_INDEX ) +tFblResult FblLbtGetBlockDescriptorByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +tFblResult FblLbtGetBlockNrByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tFblLbtBlockNr V_MEMRAM2 V_MEMRAM3 * blockNr); +# if defined( FBL_LBT_ENABLE_BLOCK_TYPE ) +tFblResult FblLbtGetBlockTypeByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tFblLbtBlockType V_MEMRAM2 V_MEMRAM3 * blockType); +# endif +# if defined( FBL_LBT_ENABLE_HEADER_ADDRESS ) +tFblResult FblLbtGetBlockHeaderAddressByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * blockHeaderAddress); +# endif +# if defined( FBL_LBT_ENABLE_BM_HEADER_ADDRESS ) +tFblResult FblLbtGetBlockBmHeaderAddressByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tFblAddress V_MEMRAM2 V_MEMRAM3 * bmHeaderAddress); +# endif +# if defined( FBL_LBT_ENABLE_MAX_PROG_ATTEMPTS ) +tFblResult FblLbtGetBlockMaxProgAttemptsByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tFblLbtMaxProgAttempts V_MEMRAM2 V_MEMRAM3 * maxProgAttempts); +# endif +# if defined( FBL_LBT_ENABLE_VERIFY_INPUT ) +tFblResult FblLbtGetBlockVerifyInputFuncByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +# endif +# if defined( FBL_LBT_ENABLE_VERIFY_PROCESSED ) +tFblResult FblLbtGetBlockVerifyProcessedFuncByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +# endif +# if defined( FBL_LBT_ENABLE_VERIFY_PIPELINED ) +tFblResult FblLbtGetBlockVerifyPipelinedFuncByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +# endif +# if defined( FBL_LBT_ENABLE_VERIFY_OUTPUT ) +tFblResult FblLbtGetBlockVerifyOutputFuncByIndex(tFblLbtBlockIndex blockIndex, V_MEMRAM1 tExportFct V_MEMRAM2 V_MEMRAM3 * blockVerifyFunc); +# endif +#endif /* FBL_LBT_ENABLE_BLOCK_INDEX */ +#if defined( FBL_LBT_ENABLE_FILE_NAME ) +tFblResult FblLbtGetBlockDescriptorByFilenameLength(const V_MEMRAM1 tFblLbtFileName V_MEMRAM2 V_MEMRAM3 * fileName, + tFblLbtFileNameSize fileNameSize, tFblLength fileLength, V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor); +#endif /* FBL_LBT_ENABLE_FILE_NAME */ + +/* Iterator */ +tBlockDescriptor FblLbtBlockFirst(const V_MEMRAM1 tFblLbtBlockFilter V_MEMRAM2 V_MEMRAM3 * blockFilter); +tBlockDescriptor FblLbtBlockNext(void); +boolean FblLbtBlockDone(void); + +/* Checker */ +tFblResult FblLbtCheckAddressRange(tFblAddress address, tFblAddress rangeStart, tFblLength rangeLength); +tFblResult FblLbtCheckRangeContained(tFblAddress address, tFblLength length, tFblAddress rangeStart, tFblLength rangeLength); + +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +tFblResult FblLbtCheckConsistency(void); +void FblLbtActivateLbtBlock(void); +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ +void FblLbtActivateLbtBlockByAddress(tFblAddress address); + +#define FBLLBT_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLLIB_LBT_ACCESS_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_LBT_ACCESS.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_main.c b/Source/bsw/Fbl/fbl_main.c new file mode 100644 index 0000000..36aa2cd --- /dev/null +++ b/Source/bsw/Fbl/fbl_main.c @@ -0,0 +1,603 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of FBL + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2019-10-10 vistmo FBL-388 Adapt main function interface for vBaseEnv + * 05.01.00 2019-11-14 visrcn FBL-830 Add support for VTT use case + * 05.01.01 2020-02-27 vistbe ESCAN00105432 [DemoAppl] No diagnostic requests can be processed + * 06.00.00 2020-04-08 visrie FBL-1016 Support of EcuM functions, support of new FblSb interface + * 06.01.00 2020-04-29 vistmo FBL-1584 Adding OTA startup support + * 06.01.01 2020-10-28 visrcn ESCAN00107190 Compiler error: Wrong definition for FblMain function + * 06.01.02 2020-11-26 visrcn ESCAN00107979 Tester connection is not shutdown after StayInBoot check + * 06.02.00 2022-04-08 lhopfhauer FBL-4852 Add support for new swap API + * 06.03.00 2022-05-06 lhopfhauer FBL-5148 Encapsulate call of FblInterruptDisable + * 06.04.00 2022-07-06 fmenke FBL-5235 Use Pre Timer/Wd init as standard + * 06.05.00 2022-11-30 visrie FBL-6065 Encapsulate FblMain declaration + * 06.05.01 2023-04-06 lhopfhauer ESCAN00113532 [DemoAppl only] FblCwClrCheckForStartMsg is not cleared if Stay + * in Boot is enabled - DemoAppl is not responding + * 06.06.00 2023-05-24 fmenke FBL-7036 P2 timeout in tester after the programming session request + * 06.07.00 2025-06-18 vsarcmijo FBL-9710 Extend presence pattern to connect validity information + * ESCAN00116602 [DemoAppl only] Compiler error: FblCwClrCheckForStartMsg is not + * defined + * 06.08.00 2025-10-21 pharring FBL-11469 Set a state when FblRepeat is reached + **********************************************************************************************************************/ + +#define FBL_MAIN_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" + +#include "EcuM.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLMAIN_VERSION != 0x0608u ) || \ + ( FBLMAIN_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_main.c: Source and header file are inconsistent!" +#endif + +#if ( FBLMAIN_VERSION != _FBL_MAIN_VERSION ) || \ + ( FBLMAIN_RELEASE_VERSION != _FBL_MAIN_RELEASE_VERSION) +# error "Error in fbl_main.c: Source and v_ver.h are inconsistent!" +#endif + +#if defined( _MICROSOFT_C_VTT_ ) +# define FBL_MAIN_ENABLE_VTT_USECASE +#endif /* _MICROSOFT_C_VTT_ */ + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if !defined( FBL_BM_HEADER_ADDRESS ) +# define FBL_BM_HEADER_ADDRESS &FblBmHdrHeader +#endif /* FBL_BM_HEADER_ADDRESS */ + +/* FblStart feature */ +#if defined( FBL_ENABLE_FBL_START ) +# if !defined( FblStartReset ) +# define FblStartReset() ApplFblReset() +# endif +#endif /* FBL_ENABLE_FBL_START */ + +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +# if !defined( kFblMainStartMessageDelay ) +# define kFblMainStartMessageDelay 20u /**< Start message delay default value: 20ms */ +# endif +# define kFblMainStartMessageReceived 0u /**< Indicates that a startup message has been received */ +# define kFblMainStartMessageTimeout 1u /**< No startup message has been received before timeout */ +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + +/* Main state handling */ +#define FblMainSetStartFromReset() SetFblMainState( kFblMainStateStartFromReset ) +#define FblMainSetStartFromAppl() SetFblMainState( kFblMainStateStartFromAppl ) +#define FblMainSetStartFromXcp() SetFblMainState( kFblMainStateStartFromXcp ) +#define FblMainSetStartFromOta() SetFblMainState( kFblMainStateStartFromOta ) +#define FblMainSetApplicationValid() SetFblMainState( kFblMainStateApplicationValid ) +#define FblMainSetWaitStartMessage() { \ + SetFblMainState( kFblMainStateWaitStartMessage ); \ + startMessageDelay = kFblMainStartMessageDelay + 1u; \ + } +#define FblMainSetStartMessageReceived() SetFblMainState( kFblMainStateStartMessageReceived ) + +#define FblMainClrStartFromReset() ClrFblMainState( kFblMainStateStartFromReset ) +#define FblMainClrStartFromAppl() ClrFblMainState( kFblMainStateStartFromAppl ) +#define FblMainClrStartFromXcp() ClrFblMainState( kFblMainStateStartFromXcp ) +#define FblMainClrStartFromOta() ClrFblMainState( kFblMainStateStartFromOta ) +#define FblMainClrApplicationValid() ClrFblMainState( kFblMainStateApplicationValid ) +#define FblMainClrWaitStartMessage() ClrFblMainState( kFblMainStateWaitStartMessage ) +#define FblMainClrStartMessageReceived() ClrFblMainState( kFblMainStateStartMessageReceived ) + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +# define FBLHEADER_START_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** FBL header data for access from application software */ +V_MEMROM0 V_MEMROM1 tFblHeader V_MEMROM2 FblHeader = /* PRQA S 1514 */ /* MD_FblMain_1514_FblHeader */ +{ + FBL_MAIN_HEADER_MAGIC_FLAG +# if defined( FBL_MTAB_NO_OF_BLOCKS ) + ,(tFblHeaderLogicalBlockTablePtr)(&FblLogicalBlockTable) + ,sizeof(FblLogicalBlockTable) +# else + ,V_NULL + ,0u +# endif +# if defined( FBL_ENABLE_COMMON_DATA ) + ,(tFblCommonDataPtr)(&fblCommonData) +# endif + ,FBL_BLOCK_START_ADDRESS + ,FBL_BLOCK_LENGTH + ,FBL_BM_HEADER_ADDRESS +}; +# define FBLHEADER_STOP_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define FBLMAIN_START_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +V_MEMRAM0 static V_MEMRAM1 vuint16 V_MEMRAM2 startMessageDelay; +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + +V_MEMRAM0 V_MEMRAM1_NEAR tFblStateBitmap V_MEMRAM2_NEAR fblMainStates[FBL_STATE_INDEX(kFblMainNumberOfStates - 1u) + 1u]; + +#define FBLMAIN_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLMAIN_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static void FblCheckProgrammingRequest(void); +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +static void FblPostProcessStartMsg( vuintx startMsgResult ); +static void FblRepeatCheckForStartMsg(void); +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + +static void FblInitPowerOn( void ); +static void FblInit( vuint8 initposition ); + +static void FblDeinit( void ); + +static void FblRepeat( void ); + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblCheckProgrammingRequest + **********************************************************************************************************************/ +/*! \brief Evaluates the programming request flag and decides the next steps (e.g. stay in bootloader, check for + * stay-in-boot message or some SecureBoot specific operations). + **********************************************************************************************************************/ +static void FblCheckProgrammingRequest(void) +{ + /* Decide the next step of the Bootloader */ + switch (ApplFblExtProgRequest()) + { + case kProgRequest: + { + FblMainSetStartFromAppl(); + break; + } +# if defined( FBL_ENABLE_STAY_IN_BOOT ) + case kCheckStayInBootRequest: + { + /* Check for stay in boot message during startup */ + FblMainSetWaitStartMessage(); + break; + } +# endif /* FBL_ENABLE_STAY_IN_BOOT */ +# if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined ( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) + case kInitKeysRequest: /* Intentional fall through */ +# endif +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) + case kInitMacsRequest: /* Intentional fall through */ +# endif +# endif /* FBLBM_ENABLE_SECURE_BOOT */ + case kNoProgRequest: /* Intentional fall through */ + default: + { + /* Normal startup */ + FblMainSetStartFromReset(); + break; + } + } +} + +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +/*********************************************************************************************************************** + * FblPostProcessStartMsg + **********************************************************************************************************************/ +/*! \brief Post-process result of start message reception + * \details This function post-processes the result of the startup message check - either + * the Bootloader is prepared or the application is started. + * \param[in] startMsgResult Indicates if a start message has been received or not + **********************************************************************************************************************/ +static void FblPostProcessStartMsg(vuintx startMsgResult) +{ + switch (startMsgResult) + { + case kFblMainStartMessageReceived: + { + FblMainSetStartMessageReceived(); + break; + } + case kFblMainStartMessageTimeout: + { +# if defined( FBL_NO_JSR_APPL ) +# else /* FBL_NO_JSR_APPL */ + /* Request shutdown from Com-Wrapper */ + FblCwShutdownRequest(kFblCwResetEcuRegularCase); + + while (!FblMainGetFblShutdownRequest()) + { + FblLookForWatchdogVoid(); + } + + FblDeinit(); + CallApplStart(); +# endif /* FBL_NO_JSR_APPL */ + break; + } + default: + { + assertFblInternal(0u, kFblSysAssertParameterOutOfRange); /* PRQA S 2741,4558 */ /* MD_FblMain_2741_4558 */ + break; + } + } +} +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + +/*********************************************************************************************************************** + * FblInitPowerOn + **********************************************************************************************************************/ +/*! \brief Pre-initialization of Bootloader variables + * \details Initializes all variables needed to control the Bootloader + **********************************************************************************************************************/ +static void FblInitPowerOn(void) /* PRQA S 3006 */ /* MD_FblMain_3006 */ +{ + vuintx i; + +#if defined( FBL_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) + /* Disable global interrupt handling */ + FblInterruptDisable(); /* PRQA S 1006 */ /* MD_FblMain_1006 */ +#endif /* FBL_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON */ + +#if defined( FBL_MAIN_ENABLE_VTT_USECASE ) +#else + /* Check if bootloader header address is correctly configured in generation tool */ + /* PRQA S 0306 1 */ /* MD_FblMain_FblHeader */ + assertFblGen(FblHeaderLocal == FblHeaderTable, kFblSysAssertParameterOutOfRange); +#endif /* FBL_ENABLE_DEMOAPPL || FBL_MAIN_ENABLE_VTT_USECASE */ + + /* Initialization of main variables */ + for (i = 0u; i < (sizeof(fblMainStates) / sizeof(fblMainStates[0])); i++) + { + fblMainStates[i] = (tFblStateBitmap)0x00u; + } +# if defined( FBL_ENABLE_STAY_IN_BOOT ) + startMessageDelay = 0u; +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + + /* Power on initialization of core modules */ + ClrWDInit(); + + FblDiagInitPowerOn(); + + MemDriver_InitPowerOn(); + /* Initialize intermediate access layer for LBT */ + FblLbtInitPowerOn(); + +#if defined( FBL_ENABLE_HARDWARE_SWAP ) + /* Initialize hardware swap module */ + FblSwapInitPowerOn(); +#endif + +# if defined( FBL_ENABLE_SECMOD_VECTOR ) + (void)SecM_InitPowerOn(V_NULL); +# endif /* FBL_ENABLE_SECMOD_VECTOR */ + +} + +/*********************************************************************************************************************** + * FblInit + **********************************************************************************************************************/ +/*! \brief Do initializations after reset or start out of application + **********************************************************************************************************************/ +/* PRQA S 6050 1 */ /* MD_MSR_STCAL */ +static void FblInit( vuint8 initposition ) +{ + /* User initialization before core initializations */ + ApplFblStartup(kFblInitPreCallback | initposition); /* PRQA S 2986 */ /* MD_FblMain_2986 */ + + switch (initposition) + { + /* Initialization steps the application validity is checked */ + case kFblInitBaseInitialization: + { + /* Initialize watchdog handling */ + FblInitWatchdog(); + /* Initialize Timer */ + FblTimerInit(); + break; + } + + /* Initialization steps after the application validity is checked */ + case kFblInitFblCommunication: + { + + EcuM_StartupTwo(); + + /* Initialize diagnostic module */ + FblDiagInit(); + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + /* Initialize SecureBoot functionality */ + FblSb_Init(); +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + /* Initialize extended presence pattern once */ + FblNvPatternSignedPresencePatternInit(); +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + break; + } + + /* Initialization steps executed after the Bootloader is invoked */ + case kFblInitFblFinalize: + { + + /* Diagnostic layer - init steps after NV-memory init */ + FblDiagPostInit(); + break; + } + + default: + { + assertFblInternal(0u, kFblSysAssertParameterOutOfRange); /* PRQA S 2741,4558 */ /* MD_FblMain_2741_4558 */ + break; + } + } + + /* User initialization after core initialization */ + ApplFblStartup(kFblInitPostCallback | initposition); +} + +/*********************************************************************************************************************** + * FblDeinit + **********************************************************************************************************************/ +/*! \brief Do necessary deinitializations + **********************************************************************************************************************/ +static void FblDeinit( void ) +{ + /* Deinitialize communication wrapper */ +# if( FBL_CW_API_REFERENCE_VERSION_MAJOR == 0x02u ) + FblCw_Deinit(); +# else + FblCwDeinit(); +# endif /* FBL_CW_API_REFERENCE_VERSION_MAJOR == 0x02u */ + +#if defined( FBL_WATCHDOG_ON ) + /* Synchronize watchdog before reset */ + ApplFblWDLong(); +#endif /* FBL_WATCHDOG_ON */ + FblTimerStopp(); /* PRQA S 0303 */ /* MD_FBL_0303_MemoryMappedRegAccess */ +} + +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +/*********************************************************************************************************************** + * FblRepeatCheckForStartMsg + **********************************************************************************************************************/ +/*! \brief This function waits during the acceptance window if the start message is received. + * \pre Hardware has to be initialized. + **********************************************************************************************************************/ +static void FblRepeatCheckForStartMsg( void ) +{ + /* Set COM wrapper flag for start message window */ + FblCwSetCheckForStartMsg(); + while (FblMainGetWaitStartMessage()) + { + /* Check if 1ms hardware timer expired */ + if ((FblLookForWatchdog() & FBL_TM_TRIGGERED) == FBL_TM_TRIGGERED) + { + /* Handle timer each millisecond */ + startMessageDelay--; + if (startMessageDelay == 0u) + { + /* Start message wait time expired */ + FblMainClrWaitStartMessage(); + FblPostProcessStartMsg(kFblMainStartMessageTimeout); + } + } + + if (FblCwCheckStartMessage() == kFblOk) + { + /* Startup message has been received */ + FblMainClrWaitStartMessage(); + FblPostProcessStartMsg(kFblMainStartMessageReceived); + } + } + /* Start message window is closed now */ + FblCwClrCheckForStartMsg(); +} +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + +/*********************************************************************************************************************** + * FblRepeat + **********************************************************************************************************************/ +/*! \brief This function contains the main loop of the FBL. + * \details In this loop, the Bus is polled and the watchdog is triggered. + * This function is used by the boot procedure for the start delay and for the real operation. + * \pre Hardware has to be initialized before. + * \return The return value is used by the boot procedure to determine whether to stay in FBL or start the appl. + **********************************************************************************************************************/ +static void FblRepeat( void ) +{ +#if defined( FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE ) + FblMainSetFblRepeatStarted(); +#endif /* FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE */ + + /* This loop will be left only for reset */ + while (!FblMainGetFblShutdownRequest()) + { + /* Check if 1ms hardware timer expired */ + if ((FblLookForWatchdog() & FBL_TM_TRIGGERED) == FBL_TM_TRIGGERED) + { + /* Run 1ms based tasks */ + FblDiagTimerTask(); + +#if defined( FBL_ENABLE_APPL_TIMER_TASK ) + /* Call cyclic function of fbl application module (if configured) */ + ApplFblTask(); +#endif /* FBL_ENABLE_APPL_TIMER_TASK */ + } + /* Run non-timer relevant operations */ + FblDiagStateTask(); + FblCwIdleTask(); + +# if defined( FBL_MEM_ENABLE_PIPELINING ) + if (FblMemTaskIsPending()) + { + FblMemTask(); + } +# endif /* FBL_MEM_ENABLE_PIPELINING */ + +#if defined( FBL_ENABLE_APPL_STATE_TASK ) + /* Call background function of fbl application module (if configured) */ + ApplFblStateTask(); +#endif /* FBL_ENABLE_APPL_STATE_TASK */ + + } +#if defined( FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE ) + FblMainClrFblRepeatStarted(); +#endif /* FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE */ +} + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblMain + **********************************************************************************************************************/ +/*! \brief Wrapper function to call the actual FblMainInternal function + **********************************************************************************************************************/ +#if !defined( FBLBM_INSTANCE_BOOTMANAGER ) +void V_API_NEAR FblMain( void ) /* PRQA S 5209 */ /* MD_FblMain_5209 */ +{ + FblMainInternal(); +} +#endif /* !FBLBM_INSTANCE_BOOTMANAGER */ + +/*********************************************************************************************************************** + * FblMainInternal + **********************************************************************************************************************/ +/*! \brief Main function of the Bootloader. + * \details The FBL initializes the hardware and waits for a download request. + **********************************************************************************************************************/ +void V_API_NEAR FblMainInternal( void ) /* PRQA S 5209 */ /* MD_FblMain_5209 */ +{ + /* Initialize variables */ + FblInitPowerOn(); + + /* Base initialization step - valid for both application and Bootloader */ + FblInit(kFblInitBaseInitialization); + + /* Evaluate programming request flag and decide next bootloader step */ + FblCheckProgrammingRequest(); + + /* Bootloader initialization step 1 - hardware and basic communication */ + FblInit(kFblInitFblCommunication); +# if defined( FBL_ENABLE_STAY_IN_BOOT ) + /* Check for start message */ + FblRepeatCheckForStartMsg(); +# endif /* FBL_ENABLE_STAY_IN_BOOT */ + + + /* Bootloader initialization step 2 - full diagnostics initialization */ + FblInit(kFblInitFblFinalize); + + /* Bootloader execution */ + FblRepeat(); + + /* Deinitialize and reset bootloader */ + FblDeinit(); + ApplFblReset(); +} + +#define FBLMAIN_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FBL_0303_MemoryMappedRegAccess: + Reason: Addressing memory mapped registers or other hardware specific feature requires casting a pointer type to + an integral type. This is a usual pattern for MCAL (Micro Controller Abstraction Layer) software. + Risk: Unintended read or write access into memory location. + Prevention: Code inspection focus on correct access to expected memory location. + + MD_FblMain_1006: + Reason: Assembler code is used to deactivate interrupts and set context information. + Risk: The code is not portable for different compilers. + Prevention: The assembler code provided by each FblHw module has to be tested. + + MD_FblMain_1514_FblHeader + Reason: MISRA: The object FblBmHeader is only referenced by function ..., in the translation unit where it is defined + This object is exported globally to other translation units + Risk: Name space pollution + Prevention: No Prevention necessary + + MD_FblMain_2741_4558: + Reason: Assertion macros have to be disabled in production code and are used only for development. + Risk: Assertion code may be enabled in production code unintentionally. If a assertion condition is unexpectedly + false, the code is active. A problem may occur if the Macro is additionally changed from single statement + to multiple statement. + Prevention: Macro is not allowed to be changed without review. Development code is automatically disabled via + configuration of project state "Production". + + MD_FblMain_2986: + Reason: This code is redundant but kept for clarity. + Risk: No risk. + Prevention: No prevention necessary. + + MD_FblMain_3006: + Reason: Assembler code is used to deactivate interrupts and set context information. + Risk: The code is not portable for different compilers. + Prevention: The assembler code provided by each FblHw module has to be tested. + + MD_FblMain_5209: + Reason: The Vector standard API for main function follows ANSI C typical definition of main function returning int. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMain_FblHeader: + Reason: A memory address is compared to a configured value. The configured value is interpreted as an integer. + Risk: The comparison may fail due to different data types. + Prevention: If this check fails, the configuration checks done by assertions have to verified manually. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MAIN.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_main.h b/Source/bsw/Fbl/fbl_main.h new file mode 100644 index 0000000..69cf91b --- /dev/null +++ b/Source/bsw/Fbl/fbl_main.h @@ -0,0 +1,180 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of FBL + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2019-10-10 vistmo FBL-388 Adapt main function interface for vBaseEnv + * 05.01.00 2019-11-14 visrcn FBL-830 No changes + * 05.01.01 2020-02-27 vistbe ESCAN00105432 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.01.00 2020-04-29 vistmo FBL-1584 Adding OTA startup support + * 06.01.01 2020-10-28 visrcn ESCAN00107190 Compiler error: Wrong definition for FblMain function + * 06.01.02 2020-11-26 visrcn ESCAN00107979 No changes + * 06.02.00 2022-04-08 lhopfhauer FBL-4852 No changes + * 06.03.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.04.00 2022-07-06 fmenke FBL-5235 No changes + * 06.05.00 2022-11-30 visrie FBL-6065 Encapsulate FblMain declaration + * 06.05.01 2023-04-06 lhopfhauer ESCAN00113532 No changes + * 06.06.00 2023-05-24 fmenke FBL-7036 No changes + * 06.07.00 2025-06-18 vsarcmijo FBL-9710 Fix version defines + * ESCAN00116602 No changes + * 06.08.00 2025-10-21 pharring FBL-11469 Set a state when FblRepeat is reached + **********************************************************************************************************************/ + +#ifndef FBL_MAIN_H +#define FBL_MAIN_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_main_types.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblMain CQComponent : Implementation */ +#define FBLMAIN_VERSION 0x0608u +#define FBLMAIN_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + + +/*********************************************************************************************************************** + * Main state definitions + **********************************************************************************************************************/ +#define kFblMainStateStartFromReset 0u +#define kFblMainStateStartFromAppl 1u +#define kFblMainStateStartFromXcp 2u +#define kFblMainStateStartFromOta 3u +#define kFblMainStateApplicationValid 4u +#define kFblMainStateWaitStartMessage 5u +#define kFblMainStateStartMessageReceived 6u +#define kFblMainStateFblShutdownRequest 7u +#define kFblMainStateFblRepeatStarted 8u + +#define kFblMainNumberOfStates 9u + +/*********************************************************************************************************************** + * State handling framework + **********************************************************************************************************************/ +/* PRQA S 3453 3 */ /* MD_MSR_FctLikeMacro */ +#define GetFblMainState(state) FBL_STATE_TEST(fblMainStates, (state)) /**< Read fbl_main state bit */ +#define SetFblMainState(state) FBL_STATE_SET(fblMainStates, state) /**< Set fbl_main state bit */ +#define ClrFblMainState(state) FBL_STATE_CLR(fblMainStates, state) /**< Clear fbl_main state bit */ + +#define FblMainGetStartFromReset() GetFblMainState( kFblMainStateStartFromReset ) +#define FblMainGetStartFromAppl() GetFblMainState( kFblMainStateStartFromAppl ) +#define FblMainGetStartFromXcp() GetFblMainState( kFblMainStateStartFromXcp ) +#define FblMainGetStartFromOta() GetFblMainState( kFblMainStateStartFromOta ) +#define FblMainGetApplicationValid() GetFblMainState( kFblMainStateApplicationValid ) +#define FblMainGetWaitStartMessage() GetFblMainState( kFblMainStateWaitStartMessage ) +#define FblMainGetStartMessageReceived() GetFblMainState( kFblMainStateStartMessageReceived ) +#define FblMainGetFblShutdownRequest() GetFblMainState( kFblMainStateFblShutdownRequest ) +#define FblMainGetFblRepeatStarted() GetFblMainState( kFblMainStateFblRepeatStarted ) + +#define FblMainSetFblShutdownRequest() SetFblMainState( kFblMainStateFblShutdownRequest ) +#define FblMainClrFblShutdownRequest() ClrFblMainState( kFblMainStateFblShutdownRequest ) +#define FblSetShutdownRequest() FblMainSetFblShutdownRequest() + +#define FblMainSetFblRepeatStarted() SetFblMainState( kFblMainStateFblRepeatStarted ) +#define FblMainClrFblRepeatStarted() ClrFblMainState( kFblMainStateFblRepeatStarted ) + +/*********************************************************************************************************************** + * Initialization steps + **********************************************************************************************************************/ +#define kFblInitPowerOn 0x00u /**< Power-on initialization step */ +#define kFblInitBaseInitialization 0x01u /**< Init steps before application validity check */ +#define kFblInitFblCommunication 0x02u /**< Bootloader initialization first part - mainly communication */ +#define kFblInitFblFinalize 0x03u /**< Finalize Bootloader initialization if application isn't started */ + +#define kFblInitPreCallback 0x00u /**< Initialization callback before core init function */ +#define kFblInitPostCallback 0x80u /**< Initialization callback after core init function */ + +/*********************************************************************************************************************** +* COM WRAPPER COMPATIBILITY DEFINITIONS +**********************************************************************************************************************/ + +/* Define interface version for classic FblWrapperCom modules */ +# if !defined( FBL_CW_API_REFERENCE_VERSION_MAJOR ) +/** Major interface version identifies incompatible changes */ +# define FBL_CW_API_REFERENCE_VERSION_MAJOR 0x01u +/** Minor interface version identifies backward compatible changes */ +# define FBL_CW_API_REFERENCE_VERSION_MINOR 0x00u +/** Release interface version identifies cosmetic changes */ +# define FBL_CW_API_REFERENCE_VERSION_RELEASE 0x00u +# endif /* !defined FBL_CW_API_REFERENCE_VERSION_MAJOR */ + +# if !defined( FBL_CW_CFG_PTR ) +# define FBL_CW_CFG_PTR V_NULL +# endif /* !defined FBL_CW_CFG_PTR */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLMAIN_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 extern V_MEMRAM1_NEAR tFblStateBitmap V_MEMRAM2_NEAR fblMainStates[FBL_STATE_INDEX(kFblMainNumberOfStates - 1u) + 1u]; +# define FBLMAIN_STOP_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define FBLHEADER_START_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMROM0 extern V_MEMROM1 tFblHeader V_MEMROM2 FblHeader; +# define FBLHEADER_STOP_SEC_CONST +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLMAIN_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if !defined( FBLBM_INSTANCE_BOOTMANAGER ) +void V_API_NEAR FblMain( void ); /* PRQA S 5209 */ /* MD_FblMain_5209 */ +#endif /* !FBLBM_INSTANCE_BOOTMANAGER */ +void V_API_NEAR FblMainInternal( void ); /* PRQA S 5209 */ /* MD_FblMain_5209 */ + +#define FBLMAIN_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ +/* Check diagnostic task call cycle */ +# if defined( kDiagCallCycle ) +# if( kDiagCallCycle != 1u ) +# error "Diagnostic task call cycle has to be configured to 1ms." +# endif +# endif /* kDiagCallCycle */ + +#endif /* FBL_MAIN_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MAIN.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_main_types.h b/Source/bsw/Fbl/fbl_main_types.h new file mode 100644 index 0000000..8c25a0e --- /dev/null +++ b/Source/bsw/Fbl/fbl_main_types.h @@ -0,0 +1,104 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of FBL + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2019-10-10 vistmo FBL-388 No changes + * 05.01.00 2019-11-14 visrcn FBL-830 No changes + * 05.01.01 2020-02-27 vistbe ESCAN00105432 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.01.00 2020-04-29 vistmo FBL-1584 No changes + * 06.01.01 2020-10-28 visrcn ESCAN00107190 No changes + * 06.01.02 2020-11-26 visrcn ESCAN00107979 No changes + * 06.02.00 2022-04-08 lhopfhauer FBL-4852 No changes + * 06.03.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.04.00 2022-07-06 fmenke FBL-5235 No changes + * 06.05.00 2022-11-30 visrie FBL-6065 No changes + * 06.05.01 2023-04-06 lhopfhauer ESCAN00113532 No changes + * 06.06.00 2023-05-24 fmenke FBL-7036 No changes + * 06.07.00 2025-06-18 vsarcmijo FBL-9710 No changes + * ESCAN00116602 No changes + * 06.08.00 2025-10-21 pharring FBL-11469 No changes + **********************************************************************************************************************/ + +#ifndef FBL_MAIN_TYPES_H +#define FBL_MAIN_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "bm_types.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblHeader access + **********************************************************************************************************************/ + +/* Define to access the FBL header structure */ +#define FblHeaderTable ((V_MEMROM1_FAR tFblHeader V_MEMROM2_FAR V_MEMROM3 *)(FBL_HEADER_ADDRESS)) +#define FblHeaderLocal ((V_MEMROM1_FAR tFblHeader V_MEMROM2_FAR V_MEMROM3 *)(&FblHeader)) + +/* Access macros for FblHeader elements for application */ +#if defined( FBL_ENABLE_COMMON_DATA ) +# define GetFblCommonDataPtr() (FblHeaderTable->pFblCommonData) +#endif + +#define FBL_MAIN_HEADER_MAGIC_FLAG 0x58462918u + +/*********************************************************************************************************************** + * TYPE DEFINITIONS + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_COMMON_DATA ) +/** Pointer to shared ROM constants */ +typedef V_MEMROM1_FAR void V_MEMROM2_FAR V_MEMROM3 * tFblCommonDataPtr; +#endif /* FBL_ENABLE_COMMON_DATA */ + +/** Pointer type to logical block table */ +typedef V_MEMROM1_FAR tLogicalBlockTable V_MEMROM2_FAR V_MEMROM3 * tFblHeaderLogicalBlockTablePtr; +/** Pointer type to BM header structure */ +typedef V_MEMROM1_FAR tFblBmHdrHeader V_MEMROM2_FAR V_MEMROM3 * tFblHeaderBmHeaderPtr; + +/** FBL header structure */ +typedef struct +{ + vuint32 magicFlag; + tFblHeaderLogicalBlockTablePtr pLogicalBlockTable; + tFblLength logicalBlockTableSize; +#if defined( FBL_ENABLE_COMMON_DATA ) + tFblCommonDataPtr pFblCommonData; /**< Common data structure - OEM dependent */ +#endif /* FBL_ENABLE_COMMON_DATA */ + tFblAddress fblStartAddress; + tFblLength fblLength; + tFblHeaderBmHeaderPtr bmHeader; +} tFblHeader; + +#endif /* FBL_MAIN_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MAIN_TYPES.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_mem.c b/Source/bsw/Fbl/fbl_mem.c new file mode 100644 index 0000000..20266b0 --- /dev/null +++ b/Source/bsw/Fbl/fbl_mem.c @@ -0,0 +1,6012 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Library containing common functionality for memory programming: + * - Erase of memory region + * - Data processing (e.g. decryption and decompression) + * - Segmentation and alignment + * - Signature / checksum verification over RAM and ROM contents + * - Pipelined programming + * + * Used by OEM dependent diagnostics to program incoming download data. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-03-23 visjhg - Initial release + * 01.00.01 2012-03-26 visjhg - Added description to file header + * - Added unsigned qualifier to constants + * 01.01.00 2012-04-05 visjhg ESCAN00057963 Initialization of return value in segment end indication when + * remainder handling is disabled + * Changes and optimizations after code review + * 01.02.00 2012-04-27 visjhg ESCAN00058452 Added support for processed length + * ESCAN00058621 Added __ApplFblMemCopyBuffer + * 01.03.00 2012-06-22 visjhg ESCAN00059475 Restore preamble in segment end indication + * ESCAN00059477 Restore default preamble offset in segment end indication + * Disable remainder handling for volatile memory + * Check for potential buffer overflow in FblMemGetActiveBuffer + * 01.04.00 2013-02-01 visjhg ESCAN00064290 Extensions for multi processor systems (pass-through) + * Rework of block start indication interface + * Pass additional info in structure + * visjhg ESCAN00064292 Added block erase + * visjhg ESCAN00064296 Preamble length switchable at runtime + * visjhg ESCAN00064301 Added signature verification on ROM contents + * Rework of block verify interface + * Keep track of segment history (structure provided externally) + * Extended pass-through interface for BlockVerify to pass + * user-specific information + * visjhg ESCAN00061335 Accept buffer offsets differing from constant preamble length + * in data indication + * visjhg ESCAN00064333 Differentiate watchdog trigger w/ and w/o status + * visjhg ESCAN00061764 Rework of function return paths + * visjhg ESCAN00061814 Encapsulate FblMemQueuePrepend with FBL_ENABLE_DATA_PROCESSING + * visjhg ESCAN00064338 Added post handler for SegmentEndIndication + * visach ESCAN00062919 Adapted comments to use Doxygen + * visjhg ESCAN00064334 Added interface to remap error codes to OEM dependent value + * visjhg ESCAN00064339 Segmented data processing: data produced during one cycle may be + * smaller than buffer size + * visjhg ESCAN00064330 Explicit resume of suspended operation + * Added state "suspend pending" + * visjhg ESCAN00064343 Added support for multiple input sources + * visjhg ESCAN00064543 Release active buffer in case of failed processing + * visjhg ESCAN00064720 Replaced __ApplFblMemCheckDfi by __ApplFblMemIsDataProcessingRequired + * 01.05.00 2013-04-10 visjhg ESCAN00064871 Reserve space for remainder data to be programmed + * visjhg ESCAN00064890 Move processing queue handle to global context + * visjhg - Minor fixes + * visjhg ESCAN00065830 Encapsulate setting of gProgContext + * visjhg ESCAN00066375 Restore original data after programming padded buffer + * Relocate buffer offset or search matching input buffer + * visjhg ESCAN00066377 Encapsulate erase functionality + * visjhg ESCAN00066379 Added interface version compatibility check + * visjhg ESCAN00066380 Exported FblMemInit + * 01.06.00 2013-07-22 visase ESCAN00066743 Fixed compiler warning regarding gProgContext + * visjhg ESCAN00067433 Added FblMemDeinit + * visjhg ESCAN00068321 Force response pending for erase operation + * visjhg ESCAN00069161 Added pipelined verification + * Rework of block start and verify interface + * Changed processing queue from FIFO to priority queue + * Added jobs for finalization of data processing and remainder + * General refactoring + * visjhg ESCAN00069190 Rework suspend operation + * 01.07.00 2013-08-16 visjhg ESCAN00069507 Corrected input type of FblMemSetInteger + * visjhg ESCAN00069803 Enable/disable verification at run-time + * visjhg ESCAN00069781 Corrected net size of data processing buffer + * Added canary word to detect buffer overflows + * visjhg ESCAN00069797 Set low priority of data processing equal to input priority + * visjhg ESCAN00069843 Limit restoring of data after padding to segmented input use-case + * Use dedicated buffer to store temporary data + * 02.00.00 2013-12-12 visjhg ESCAN00069945 Encapsulate write finalization entry in gLengthLimits + * visjhg ESCAN00072568 Perform input verification initialization on first segment start + * visjhg ESCAN00071344 Processed length: Limit programming to area defined by block + * visjhg - Additional canary word in front of buffer + * visjhg ESCAN00072569 Raised major version to match API version + * visjhg ESCAN00072156 Encapsulation of FblMemGetSpecificRemainder + * visjhg ESCAN00072570 Removed encapsulation of gProgContext + * visjhg ESCAN00072631 Set programming state to pending in FblMemProgramBuffer + * 02.01.00 2014-03-12 visjhg ESCAN00073504 No changes + * visjhg ESCAN00074066 Explicitly resume operation for finalization of pipelined verification + * 02.02.00 2014-05-09 visjhg ESCAN00075225 Restore default input offset for RAM data + * visjhg - Remove explicit memory qualifiers from __ApplFblMemCopyBuffer + * 03.00.00 2015-03-03 visjhg ESCAN00076591 Added support for external stream output + * visjhg ESCAN00077689 Finalize data processing when remainder handling is disabled + * - Support combination of stream output and pipelined verification + * visjhg ESCAN00077891 Added job for handling of segment address (pipelined verification) + * visjhg ESCAN00081491 Added support for resumable programming + * visjhg ESCAN00081494 Added support for verification on processed input data + * visjhg ESCAN00081493 Added selective pipelined programming (forced flush when disabled) + * 03.01.00 2015-04-23 visjhg ESCAN00082572 Introduced job class for handling of pipelined queues + * visjhg ESCAN00082605 Added support for reporting of progress information + * visjhg ESCAN00082606 Added support for gap fill (requires ordered segments) + * 03.01.01 2015-04-27 visjhg ESCAN00082700 Removed assertion for consumed buffer in FblProcessJob + * 03.01.02 2015-05-27 visjhg ESCAN00083138 Reworked padding byte handling and gap fill calculations + * 03.01.03 2015-06-13 visjhg ESCAN00083358 Don't update position after hashing of segment address (pipelined verification) + * visjhg ESCAN00083390 Update buffer size of pipelined verification read jobs + * visjhg ESCAN00083391 Unconditionally unblock pipelined verification queue when + * FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH is enabled + * visjhg ESCAN00083392 Pass correct block length to output verification + * 03.02.00 2015-07-21 visjhg ESCAN00084101 Unconditionally limit write length for + * FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP + * visjhg ESCAN00084102 No changes + * 03.02.01 2015-08-19 visjhg ESCAN00084279 Re-initialize data processing on snapshot restoration + * visjhg ESCAN00084559 Clear write remainder on snapshot creation + * visjhg ESCAN00084560 Force finalization when programming unprocessed data + * 03.02.02 2015-09-04 visjhg ESCAN00084994 Postpone remainder handling after checkpoint indication + * 04.00.00 2015-09-17 visjhg ESCAN00085249 Support combination of input and processed verification + * visjhg ESCAN00085250 Run-time decision whether address and length info is included in verification + * visjhg ESCAN00085251 Pass external segment info to __ApplFblMemIsPipelinedProgrammingDisabled + * 04.01.00 2016-04-01 visjhg ESCAN00087997 Rx interrupt: Critical section around crucial accesses to programming state + * visjhg ESCAN00088935 Corrected segment info pointer passed to __ApplFblMemIsPipelinedProgrammingDisabled + * 04.02.00 2016-10-06 visjhg ESCAN00090120 Changed segmentIndex parameter of FblMemPrepareVerifyPipeJob to vuintx type + * vishrf ESCAN00091253 Change allowed state when all data has been processed within the + * last chunk of data + * 04.02.01 2017-05-31 visjhg ESCAN00094695 Explicitly align gRemainderBuffer + * visjhg ESCAN00095201 Limit data processing input to less than 64 kB + * visjhg ESCAN00095356 Disable length check in FblMemDataIndication when stream output is active + * 04.03.00 2017-07-26 visjhg ESCAN00095772 Disable remainder handling for processed input data + * visjhg ESCAN00095774 Added FblMemFlushInputData + * visjhg ESCAN00095683 Place FblMemResumeIndication in RAMCODE section + * visjhg ESCAN00096075 Re-initialize input verification routines on snapshot restoration + * 04.03.01 2017-08-07 visjhg ESCAN00096209 Only update running input data length when data is unprocessed + * 04.04.00 2018-08-22 visjhg ESCAN00100464 Only store segments in snapshot when BlockStartIndication was executed before + * visjhg ESCAN00097115 Increase gap fill buffer to maximum segment size when necessary + * visjhg ESCAN00100482 Added hook __ApplFblMemConditionCheck before and after memory operations + * 04.04.01 2018-09-25 visjhg ESCAN00100850 No changes + * 04.05.00 2018-11-30 visjhg ESCAN00101500 No changes + * 04.05.01 2019-01-23 visjhg ESCAN00101568 Update segment information for pass-through use-case + * 04.05.02 2019-08-20 vistbe ESCAN00103967 Reinitialization is not executed on slave instances of LibMem + * 04.05.03 2019-10-02 visrie ESCAN00104203 Fixed resumable pipelined verification + * 04.06.00 2019-10-29 vistmo FBL-813 Migration to MISRA 2012 + * 04.06.01 2020-03-18 visrie ESCAN00105683 Fixed pipelined verification handling + * 04.06.02 2020-05-11 visjdn ESCAN00105967 Fixed 0 length pipelined verification. + * 04.06.03 2020-07-03 vistmo ESCAN00106050 TransferData might be rejected + * 04.07.00 2021-04-12 lhopfhauer FBL-2187 Add support for Spec 1.3 + * Added/adapted MemMap sections + * 04.08.00 2021-06-11 visjdn FBL-3560 No changes + * 04.09.00 2021-07-09 lhopfhauer FBL-3442 Add option to avoid abortion of verification procedure in case of error + * Updated MISRA justifications + * 04.09.01 2021-11-05 lhopfhauer ESCAN00110663 Verification failure for flash driver download + * 04.10.00 2022-05-02 lhopfhauer FBL-5067 Support embedded signatures with processed verification + * 04.10.01 2022-08-03 fmenke ESCAN00112185 Wrong verification result may be returned if any verification fails + * 04.10.02 2023-05-08 lhopfhauer ESCAN00114573 Processed verification not working with embedded signatures/checksums + * 04.11.00 2023-08-04 visrie FBL-5709 Allow Input length verification in resumable + pipelined + * programming config + * 04.12.00 2023-09-04 vistmo FBL-7572 Allow processed verification in combination with stream output + * 04.12.01 2024-02-02 lhopfhauer ESCAN00116407 Out of bounds write access + * ESCAN00116408 Resume may not work + * ESCAN00116457 Assertion missing in FblMemGet/SetInteger + * 04.13.00 2025-09-16 pharring FBL-10120 Add support for FblLib_Logger + * 04.13.01 2025-11-07 aeller ESCAN00121551 Download may fail when decompression is invoked with pending metadata only byte + * ESCAN00121700 No changes + * 04.14.00 2025-11-25 fmenke FBL-11808 Support passthrough HSM update + **********************************************************************************************************************/ + +#define FBL_MEM_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_mem.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLLIB_MEM_VERSION != 0x0414u ) || \ + ( FBLLIB_MEM_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_mem.c: Source and Header file are inconsistent!" +#endif + +#if ( FBLLIB_MEM_VERSION != _FBLLIB_MEM_VERSION ) || \ + ( FBLLIB_MEM_RELEASE_VERSION != _FBLLIB_MEM_RELEASE_VERSION ) +# error "Error in fbl_mem.c: Source and v_ver.h are inconsistent!" +#endif + +/* Interface version compatibility check */ +#if defined( FBL_MEM_API_REFERENCE_VERSION_MAJOR ) && \ + defined( FBL_MEM_API_REFERENCE_VERSION_MINOR ) +#else +# error "Error in fbl_mem.c: Interface version requirements not defined!" +#endif + +#if ( FBL_MEM_API_REFERENCE_VERSION_MAJOR != FBL_MEM_API_VERSION_MAJOR) || \ + ( FBL_MEM_API_REFERENCE_VERSION_MINOR > FBL_MEM_API_VERSION_MINOR) +# error "Error in fbl_mem.c: Interface version compatibility check failed!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/** Internal maximum segment size */ +#define FBL_MEM_SEGMENT_SIZE FBL_MAX_SEGMENT_SIZE + +/*-- Remap configuration switches--------------------------------------------*/ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) || \ + defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +/** Input buffer changed after data indication: Store and restore preamble */ +# define FBL_MEM_ENABLE_PREAMBLE_HANDLING +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING || FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +/* No remainder handling necessary for single byte segments */ +# if ( FBL_MEM_SEGMENT_SIZE > 1u ) +/** Programming may result in remainder which has to be stored for next cycle */ +# define FBL_MEM_ENABLE_REMAINDER_HANDLING +# endif /* FBL_MEM_SEGMENT_SIZE > 1u */ +#endif /* FBL_ENABLE_DATA_PROCESSING || FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) || \ + defined( FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP ) +/** Split buffer operations (write, data processing, verification and pass-through) into smaller pieces */ +# define FBL_MEM_ENABLE_SEGMENTATION +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING || FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP */ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) || \ + defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) +/** Keep track of running remaining length of input data */ +# define FBL_MEM_ENABLE_INPUT_LENGTH +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING || FBL_ENABLE_PROCESSED_DATA_LENGTH */ + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) && \ + defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +/** Allow use of any available input buffer and not only active one */ +# define FBL_MEM_ENABLE_VARYING_INPUT_BUFFER +#endif + +#if defined( FBL_MEM_WRITE_SEGMENTATION ) +#else +/** Set segmentation to default value */ +# define FBL_MEM_WRITE_SEGMENTATION (FBL_MEM_BUFFER_SIZE + FBL_MEM_SEGMENT_SIZE) +#endif /* FBL_MEM_WRITE_SEGMENTATION */ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +# if defined( FBL_MEM_ENABLE_SEGMENTATION ) +# define FBL_MEM_INTERNAL_PROC_SEGMENTATION FBL_MEM_PROC_SEGMENTATION +# if ( FBL_MEM_INTERNAL_PROC_SEGMENTATION == FBL_MEM_PROC_BUFFER_SIZE) +/* Segmented processing enabled, but data processing segmentation matches buffer size */ +# else +/* Split data processing into smaller pieces */ +# define FBL_MEM_ENABLE_PROC_SEGMENTATION +# endif +# else +/* Fill data processing buffer at once */ +# define FBL_MEM_INTERNAL_PROC_SEGMENTATION FBL_MEM_PROC_BUFFER_SIZE +# endif /* FBL_MEM_ENABLE_SEGMENTATION */ +# if defined( FBL_MEM_TRY_COUNTER_LIMIT_DATA_PROC ) +# else +/* Try counter limit for data processing to avoid endless loop */ +# define FBL_MEM_TRY_COUNTER_LIMIT_DATA_PROC 1u +# endif /* FBL_MEM_TRY_COUNTER_LIMIT_DATA_PROC */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** Stream verification is active */ +# define FBL_MEM_ENABLE_VERIFY_STREAM +#endif /* FBL_MEM_ENABLE_VERIFY_INPUT | FBL_MEM_ENABLE_VERIFY_PROCESSED | FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) || \ + defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +/** Verification is active */ +# define FBL_MEM_ENABLE_VERIFICATION +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM | FBL_MEM_ENABLE_VERIFY_OUTPUT */ + +#if defined( FBL_MEM_VERIFY_SEGMENTATION ) +# if defined( FBL_MEM_VERIFY_INPUT_SEGMENTATION ) +# else +/** Set input verification length to common segmentation length */ +# define FBL_MEM_VERIFY_INPUT_SEGMENTATION FBL_MEM_VERIFY_SEGMENTATION +# endif /* FBL_MEM_VERIFY_INPUT_SEGMENTATION */ +# if defined( FBL_MEM_VERIFY_PIPELINED_SEGMENTATION ) +# else +/** Set pipelined verification length to common segmentation length */ +# define FBL_MEM_VERIFY_PIPELINED_SEGMENTATION FBL_MEM_VERIFY_SEGMENTATION +# endif /* FBL_MEM_VERIFY_PIPELINED_SEGMENTATION */ +#endif /* FBL_MEM_VERIFY_SEGMENTATION */ + +#if defined( FBL_MEM_VERIFY_INPUT_SEGMENTATION ) +#else +/** Set input verification length to default value */ +# define FBL_MEM_VERIFY_INPUT_SEGMENTATION 64u +#endif /* FBL_MEM_VERIFY_INPUT_SEGMENTATION */ + +#if defined( FBL_MEM_VERIFY_PIPELINED_SEGMENTATION ) +#else +/** Set pipelined verification length to default value */ +# define FBL_MEM_VERIFY_PIPELINED_SEGMENTATION 64u +#endif /* FBL_MEM_VERIFY_PIPELINED_SEGMENTATION */ + +/** Response pending handling */ +# define FBL_MEM_ENABLE_RESPONSE_PENDING + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +# if defined( FBL_MEM_ENABLE_SELECTIVE_PIPELINED_PROGRAMMING ) +# define FBL_MEM_ENABLE_INPUT_DATA_FLUSH +# endif /* FBL_MEM_ENABLE_SELECTIVE_PIPELINED_PROGRAMMING */ +#else +/** Flush input data in data indication function */ +# define FBL_MEM_ENABLE_INPUT_DATA_FLUSH +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +#if defined( FBL_MEM_ENABLE_GAP_FILL ) +# if defined( FBL_MEM_GAP_FILL_SEGMENTATION ) +# else +/* Buffer size for gap fill function */ +# if defined( FBL_MEM_WRITE_SEGMENTATION ) +# if (FBL_MEM_SEGMENT_SIZE > FBL_MEM_WRITE_SEGMENTATION) +# define FBL_MEM_GAP_FILL_SEGMENTATION FBL_MEM_SEGMENT_SIZE +# else +# define FBL_MEM_GAP_FILL_SEGMENTATION FBL_MEM_WRITE_SEGMENTATION +# endif +# else +# define FBL_MEM_GAP_FILL_SEGMENTATION FBL_MEM_SEGMENT_SIZE +# endif /* FBL_MEM_WRITE_SEGMENTATION */ +# endif /* FBL_MEM_GAP_FILL_SEGMENTATION */ +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +# if defined( FBL_MEM_PROGRESS_ERASE ) +# else +/** Progress percentage of erase operation */ +# define FBL_MEM_PROGRESS_ERASE 10u +# endif /* FBL_MEM_PROGRESS_ERASE */ +# if defined( FBL_MEM_PROGRESS_VERIFY ) +# else +/** Progress percentage of final verify operation */ +# define FBL_MEM_PROGRESS_VERIFY 10u +# endif /* FBL_MEM_PROGRESS_VERIFY */ +# if defined( FBL_MEM_PROGRESS_INITIAL ) +# else +/** Initial progress value of overall progress and partial progress */ +# define FBL_MEM_PROGRESS_INITIAL 0u +# endif /* FBL_MEM_PROGRESS_INITIAL */ +# if defined( FBL_MEM_PROGRESS_COMPLETE ) +# else +/** Final progress value of overall progress and partial progress */ +# define FBL_MEM_PROGRESS_COMPLETE 100u +# endif /* FBL_MEM_PROGRESS_COMPLETE */ +# if defined( FBL_MEM_PROGRESS_PROGRAM ) +# else +/** Progress percentage of program operation */ +# define FBL_MEM_PROGRESS_PROGRAM (FBL_MEM_PROGRESS_COMPLETE - FBL_MEM_PROGRESS_ERASE - FBL_MEM_PROGRESS_VERIFY) +# endif /* FBL_MEM_PROGRESS_PROGRAM */ +# if defined( FBL_MEM_PROGRESS_THRESHOLD_BYTES ) +# else +/** Threshold for consecutive calls to reporting callback (in bytes) */ +# define FBL_MEM_PROGRESS_THRESHOLD_BYTES 1024u +# endif /* FBL_MEM_PROGRESS_THRESHOLD_BYTES */ +# if defined( FBL_MEM_PROGRESS_THRESHOLD_PERCENTAGE ) +# else +/** Threshold for consecutive calls to reporting callback (in percentage points) */ +# define FBL_MEM_PROGRESS_THRESHOLD_PERCENTAGE 5u +# endif /* FBL_MEM_PROGRESS_THRESHOLD_PERCENTAGE */ +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +/*-- Processing queue -------------------------------------------------------*/ +/* Number of input buffers */ +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +# if defined( FBL_MEM_PIPE_PROG_BUFFER_COUNT ) +/** Overwrite default value */ +# define FBL_MEM_QUEUE_ENTRIES_INPUT FBL_MEM_PIPE_PROG_BUFFER_COUNT +# else +/** Default value: Alternating input buffers */ +# define FBL_MEM_QUEUE_ENTRIES_INPUT 2u +# endif /* FBL_MEM_PIPE_PROG_BUFFER_COUNT */ +#else +/** Single buffer use-case */ +# define FBL_MEM_QUEUE_ENTRIES_INPUT 1u +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +/** Actual buffer count + * Input queue shared amongst all input sources */ +#define FBL_MEM_BUFFER_COUNT_INPUT ((FBL_MEM_QUEUE_ENTRIES_INPUT + FBL_MEM_SOURCE_COUNT) - 1u) + +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_INPUT 0u + +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_PROCESSED 0u + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +/** Reserve entries for write and finalization jobs */ +# define FBL_MEM_QUEUE_ENTRIES_DATA_PROC 2u +#else +# define FBL_MEM_QUEUE_ENTRIES_DATA_PROC 0u +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) +/** Reserve entries for write and finalization jobs */ +# define FBL_MEM_QUEUE_ENTRIES_STREAM_OUTPUT 2u +#else +# define FBL_MEM_QUEUE_ENTRIES_STREAM_OUTPUT 0u +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/** Reserve entry for write remainder finalization + * Only added in case processing queue already used */ +# define FBL_MEM_QUEUE_ENTRIES_REMAINDER 1u +#else +# define FBL_MEM_QUEUE_ENTRIES_REMAINDER 0u +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +# define FBL_MEM_QUEUE_ENTRIES_CHECKPOINT 0u + +#if defined( FBL_MEM_ENABLE_GAP_FILL ) +/** Reserve entry for gap fill */ +# define FBL_MEM_QUEUE_ENTRIES_GAP_FILL 1u +#else +# define FBL_MEM_QUEUE_ENTRIES_GAP_FILL 0u +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +/** Total number of processing queue entries */ +#define FBL_MEM_QUEUE_ENTRIES_PROCESSING \ + ( FBL_MEM_QUEUE_ENTRIES_VERIFY_INPUT + FBL_MEM_QUEUE_ENTRIES_VERIFY_PROCESSED + FBL_MEM_QUEUE_ENTRIES_DATA_PROC \ + + FBL_MEM_QUEUE_ENTRIES_STREAM_OUTPUT + FBL_MEM_QUEUE_ENTRIES_INPUT + FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE \ + + FBL_MEM_QUEUE_ENTRIES_CHECKPOINT + FBL_MEM_QUEUE_ENTRIES_GAP_FILL ) + +#if ( FBL_MEM_QUEUE_ENTRIES_PROCESSING > 1u ) +/** Activate processing queue */ +# define FBL_MEM_ENABLE_PROC_QUEUE +/** Add remainder handling to processing queue */ +# define FBL_MEM_QUEUE_ENTRIES_TOTAL (FBL_MEM_QUEUE_ENTRIES_PROCESSING + FBL_MEM_QUEUE_ENTRIES_REMAINDER) +#else +/** Single buffer use-case: no processing queue required */ +# define FBL_MEM_DISABLE_PROC_QUEUE +#endif /* FBL_MEM_QUEUE_ENTRIES_PROCESSING > 1u */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +# if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +# else +/** Update single write job to trigger remainder flush */ +# define FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB +# endif /* FBL_MEM_ENABLE_PROC_QUEUE */ +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +/* Processing queue specific */ + +/** Reserve two entries in data structure for explicit free and used head */ +# define FBL_MEM_RESERVED_QUEUE_ENTRIES 2u +/* Handles for free and used head */ +# define FBL_MEM_QUEUE_HANDLE_HEAD_USED 0u +# define FBL_MEM_QUEUE_HANDLE_HEAD_FREE 1u +/* Start handle for actual entries */ +# define FBL_MEM_QUEUE_HANDLE_ENTRY_OFFSET 2u + +/** Size of data structure for processing queue */ +# define FBL_MEM_QUEUE_SIZE_PROCESSING (FBL_MEM_RESERVED_QUEUE_ENTRIES + FBL_MEM_QUEUE_ENTRIES_TOTAL) +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +/** Size of data structure for pipelined programming queue */ +# define FBL_MEM_QUEUE_SIZE_PIPE_PROG (FBL_MEM_RESERVED_QUEUE_ENTRIES + FBL_MEM_QUEUE_ENTRIES_INPUT) +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# define FBL_MEM_QUEUE_SIZE_PIPE_VERIFY (FBL_MEM_RESERVED_QUEUE_ENTRIES + FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ) +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/* + Access macros to check for empty queues + A queue is empty if the head references itself (cyclic double linked list) +*/ +# define FblMemQueueIsEmpty(queue) (FBL_MEM_QUEUE_HANDLE_HEAD_USED == (queue)[FBL_MEM_QUEUE_HANDLE_HEAD_USED].next) +# define FblMemQueueIsFull(queue) (FBL_MEM_QUEUE_HANDLE_HEAD_FREE == (queue)[FBL_MEM_QUEUE_HANDLE_HEAD_FREE].next) + +/* Access macros to get handle of first entry */ +# define FblMemQueueGetFirstUsedHandle(queue) ((queue)[FBL_MEM_QUEUE_HANDLE_HEAD_USED].next) +# define FblMemQueueGetLastUsedHandle(queue) ((queue)[FBL_MEM_QUEUE_HANDLE_HEAD_USED].prev) +# define FblMemQueueGetFirstFreeHandle(queue) ((queue)[FBL_MEM_QUEUE_HANDLE_HEAD_FREE].next) + +/** Access macro to entry using handle */ +# define FblMemQueueGetEntry(queue, handle) ((queue)[handle]) +/* Access macros to get first or last entry */ +# define FblMemQueueGetFirstUsedEntry(queue) (FblMemQueueGetEntry((queue), FblMemQueueGetFirstUsedHandle(queue))) +# define FblMemQueueGetLastUsedEntry(queue) (FblMemQueueGetEntry((queue), FblMemQueueGetLastUsedHandle(queue))) +# define FblMemQueueGetFirstFreeEntry(queue) (FblMemQueueGetEntry((queue), FblMemQueueGetFirstFreeHandle(queue))) +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +/* Default priorities for queue entries */ +# define FBL_MEM_QUEUE_PRIO_LOWEST 0x00u +# define FBL_MEM_QUEUE_PRIO_HIGHEST 0xFFu + +/** Null queue entry pointer */ +# define FBL_MEM_QUEUE_NULL ((V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 *)V_NULL) +/** Null job pointer */ +# define FBL_MEM_JOB_NULL ((V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 *)V_NULL) + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +#else +/** Remap fill buffer for single input buffer use-case */ +# define FblMemGetPendingInputJob() (&FBL_MEM_INPUT_JOB[0]) +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +/*-- Verification -----------------------------------------------------------*/ +/** Null verification status pointer */ +#define FBL_MEM_VERIFY_STATUS_NULL ((V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 *)V_NULL) +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) +/** Null input verification function pointer (use of 0 avoid cast from pointer to object) */ +# define FBL_MEM_VERIFY_FCT_INPUT_NULL ((tFblMemVerifyFctInput)0) +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM */ +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +/** Null input verification function pointer (use of 0 avoid cast from pointer to object) */ +# define FBL_MEM_VERIFY_FCT_OUTPUT_NULL ((tFblMemVerifyFctOutput)0) +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + +/*-- Segment and platform alignment -----------------------------------------*/ + +/** Calculate remainder for given address range and segment size */ +#define FblMemGetRemainder(address, length, segSize) ((tFblLength)(((address) + (tFblAddress)(length)) & ((tFblAddress)(segSize) - 1u))) +/** Remainder for global segment size */ +#define FblMemGetGlobalRemainder(address, length) FblMemGetRemainder((address), (length), FBL_MEM_SEGMENT_SIZE) +/* Use global or device specific segment size for remainder determination? */ +# if defined( FBL_ENABLE_MULTIPLE_MEM_DEVICES ) && \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +# define FblMemGetWriteRemainder(address, length) FblMemGetSpecificRemainder((address), (length)) +# else +/** Only one device present, global remainder equals device specific remainder */ +# define FblMemGetWriteRemainder(address, length) FblMemGetGlobalRemainder((address), (length)) +# endif /* FBL_ENABLE_MULTIPLE_MEM_DEVICES || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +/* Buffer padding for potential write remainder */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/* Reserve space for remainder from previous cycle and one for buffer padding for last write */ +# define FBL_MEM_REMAINDER_PADDING (FBL_MEM_SEGMENT_SIZE - 1u) +/* Reserve space for buffer padding of last write */ +# define FBL_MEM_WRITE_PADDING (FBL_MEM_SEGMENT_SIZE - 1u) +#else +# define FBL_MEM_REMAINDER_PADDING 0u +# define FBL_MEM_WRITE_PADDING 0u +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#define FBL_MEM_TOTAL_PADDING (FBL_MEM_REMAINDER_PADDING + FBL_MEM_WRITE_PADDING) + +#if defined( FBL_ENABLE_SYSTEM_CHECK ) +/** Magic value of "canary" word used to detect buffer overflows (ASCII "Bird") */ +# define FBL_MEM_CANARY_VALUE 0x42697264uL +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + +#if defined( C_CPUTYPE_32BIT ) || \ + defined( C_CPUTYPE_16BIT ) +# define FBL_MEM_PLATFORM_ALIGN 4u +# define FBL_MEM_PLATFORM_ALIGN_MASK 0x03u +#else /* C_CPUTYPE_8BIT */ +# define FBL_MEM_PLATFORM_ALIGN 1u +# define FBL_MEM_PLATFORM_ALIGN_MASK 0x00u +#endif /* C_CPUTYPE_32BIT || C_CPUTYPE_16BIT */ + +#if defined( FBL_ENABLE_SYSTEM_CHECK ) +/** Macro to generate basic data type including buffer alignment to platform requirements */ +# define FBL_MEM_ALIGNED_BUFFER_TYPE(size) \ + struct \ + { \ + /** Magic value of "canary" word used to detect buffer overflows */ \ + vuint32 canaryFront; \ + /** Reserve buffer for configured size and potential alignment */ \ + vuint8 data[size]; \ + /** Magic value of "canary" word used to detect buffer overflows */ \ + vuint32 canaryBack; \ + } +#else +/* Force alignment to 32 bit boundary (if required by platform) */ +# if defined( C_CPUTYPE_32BIT ) || \ + defined( C_CPUTYPE_16BIT ) +/** Macro to generate basic data type including buffer alignment to platform requirements */ +# define FBL_MEM_ALIGNED_BUFFER_TYPE(size) \ + struct \ + { \ + vuint32 alignDummy; \ + /** Reserve buffer for configured size and potential alignment */ \ + vuint8 data[size]; \ + } +# else /* C_CPUTYPE_8BIT */ +/** Macro to generate basic data type including buffer alignment to platform requirements */ +# define FBL_MEM_ALIGNED_BUFFER_TYPE(size) \ + struct \ + { \ + /** Reserve buffer for configured size and potential alignment */ \ + vuint8 data[size]; \ + } +# endif /* C_CPUTYPE_32BIT || C_CPUTYPE_16BIT */ +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + +/** Round length up to next multiple of alignment */ +#define FBL_MEM_LENGTH_ALIGN(length, align) (((((length) - 1u) / (align)) + 1u) * (align)) + +/** Align space used by preamble to multiple of platform requirement */ +#define FBL_MEM_PREAMBLE_ALIGN(length) FBL_MEM_LENGTH_ALIGN((length), FBL_MEM_PLATFORM_ALIGN) +/** As preamble always lies within the actual buffer it can be subtracted from the total length */ +#define FBL_MEM_PREAMBLE_OFFSET(length) (FBL_MEM_PREAMBLE_ALIGN(length) - (length)) +/** Padded buffer size for input buffers (including maximum platform alignment) */ +#define FBL_MEM_PADDED_BUFFER_SIZE (FBL_MEM_BUFFER_SIZE + (FBL_MEM_PLATFORM_ALIGN - 1u) + FBL_MEM_TOTAL_PADDING) +#if defined( FBL_ENABLE_DATA_PROCESSING ) +/** Padded buffer size for data processing buffers */ +# define FBL_MEM_PADDED_PROC_BUFFER_SIZE (FBL_MEM_PROC_BUFFER_SIZE + FBL_MEM_TOTAL_PADDING) +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +/** Dynamic input source */ +# define FBL_MEM_ACTIVE_SOURCE gActiveSource +#else +/** Fixed input source */ +# define FBL_MEM_ACTIVE_SOURCE 0u +# if defined( FBL_MEM_SOURCE_COUNT ) +# else +/** Set input source count if not already defined */ +# define FBL_MEM_SOURCE_COUNT 1u +# endif +#endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ + +#if defined( FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH ) +/** Dynamic preamble length stored per input source */ +# define FBL_MEM_PREAMBLE_LENGTH gPreambleLength[FBL_MEM_ACTIVE_SOURCE] +#else +/** Fixed preamble length */ +# define FBL_MEM_PREAMBLE_LENGTH FBL_MEM_DEFAULT_PREAMBLE_LENGTH +#endif /* FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH */ + +/** Substitution macro to access input buffers depending on active input source */ +#define FBL_MEM_INPUT_JOB gInputJobs[FBL_MEM_ACTIVE_SOURCE] +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +/** Substitution macro to access pipelined programming queue depending on active input source */ +# define FBL_MEM_PIPE_PROG_QUEUE gPipeProgQueue[FBL_MEM_ACTIVE_SOURCE] +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +/** Helper macro to get number of array entries */ +#define FBL_MEM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + + +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# if defined( FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP ) +/** Unconditionally limited for proper RCR-RP handling */ +# define FBL_MEM_FINALIZE_UNLIMITED_MODE kFblMemOperationMode_Unconditional +# else +/** Write complete remaining data at once during finalization */ +# define FBL_MEM_FINALIZE_UNLIMITED_MODE kFblMemOperationMode_Finalize +# endif /* FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP */ +#else +/** Do not limit input length, process complete buffer */ +# define FblMemLimitLength(inputLen, type, finalize) (inputLen) +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( __ApplFblMemCopyBuffer ) +#else +/* PRQA S 0602, 0603 2 */ /* MD_FblMem_0602_0603 */ +/** Copy input buffer to destination address */ +# define __ApplFblMemCopyBuffer(address, data, length) (void)MEMCPY((address), (data), (length)) +#endif /* __ApplFblMemCopyBuffer */ + +/** Null buffer pointer */ +# define FBL_MEM_BUFFER_NULL ((tFblMemRamData)V_NULL) + +/*-- Indication function order ----------------------------------------------*/ +/* + Allowed indication order: + + Init(PowerOn) + | + +-------->+--------+ + | V | + | +-> BlockErase | + | +-------+ | + | V | + | BlockStart <-+ + | | + | V + | SegmentStart <-+ + | | | + | V | + | +-> Data | + | +-----+ | + | V | + | SegmentEnd | + | +---------+ + | V + | BlockEnd + | | + | V + | BlockVerify <-+ + | | | + +---------+--------+ +*/ + +/* Bitmasks for allowed states */ +#define FBL_MEM_ALLOWED_NONE 0x00u +#define FBL_MEM_ALLOWED_BLOCK_START 0x01u +#define FBL_MEM_ALLOWED_SEGMENT_START 0x02u +#define FBL_MEM_ALLOWED_DATA_IND 0x04u +#define FBL_MEM_ALLOWED_SEGMENT_END 0x08u +#define FBL_MEM_ALLOWED_BLOCK_END 0x10u +#define FBL_MEM_ALLOWED_BLOCK_VERIFY 0x20u +#define FBL_MEM_ALLOWED_BLOCK_ERASE 0x40u + +/* Access macros for handling of allowed states */ +/** Reset all states */ +#define FblMemResetAllowed() FblMemSetAllowed(FBL_MEM_ALLOWED_NONE) +/** Set states according to bitmask (overwriting previous settings) */ +# define FblMemSetAllowed(mask) (gAllowedInd = (tFblMemAllowedInd)(mask)) +/** Add states according to bitmask (previous settings unchanged) */ +# define FblMemAddAllowed(mask) (gAllowedInd |= (tFblMemAllowedInd)(mask)) +/** Clear states according to bitmask */ +#define FblMemClrAllowed(mask) (gAllowedInd &= FblInvertBits(mask, tFblMemAllowedInd)) +/** Check for required states against bitmask */ +#define FblMemIsAllowed(mask) ((gAllowedInd & (tFblMemAllowedInd)(mask)) == (tFblMemAllowedInd)(mask)) +/** Check if any of the required states is currently allowed */ +#define FblMemIsAnyAllowed(mask) ((gAllowedInd & (tFblMemAllowedInd)(mask)) != (tFblMemAllowedInd)(FBL_MEM_ALLOWED_NONE)) + +/*-- Error handling ---------------------------------------------------------*/ +/** Dummy value for errors without extended status */ +#define FBL_MEM_EXT_STATUS_NONE 0x00u +/** Remap errors without extended status to common macro */ +#define FBL_MEM_SET_STATUS(status, var) FBL_MEM_SET_EXT_STATUS(status, FBL_MEM_EXT_STATUS_NONE, var) +/* Extended status configured? */ +#if defined( FBL_MEM_ENABLE_EXT_STATUS ) +# define FBL_MEM_SET_EXT_STATUS(status, ext, var) { \ + FBL_MEM_EXT_STATUS_ ## status(ext); \ + (var) = kFblMemStatus_ ## status; \ + } +/* Pass extended info without setting error code */ +# define FBL_MEM_SET_EXT_INFO(type, info) FBL_MEM_EXT_STATUS_ ## type(info) /* PRQA S 0342 */ /* MD_MSR_Rule20.10_0342 */ +#else +/* Set error code, no extended status */ +# define FBL_MEM_SET_EXT_STATUS(status, ext, var) (var) = kFblMemStatus_ ## status /* PRQA S 0342 */ /* MD_MSR_Rule20.10_0342 */ +# define FBL_MEM_SET_EXT_INFO(type, info) +#endif /* FBL_MEM_ENABLE_EXT_STATUS */ + + +/** Assertion codes */ +#define kFblMemAssertParameterOutOfRange 0x01u +#define kFblMemAssertUserResultOutOfRange 0x02u + +/*-- Critical sections ------------------------------------------------------*/ +/* Allow override in configuration */ +#if defined( __ApplFblMemEnterCriticalSection ) +#else +/** Enter critical section: Do nothing in default configuration */ +# define __ApplFblMemEnterCriticalSection() /* PRQA S 0602, 0603 */ /* MD_FblMem_0602_0603 */ +#endif /* __ApplFblMemEnterCriticalSection */ + +/* Allow override in configuration */ +#if defined( __ApplFblMemLeaveCriticalSection ) +#else +/** Leave critical section: Do nothing in default configuration */ +# define __ApplFblMemLeaveCriticalSection() /* PRQA S 0602, 0603 */ /* MD_FblMem_0602_0603 */ +#endif /* __ApplFblMemLeaveCriticalSection */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/*-- Indication function order ----------------------------------------------*/ +/** States for indication order */ +typedef vuintx tFblMemAllowedInd; + +/*-- Buffer handling --------------------------------------------------------*/ +/** Job types */ +typedef enum +{ + kFblMemJobType_InputWrite = 0u /**< Input buffer, write through without any data processing */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + , kFblMemJobType_WriteFinalize /**< Trigger programming of write remainder */ +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) + , kFblMemJobType_ProcInput /**< Input buffer, process data before writing */ + , kFblMemJobType_ProcWrite /**< Write buffer for processed data */ + , kFblMemJobType_ProcFinalize /**< Trigger for data processing finalization */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + , kFblMemJobType_VerifyPipeInfo /**< Update pipelined verification hash with segment information */ +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + , kFblMemJobType_VerifyPipeRead /**< Read back data already programmed for pipelined verification */ + , kFblMemJobType_VerifyPipeUpdate /**< Update pipelined verification hash */ + , kFblMemJobType_VerifyPipeFinalize /**< Trigger finalization of pipelined verification */ +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + , kFblMemJobType_StreamInput /**< Input buffer, pass to stream output */ + , kFblMemJobType_StreamProc /**< Pass processed data to stream output */ + , kFblMemJobType_StreamFinalize /**< Trigger for data processing finalization */ +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + , kFblMemJobType_GapFill /**< Fill gaps between programmed segments */ +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + , kFblMemJobType_Max +} tFblMemJobType; + +/** Job class, initiate special handling on completion */ +#if defined( FBL_MEM_ENABLE_PIPELINING ) +typedef enum +{ + tFblMemJobClass_Default /**< Default job, no special handling required */ +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + , tFblMemJobClass_PipeProg /**< Pipelined programming job */ +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + , tFblMemJobClass_VerifyPipe /**< Pipelined verification job */ +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +} tFblMemJobClass; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +/** Flag to indicate finalization to subfunction */ +typedef enum +{ + kFblMemOperationMode_Normal = 0u, /**< Normal operation, job complete as soon as "used" member reaches zero */ + kFblMemOperationMode_Finalize, /**< Finalize operation */ + kFblMemOperationMode_Unconditional /**< Job unconditionally completed after first run */ +} tFblMemOperationMode; + +/** Aligned input buffer type */ +typedef FBL_MEM_ALIGNED_BUFFER_TYPE(FBL_MEM_PADDED_BUFFER_SIZE) tFblMemInputBuffer; +#if defined( FBL_ENABLE_DATA_PROCESSING ) +/** Aligned buffer type for data processing */ +typedef FBL_MEM_ALIGNED_BUFFER_TYPE(FBL_MEM_PADDED_PROC_BUFFER_SIZE) tFblMemProcBuffer; +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) +/** Aligned buffer type for gap fill */ +typedef FBL_MEM_ALIGNED_BUFFER_TYPE(FBL_MEM_GAP_FILL_SEGMENTATION) tFblMemGapFillBuffer; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/** Aligned buffer type for remainder handling */ +typedef FBL_MEM_ALIGNED_BUFFER_TYPE(FBL_MEM_SEGMENT_SIZE) tFblMemRemainderBuffer; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +/** Job information */ +typedef struct +{ + tFblMemRamData buffer; /**< Pointer to referenced buffer */ + tFblLength totalSize; /**< Total size of referenced buffer */ + tFblLength netSize; /**< Size actually usable for input data */ + tFblLength offset; /**< Offset of actual buffer content */ + tFblLength position; /**< Current position in buffer */ + tFblLength used; /**< Current data length */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) || \ + defined( FBL_MEM_ENABLE_GAP_FILL ) + tFblAddress baseAddress; /**< Memory base address */ +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED || FBL_MEM_ENABLE_RESUMABLE_PROGRAMMING || FBL_MEM_ENABLE_GAP_FILL */ + tFblMemJobType type; /**< Job type */ + tFblMemOperationMode completion; /**< Handling of job completion */ + vuintx segmentIndex; /**< Index of segment associated with job */ +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +#if defined( FBL_MEM_ENABLE_PIPELINING ) + tFblMemJobClass jobClass; /**< Job class, initiate special handling on completion */ +#endif /* FBL_MEM_ENABLE_PIPELINING */ +} tFblMemJob; + +/** Module internal segment information */ +typedef struct +{ + tFblMemSegmentInfo input; /**< Input segment information */ + /* Internal attributes */ + tFblAddress writeAddress; /**< Current address */ + tFblLength writeRemainder; /**< Unwritten remainder */ + tFblLength writeLength; /**< Remaining length */ +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + tFblLength writtenLength; /**< Total written length */ +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) + tFblLength inputAddress; /**< Running address of input data */ +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +#if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + tFblLength inputLength; /**< Running remaining length of input data */ +#endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + tFblMemJobType jobType; /**< Remember input job types */ +#endif /* FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_PASSTHROUGH || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + vuintx ownIndex; /**< Index of segment */ + vuintx nextIndex; /**< Index of next segment */ +} tFblMemSegmentInternal; + +/*-- Processing queue -------------------------------------------------------*/ +/** Priority of queue entry */ +typedef vuint8 tFblMemQueuePrio; + +/** Job priorities */ +/* PRQA S 0724 TAG_FblMem_0724 */ /* MD_FblMem_0724_EnumValNotUnique */ +typedef enum +{ + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_Lowest = FBL_MEM_QUEUE_PRIO_LOWEST, /**< Lowest job priority */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + kFblMemJobPrio_VerifyPipeFinalize, /**< Finalization of pipelined verification */ + kFblMemJobPrio_VerifyPipeInput, /**< Not actually used, but acts as a common priority + * for all pipelined verification jobs which + * generate input data for update job */ +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + kFblMemJobPrio_VerifyPipeInfo = kFblMemJobPrio_VerifyPipeInput, /**< Pipelined verification segment information */ +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + kFblMemJobPrio_VerifyPipeRead = kFblMemJobPrio_VerifyPipeInput, /**< Pipelined verification read */ + kFblMemJobPrio_VerifyPipeUpdate, /**< Pipelined verification update */ +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + kFblMemJobPrio_Write, /**< Helper entry for flushing of all pending write jobs */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + kFblMemJobPrio_GapFill, /**< Fill gaps between programmed segments */ +#endif /* FBL_MEM_ENABLE_GAP_FILL */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_WriteFinalize, /**< Finalize remainder write */ +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) + kFblMemJobPrio_ProcFinalize, /**< Finalization of data processing */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + kFblMemJobPrio_StreamFinalize, /**< Finalization of stream output */ +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + kFblMemJobPrio_Input, /**< Not actually used, but acts as a common priority + * for all input jobs */ + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_InputWrite = kFblMemJobPrio_Input, /**< Input: Write through */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + /* PRQA S 3205 2 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_StreamInput = kFblMemJobPrio_Input, /**< Input: Stream output */ + kFblMemJobPrio_StreamProcLow = kFblMemJobPrio_Input, /**< Stream output of processed data, low priority + * used when processing is split into smaller pieces + * Prevent overtaking by following input jobs */ +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) + kFblMemJobPrio_ProcInput = kFblMemJobPrio_Input, /**< Input: Data processing */ + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_ProcWriteLow = kFblMemJobPrio_Input, /**< Write operation of data processing, low priority + * used when processing is split into smaller pieces + * Prevent overtaking by following input jobs */ + kFblMemJobPrio_ProcWriteHigh, /**< Write operation of data processing, high priority + * used to flush buffer */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_StreamProcHigh, /**< Stream output of processed data, high priority + * used to flush buffer */ +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + /* PRQA S 3205 1 */ /* MD_FblMem_3205_IdentifierNotUsed */ + kFblMemJobPrio_Highest = FBL_MEM_QUEUE_PRIO_HIGHEST /**< Highest job priority */ +} tFblMemJobPrio; /* PRQA S 3205 */ /* MD_FblMem_3205_IdentifierNotUsed */ +/* PRQA L:TAG_FblMem_0724 */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +/** Handle for queue entry */ +typedef vuintx tFblMemQueueHandle; + +/** Queue entry */ +typedef struct +{ + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job; /**< Associated job */ + tFblMemQueuePrio prio; /**< Entry priority */ + tFblMemQueueHandle prev; /**< Handle of previous queue entry */ + tFblMemQueueHandle next; /**< Handle of next queue entry */ +} tFblMemQueueEntry; +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** Limitation of processed length per cycle */ +typedef struct +{ + tFblLength limit; /**< Length limit, 0 equals unlimited */ + tFblMemOperationMode unlimitedMode; /**< Operation mode which returns unlimited length */ +} tFblMemLengthLimit; +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/*-- Pipelined programming --------------------------------------------------*/ +#if defined( FBL_MEM_ENABLE_PIPELINING ) +/* + Context of active programming operation + Generation of RCR-RP message only applicable in service context + Otherwise service dispatching may not be in a state where RCR-RP is allowed +*/ +typedef enum +{ + kFblMemContext_Service = 0u, /**< Programming directly initiated by service dispatcher */ + kFblMemContext_Background /**< Background programming while data transfer is in progress */ +} tFblMemContext; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +/*-- Progress information ---------------------------------------------------*/ +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/** Progress reporting state */ +typedef enum +{ + kFblMemProgressState_Disabled, /**< Disable progress reporting */ + kFblMemProgressState_Enabled /**< Enable progress reporting */ +} tFblMemProgressState; + +/** Internal progress information */ +typedef struct +{ + vuint32 target; /**< Expected maximum value of partial operation in arbitrary unit (e.g. bytes) */ + vuint8 totalOffset; /**< Percentage offset of total operation for current operation type */ + vuint8 totalPercentage; /**< Percentage contribution to total operation of current operation type */ +} tFblMemProgressInfoInternal; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +/*-- Resumable programming --------------------------------------------------*/ + +/*-- Error handling ---------------------------------------------------------*/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLLIB_MEM_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/** State of programming operation */ +V_MEMRAM0 V_MEMRAM1 tFblMemProgState V_MEMRAM2 fblMemProgState; + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +/* PRQA S 3218 TAG_FblMem_3218 */ /* MD_FblMem_3218 */ + +/** States for indication order */ +V_MEMRAM0 static V_MEMRAM1 tFblMemAllowedInd V_MEMRAM2 gAllowedInd; +/** Error status for programming operations (potentially ran in background) */ +V_MEMRAM0 static V_MEMRAM1 tFblMemStatus V_MEMRAM2 gErrorStatus; + +#if defined( FBL_MEM_ENABLE_PIPELINING ) +/** Context of programming operation (service context / background context) */ +V_MEMRAM0 static V_MEMRAM1 tFblMemContext V_MEMRAM2 gProgContext; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +#if defined( FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO ) +/** Block information */ +V_MEMRAM0 static V_MEMRAM1 tFblMemBlockInfo V_MEMRAM2 gBlockInfo; +#endif /* FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO */ + +/** Segment information */ +V_MEMRAM0 static V_MEMRAM1 tFblMemSegmentInternal V_MEMRAM2 gSegInfo; + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +/** Active input source */ +V_MEMRAM0 static V_MEMRAM1 tFblMemInputSource V_MEMRAM2 gActiveSource; +#endif + +#if defined( FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH ) +/** Preamble length stored per input source */ +V_MEMRAM0 static V_MEMRAM1 tFblLength V_MEMRAM2 gPreambleLength[FBL_MEM_SOURCE_COUNT]; +#endif /* FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH */ + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) +/** Temporary buffer for storage of preamble */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 gPreambleBuffer[FBL_MEM_MAX_PREAMBLE_LENGTH]; +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/** Temporary buffer for write remainder */ +V_MEMRAM0 static V_MEMRAM1 tFblMemRemainderBuffer V_MEMRAM2 gRemainderBuffer; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +/** Temporary buffer for data overwritten by buffer padding */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 gPaddingBuffer[FBL_MEM_SEGMENT_SIZE]; +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + +/*-- Input buffers ----------------------------------------------------------*/ +/** Data buffer(s) */ +V_MEMRAM0 static V_MEMRAM1 tFblMemInputBuffer V_MEMRAM2 gBasicInputBuffer[FBL_MEM_BUFFER_COUNT_INPUT]; +/** Input jobs */ +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gInputJobs[FBL_MEM_SOURCE_COUNT][FBL_MEM_QUEUE_ENTRIES_INPUT]; + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/** Write finalization job */ +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gWriteFinalizeJob; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +/*-- On-the-fly verification ------------------------------------------------*/ + + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** Pipelined verification jobs */ +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gVerifyPipeReadJob[FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ]; +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gVerifyPipeUpdateJob; +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gVerifyPipeFinalizeJob; +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 gVerifyPipeReadBuffer[FBL_MEM_VERIFY_PIPELINED_SEGMENTATION]; +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) +/** Data buffer(s) for segment information */ +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 gVerifyPipeInfoBuffer[FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ][FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE]; +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +/*-- Data processing --------------------------------------------------------*/ +V_MEMRAM0 static V_MEMRAM1 tProcParam V_MEMRAM2 gProcParam; +/* Data processing jobs */ +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gProcWriteJob; +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gProcFinalizeJob; +/* Data processing buffer */ +V_MEMRAM0 static V_MEMRAM1 tFblMemProcBuffer V_MEMRAM2 gProcBuffer; + +# if defined( FBL_MEM_ENABLE_PROC_SEGMENTATION ) +/** Handle of data processing write job in processing queue + Defined globally as information has to be persistent across multiple calls of FblMemProcessJob */ +V_MEMRAM0 static V_MEMRAM1 tFblMemQueueHandle V_MEMRAM2 gProcHandle; +# endif /* FBL_MEM_ENABLE_PROC_SEGMENTATION */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) +/*-- Stream output ----------------------------------------------------------*/ +V_MEMRAM0 static V_MEMRAM1 tFblMemStreamProcessing V_MEMRAM2 gStreamParam; +/* Stream output jobs */ +# if defined( FBL_ENABLE_DATA_PROCESSING ) +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gStreamProcJob; +# endif /* FBL_ENABLE_DATA_PROCESSING */ +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gStreamFinalizeJob; +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + + +#if defined( FBL_MEM_ENABLE_GAP_FILL ) +V_MEMRAM0 static V_MEMRAM1 tFblMemJob V_MEMRAM2 gGapFillJob; +V_MEMRAM0 static V_MEMRAM1 tFblMemGapFillBuffer V_MEMRAM2 gGapFillBuffer; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/*-- Progress information ---------------------------------------------------*/ +/** Current progress information */ +V_MEMRAM0 static V_MEMRAM1 tFblMemProgressInfo V_MEMRAM2 gProgressInfo; +/** Previously reported progress information */ +V_MEMRAM0 static V_MEMRAM1 tFblMemProgressInfo V_MEMRAM2 gPrevProgressInfo; + +/** Explicitely enable or disable reporting of erase progress */ +V_MEMRAM0 static V_MEMRAM1 tFblMemProgressState V_MEMRAM2 gProgressState; + +/** Internal progress information (current percentage contribution, target value) */ +V_MEMRAM0 static V_MEMRAM1 tFblMemProgressInfoInternal V_MEMRAM2 gProgressInfoInternal; +/** Value of progress remainder during previous update */ +V_MEMRAM0 static V_MEMRAM1 vuint32 V_MEMRAM2 gProgressPrevRemainder; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +/*-- Processing queue -------------------------------------------------------*/ +/** Processing queue */ +V_MEMRAM0 static V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 gProcessingQueue[FBL_MEM_QUEUE_SIZE_PROCESSING]; +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +/** Pipelined programming queue */ +V_MEMRAM0 static V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 gPipeProgQueue[FBL_MEM_SOURCE_COUNT][FBL_MEM_QUEUE_SIZE_PIPE_PROG]; +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +V_MEMRAM0 static V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 gVerifyPipeQueue[FBL_MEM_QUEUE_SIZE_PIPE_VERIFY]; +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#define FBLLIB_MEM_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLLIB_MEM_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +/** Mapping of priorities to job types + * Has to be same order as tFblMemJobType */ +V_MEMROM0 static V_MEMROM1 tFblMemQueuePrio V_MEMROM2 gJobPrio[] = +{ + (vuint8)kFblMemJobPrio_InputWrite /**< InputWrite */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + , (vuint8)kFblMemJobPrio_WriteFinalize /**< WriteFinalize */ +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +# if defined( FBL_ENABLE_DATA_PROCESSING ) + , (vuint8)kFblMemJobPrio_ProcInput /**< ProcInput */ +# if defined( FBL_MEM_ENABLE_PROC_SEGMENTATION ) + , (vuint8)kFblMemJobPrio_ProcWriteLow /**< ProcWrite, low priority when processing is split into smaller pieces */ + /* kFblMemJobPrio_ProcWriteHigh not explicitely mapped as it is not used when inserting job, + * but only when temporarily updating the priority because of a full processing buffer */ +# else + , (vuint8)kFblMemJobPrio_ProcWriteHigh /**< ProcWrite, high priority used to flush buffer */ + /* kFblMemJobPrio_ProcWriteLow not used */ +# endif /* FBL_MEM_ENABLE_PROC_SEGMENTATION */ + , (vuint8)kFblMemJobPrio_ProcFinalize /**< ProcFinalize */ +# endif /* FBL_ENABLE_DATA_PROCESSING */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + , (vuint8)kFblMemJobPrio_VerifyPipeInfo /**< VerifyPipeInfo */ +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + , (vuint8)kFblMemJobPrio_VerifyPipeRead /**< VerifyPipeRead */ + , (vuint8)kFblMemJobPrio_VerifyPipeUpdate /**< VerifyPipeUpdate */ + , (vuint8)kFblMemJobPrio_VerifyPipeFinalize /**< VerifyPipeFinalize */ +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + , (vuint8)kFblMemJobPrio_StreamInput /**< StreamInput */ +# if defined( FBL_MEM_ENABLE_PROC_SEGMENTATION ) + , (vuint8)kFblMemJobPrio_StreamProcLow /**< StreamProc, low priority when processing is split into smaller pieces */ + /* kFblMemJobPrio_StreamProcHigh not explicitely mapped as it is not used when inserting job, + * but only when temporarily updating the priority because of a full processing buffer */ +# else + , (vuint8)kFblMemJobPrio_StreamProcHigh /**< StreamProc, high priority used to flush buffer */ + /* kFblMemJobPrio_StreamProcLow not used */ +# endif /* FBL_MEM_ENABLE_PROC_SEGMENTATION */ + , (vuint8)kFblMemJobPrio_StreamFinalize /**< StreamFinalize */ +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + , (vuint8)kFblMemJobPrio_GapFill /**< GapFill */ +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + , (vuint8)kFblMemJobPrio_Lowest /**< Concluding entry */ +}; +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** Limitation of processed length per cycle + * Has to be same order as tFblMemJobType */ +V_MEMROM0 static V_MEMROM1 tFblMemLengthLimit V_MEMROM2 gLengthLimits[] = +{ + { FBL_MEM_WRITE_SEGMENTATION, FBL_MEM_FINALIZE_UNLIMITED_MODE } /**< InputWrite */ +# if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + , { 0u, kFblMemOperationMode_Normal } /**< WriteFinalize, no actual input data */ +# endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +# if defined( FBL_ENABLE_DATA_PROCESSING ) + , { 0xFFFFu, kFblMemOperationMode_Unconditional } /**< ProcInput, limited to 16 bit */ + , { FBL_MEM_WRITE_SEGMENTATION, FBL_MEM_FINALIZE_UNLIMITED_MODE } /**< ProcWrite */ + , { 0u, kFblMemOperationMode_Normal } /**< ProcFinalize, no actual input data */ +# endif /* FBL_ENABLE_DATA_PROCESSING */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + , { FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE, kFblMemOperationMode_Unconditional } /**< VerifyPipeInfo, unconditionally limited by size of segment information */ +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + , { FBL_MEM_VERIFY_PIPELINED_SEGMENTATION, kFblMemOperationMode_Unconditional } /**< VerifyPipeRead, unconditionally limited by temporary buffer */ + , { FBL_MEM_VERIFY_PIPELINED_SEGMENTATION, kFblMemOperationMode_Unconditional } /**< VerifyPipeUpdate, limited by VerifyPipeRead */ + , { 0u, kFblMemOperationMode_Normal } /**< VerifyPipeFinalize, no actual input data */ +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + , { FBL_MEM_WRITE_SEGMENTATION, FBL_MEM_FINALIZE_UNLIMITED_MODE } /**< StreamInput */ + , { FBL_MEM_WRITE_SEGMENTATION, FBL_MEM_FINALIZE_UNLIMITED_MODE } /**< StreamProc */ + , { 0u, kFblMemOperationMode_Normal } /**< StreamFinalize, no actual input data */ +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + , { 0u, kFblMemOperationMode_Normal } /**< GapFill, limit applied in job processing */ +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + , { 0u, kFblMemOperationMode_Normal } /**< Concluding entry */ +}; +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/*-- Error handling ---------------------------------------------------------*/ + +/* PRQA L:TAG_FblMem_3218 */ + +#define FBLLIB_MEM_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLLIB_MEM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +static tFblMemTriggerStatus FblMemTriggerWatchdogExt( void ); +static void FblMemTriggerWatchdog( void ); +#if defined( FBL_MEM_ENABLE_RESPONSE_PENDING ) +static void FblMemResponsePending( void ); +#endif /* FBL_MEM_ENABLE_RESPONSE_PENDING */ + +static void FblMemInitInputQueue( void ); +static void FblMemInitStates( void ); +static tFblMemRamData FblMemInitInternal( void ); +static tFblMemStatus FblMemQueueBuffer( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ); +static void FblMemProcessQueue( tFblMemOperationMode mode ); +static void FblMemFlushQueueByPrio( tFblMemQueuePrio prio ); +#if defined( FBL_MEM_ENABLE_PIPELINING ) +static void FblMemUnblockQueue( const V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue ); +#endif /* FBL_MEM_ENABLE_PIPELINING */ +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) +static tFblMemStatus FblMemVerifyInput( V_MEMRAM1 tFblMemVerifyRoutineInput V_MEMRAM2 V_MEMRAM3 * routine, + const V_MEMRAM1 tFblMemVerifyData V_MEMRAM2 V_MEMRAM3 * data, vuint8 state, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * result ); +static tFblMemStatus FblMemInitVerifyInput( void ); +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemPrepareVerifyPipeJob( vuintx segmentIndex, tFblAddress address ); +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemUpdateVerifyPipeJob( vuintx segmentIndex, tFblAddress address, tFblLength length ); +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +static tFblMemStatus FblMemProcessJob( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob, tFblMemOperationMode mode ); +static tFblMemStatus FblMemProgramStream( const V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * programJob, + V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemOperationMode mode ); +static tFblLength FblMemPadLength( tFblAddress address, tFblLength length ); +static tFblLength FblMemPadBuffer( tFblAddress address, tFblLength length, tFblMemRamData data ); +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +static void FblMemUnpadBuffer( tFblMemRamData data, tFblLength padLen ); +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ +static tFblMemStatus FblMemCopyBuffer( tFblAddress programAddress, + const V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemConstRamData programData ); +static tFblMemStatus FblMemEraseRegionInternal( tFblAddress eraseAddress, tFblLength eraseLength ); +static tFblMemStatus FblMemProgramBufferInternal( tFblAddress programAddress, + V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemRamData programData, + tFblMemProgState checkPointState ); +# if defined( FBL_ENABLE_MULTIPLE_MEM_DEVICES ) && \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +static tFblLength FblMemGetSpecificRemainder( tFblAddress address, tFblLength length ); +# endif /* FBL_ENABLE_MULTIPLE_MEM_DEVICES && FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +static tFblMemStatus FblMemRelocateBufferOffset( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob, + tFblMemConstRamData buffer, tFblLength offset, tFblLength length ); +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ +#if defined( FBL_MEM_ENABLE_VARYING_INPUT_BUFFER ) +static tFblMemStatus FblMemSearchInputBuffer( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ); +#endif /* FBL_MEM_ENABLE_VARYING_INPUT_BUFFER */ + +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +static tFblLength FblMemLimitLength( tFblLength inputLen, tFblMemJobType type, tFblMemOperationMode mode ); +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) +static void FblMemStorePreamble( void ); +static void FblMemRestorePreamble( void ); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + +static tFblResult FblMemCheckAllowed( tFblMemAllowedInd check, tFblMemAllowedInd clear ); +static tFblMemRamData FblMemGetBuffer( const V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job ); +#if defined( FBL_ENABLE_SYSTEM_CHECK ) +static void FblMemInitBufferIntegrity( void ); +static tFblMemStatus FblMemVerifyBufferIntegrity( void ); +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +static void FblMemQueueInit( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, tFblMemQueueHandle length ); + +static tFblMemQueueHandle FblMemQueueMove( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle, tFblMemQueueHandle prevNew ); + +# if defined( FBL_MEM_ENABLE_PIPELINING ) +static tFblMemQueueHandle FblMemQueueMoveFirstFreeEntry( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle prevNew ); +static tFblMemQueueHandle FblMemQueueAppend( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue ); +# endif /* FBL_MEM_ENABLE_PIPELINING */ +static tFblMemQueueHandle FblMemQueueRemove( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle ); +static tFblMemQueueHandle FblMemQueuePrioUpdate( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle, tFblMemQueuePrio prio ); +static tFblMemQueueHandle FblMemQueuePrioInsert( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueuePrio prio, V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job ); +static tFblMemQueueHandle FblMemQueueDefaultPrioInsert( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job, vuintx segmentIndex ); +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemGetPendingInputJob( void ); +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +static void FblMemInitJob( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job, tFblMemRamData buffer, + tFblLength size, tFblMemJobType type ); + + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +static vuint8 FblMemCalculateProgress( vuint32 current, vuint32 total, vuint8 percentage ); +static void FblMemInitProgress( void ); +static void FblMemReportProgress( void ); +static void FblMemSetupProgress( tFblMemProgressType type, tFblAddress logicalAddress, vuint32 segmentCount, + vuint8 totalOffset, vuint8 totalPercentage, vuint32 target ); +static void FblMemOffsetProgress( vuint32 totalDone, vuint32 totalTarget ); +static void FblMemUpdateProgress( vuint32 remainderPart ); +static void FblMemConcludeProgress( void ); +# if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +# if defined( FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM ) +/* Parameters order changed in comparison to HIS security module specification */ +static tFblMemVerifySize FblMemProgressRead( tFblMemVerifyAddr address, tFblMemVerifySize length, tFblMemVerifyDataPtr buffer ); +# else +/* Parameters order as defined by HIS security module specification */ +static tFblMemVerifySize FblMemProgressRead( tFblMemVerifyAddr address, tFblMemVerifyDataPtr buffer, tFblMemVerifySize length ); +# endif /* FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM */ +# endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +/*********************************************************************************************************************** + * EXTERNAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblMemTriggerWatchdogExt + **********************************************************************************************************************/ +/*! \brief Call configured watchdog trigger routine + * \details If pipelined programming is supported and the trigger is called while a background programming operation + * is active, the default watchdog trigger is executed. + * Otherwise an erroneous RCR-RP could be generated before service dispatching is finished. + * E.g. ISO 14229 enforces that certain message checks (length, ...) are performed before the first RCR-RP + * transmission. + * For all other cases (non-pipelined programming, service context) the configured routine to support an + * adaptive RCR-RP generation is called instead. + * \return Watchdog trigger status + **********************************************************************************************************************/ +static tFblMemTriggerStatus FblMemTriggerWatchdogExt( void ) +{ + tFblMemTriggerStatus result; + +#if defined( FBL_MEM_ENABLE_PIPELINING ) && \ + defined( __ApplFblMemWdTrigger ) + /* Do not generate RCR-RP while programming in background context */ + if (kFblMemContext_Background == gProgContext) + { + /* Default watchdog trigger */ + result = __ApplFblMemWdTrigger(); + } + else +#endif /* FBL_MEM_ENABLE_PIPELINING && __ApplFblMemWdTrigger */ + { +#if defined( __ApplFblMemAdaptiveRcrRp ) + /* Trigger watchdog and dynamically generate RCR-RP */ + result = __ApplFblMemAdaptiveRcrRp(); +#else + /* Callback not configured, return default value */ + result = FBL_MEM_WD_TRIGGER_DEFAULT; +#endif /* __ApplFblMemAdaptiveRcrRp */ + } + + return result; +} + +/*********************************************************************************************************************** + * FblMemTriggerWatchdog + **********************************************************************************************************************/ +/*! \brief Call configured watchdog trigger routine + * \details Suppress watchdog trigger status (see FblMemTriggerWatchdogExt) + **********************************************************************************************************************/ +static void FblMemTriggerWatchdog( void ) +{ + (void)FblMemTriggerWatchdogExt(); +} + +#if defined( FBL_MEM_ENABLE_RESPONSE_PENDING ) +/*********************************************************************************************************************** + * FblMemResponsePending + **********************************************************************************************************************/ +/*! \brief Force RCR-RP by calling configured routine + * \details If pipelined programming is supported only execute function if called in service context. Otherwise an + * erroneous RCR-RP could be generated before service dispatching is finished + **********************************************************************************************************************/ +static void FblMemResponsePending( void ) +{ +# if defined( __ApplFblMemForcedRcrRp ) +# if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Do not force RCR-RP while programming in background context */ + if (kFblMemContext_Service == gProgContext) +# endif /* FBL_MEM_ENABLE_PIPELINING */ + { +# if defined( __ApplFblMemIsRcrRpActive ) + /* Do not force RCR-RP if already active */ + if (kFblOk != __ApplFblMemIsRcrRpActive()) +# endif /* __ApplFblMemIsRcrRpActive */ + { + /* Force RCR-RP */ + __ApplFblMemForcedRcrRp(); + } + } +# endif /* __ApplFblMemForcedRcrRp */ +} +#endif /* FBL_MEM_ENABLE_RESPONSE_PENDING */ + +/*********************************************************************************************************************** + * FblMemGetBuffer + **********************************************************************************************************************/ +/*! \brief Get a pointer to the referenced buffer, taking into account the current position value + * \param[in] job Pointer to job information + * \return Pointer to current buffer position + * Null pointer in case referenced buffer is not defined + **********************************************************************************************************************/ +static tFblMemRamData FblMemGetBuffer( const V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job ) +{ + tFblMemRamData jobBuffer; + + /* Get referenced buffer */ + jobBuffer = job->buffer; + + /* Check for undefined buffer (null pointer) */ + if (FBL_MEM_BUFFER_NULL != jobBuffer) + { + /* Check for potential buffer overflow */ + assertFblInternal((job->offset <= (job->totalSize - job->netSize)), kFblMemAssertParameterOutOfRange); + assertFblInternal((job->used <= (job->totalSize - job->offset)), kFblMemAssertParameterOutOfRange); + + /* Valid buffer pointer + Evaluate position */ + jobBuffer = &jobBuffer[job->position]; + } + + /* Return pointer to current buffer position */ + return jobBuffer; +} + +#if defined( FBL_ENABLE_SYSTEM_CHECK ) +/*********************************************************************************************************************** + * FblMemInitBufferIntegrity + **********************************************************************************************************************/ +/*! \brief Initialize "canary" words placed after aligned buffer contents + * \details "Canary" value is placed behind actual buffer contents and contains a magic value. + * In case of a buffer overrun it is likely that the "canary" is modified too. This can be used to + * detect the overrun. + **********************************************************************************************************************/ +static void FblMemInitBufferIntegrity( void ) +{ + vuintx idx; + + /* Data buffer(s) */ + for (idx = 0u; idx < FBL_MEM_BUFFER_COUNT_INPUT; idx++) + { + gBasicInputBuffer[idx].canaryFront = FBL_MEM_CANARY_VALUE; + gBasicInputBuffer[idx].canaryBack = FBL_MEM_CANARY_VALUE; + } + +# if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Data processing buffer */ + gProcBuffer.canaryFront = FBL_MEM_CANARY_VALUE; + gProcBuffer.canaryBack = FBL_MEM_CANARY_VALUE; +# endif /* FBL_ENABLE_DATA_PROCESSING */ + +# if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Remainder buffer */ + gRemainderBuffer.canaryFront = FBL_MEM_CANARY_VALUE; + gRemainderBuffer.canaryBack = FBL_MEM_CANARY_VALUE; +# endif /* FBL_ENABLE_DATA_PROCESSING */ + +# if defined( FBL_MEM_ENABLE_GAP_FILL ) + /* Gap fill buffer */ + gGapFillBuffer.canaryFront = FBL_MEM_CANARY_VALUE; + gGapFillBuffer.canaryBack = FBL_MEM_CANARY_VALUE; +# endif /* FBL_ENABLE_DATA_PROCESSING */ +} + +/*********************************************************************************************************************** + * FblMemVerifyBufferIntegrity + **********************************************************************************************************************/ +/*! \brief Verify "canary" words placed before and after aligned buffer contents + * \details "Canary" values are placed in front and behind actual buffer contents and contain a magic value. + * In case of a buffer overrun it is likely that the "canary" is modified too. This can be used to + * detect the overrun. + * \return kFblMemStatus_Ok if "canary" words of all aligned buffers are intact, + * kFblMemStatus_Failed otherwise + **********************************************************************************************************************/ +static tFblMemStatus FblMemVerifyBufferIntegrity( void ) +{ + tFblMemStatus retVal; + vuint32 aggregated; + vuintx idx; + + retVal = kFblMemStatus_Ok; + aggregated = 0x00uL; + + /* Data buffer(s) */ + for (idx = 0u; idx < FBL_MEM_BUFFER_COUNT_INPUT; idx++) + { + aggregated |= (FBL_MEM_CANARY_VALUE ^ gBasicInputBuffer[idx].canaryFront); + aggregated |= (FBL_MEM_CANARY_VALUE ^ gBasicInputBuffer[idx].canaryBack); + } + +# if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Data processing buffer */ + aggregated |= (FBL_MEM_CANARY_VALUE ^ gProcBuffer.canaryFront); + aggregated |= (FBL_MEM_CANARY_VALUE ^ gProcBuffer.canaryBack); +# endif /* FBL_ENABLE_DATA_PROCESSING */ + +# if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Remainder buffer */ + aggregated |= (FBL_MEM_CANARY_VALUE ^ gRemainderBuffer.canaryFront); + aggregated |= (FBL_MEM_CANARY_VALUE ^ gRemainderBuffer.canaryBack); +# endif /* FBL_ENABLE_DATA_PROCESSING */ + +# if defined( FBL_MEM_ENABLE_GAP_FILL ) + /* Gap fill buffer */ + aggregated |= (FBL_MEM_CANARY_VALUE ^ gGapFillBuffer.canaryFront); + aggregated |= (FBL_MEM_CANARY_VALUE ^ gGapFillBuffer.canaryBack); +# endif /* FBL_ENABLE_DATA_PROCESSING */ + + if (0x00uL != aggregated) + { + retVal = kFblMemStatus_Failed; + } + + return retVal; +} +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +/* Queue handling ************************************************************/ + +/*********************************************************************************************************************** + * FblMemQueueInit + **********************************************************************************************************************/ +/*! \brief Initialize queue structure + * \details Implements two double linked lists, representing a used and a free queue. + * \param[in,out] queue Pointer to queue array + * \param[in] length Total length of queue, including used and free head + **********************************************************************************************************************/ +static void FblMemQueueInit( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, tFblMemQueueHandle length ) +{ + tFblMemQueueHandle handle; + tFblMemQueueHandle prevHandle; + tFblMemQueueHandle nextHandle; + + /* Start with empty queue by self-reference */ + queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].next = FBL_MEM_QUEUE_HANDLE_HEAD_USED; + queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].prev = FBL_MEM_QUEUE_HANDLE_HEAD_USED; + /* Set default values */ + queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].job = FBL_MEM_JOB_NULL; + queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].prio = FBL_MEM_QUEUE_PRIO_HIGHEST; + + /* Setup double linked list of empty queue entries */ + /* Head references last entry as predecessor */ + prevHandle = length - 1u; + nextHandle = FBL_MEM_QUEUE_HANDLE_HEAD_FREE; + + /* Append available entries to free queue */ + for (handle = FBL_MEM_QUEUE_HANDLE_HEAD_FREE; handle < length; handle++) + { + nextHandle++; + + /* Set predecessor and successor */ + queue[handle].prev = prevHandle; + queue[handle].next = nextHandle; + /* Set default values */ + queue[handle].job = FBL_MEM_JOB_NULL; + queue[handle].prio = FBL_MEM_QUEUE_PRIO_LOWEST; + + prevHandle = handle; + } + + /* Last entry references head as successor */ + queue[length - 1u].next = FBL_MEM_QUEUE_HANDLE_HEAD_FREE; +} + +/*********************************************************************************************************************** + * FblMemQueueMove + **********************************************************************************************************************/ +/*! \brief Cut queue entry from current position and place it at a different location (either in same or other queue) + * \pre FblMemQueueInit executed before, source queue not empty + * Passed handles have to represent actual predecessor and successor relationship + * \param[in,out] queue Pointer to queue array + * \param[in] handle Handle of queue entry to be moved + * \param[in] prevNew Handle of new predecessor + * \return Handle of affected entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueueMove( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle, tFblMemQueueHandle prevNew ) +{ + tFblMemQueueHandle prevOld; + tFblMemQueueHandle nextOld; + tFblMemQueueHandle nextNew; + + /* Check for matching handles */ + if (handle == prevNew) + { + /* Entry placed at exact same location + No need to change anything */ + } + else + { + /* Get current predecessor and successor */ + prevOld = queue[handle].prev; + nextOld = queue[handle].next; + + /* Old queue empty? */ + assertFblInternal((queue[prevOld].next != prevOld), kFblMemAssertParameterOutOfRange); + + /* Remove entry from old queue */ + queue[prevOld].next = nextOld; + queue[nextOld].prev = prevOld; + + /* Get new predecessor */ + nextNew = queue[prevNew].next; + + /* Insert entry into new queue */ + queue[handle].prev = prevNew; + queue[prevNew].next = handle; + queue[handle].next = nextNew; + queue[nextNew].prev = handle; + } + + return handle; +} + +# if defined( FBL_MEM_ENABLE_PIPELINING ) +/*********************************************************************************************************************** + * FblMemQueueMoveFirstFreeEntry + **********************************************************************************************************************/ +/*! \brief Take first free entry, remove it from free queue and insert it into defined location in used queue. + * \pre FblMemQueueInit executed before, queue not full + * \param[in,out] queue Pointer to queue array + * \param[in] prevNew Handle of new predecessor + * \return Handle of moved entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueueMoveFirstFreeEntry( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle prevNew ) +{ + /* Free queue empty? */ + assertFblInternal((!FblMemQueueIsFull(queue)), kFblMemAssertParameterOutOfRange); + + /* Move first free entry to new position */ + return FblMemQueueMove(queue, queue[FBL_MEM_QUEUE_HANDLE_HEAD_FREE].next, prevNew); +} + +/*********************************************************************************************************************** + * FblMemQueueAppend + **********************************************************************************************************************/ +/*! \brief Append entry to end of queue + * \details Take first free entry, remove it from free queue and insert it as last entry into used queue. + * \pre FblMemQueueInit executed before, queue not full + * \param[in,out] queue Pointer to queue array + * \return Handle of appended entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueueAppend( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue ) +{ + /* Insert at end of used queue + Place between current last entry and tail (== head) */ + return FblMemQueueMoveFirstFreeEntry(queue, queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].prev); +} + +# endif /* FBL_MEM_ENABLE_PIPELINING */ + +/*********************************************************************************************************************** + * FblMemQueueRemove + **********************************************************************************************************************/ +/*! \brief Remove specific entry from queue + * \details Take specific entry, remove it from queue and insert it as last entry into free queue. + * \pre FblMemQueueInit executed before, queue not empty + * \param[in,out] queue Pointer to queue array + * \param[in] handle Queue entry handle + * \return Handle of removed entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueueRemove( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle ) +{ + /* Insert at end of free queue + Place between current last entry and tail (== head) */ + return FblMemQueueMove(queue, handle, queue[FBL_MEM_QUEUE_HANDLE_HEAD_FREE].prev); +} + +/*********************************************************************************************************************** + * FblMemQueuePrioUpdate + **********************************************************************************************************************/ +/*! \brief Update priority of a queue entry + * \details Take specific entry, remove it from queue and re-insert it according to the updated priority. + * \pre FblMemQueueInit executed before, queue not empty + * \param[in,out] queue Pointer to queue array + * \param[in] handle Queue entry handle + * \param[in] prio New priority value + * \return Handle of updated entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueuePrioUpdate( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueueHandle handle, tFblMemQueuePrio prio ) +{ + tFblMemQueueHandle prevHandle; + + /* Start search at last entry */ + prevHandle = queue[FBL_MEM_QUEUE_HANDLE_HEAD_USED].prev; + + /* Skip all entries with lower priority + Remark: Search is assured to stop at head because it has the highest possible priority */ + while (queue[prevHandle].prio < prio) + { + prevHandle = queue[prevHandle].prev; + } + + /* Append after first entry with higher or equal priority */ + (void)FblMemQueueMove(queue, handle, prevHandle); + /* Update priority of inserted entry */ + queue[handle].prio = prio; + + return handle; +} + +/*********************************************************************************************************************** + * FblMemQueuePrioInsert + **********************************************************************************************************************/ +/*! \brief Insert entry into queue using given priority + * \details Take first free entry, remove it from free queue and insert it according to the given priority. + * Additionally set job associated with queue entry + * \pre FblMemQueueInit executed before, queue not empty + * \param[in,out] queue Pointer to queue array + * \param[in] prio Priority value + * \param[in] job Job associated with queue entry + * \return Handle of inserted entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueuePrioInsert( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + tFblMemQueuePrio prio, V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job ) +{ + tFblMemQueueHandle handle; + + /* Free queue empty? */ + assertFblInternal((!FblMemQueueIsFull(queue)), kFblMemAssertParameterOutOfRange); + + /* Relocate first free entry according to given priority */ + handle = FblMemQueuePrioUpdate(queue, queue[FBL_MEM_QUEUE_HANDLE_HEAD_FREE].next, prio); + /* Set job of entry */ + queue[handle].job = job; + + return handle; +} + +/*********************************************************************************************************************** + * FblMemQueueDefaultPrioInsert + **********************************************************************************************************************/ +/*! \brief Insert entry into queue using default priority + * \details Take first free entry, remove it from free queue and insert it according to the default priority of + the given job's type. Additionally set job associated with queue entry and update segment index of job. + * \pre FblMemQueueInit executed before, queue not empty + * \param[in,out] queue Pointer to queue array + * \param[in] job Job associated with queue entry + * \param[in] segmentIndex Segment index assigned to job + * \return Handle of inserted entry + **********************************************************************************************************************/ +static tFblMemQueueHandle FblMemQueueDefaultPrioInsert( V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue, + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job, vuintx segmentIndex ) +{ + /* Valid job type? */ + assertFblInternal((job->type < kFblMemJobType_Max), kFblMemAssertParameterOutOfRange); + + /* Remember segment index associated with job */ + job->segmentIndex = segmentIndex; + + return FblMemQueuePrioInsert(queue, gJobPrio[job->type], job); +} +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +/*********************************************************************************************************************** + * FblMemGetPendingInputJob + **********************************************************************************************************************/ +/*! \brief Get information of current pending job + * \details This is the very first entry in the free queue + * \pre Pipelined programming queue initialized + * \return Pointer to pending input job + **********************************************************************************************************************/ +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemGetPendingInputJob( void ) +{ + /* Free queue empty? */ + assertFblInternal((!FblMemQueueIsFull(FBL_MEM_PIPE_PROG_QUEUE)), kFblMemAssertParameterOutOfRange); + + /* Return job information of first free entry */ + return FblMemQueueGetFirstFreeEntry(FBL_MEM_PIPE_PROG_QUEUE).job; +} +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +/*********************************************************************************************************************** + * FblMemInitJob + **********************************************************************************************************************/ +/*! \brief Initialize job information structure + * \details Assign given buffer to job and set type + * \param[in,out] job Job information to be initialized + * \param[in] buffer Buffer associated with job + * \param[in] size Size of given buffer + * \param[in] type Type of job + **********************************************************************************************************************/ +static void FblMemInitJob( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * job, tFblMemRamData buffer, tFblLength size, + tFblMemJobType type ) +{ + /* Assign given buffer */ + job->buffer = buffer; + job->totalSize = size; + job->netSize = size; + /* Default values */ + job->offset = 0u; + job->position = 0u; + job->used = 0u; +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Default job */ + job->jobClass = tFblMemJobClass_Default; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + /* Set job type */ + job->type = type; + /* Job complete as soon as "used" member reaches zero */ + job->completion = kFblMemOperationMode_Normal; +} + +/*********************************************************************************************************************** + * FblMemInitInputQueue + **********************************************************************************************************************/ +/*! \brief Initialize input queue + * \details Additionally job information of input buffers is prepared. + * Will also be carried out for single buffer use-case + **********************************************************************************************************************/ +static void FblMemInitInputQueue( void ) +{ + vuintx idx; + vuintx actualBasicIdx; +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + vuintx basicIdx; + tFblMemQueueHandle queueHandle; +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + + /* First input buffer assigned to specified input source */ + actualBasicIdx = FBL_MEM_ACTIVE_SOURCE; + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Setup pipelined programming queue */ + FblMemQueueInit(FBL_MEM_PIPE_PROG_QUEUE, FBL_MEM_ARRAY_SIZE(FBL_MEM_PIPE_PROG_QUEUE)); + + queueHandle = (tFblMemQueueHandle)FBL_MEM_QUEUE_HANDLE_ENTRY_OFFSET; + basicIdx = FBL_MEM_SOURCE_COUNT; + + for (idx = 0u; idx < FBL_MEM_QUEUE_ENTRIES_INPUT; idx++) + { + if (0u != idx) + { + actualBasicIdx = basicIdx; + basicIdx++; + } +#else + idx = 0u; + + { +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + /* Reset job information and assign actual buffers */ + /* PRQA S 2801, 2851 2 */ /* MD_FblMem_FalseFinding */ + FblMemInitJob( &FBL_MEM_INPUT_JOB[idx], gBasicInputBuffer[actualBasicIdx].data, + FBL_MEM_ARRAY_SIZE(gBasicInputBuffer[actualBasicIdx].data), kFblMemJobType_InputWrite ); + /* Overwrite net size, to exclude overhead for remainder and padding */ + FBL_MEM_INPUT_JOB[idx].netSize = FBL_MEM_BUFFER_SIZE; + /* Default offset to align actual data to platform requirements */ + FBL_MEM_INPUT_JOB[idx].offset = FBL_MEM_PREAMBLE_OFFSET(FBL_MEM_PREAMBLE_LENGTH); + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Set dedicated job class */ + FBL_MEM_INPUT_JOB[idx].jobClass = tFblMemJobClass_PipeProg; + /* Assign job to input queue entry */ + FblMemQueueGetEntry(FBL_MEM_PIPE_PROG_QUEUE, queueHandle).job = &FBL_MEM_INPUT_JOB[idx]; + queueHandle++; +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + } +} + +/*********************************************************************************************************************** + * FblMemInitStates + **********************************************************************************************************************/ +/*! \brief Setup all data structures + * \pre FblMemInitPowerOn executed before + **********************************************************************************************************************/ +static void FblMemInitStates( void ) +{ + /* Setup idle state */ + fblMemProgState = kFblMemProgState_Idle; + gErrorStatus = kFblMemStatus_Ok; +#if defined( FBL_MEM_ENABLE_PIPELINING ) + gProgContext = kFblMemContext_Service; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + + /* No operations allowed */ + FblMemResetAllowed(); +} + +/*********************************************************************************************************************** + * FblMemInitInternal + **********************************************************************************************************************/ +/*! \brief Setup all data structures + * \pre FblMemInitPowerOn executed before + * \return Pointer to active input buffer + **********************************************************************************************************************/ +static tFblMemRamData FblMemInitInternal( void ) +{ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + vuintx idx; + tFblMemQueueHandle queueHandle; +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + /* Setup idle state */ + FblMemInitStates(); + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Setup processing queue */ + FblMemQueueInit(gProcessingQueue, FBL_MEM_ARRAY_SIZE(gProcessingQueue)); +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + FblMemInitInputQueue(); + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + FblMemInitJob(&gWriteFinalizeJob, gRemainderBuffer.data, FBL_MEM_SEGMENT_SIZE, kFblMemJobType_WriteFinalize); +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Reset current data length, no full re-initialization necessary */ + gProcWriteJob.used = 0u; +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) && \ + defined( FBL_ENABLE_DATA_PROCESSING ) + /* Reset current data length, no full re-initialization necessary */ + gStreamProcJob.used = 0u; +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT && FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Setup pipelined verification queue */ + FblMemQueueInit(gVerifyPipeQueue, FBL_MEM_ARRAY_SIZE(gVerifyPipeQueue)); + + queueHandle = (tFblMemQueueHandle)FBL_MEM_QUEUE_HANDLE_ENTRY_OFFSET; + +# if ( FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ == 1u ) + idx = 0u; +# else + for (idx = 0u; idx < FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ; idx++) +# endif /* FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ */ + { + /* Initialize job */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) + /* Assign dedicated buffer for segment information */ + FblMemInitJob(&gVerifyPipeReadJob[idx], gVerifyPipeInfoBuffer[idx], FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE, kFblMemJobType_VerifyPipeRead); +# else + FblMemInitJob(&gVerifyPipeReadJob[idx], FBL_MEM_BUFFER_NULL, 0, kFblMemJobType_VerifyPipeRead); +# endif + /* Set dedicated job class */ + gVerifyPipeReadJob[idx].jobClass = tFblMemJobClass_VerifyPipe; + + /* Assign job to verify queue entry */ + FblMemQueueGetEntry(gVerifyPipeQueue, queueHandle).job = &gVerifyPipeReadJob[idx]; +# if ( FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ > 1u ) + queueHandle++; +# endif /* FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ */ + } + + /* Initialize jobs for update and finalize */ + FblMemInitJob(&gVerifyPipeUpdateJob, gVerifyPipeReadBuffer, FBL_MEM_VERIFY_PIPELINED_SEGMENTATION, kFblMemJobType_VerifyPipeUpdate); + FblMemInitJob(&gVerifyPipeFinalizeJob, FBL_MEM_BUFFER_NULL, 0, kFblMemJobType_VerifyPipeFinalize); +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_ENABLE_SYSTEM_CHECK ) + FblMemInitBufferIntegrity(); +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + FblMemInitProgress(); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + /* Allow block start / erase indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_BLOCK_START | FBL_MEM_ALLOWED_BLOCK_ERASE); + + return FblMemGetActiveBuffer(); +} + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) +/*********************************************************************************************************************** + * FblMemStorePreamble + **********************************************************************************************************************/ +/*! \brief Store the current buffer preamble (protocol information before actual data) + * \details Active fill buffer may be exchanged by subsequent operations, so preamble has to be restored for + * calling instance + * \pre FblMemInitPowerOn executed before, fill buffer available + **********************************************************************************************************************/ +static void FblMemStorePreamble( void ) +{ +#if defined( FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH ) + /* Verify preamble fits into reserved buffer */ + assertFblGen(FBL_MEM_PREAMBLE_LENGTH <= FBL_MEM_MAX_PREAMBLE_LENGTH, kFblMemAssertParameterOutOfRange); +#endif /* FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH */ + + /* Copy preamble from active fill to temporary buffer */ + (void)MEMCPY(gPreambleBuffer, FblMemGetActiveBuffer(), FBL_MEM_PREAMBLE_LENGTH); /* PRQA S 0314 */ /* MD_FblMem_0314_0326_MemCpy */ +} + +/*********************************************************************************************************************** + * FblMemRestorePreamble + **********************************************************************************************************************/ +/*! \brief Restore the previously stored preamble (protocol information before actual data) into the (new) active + * fill buffer + * \details Active buffer could be exchanged by preceding operations, so preamble has to be restored for calling + * instance + * \pre FblMemInitPowerOn executed before, fill buffer available + **********************************************************************************************************************/ +static void FblMemRestorePreamble( void ) +{ + /* Copy previously stored preamble from temporary to active fill buffer */ + (void)MEMCPY(FblMemGetActiveBuffer(), gPreambleBuffer, FBL_MEM_PREAMBLE_LENGTH); /* PRQA S 0314 */ /* MD_FblMem_0314_0326_MemCpy */ +} +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/*********************************************************************************************************************** + * FblMemLimitLength + **********************************************************************************************************************/ +/*! \brief Length will be truncated if limit is exceeded + * \details Original value will be returned if finalization operation mode is set + * \param[in] inputLen Original length + * \param[in] type Type of active job + * \param[in] mode Current operation mode (used for finalization) + * \return Input length limited to given range + **********************************************************************************************************************/ +static tFblLength FblMemLimitLength( tFblLength inputLen, tFblMemJobType type, tFblMemOperationMode mode ) +{ + tFblLength lengthLimit; + tFblLength localInputLen; + + localInputLen = inputLen; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_SEGMENTATION ) +# else + (void)mode; +# endif /* FBL_MEM_ENABLE_SEGMENTATION */ +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + /* Valid job type? */ + assertFblInternal((type < kFblMemJobType_Max), kFblMemAssertParameterOutOfRange); + + lengthLimit = gLengthLimits[type].limit; + + if (lengthLimit > 0u) + { +# if defined( FBL_MEM_ENABLE_SEGMENTATION ) + /* Segmentation explicitly enabled + Truncate to given limit, unless unlimited mode for job type (typically finalize) is set */ + if ((gLengthLimits[type].unlimitedMode != mode) && (localInputLen > lengthLimit)) +# else + /* Truncate to given limit, if unconditional mode is configured for job type */ + if ((gLengthLimits[type].unlimitedMode == kFblMemOperationMode_Unconditional) && (localInputLen > lengthLimit)) +# endif /* FBL_MEM_ENABLE_SEGMENTATION */ + { + localInputLen = lengthLimit; + } + } + + return localInputLen; +} +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/*********************************************************************************************************************** + * FblMemPadLength + **********************************************************************************************************************/ +/*! \brief Calculate number of bytes required to pad provided address range to memory segment size + * \param[in] address Start address of memory range + * \param[in] length Length of memory range + * \return Number of required padding bytes + **********************************************************************************************************************/ +static tFblLength FblMemPadLength( tFblAddress address, tFblLength length ) +{ + tFblLength localAddress; + tFblLength localLength; + tFblLength padLen; + tFblAddress alignMask; + vsint16 oldSegment; + + /* Local copy of length */ + localLength = length; + /* Special handling required for zero length + Address used directly */ + if (length > 0u) + { + localLength--; + } + + /* Calculate end address */ + localAddress = address + localLength; + + /* Initialize padding length */ + padLen = 0u; + + /* Remember current memory segment */ + oldSegment = memSegment; + + /* Evaluate memory segment */ + memSegment = FblMemSegmentNrGet(localAddress); + + /* Check if segment was found */ + if (memSegment >= 0) + { + /* Bit mask for memory segment alignment */ + alignMask = (tFblAddress)(MemDriver_SegmentSize - 1uL); + + /* Padding length calculated for end address of data to be padded */ + /* Invert all masked bits */ + padLen = localAddress ^ alignMask; + + /* Modify padding length for special case (zero length) */ + if (0u == length) + { + padLen++; + } + + /* Apply mask to cut of unnecessary bits (e.g. additional address info, overflow of addition) */ + padLen &= alignMask; + } + + /* Restore memory segment */ + memSegment = oldSegment; + + return padLen; +} + +/*********************************************************************************************************************** + * FblMemPadBuffer + **********************************************************************************************************************/ +/*! \brief Fill up the provided buffer with kFillChar if not aligned to the memory segment size + * \pre Buffer provided has to be large enough to hold added padding bytes + * \param[in] address Start address of memory range + * \param[in] length Length of memory range + * \param[in,out] data Pointer to last byte of actual data + * \return Number of padded bytes + **********************************************************************************************************************/ +static tFblLength FblMemPadBuffer( tFblAddress address, tFblLength length, tFblMemRamData data ) +{ + tFblMemRamData padBuffer; + tFblLength padLen; + tFblLength idx; + + /* Calculate number of required padding bytes */ + padLen = FblMemPadLength(address, length); + + /* In case data was already aligned the last buffer byte may be located at the very last memory address + Prevent address wrap around by relocating buffer not until padding is necessary */ + if (padLen > 0u) + { + /* Input buffer points to last byte of actual data */ + padBuffer = &data[1]; + + /* Append data to align buffer to segment size */ + for (idx = 0u; idx < padLen; idx++) + { +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + /* Save original data, restored after programming operation */ + gPaddingBuffer[idx] = padBuffer[idx]; +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + + padBuffer[idx] = kFillChar; + } + } + + return padLen; +} + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +/*********************************************************************************************************************** + * FblMemUnpadBuffer + **********************************************************************************************************************/ +/*! \brief Restore previous state of buffer after padding with fill pattern + * \pre memSegment correctly initialized (only relevant for multiple memory devices configuration) + * FblMemPadBuffer called before with exact same parameters + * \param[in] data Pointer to last byte of actual data + * \param[in] padLen Number of previously padded bytes + **********************************************************************************************************************/ +static void FblMemUnpadBuffer( tFblMemRamData data, tFblLength padLen ) +{ + /* In case data was already aligned the last buffer byte may be located at the very last memory address + Prevent address wrap around by relocating buffer not until padding is necessary */ + if (padLen > 0u) + { + /* Restore original data, overwritten by padding */ + (void)MEMCPY(&data[1u], gPaddingBuffer, padLen); /* PRQA S 0314 */ /* MD_FblMem_0314_0326_MemCpy */ + } +} +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + +/*********************************************************************************************************************** + * FblMemCopyBuffer + **********************************************************************************************************************/ +/*! \brief Performs program operation to volatile memory + * \param[in] programAddress Program address + * \param[in] programLength Length of data (output: length actually programmed) + * \param[in] programData Pointer to program data + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +static tFblMemStatus FblMemCopyBuffer( tFblAddress programAddress, + const V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemConstRamData programData ) +{ + /* Copy input buffer to destination address */ + __ApplFblMemCopyBuffer(programAddress, programData, *programLength); /* PRQA S 0314, 0326 */ /* MD_FblMem_0314_0326_MemCpy */ + + return kFblMemStatus_Ok; +} + +/*********************************************************************************************************************** + * FblMemEraseRegionInternal + **********************************************************************************************************************/ +/*! \brief Performs erase operation in non-volatile memory + * \details All memory segments fully or partially covered by given region are affected. Gaps in the memory segment + * definition are skipped. + * \pre Memory driver initialized + * \param[in] eraseAddress Start address of erase region + * \param[in] eraseLength Length of erase region + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 2889, 6010, 6030 1 */ /* MD_FblMem_2889, MD_MSR_STPTH, MD_MSR_STCYC */ +static tFblMemStatus FblMemEraseRegionInternal( tFblAddress eraseAddress, tFblLength eraseLength ) +{ + tFblMemStatus retVal; + IO_ErrorType flashErrorCode; + tFblLength eraseRemainder; + tFblLength currentLength; + tFblLength distance; + vsint16 nextMemSegment; + tFblAddress localEraseAddress; +#if defined( __ApplFblMemConditionCheck ) + tFblMemStatus customReturnCode; +#endif /* __ApplFblMemConditionCheck */ + + retVal = kFblMemStatus_Ok; + + localEraseAddress = eraseAddress; + eraseRemainder = eraseLength; + memSegment = FblMemSegmentNrGet(localEraseAddress); + + /* Check if there is a valid block for start address */ + if (memSegment < 0) + { + FBL_MEM_SET_EXT_INFO(EraseAddress, localEraseAddress); + FBL_MEM_SET_STATUS(EraseOutsideFbt, retVal); + } + else + { + nextMemSegment = memSegment; + + while (eraseRemainder > 0u) + { + /* Watchdog and response pending handling */ + FblMemTriggerWatchdog(); + /* Force response pending on first loop cycle */ + FblMemResponsePending(); + + /* Initialize error address */ + FBL_MEM_SET_EXT_INFO(EraseAddress, localEraseAddress); + +#if defined( __ApplFblMemDriverReady ) + /* Check if required flash driver is initialized */ + if (kFblOk != __ApplFblMemDriverReady(memSegment)) + { + /* Flash driver initialization failure */ + FBL_MEM_SET_STATUS(EraseDriverNotReady, retVal); + return retVal; + } +#endif + + /* Check if erase range crosses Flash block boundary */ + currentLength = (FlashBlock[memSegment].end - localEraseAddress) + 1u; + if (eraseRemainder > currentLength) + { + nextMemSegment = memSegment + 1; + + if (nextMemSegment >= (vsint16)kNrOfFlashBlock) + { + /* End of erase region lies behind defined memory */ + FBL_MEM_SET_STATUS(EraseOutsideFbt, retVal); + return retVal; + } + + /* Update remainder */ + distance = FlashBlock[nextMemSegment].begin - localEraseAddress; + if (distance <= eraseRemainder) + { + eraseRemainder -= distance; + } + else + { + /* End of erase region lies in gap */ + FBL_MEM_SET_STATUS(EraseOutsideFbt, retVal); + return retVal; + } + } + else + { + currentLength = eraseRemainder; + eraseRemainder = 0u; + } + +#if defined( __ApplFblMemConditionCheck ) + /* Check conditions before executing memory operation */ + customReturnCode = __ApplFblMemConditionCheck(); + + if (kFblMemStatus_Ok != customReturnCode) + { + retVal = customReturnCode; + return retVal; + } +#endif /* __ApplFblMemConditionCheck */ +#if defined( __ApplFblMemPreErase ) + /* Perform actions directly before memory driver erase */ + if (kFblOk != __ApplFblMemPreErase()) + { + FBL_MEM_SET_STATUS(ErasePreErase, retVal); + return retVal; + } +#endif /* __ApplFblMemPreErase */ + + flashErrorCode = MemDriver_REraseSync(currentLength, localEraseAddress); + +#if defined( __ApplFblMemPostErase ) + /* Perform actions directly after memory driver erase */ + if (kFblOk != __ApplFblMemPostErase()) + { + FBL_MEM_SET_STATUS(ErasePostErase, retVal); + return retVal; + } +#endif /* __ApplFblMemPostErase */ +#if defined( __ApplFblMemConditionCheck ) + /* Check conditions after executing memory operation */ + customReturnCode = __ApplFblMemConditionCheck(); + + if (kFblMemStatus_Ok != customReturnCode) + { + retVal = customReturnCode; + return retVal; + } +#endif /* __ApplFblMemConditionCheck */ + + if (IO_E_OK != flashErrorCode) + { + /* Error while erasing */ + FBL_MEM_SET_EXT_STATUS(DriverErase, flashErrorCode, retVal); + return retVal; + } + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Only report progress when explicitly enabled */ + if (kFblMemProgressState_Enabled == gProgressState) + { + FblMemUpdateProgress(eraseRemainder); + } +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + /* Continue with next segment */ + memSegment = nextMemSegment; + localEraseAddress = FlashBlock[memSegment].begin; + } + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemProgramBufferInternal + **********************************************************************************************************************/ +/*! \brief Performs program operation to non-volatile memory + * \details If the length is not aligned to the segment size the odd bytes are padded with the configured fill + * character. + * Programming may be suspended by an external event. In this case parameter programLength will be + * updated to reflect the length actually programmed + * In case resumable programming is active, crossing a flash block boundary leads to the setting + * of the programming state to the passed value. + * \pre Memory driver initialized, address aligned to memory segment size + * \param[in] programAddress Program address + * \param[in,out] programLength Length of data (output: length actually programmed) + * \param[in,out] programData Pointer to program data (contents are padded in case length is not aligned to memory + * segment size!) + * \param[in] checkPointState Programming state value to be set in case a checkpoint is reached + * Typical values are either kFblMemProgState_Checkpoint (suspend programming and indicate checkpoint) + * or kFblMemProgState_Pending (continue programming) + * + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 2889, 6010, 6030, 6050 1 */ /* MD_FblMem_2889, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +static tFblMemStatus FblMemProgramBufferInternal( tFblAddress programAddress, + V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemRamData programData, tFblMemProgState checkPointState ) +{ + tFblMemStatus retVal; + tFblLength currentLength; + tFblLength localLength; + tFblLength segLength; + tFblLength padLength; + tFblLength bufferIndex; + tFblLength padOffset; + IO_ErrorType flashErrorCode; + tFblAddress localProgramAddress; +#if defined( __ApplFblMemConditionCheck ) + tFblMemStatus customReturnCode; +#endif /* __ApplFblMemConditionCheck */ + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)checkPointState; +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + retVal = kFblMemStatus_Ok; + padLength = 0u; /* PRQA S 2982 */ /* MD_FblMem_2982 */ + padOffset = 0u; /* PRQA S 2982 */ /* MD_FblMem_2982 */ + localProgramAddress = programAddress; + + /* Copy requested length to local variable */ + localLength = *programLength; + /* Start at beginning of buffer */ + bufferIndex = 0u; + + /* Loop while data left and operation not suspended by external event */ + while ((localLength > 0u) && (kFblMemProgState_Pending == fblMemProgState)) + { + /* Watchdog and response pending handling */ + FblMemTriggerWatchdog(); +#if defined( FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP ) + /* Disable forced RCR-RP for adaptive mode */ +#else + /* Force response pending on first loop cycle */ + FblMemResponsePending(); +#endif /* FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP */ + + /* Initialize error address */ + FBL_MEM_SET_EXT_INFO(ProgramAddress, localProgramAddress); + + /* Length to be programmed in current loop cycle */ + currentLength = localLength; + /* Evaluate memory segment */ + memSegment = FblMemSegmentNrGet(localProgramAddress); + + /* Check if segment was found */ + if (memSegment < 0) + { + FBL_MEM_SET_STATUS(ProgramOutsideFbt, retVal); + return retVal; + } + +#if defined( __ApplFblMemDriverReady ) + /* Check if required flash driver is initialized */ + if (kFblOk != __ApplFblMemDriverReady(memSegment)) + { + /* Flash driver initialization failure */ + FBL_MEM_SET_STATUS(ProgramDriverNotReady, retVal); + return retVal; + } +#endif + + /* Check if address is aligned to memory segment size */ + if (0u != (localProgramAddress & ((tFblAddress)MemDriver_SegmentSize - 1u))) + { + FBL_MEM_SET_STATUS(ProgramUnalignedAddress, retVal); + return retVal; + } + + /* Remaining length until end of current segment */ + segLength = (FlashBlock[memSegment].end - localProgramAddress) + 1u; + + /* Download memory overlaps segment: adjust to current segment */ + if (segLength < currentLength) + { + /* Adapt currentLength to segment programming size */ + currentLength = segLength; + } + +#if defined( FBL_ENABLE_FUNC_VIRTUAL_MEMORY ) + if (MemDriver_IsVirtualMem(localProgramAddress) == IO_E_OK) + { + /* Announce the end-address to the virtual memory driver */ + if (MemDriver_RVirtualMemPayloadEndSync(localProgramAddress + currentLength - 1u) != IO_E_OK) + { + FBL_MEM_SET_STATUS(ProgramDriverNotReady, retVal); + return retVal; + } + } +#endif /* FBL_ENABLE_FUNC_VIRTUAL_MEMORY */ + + if (segLength > currentLength) + { + /* Offset to last byte of actual data */ + padOffset = bufferIndex + (currentLength - 1u); + + /* Pad buffer to memory segment */ + padLength = FblMemPadBuffer(localProgramAddress, currentLength, &programData[padOffset]); + currentLength += padLength; + } + +#if defined( __ApplFblMemConditionCheck ) + /* Check conditions before executing memory operation */ + customReturnCode = __ApplFblMemConditionCheck(); + + if (kFblMemStatus_Ok != customReturnCode) + { + retVal = customReturnCode; + return retVal; + } +#endif /* __ApplFblMemConditionCheck */ +#if defined( __ApplFblMemPreWrite ) + /* Perform actions directly before memory driver write */ + if (kFblOk != __ApplFblMemPreWrite()) + { + FBL_MEM_SET_STATUS(ProgramPreWrite, retVal); + return retVal; + } +#endif /* __ApplFblMemPreWrite */ + + /* Pass programming request to memory driver */ + flashErrorCode = MemDriver_RWriteSync(&programData[bufferIndex], currentLength, localProgramAddress); + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + /* Restore original data, overwritten by padding */ + FblMemUnpadBuffer(&programData[padOffset], padLength); +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + +#if defined( __ApplFblMemPostWrite ) + /* Perform actions directly after memory driver write */ + if (kFblOk != __ApplFblMemPostWrite()) + { + FBL_MEM_SET_STATUS(ProgramPostWrite, retVal); + return retVal; + } +#endif /* __ApplFblMemPostWrite */ +#if defined( __ApplFblMemConditionCheck ) + /* Check conditions after executing memory operation */ + customReturnCode = __ApplFblMemConditionCheck(); + + if (kFblMemStatus_Ok != customReturnCode) + { + retVal = customReturnCode; + return retVal; + } +#endif /* __ApplFblMemConditionCheck */ + + /* Check result of programming operation */ + if (IO_E_OK != flashErrorCode) + { + FBL_MEM_SET_EXT_STATUS(DriverWrite, flashErrorCode, retVal); + return retVal; + } + + + /* Update address for next cycle */ + localProgramAddress += (tFblAddress)currentLength; + + if (localLength > currentLength) + { + /* Prepare buffer index for next loop */ + bufferIndex += currentLength; + localLength -= currentLength; + } + else + { + /* Lengths should be exactly the same here */ + assertFblInternal(((currentLength - padLength) == localLength), kFblMemAssertParameterOutOfRange); + + /* Buffer completely processed */ + localLength = 0u; + } + + } + + /* Return length actually written (without padding) */ + *programLength -= localLength; + + return retVal; +} + +# if defined( FBL_ENABLE_MULTIPLE_MEM_DEVICES ) && \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +/*********************************************************************************************************************** + * FblMemGetSpecificRemainder + **********************************************************************************************************************/ +/*! \brief Calculate remainder of given range specific for affected memory device + * \param[in] address Start address of memory range + * \param[in] length Length of memory range + * \return Remainder to full memory segment in byte + **********************************************************************************************************************/ +static tFblLength FblMemGetSpecificRemainder( tFblAddress address, tFblLength length ) +{ + tFblLength localRemainder; + vsint16 tempSegment; + + /* Initialize remainder */ + localRemainder = 0u; + + /* Re-evaluate memory segment */ + tempSegment = memSegment; + memSegment = FblMemSegmentNrGet(address + (length - 1u)); + + if (memSegment >= 0) + { + /* Calculate remainder */ + localRemainder = FblMemGetRemainder(address, length, MemDriver_SegmentSize); + } + + /* Restore previous memory segment value */ + memSegment = tempSegment; + + return localRemainder; +} +# endif /* FBL_ENABLE_MULTIPLE_MEM_DEVICES && FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +/*********************************************************************************************************************** + * FblMemRelocateBufferOffset + **********************************************************************************************************************/ +/*! \brief Verify provided buffer lies within range of existing buffer and relocate offset accordingly + * \details Provided buffer has to reside completely in existing buffer + * \param[in,out] activeJob Information of buffer to be updated + * \param[in] buffer Pointer to provided buffer + * \param[in] offset Offset index into provided buffer + * \param[in] length Length of data in provided buffer + * \return kFblMemStatus_Ok if requested buffer lies inside provided information and offset could be relocated, + * kFblMemStatus_Failed otherwise + **********************************************************************************************************************/ +static tFblMemStatus FblMemRelocateBufferOffset( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob, + tFblMemConstRamData buffer, tFblLength offset, tFblLength length ) +{ + tFblMemStatus retVal; + tFblMemConstRamData activeBuffer; + tFblLength activeOffset; + + retVal = kFblMemStatus_Failed; + activeBuffer = activeJob->buffer; + + /* Provided buffer has to reside in raw input buffer */ + if (buffer >= activeBuffer) + { + activeOffset = (tFblLength)(buffer - activeBuffer); /* PRQA S 0488 */ /* MD_FblMem_0488 */ + + /* Provided data has to lie within raw input buffer (excluding potential padding) */ + if ( (length <= activeJob->netSize) + && (offset <= (activeJob->netSize - length)) + && (activeOffset < activeJob->totalSize) + && ((offset + length + FBL_MEM_REMAINDER_PADDING) <= (activeJob->totalSize - activeOffset)) ) + { +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Remainder requires reserved area in front of actual data (defined by current offset) */ + if ((activeOffset + offset) >= activeJob->offset) +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + { + /* Relocate offset to provided buffer */ + activeJob->offset = activeOffset; + retVal = kFblMemStatus_Ok; + } + } + } + + return retVal; +} +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + +#if defined( FBL_MEM_ENABLE_VARYING_INPUT_BUFFER ) +/*********************************************************************************************************************** + * FblMemSearchInputBuffer + **********************************************************************************************************************/ +/*! \brief Search matching input buffer for provided buffer + * \details Look for input buffer in which provided buffer completely resides, respective job information is + * moved to beginning of free queue and offset is relocated to match provided buffer + * \param[in] buffer Pointer to provided buffer + * \param[in] offset Offset index into provided buffer + * \param[in] length Length of data in provided buffer + * \return kFblMemStatus_Ok if requested buffer lies inside of available buffer and offset could be relocated, + * kFblMemStatus_Failed otherwise + **********************************************************************************************************************/ +static tFblMemStatus FblMemSearchInputBuffer( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ) +{ + tFblMemStatus retVal; + tFblMemQueueHandle queueHandle; + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob; + + retVal = kFblMemStatus_Failed; + + /* Get first buffer handle */ + queueHandle = FblMemQueueGetFirstFreeHandle(FBL_MEM_PIPE_PROG_QUEUE); + + /* Loop all free buffers */ + while (FBL_MEM_QUEUE_HANDLE_HEAD_FREE != queueHandle) + { + activeJob = FBL_MEM_PIPE_PROG_QUEUE[queueHandle].job; + + /* Check for matching input buffer */ + if (kFblMemStatus_Ok == FblMemRelocateBufferOffset(activeJob, buffer, offset, length)) + { + /* Move to beginning of free queue */ + (void)FblMemQueueMove(FBL_MEM_PIPE_PROG_QUEUE, queueHandle, FBL_MEM_QUEUE_HANDLE_HEAD_FREE); + retVal = kFblMemStatus_Ok; + + break; + } + + /* Get next free buffer */ + queueHandle = FBL_MEM_PIPE_PROG_QUEUE[queueHandle].next; + } + + return retVal; +} +#endif /* FBL_MEM_ENABLE_VARYING_INPUT_BUFFER */ + +/*********************************************************************************************************************** + * FblMemProgramStream + **********************************************************************************************************************/ +/*! \brief Take a byte stream to be programmed and align it to the memory requirements + * \details If the length is not aligned to the segment size the odd bytes are stored in a remainder buffer, + * which will be programmed on the next call. + * Programming may be suspended by an external event. In this case parameter programLength will be + * updated to reflect the length actually programmed. + * \pre FblMemSegmentStartIndication executed before + * \param[in] programJob Information of buffer to be programmed + * \param[in,out] programLength Requested program length (output: length actually programmed) + * \param[in] mode Operation mode (include remainder in case of finalization) + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static tFblMemStatus FblMemProgramStream( const V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * programJob, + V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemOperationMode mode ) +{ + tFblMemStatus retVal; + tFblMemRamData programData; + tFblLength localLength; +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + tFblLength requestLength; + tFblLength localRemainder; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +# else + (void)mode; +# endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + FblMemTriggerWatchdog(); + + /* Store requested length to local variable */ + localLength = *programLength; + /* Pointer to current buffer position */ + programData = FblMemGetBuffer(programJob); + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + localRemainder = 0u; + + /* No remainder handling required for volatile memory */ + if (kFblMemType_RAM != gSegInfo.input.type) + { + /* + Handle remainder from previous run + Special case where remainder is empty is not explicitly handled + as performing the following operations with a value of zero + doesn't have any side-effects + */ + + /* Check available space in front of current data */ + assertFblInternal(gSegInfo.writeRemainder <= programJob->position, kFblMemAssertParameterOutOfRange); + + /* Redirect programming pointer to make room for remainder */ + programData = &programJob->buffer[programJob->position - gSegInfo.writeRemainder]; + + /* Copy remainder in front of actual data */ + (void)MEMCPY(programData, gRemainderBuffer.data, gSegInfo.writeRemainder); /* PRQA S 0314 */ /* MD_FblMem_0314_0326_MemCpy */ + /* Update length to be programmed */ + localLength += gSegInfo.writeRemainder; + + /* Write complete data if explicit finalization is requested */ + if ( (kFblMemOperationMode_Finalize == mode) +# if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) +# else + /* or end of requested segment is reached */ + || (localLength == gSegInfo.writeLength) +# endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + ) + { + /* No remainder left */ + } + else + { + /* Calculate new remainder, not aligned to segment size */ + localRemainder = FblMemGetWriteRemainder(gSegInfo.writeAddress, localLength); + + /* Handle special case: When the segment was already finalized, the padding isn't included in write address + Remainder calculation thus includes data already written, resulting in a value larger than the requested length + This would cause two range overflows, but is only a cosmetic issue, as it cancels out in the end */ + if (localRemainder > localLength) + { + localRemainder = 0u; + } + + /* Update length to be programmed */ + localLength -= localRemainder; + + } + } + + /* Remember actual programming length, may be altered by programming routine */ + requestLength = localLength; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + + /* Verify complete programming length does not exceed previously requested memory range */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + if ((localLength + localRemainder) > gSegInfo.writeLength) +#else + if (localLength > gSegInfo.writeLength) +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + { + FBL_MEM_SET_STATUS(ProgramOverflow, retVal); + } + else + { + /* + Call programming function even if actual length is zero + In this case the input length will be completely moved to the remainder + */ + if (kFblMemType_RAM == gSegInfo.input.type) + { + /* Copy to volatile memory */ + retVal = FblMemCopyBuffer(gSegInfo.writeAddress, &localLength, programData); + } + else + { + /* Program non-volatile memory */ + retVal = FblMemProgramBufferInternal(gSegInfo.writeAddress, &localLength, programData, kFblMemProgState_Checkpoint); + } + } + + /* Check result */ + if (kFblMemStatus_Ok == retVal) + { + /* Returned length shall not exceed requested length */ + assertFblInternal(localLength <= gSegInfo.writeLength, kFblMemAssertParameterOutOfRange); + + /* Update segment information */ + gSegInfo.writeAddress += (tFblAddress)localLength; + /* Reduce expected remainder */ + gSegInfo.writeLength -= localLength; +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Length actually written */ + gSegInfo.writtenLength += localLength; +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Everything consumed, program length already matches */ + if (requestLength == localLength) + { + /* Everything written, store new remaining data */ + gSegInfo.writeRemainder = localRemainder; + /* Call copy function even if remainder length is zero */ + (void)MEMCPY(gRemainderBuffer.data, &programData[localLength], localRemainder); /* PRQA S 0314 */ /* MD_FblMem_0314_0326_MemCpy */ + } + /* Data partially programmed (most likely suspended by external event) */ + else if (localLength > 0u) + { + /* Store consumed length */ + *programLength = localLength - gSegInfo.writeRemainder; + /* Some data written, no remainder */ + gSegInfo.writeRemainder = 0u; + } + else + { + /* Nothing consumed at all */ + *programLength = 0u; + /* Nothing written at all, remainder from previous run unchanged */ + } +#else + /* Store consumed length */ + *programLength = localLength; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + } + + return retVal; +} + +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) +/*********************************************************************************************************************** + * FblMemVerifyInput + **********************************************************************************************************************/ +/*! \brief Execute input verification operation + * \details Pass input data to given input verification routine + * No operation will be carried out if null pointer is passed as function + * \param[in] routine Input verification operation to be executed + * \param[in] data Verification data + * - FBL_MEM_VERIFY_STATE_INIT / FBL_MEM_VERIFY_STATE_FINALIZE: Usually irrelevant + * - FBL_MEM_VERIFY_STATE_COMPUTE: Data to be hashed + * - FBL_MEM_VERIFY_STATE_VERIFY: Reference checksum / signature + * state Sub-operation to be executed + * \param[in,out] result Pointer to extended verification result + * FBL_MEM_VERIFY_STATUS_NULL if neither relevant nor used + * \return kFblMemStatus_Ok if operation successfully executed, + * kFblMemStatus_Failed otherwise + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FblMem_3673 */ +static tFblMemStatus FblMemVerifyInput( V_MEMRAM1 tFblMemVerifyRoutineInput V_MEMRAM2 V_MEMRAM3 * routine, + const V_MEMRAM1 tFblMemVerifyData V_MEMRAM2 V_MEMRAM3 * data, vuint8 state, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * result ) +{ + tFblMemStatus retVal; + tFblMemVerifyStatus localResult; + + retVal = kFblMemStatus_Ok; + localResult = FBL_MEM_VERIFY_OK; + + /* Null pointer passed as verification function disables functionality */ + if (FBL_MEM_VERIFY_FCT_INPUT_NULL != routine->function) + { + routine->param->sigState = state; + routine->param->sigSourceBuffer = data->data; + routine->param->sigByteCount = (tFblMemVerifyLength)data->length; +# if defined( FBL_MEM_ENABLE_EXT_TRIGGER_INPUT_VERIFY ) + routine->param->wdTriggerFct = (tFblMemVerifyWdFct)&FblMemTriggerWatchdogExt; /* PRQA S 0313 */ /* MD_FblMem_0313 */ +# else + routine->param->wdTriggerFct = (tFblMemVerifyWdFct)&FblMemTriggerWatchdog; +# endif /* FBL_MEM_ENABLE_EXT_TRIGGER_INPUT_VERIFY */ + + /* Call verification function and set extended status */ + localResult = routine->function(routine->param); + if (FBL_MEM_VERIFY_OK != localResult) + { + retVal = kFblMemStatus_Failed; + } + } + + if (FBL_MEM_VERIFY_STATUS_NULL != result) + { + /* Pass extended result */ + *result |= localResult; + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemInitVerifyInput + **********************************************************************************************************************/ +/*! \brief Initialize input verification(s) + * \return kFblMemStatus_Ok if operation successfully executed, + * kFblMemStatus_Failed otherwise + **********************************************************************************************************************/ +static tFblMemStatus FblMemInitVerifyInput( void ) +{ + tFblMemStatus retVal; + tFblMemVerifyData verifyData; + + retVal = kFblMemStatus_Ok; + + /* Not used by initialization */ + verifyData.data = FBL_MEM_BUFFER_NULL; + verifyData.length = 0u; + + /* Inverted order of verification routines + Error code may be overwritten (simplifies implementation) */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Initialize the calculation */ + if (kFblMemStatus_Ok != FblMemVerifyInput( &gBlockInfo.verifyRoutinePipe, &verifyData, + FBL_MEM_VERIFY_STATE_INIT, FBL_MEM_VERIFY_STATUS_NULL )) + { + /* Overwrites previous error code */ + retVal = kFblMemStatus_Failed; + } +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + + + return retVal; +} +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM */ + + + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/*********************************************************************************************************************** + * FblMemPrepareVerifyPipeJob + **********************************************************************************************************************/ +/*! \brief Get active pipelined verification job + * \details If no previous job is pending for the requested segment, a new job is queued, using the provided address + * as starting point. + * \param[in] segmentIndex Index of requested segment + * \param[in] address Address of newly programmed data + * \return Pointer to the current verify job + **********************************************************************************************************************/ +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemPrepareVerifyPipeJob( vuintx segmentIndex, tFblAddress address ) +{ + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * verifyJob; + + verifyJob = FBL_MEM_JOB_NULL; + + /* Null pointer passed as verification function disables functionality */ + if (FBL_MEM_VERIFY_FCT_INPUT_NULL != gBlockInfo.verifyRoutinePipe.function) + { + /* Check for error condition */ + if (kFblMemStatus_Ok == gErrorStatus) + { + /* Verification job for current segment not yet included in processing queue */ + if ( (FblMemQueueIsEmpty(gVerifyPipeQueue)) + || (FblMemQueueGetLastUsedEntry(gVerifyPipeQueue).job->segmentIndex != segmentIndex) ) + { + /* Assert queue not full */ + assertFblInternal((!FblMemQueueIsFull(gVerifyPipeQueue)), kFblMemAssertParameterOutOfRange); + + /* Get first free job */ + verifyJob = FblMemQueueGetFirstFreeEntry(gVerifyPipeQueue).job; + + /* Start verification at current address */ + verifyJob->baseAddress = address; + verifyJob->position = 0u; + verifyJob->netSize = 0u; + verifyJob->totalSize = 0u; + + /* Add job to processing queue */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, verifyJob, segmentIndex); + /* Append input info to separate queue, managing verification jobs exclusively */ + (void)FblMemQueueAppend(gVerifyPipeQueue); + } + + /* Get active verification job */ + verifyJob = FblMemQueueGetLastUsedEntry(gVerifyPipeQueue).job; + } + } + + return verifyJob; +} + +/*********************************************************************************************************************** + * FblMemUpdateVerifyPipeJob + **********************************************************************************************************************/ +/*! \brief Update job of pipelined verification + * \details Add programmed data contents to queue, so it can be verified in parallel to data transmission. + * If no previous data is pending for the current segment, a new job is queued, using the provided address + * as starting point. + * The length is added to the last job in the queue. + * \param[in] segmentIndex Index of requested segment + * \param[in] address Address of newly programmed data + * \param[in] length Length of newly programmed data + * \return Pointer to the current verify job + **********************************************************************************************************************/ +static V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * FblMemUpdateVerifyPipeJob( vuintx segmentIndex, tFblAddress address, tFblLength length ) +{ + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * verifyJob; + + verifyJob = FBL_MEM_JOB_NULL; + + if (length > 0u) + { + verifyJob = FblMemPrepareVerifyPipeJob(segmentIndex, address); + + /* Check for null pointer */ + if (FBL_MEM_JOB_NULL != verifyJob) + { + /* Update pipelined verification information */ + verifyJob->used += length; + verifyJob->netSize += length; + verifyJob->totalSize += length; + } + } + + return verifyJob; +} +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/*********************************************************************************************************************** + * FblMemProcessJob + **********************************************************************************************************************/ +/*! \brief Perform processing operations on provided job + * \details Depending on the type and configuration one of the following operations will be carried out: + * - Update verification with buffer contents + * - Read already programmed data in temporary buffer for verification + * - Process buffer contents (e.g. decryption or decompression) + * Result placed in intermediate buffer, which is prepended to the processing queue + * - Program buffer contents + * - Flush program remainder + * - Pass data to other instance + * Buffer may be processed at once or split into smaller segments, requiring multiple call cycles to + * finish the buffer + * This depends on the configuration and finalization flag + * \pre FblMemSegmentStartIndication executed before + * \param[in] activeJob Information of processed buffer + * \param[in] mode Operation mode used to trigger finalization + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +static tFblMemStatus FblMemProcessJob( V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob, tFblMemOperationMode mode ) +{ + tFblLength actualLength; +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) || \ + defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + tFblMemRamData activeBuffer; +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM || FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_PASSTHROUGH */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * procOutJob; + static vuint8 tryCounterDataProc; +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) + tFblMemVerifyData verifyData; +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM */ +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + tFblAddress prevAddress; + tFblLength prevRemainder; + tFblLength pipeVerificationLength; +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + tFblResult streamResult; +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + tFblAddress fillAddress; + tFblLength fillLength; + tFblLength tempLength; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + tFblMemOperationMode finalizeStream; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_SEGMENTATION ) +# else + (void)mode; +# endif /* FBL_MEM_ENABLE_SEGMENTATION */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + /* Handle watchdog trigger */ + FblMemTriggerWatchdog(); + +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) || \ + defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + /* Get pointer to current buffer position */ + activeBuffer = FblMemGetBuffer(activeJob); +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM || FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_PASSTHROUGH */ + /* Limit processed length to configured value */ + actualLength = FblMemLimitLength(activeJob->used, activeJob->type, mode); + + /* Handle buffer types */ + switch (activeJob->type) + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Pipelined verification */ +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + case kFblMemJobType_VerifyPipeInfo: + { + /* Pass buffer to signature calculation */ + verifyData.data = activeBuffer; + verifyData.length = actualLength; + + /* Add current data to the signature */ + if (kFblMemStatus_Ok != FblMemVerifyInput( &gBlockInfo.verifyRoutinePipe, &verifyData, + FBL_MEM_VERIFY_STATE_COMPUTE, FBL_MEM_VERIFY_STATUS_NULL )) + { + /* Compute operation failed */ + FBL_MEM_SET_STATUS(VerifyCompute, gErrorStatus); + } + + /* Switch job type to read back programmed data */ + activeJob->type = kFblMemJobType_VerifyPipeRead; + /* Prevent modification of position value used by read back operation */ + activeJob->used -= actualLength; + actualLength = 0u; + + break; + } +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + case kFblMemJobType_VerifyPipeRead: + { +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + /* Reset to default completion mode, as address information operates in explicit finalization mode */ + activeJob->completion = kFblMemOperationMode_Normal; +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + + /* Verify the pipelined read only in case there is data to be verified */ + if (0u != actualLength) + { + /* Read back a chunk of the already programmed data for verification */ +# if defined( FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM ) + /* Parameters order changed in comparison to HIS security module specification */ + if (gBlockInfo.readFct(activeJob->baseAddress + activeJob->position, actualLength, gVerifyPipeUpdateJob.buffer) != actualLength) +# else + /* Parameters order as defined by HIS security module specification */ + if (gBlockInfo.readFct(activeJob->baseAddress + activeJob->position, gVerifyPipeUpdateJob.buffer, actualLength) != actualLength) +# endif /* FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM */ + { + /* Read operation failed */ + FBL_MEM_SET_STATUS(VerifyCompute, gErrorStatus); + } + else + { + /* Data successfully read, pass to update routine */ + gVerifyPipeUpdateJob.position = 0u; + gVerifyPipeUpdateJob.used = actualLength; + + /* Queue updated job */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gVerifyPipeUpdateJob, activeJob->segmentIndex); + } + } + + break; + } + case kFblMemJobType_VerifyPipeUpdate: + { + /* Pass buffer to signature calculation */ + verifyData.data = activeBuffer; + verifyData.length = actualLength; + + /* Add current data to the signature */ + if (kFblMemStatus_Ok != FblMemVerifyInput( &gBlockInfo.verifyRoutinePipe, &verifyData, + FBL_MEM_VERIFY_STATE_COMPUTE, FBL_MEM_VERIFY_STATUS_NULL )) + { + /* Compute operation failed */ + FBL_MEM_SET_STATUS(VerifyCompute, gErrorStatus); + } + + break; + } + case kFblMemJobType_VerifyPipeFinalize: + { + /* Not used by finalization */ + verifyData.data = activeBuffer; + verifyData.length = actualLength; + + /* Finish the calculation */ + if (kFblMemStatus_Ok != FblMemVerifyInput( &gBlockInfo.verifyRoutinePipe, &verifyData, + FBL_MEM_VERIFY_STATE_FINALIZE, FBL_MEM_VERIFY_STATUS_NULL )) + { + /* Verify finalization failed */ + FBL_MEM_SET_STATUS(VerifyFinalize, gErrorStatus); + } + + break; + } +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Data processing */ + case kFblMemJobType_ProcInput: + case kFblMemJobType_ProcFinalize: + { +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + if (kFblOk == __ApplFblMemIsStreamOutputRequired(gSegInfo.input.dataFormat)) + { + procOutJob = &gStreamProcJob; + } + else +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + { + procOutJob = &gProcWriteJob; + } + + /* Update position of output buffer to accommodate for programming remainder */ + procOutJob->position = gSegInfo.writeRemainder; + + /* Limit input length to 16 bit */ + if (actualLength > 0xFFFFu) + { + actualLength = 0xFFFFu; + } + + /* + Initialize parameters for data processing. + Note: Other members have been set during initialization + */ + gProcParam.dataBuffer = activeBuffer; + gProcParam.dataLength = (vuint16)actualLength; + /* Align output buffer according to current fill level */ + gProcParam.dataOutBuffer = &((FblMemGetBuffer(procOutJob))[procOutJob->used]); /* PRQA S 2822 */ /* MD_FblMem_2822 */ + gProcParam.dataOutLength = 0u; + + /* Call API function for user specific data processing */ + if (kFblOk != ApplFblDataProcessing(&gProcParam)) + { + FBL_MEM_SET_STATUS(DataProc, gErrorStatus); + } + else + { + if ((gProcParam.dataOutLength | gProcParam.dataLength) == 0u) + { + if (kFblMemJobType_ProcFinalize == activeJob->type) + { + /* Finalize data processing + gProcWriteJob already has correct values */ + if (kFblOk != ApplFblDeinitDataProcessing(&gProcParam)) + { + FBL_MEM_SET_STATUS(DataProcDeinit, gErrorStatus); + } + + /* Finish job processing */ + activeJob->completion = kFblMemOperationMode_Unconditional; + } + else + { + if (tryCounterDataProc >= FBL_MEM_TRY_COUNTER_LIMIT_DATA_PROC) + { + /* Nothing consumed or produced at all, avoid endless loop */ + FBL_MEM_SET_STATUS(DataProcConsume, gErrorStatus); + } + else + { + tryCounterDataProc++; + } + } + } + else + { + tryCounterDataProc = 0u; + } + } + + if (kFblMemStatus_Ok == gErrorStatus) + { + /* Update consumed length */ + actualLength = gProcParam.dataLength; + + /* Any data produced? */ + if (gProcParam.dataOutLength > 0u) + { + /* Output buffer changed? */ + assertFblUser((gProcParam.dataOutBuffer == &((FblMemGetBuffer(procOutJob))[procOutJob->used])), kFblMemAssertUserResultOutOfRange); /* PRQA S 2822 */ /* MD_FblMem_2822 */ + /* Output length exceeds configured limit? */ + assertFblUser((gProcParam.dataOutLength <= FBL_MEM_INTERNAL_PROC_SEGMENTATION), kFblMemAssertUserResultOutOfRange); + + /* Store processed data information */ + procOutJob->used += gProcParam.dataOutLength; + + /* Total used length exceeds buffer limits? */ + assertFblInternal((procOutJob->used <= (procOutJob->totalSize - procOutJob->offset)), kFblMemAssertParameterOutOfRange); + +# if defined( FBL_MEM_ENABLE_PROC_SEGMENTATION ) + /* Accumulate multiple data processing calls before passing output data to write routine */ + + /* Buffer was previously empty + Add behind current input data using low prio so that data will definitely be programmed after processing */ + if (procOutJob->used == gProcParam.dataOutLength) + { + /* Insert processed data into the queue and remember handle */ + gProcHandle = FblMemQueueDefaultPrioInsert(gProcessingQueue, procOutJob, activeJob->segmentIndex); + } + + /* Buffer is (almost) filled and has to be programmed before continuing processing */ + if ((procOutJob->netSize - procOutJob->used) < FBL_MEM_INTERNAL_PROC_SEGMENTATION) + { + /* Move processed data buffer in front of input data job by updating to higher priority + Handle set during current or previous cycle */ + (void)FblMemQueuePrioUpdate(gProcessingQueue, gProcHandle, (tFblMemQueuePrio)kFblMemJobPrio_ProcWriteHigh); + } +# else + /* Insert processed data into the queue */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, procOutJob, activeJob->segmentIndex); +# endif /* FBL_MEM_ENABLE_PROC_SEGMENTATION */ + } + + } + + break; + } + case kFblMemJobType_ProcWrite: +#endif /* FBL_ENABLE_DATA_PROCESSING */ +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + case kFblMemJobType_WriteFinalize: +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + case kFblMemJobType_InputWrite: + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Remember current address and remainder length */ + prevAddress = gSegInfo.writeAddress; + prevRemainder = gSegInfo.writeRemainder; +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + if (kFblMemJobType_WriteFinalize == activeJob->type) + { + finalizeStream = kFblMemOperationMode_Finalize; + /* Update position of output buffer to accommodate for programming remainder */ + activeJob->position = gSegInfo.writeRemainder; + } +# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +# else + else if (kFblMemJobType_InputWrite == activeJob->type) + { + /* Force programming of any potential remainder */ + finalizeStream = kFblMemOperationMode_Finalize; + } +# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ + else +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + { + finalizeStream = kFblMemOperationMode_Normal; + } + + /* Program data, error code reflects result of operation */ + gErrorStatus = FblMemProgramStream(activeJob, &actualLength, finalizeStream); + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Update progress information */ + if (kFblMemStatus_Ok == gErrorStatus) + { +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + FblMemUpdateProgress(gSegInfo.writeLength + gGapFillJob.used); +#else + FblMemUpdateProgress(gSegInfo.writeLength); +#endif + } +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Update size of data for pipelined verification */ + pipeVerificationLength = ((actualLength + prevRemainder) - gSegInfo.writeRemainder); + +#if defined( FBL_VERIFICATION_SEGMENT_INDEX ) + /* Check if written data is part of the verification process */ + if ((prevAddress + pipeVerificationLength) > (gSegInfo.input.logicalLength + gSegInfo.input.targetAddress)) + { + /* Data (signature/CRC) might be written at addresses larger than logical end of data, prevent underflow */ + if (prevAddress > (gSegInfo.input.logicalLength + gSegInfo.input.targetAddress)) + { + /* No more data to verify, signature/CRC was written */ + pipeVerificationLength = 0u; + } + else + { + /* Verify data until signature/CRC starts */ + pipeVerificationLength = (gSegInfo.input.logicalLength + gSegInfo.input.targetAddress) - prevAddress; + } + } +#endif /* FBL_VERIFICATION_SEGMENT_INDEX */ + /* Update pipelined verification information + Start verification at current write address + Include currently written data without possible remainder */ + (void)FblMemUpdateVerifyPipeJob(gSegInfo.ownIndex, prevAddress, pipeVerificationLength); +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + break; + } +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + case kFblMemJobType_StreamInput: + case kFblMemJobType_StreamProc: + case kFblMemJobType_StreamFinalize: + { + /* + Initialize parameters for stream output. + Note: Other members have been set during initialization + */ + gStreamParam.inputData = activeBuffer; + gStreamParam.inputLength = actualLength; + gStreamParam.consumedLength = 0u; + gStreamParam.producedLength = 0u; + gStreamParam.address = gSegInfo.writeAddress; + gStreamParam.length = gSegInfo.writeLength; + + if (kFblMemJobType_StreamFinalize == activeJob->type) + { + /* Call API function for user specific stream output */ + streamResult = ApplFblFinalizeStreamOutput(&gStreamParam); + } + else + { + /* Call API function for user specific stream output */ + streamResult = ApplFblStreamOutput(&gStreamParam); + } + + if (kFblOk != streamResult) + { + FBL_MEM_SET_STATUS(StreamOutput, gErrorStatus); + } + else + { + if ((gStreamParam.consumedLength | gStreamParam.producedLength) == 0u) + { + if (kFblMemJobType_StreamFinalize == activeJob->type) + { + /* Finalize stream output + Parameter already has correct values */ + if (kFblOk != ApplFblDeinitStreamOutput(&gStreamParam)) + { + FBL_MEM_SET_STATUS(StreamOutputDeinit, gErrorStatus); + } + + /* Finish job processing */ + activeJob->completion = kFblMemOperationMode_Unconditional; + } + else + { + /* Nothing consumed or produced at all, avoid endless loop */ + FBL_MEM_SET_STATUS(StreamOutputConsume, gErrorStatus); + } + } + } + + if (kFblMemStatus_Ok == gErrorStatus) + { + /* Update consumed length */ + actualLength = gStreamParam.consumedLength; + + /* Any data produced? */ + if (gStreamParam.producedLength > 0u) + { + /* Verify complete programming length does not exceed previously requested memory range */ + if (gStreamParam.producedLength > gSegInfo.writeLength) + { + FBL_MEM_SET_STATUS(StreamOutputConsume, gErrorStatus); + } + else + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Update pipelined verification information */ + (void)FblMemUpdateVerifyPipeJob(gSegInfo.ownIndex, gSegInfo.writeAddress, gStreamParam.producedLength); +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + /* Update segment information */ + gSegInfo.writeAddress += gStreamParam.producedLength; + /* Reduce expected remainder */ + gSegInfo.writeLength -= gStreamParam.producedLength; +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Length actually written */ + gSegInfo.writtenLength += gStreamParam.producedLength; +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + } + } + + } + + break; + } +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + case kFblMemJobType_GapFill: + { + /* Start address of current fill operation */ + fillAddress = activeJob->baseAddress + activeJob->position; + /* Remember total length */ + fillLength = actualLength; + /* Reset length actually filled */ + actualLength = 0u; + + /* Find start segment for current address */ + memSegment = FblMemSegmentNrGet(fillAddress); + + /* Valid segment addressed? */ + if (memSegment < 0) + { + /* Address lies in gap between flash blocks + Range till next block can be skipped */ + + /* Use last filled address to get follow-up segment */ + memSegment = FblMemSegmentNrGet(fillAddress - 1u) + 1; + + /* Check segment range */ + if ((memSegment >= (vsint16)kNrOfFlashBlock) || (memSegment <= 0)) + { + FBL_MEM_SET_STATUS(ProgramOutsideFbt, gErrorStatus); + } + else + { + /* Skip gap */ + if (FlashBlock[memSegment].begin > fillAddress) + { + /* Distance to start of next flash block can be skipped */ + tempLength = FlashBlock[memSegment].begin - fillAddress; + + if (tempLength < fillLength) + { + /* Range partially covers next flash block + Adapt fill range accordingly */ + actualLength = tempLength; + fillLength -= actualLength; + fillAddress = FlashBlock[memSegment].begin; + } + else + { + /* Full range lies within gap and can be skipped completely */ + actualLength = fillLength; + fillLength = 0u; + } + } + else + { + /* Full range lies within gap and can be skipped completely */ + actualLength = fillLength; + fillLength = 0u; + } + } + } + + if (kFblMemStatus_Ok == gErrorStatus) + { + /* Limit fill operation to configured segmentation (equals size of prepared buffer) */ + if (fillLength > FBL_MEM_GAP_FILL_SEGMENTATION) + { + fillLength = FBL_MEM_GAP_FILL_SEGMENTATION; + } + + /* Distance to end of current flash block */ + tempLength =(FlashBlock[memSegment].end - fillAddress) + 1u; + /* Limit fill range to current flash block */ + if (fillLength > tempLength) + { + fillLength = tempLength; + } + + /* Perform actual fill operation */ + if (fillLength > 0u) + { + /* Program non-volatile memory */ + gErrorStatus = FblMemProgramBufferInternal(fillAddress, &fillLength, gGapFillBuffer.data, kFblMemProgState_Pending); + + /* Update length actually processed */ + actualLength += fillLength; + } + } + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + if (kFblMemStatus_Ok == gErrorStatus) + { + /* Update programming progress */ + FblMemUpdateProgress(gSegInfo.writeLength + (gGapFillJob.used - actualLength)); + } +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + break; + } +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + case kFblMemJobType_Max: + default: + { + /* Invalid buffer type */ + FBL_MEM_SET_STATUS(Failed, gErrorStatus); + + break; + } + } + + /* Update buffer usage */ + activeJob->position += actualLength; + activeJob->used -= actualLength; + +#if defined( FBL_ENABLE_SYSTEM_CHECK ) + if (kFblMemStatus_Ok == gErrorStatus) + { + if (kFblMemStatus_Ok != FblMemVerifyBufferIntegrity()) + { + /* Detected buffer corruption */ + FBL_MEM_SET_STATUS(Failed, gErrorStatus); + } + } +#endif /* FBL_ENABLE_SYSTEM_CHECK */ + + /* Return global error state as function may be called in both service and background context */ + return gErrorStatus; +} + +/*********************************************************************************************************************** + * FblMemProcessQueue + **********************************************************************************************************************/ +/*! \brief Process first job in processing queue (directly use single input job if un-queued) + * \details Remove finished job from processing queue (and pipelined queue in case of input job) + * Switch to idle mode if all pending jobs are finished + * \pre FblMemQueueBuffer executed before + * \param[in] mode Operation mode used to trigger finalization + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static void FblMemProcessQueue( tFblMemOperationMode mode ) +{ +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + tFblMemQueueHandle activeHandle; +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ +#if defined( FBL_MEM_ENABLE_PIPELINING ) + V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * removeQueue; +#endif /* FBL_MEM_ENABLE_PIPELINING */ + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob; + + FblMemTriggerWatchdog(); + + /* + Critical section secures access to programming state + May also be altered in interrupt context + */ + __ApplFblMemEnterCriticalSection(); + + /* + Module in idle or error state? + Condition equals ((kFblMemProgState_Idle == fblMemProgState) || (kFblMemProgState_Error == fblMemProgState)) + */ + if (fblMemProgState < kFblMemProgState_Suspended) + { + /* Nothing to do */ + } +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Only explicit pending state allowed while programming in background context */ + else if ( (kFblMemContext_Background == gProgContext) + && (kFblMemProgState_Pending != fblMemProgState) ) + { + /* Module suspended */ + } +#endif /* FBL_MEM_ENABLE_PIPELINING */ + else + { + /* Operation potentially paused during previous execution cycle */ + fblMemProgState = kFblMemProgState_Pending; + } + + /* + No further critical access to programming state + Critical section can be left + */ + __ApplFblMemLeaveCriticalSection(); + + if (kFblMemProgState_Pending == fblMemProgState) + { +#if defined( FBL_MEM_ENABLE_PIPELINING ) + removeQueue = FBL_MEM_QUEUE_NULL; +#endif /* FBL_MEM_ENABLE_PIPELINING */ +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Set active job, stored in first entry of processing queue */ + activeHandle = FblMemQueueGetFirstUsedHandle(gProcessingQueue); + activeJob = gProcessingQueue[activeHandle].job; +#else + /* Set active job to single input job */ + activeJob = &FBL_MEM_INPUT_JOB[0]; +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + + /* Perform processing cycle on active job */ + if (kFblMemStatus_Ok == FblMemProcessJob(activeJob, mode)) + { + /* Buffer completely processed and completion mode allows job to be cleared? */ + if ( (kFblMemOperationMode_Unconditional == activeJob->completion) + || ((kFblMemOperationMode_Normal == activeJob->completion) && (0u == activeJob->used)) ) + { +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Remove buffer from processing queue */ + (void)FblMemQueueRemove(gProcessingQueue, activeHandle); + + if (FblMemQueueIsEmpty(gProcessingQueue)) +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + { + /* Processing queue empty: switch to idle state */ + fblMemProgState = kFblMemProgState_Idle; + } + +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Update additional queues */ + switch (activeJob->jobClass) + { +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Processed buffer is an input buffer */ + case tFblMemJobClass_PipeProg: + { + { + /* Remove from input buffer queue */ + removeQueue = FBL_MEM_PIPE_PROG_QUEUE; + } + + break; + } +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + case tFblMemJobClass_VerifyPipe: + { + /* Remove from verification job queue */ + removeQueue = gVerifyPipeQueue; + + break; + } +# endif + /* Default class: no special action required */ + case tFblMemJobClass_Default: + /* Ignore unknown job class */ + default: + { + /* Nothing to do */ + break; + } + } +#endif /* FBL_MEM_ENABLE_PIPELINING */ + } + } + else + { + /* Error while processing buffer: switch to error state */ + fblMemProgState = kFblMemProgState_Error; + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Remove from input buffer queue, otherwise all buffer may be in use */ + removeQueue = FBL_MEM_PIPE_PROG_QUEUE; +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + } + +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* + Remove from input buffer queue + Buffer available for new data again + */ + if ( (FBL_MEM_QUEUE_NULL != removeQueue) + && (!FblMemQueueIsEmpty(removeQueue)) ) + { + (void)FblMemQueueRemove(removeQueue, FblMemQueueGetFirstUsedHandle(removeQueue)); + } +#endif /* FBL_MEM_ENABLE_PIPELINING */ + } +} + +/*********************************************************************************************************************** + * FblMemFlushQueueByPrio + **********************************************************************************************************************/ +/*! \brief Process all jobs in processing queue with priority greater or equal to given value + * \details Loop until processing queue is empty or a job with a priority lower to the given one is reached + * \pre FblMemQueueBuffer executed before + * \param[in] prio Lowest job priority to be processed + **********************************************************************************************************************/ +static void FblMemFlushQueueByPrio( tFblMemQueuePrio prio ) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +# else + (void)prio; +# endif /* FBL_MEM_ENABLE_PROC_QUEUE */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + /* Loop while jobs are pending */ + while ( (FblMemTaskIsPending()) +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Only jobs with priority greater or equal to given one are processed */ + && (FblMemQueueGetFirstUsedEntry(gProcessingQueue).prio >= prio) +#endif + ) + { + /* Execute processing cycle */ + FblMemProcessQueue(kFblMemOperationMode_Finalize); + } +} + +#if defined( FBL_MEM_ENABLE_PIPELINING ) +/*********************************************************************************************************************** + * FblMemUnblockQueue + **********************************************************************************************************************/ +/*! \brief Unblock queue by freeing at least one queue entry + * \details Loop until given queue isn't completely filled any more + * \pre FblMemQueueBuffer executed before + * \param[in] queue Pointer to queue which should be unblocked + **********************************************************************************************************************/ +static void FblMemUnblockQueue( const V_MEMRAM1 tFblMemQueueEntry V_MEMRAM2 V_MEMRAM3 * queue ) +{ + /* Loop while queue is completely filled and jobs are pending */ + while ( (FblMemQueueIsFull(queue)) && (FblMemTaskIsPending()) ) + { + /* Execute processing cycle */ + FblMemProcessQueue(kFblMemOperationMode_Normal); + } +} +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +/*********************************************************************************************************************** + * FblMemQueueBuffer + **********************************************************************************************************************/ +/*! \brief Handle new chunk of input data + * \details If any combination of verification, data processing and pipelined programming is configured add jobs to + * processing queue + * Otherwise processing will directly work on single input buffer + * If pipelined programming is configured queue buffer and finish processing of one pending input buffer + * in case no free input buffer is available + * \pre FblMemInitPowerOn executed before, provided buffer and data offset equal the parameters of active + * input buffer + * \param[in] buffer Pointer to input buffer (including preamble) + * \param[in] offset Offset of actual data (after preamble) + * \param[in] length Length of data (without preamble) + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +static tFblMemStatus FblMemQueueBuffer( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ) +{ + tFblMemStatus retVal; + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) || \ + defined( FBL_ENABLE_SYSTEM_CHECK ) || \ + defined( FBL_ENABLE_ASSERTION ) +# else + (void)buffer; +# endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER || FBL_ENABLE_SYSTEM_CHECK || FBL_ENABLE_ASSERTION */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + +#if defined( FBL_MEM_ENABLE_VARYING_INPUT_BUFFER ) +#else + /* Received data resides in active fill buffer */ + activeJob = FblMemGetPendingInputJob(); +#endif /* FBL_MEM_ENABLE_VARYING_INPUT_BUFFER */ + +#if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) || \ + defined( FBL_ENABLE_SYSTEM_CHECK ) +# if defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) +# if defined( FBL_MEM_ENABLE_VARYING_INPUT_BUFFER ) + if (kFblMemStatus_Ok != FblMemSearchInputBuffer(buffer, offset, length)) +# else + if (kFblMemStatus_Ok != FblMemRelocateBufferOffset(activeJob, buffer, offset, length)) +# endif /* FBL_MEM_ENABLE_VARYING_INPUT_BUFFER */ +# else /* FBL_ENABLE_SYSTEM_CHECK */ + /* Limit buffer handling to previously provided buffer */ + if ( (buffer != FblMemGetBuffer(activeJob)) + || (offset >= activeJob->netSize) + || (length > (activeJob->netSize - offset)) ) +# endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + { + FBL_MEM_SET_STATUS(DataIndParam, retVal); + } + else +#else + assertFblUser(buffer == FblMemGetBuffer(activeJob), kFblMemAssertParameterOutOfRange); + assertFblUser(offset < activeJob->netSize, kFblMemAssertParameterOutOfRange); + assertFblUser(length <= (activeJob->netSize - offset), kFblMemAssertParameterOutOfRange); +#endif /* FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER || FBL_ENABLE_SYSTEM_CHECK */ + { +#if defined( FBL_MEM_ENABLE_VARYING_INPUT_BUFFER ) + activeJob = FblMemGetPendingInputJob(); +#endif /* FBL_MEM_ENABLE_VARYING_INPUT_BUFFER */ + + /* Evaluate current error state and directly return if not okay (error in background task) */ + if (kFblMemProgState_Error != fblMemProgState) + { + /* Update buffer state with provided information */ + activeJob->position = activeJob->offset + offset; + activeJob->used = length; +#if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* + Switch type of input buffer to value set in segment indication: + write through, pass through, data processing or stream output + */ + activeJob->type = gSegInfo.jobType; +#endif /* FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_PASSTHROUGH || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Processing queue full */ + if (FblMemQueueIsFull(gVerifyPipeQueue)) + { +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) + /* Last entry is exclusively used for storage of address information + This reserved job has to be free at all times so no blocking operation is necessary during segment start */ +# else + /* Verification job for current segment not yet included */ + if (FblMemQueueGetLastUsedEntry(gVerifyPipeQueue).job->segmentIndex != gSegInfo.ownIndex) +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH */ + { + /* Free at least one queue entry */ + FblMemUnblockQueue(gVerifyPipeQueue); + } + } +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + } + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Check for error condition */ + if (kFblMemProgState_Error != fblMemProgState) +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + { + /* Append buffer to processing queue */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, activeJob, gSegInfo.ownIndex); + +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Append input info to separate queue, managing input buffers exclusively */ + (void)FblMemQueueAppend(FBL_MEM_PIPE_PROG_QUEUE); + + + /* Free at least one queue entry */ + FblMemUnblockQueue(FBL_MEM_PIPE_PROG_QUEUE); +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + } +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Check for error condition */ + if (kFblMemProgState_Error != fblMemProgState) +#endif /* FBL_MEM_ENABLE_PIPELINING */ + { + /* Set pending programming request flag */ + fblMemProgState = kFblMemProgState_Pending; + } + } + + /* Result depending on queue processing by FblMemUnblockQueue */ + retVal = gErrorStatus; + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemCheckAllowed + **********************************************************************************************************************/ +/*! \brief Check if all required states are set + * \details Clear certain states if successful, completely reset allowed states otherwise + * \pre Allowed state initialized before + * \param[in] check Bitmask of states which have to be active + * \param[in] clear Bitmask of states to be cleared in case check successful + * \return All required states set (kFblOk) or not (kFblFailed) + **********************************************************************************************************************/ +static tFblResult FblMemCheckAllowed( tFblMemAllowedInd check, tFblMemAllowedInd clear ) +{ + tFblResult retVal; + + /* + Check executed at beginning of (almost) every exported function + Trigger watchdog here + */ + FblMemTriggerWatchdog(); + + + /* Check for required states */ + if (FblMemIsAllowed(check)) + { + /* Success: clear requested states */ + FblMemClrAllowed(clear); + retVal = kFblOk; + } + else + { + /* Failure: completely reset states */ + FblMemResetAllowed(); + retVal = kFblFailed; + } + + return retVal; +} + + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/*********************************************************************************************************************** + * FblMemCalculateProgress + **********************************************************************************************************************/ +/*! \brief Calculate progress percentage + * \details Percentage is calculated according to the current progress, the expected maximum value and the resulting + * maximum percentage + * \param[in] current Current progress in arbitrary unit (e.g. bytes) + * \param[in] total Expected maximum value in arbitrary unit (e.g. bytes) + * \param[in] percentage Maximum reported percentage + * \return Current progress percentage + **********************************************************************************************************************/ +static vuint8 FblMemCalculateProgress( vuint32 current, vuint32 total, vuint8 percentage ) +{ + vuint8 progress; + + /* Init to maximum percentage */ + progress = percentage; + + /* Prevent division by zero */ + if ((0u != total) && (0u != percentage)) + { + /* Calculate progress value + Use different calculation paths depending on total value to prevent integer overflow or division by zero + Remark: Unsigned cast of -1 is guaranteed to result in maximum representable value */ + if (total < (0xFFFFFFFFuL / (vuint32)percentage)) + { + /* Applying multiplication to current value prevents loss of precision, + which otherwise could result in invalid percentages (e.g. 101%) */ + progress = (vuint8)(((current * percentage) / total) & 0xFFu); + } + else + { + /* Total value is large enough to provide sufficient precision */ + progress = (vuint8)((current / (total / percentage)) & 0xFFu); + } + } + + /* Limit reported progress to maximum percentage */ + if (progress > percentage) + { + progress = percentage; + } + + return progress; +} + +/*********************************************************************************************************************** + * FblMemInitProgress + **********************************************************************************************************************/ +/*! \brief Initialize progress states + * \details Called during startup + **********************************************************************************************************************/ +static void FblMemInitProgress( void ) +{ + /* Initialize progress information */ + gProgressInfo.type = kFblMemProgressType_Undefined; + + /* Ensure reporting is triggered after change of any value */ + gPrevProgressInfo.type = kFblMemProgressType_Undefined; + gPrevProgressInfo.totalProgress = FBL_MEM_PROGRESS_INITIAL; + gPrevProgressInfo.partialProgress = FBL_MEM_PROGRESS_INITIAL; +} + +/*********************************************************************************************************************** + * FblMemReportProgress + **********************************************************************************************************************/ +/*! \brief Report current progress + * \details Report current progress to user callback in case any of the following applies: + * - Type or segment count has changed since previous report + * - Partial progress completed, but not reported yet + * - Total or partial progress increased by at least the configured threshold since previous report + **********************************************************************************************************************/ +static void FblMemReportProgress( void ) +{ + /* Check for relevant changes since previous report */ + if ( (FBL_MEM_PROGRESS_COMPLETE == gProgressInfo.partialProgress) + || (gPrevProgressInfo.type != gProgressInfo.type) + || (gPrevProgressInfo.segmentCount != gProgressInfo.segmentCount) + || ((gProgressInfo.totalProgress - gPrevProgressInfo.totalProgress) >= (vuint8)FBL_MEM_PROGRESS_THRESHOLD_PERCENTAGE) + || ((gProgressInfo.partialProgress - gPrevProgressInfo.partialProgress) >= (vuint8)FBL_MEM_PROGRESS_THRESHOLD_PERCENTAGE) ) + { + /* Prevent re-reporting of completed partial progress */ + if (FBL_MEM_PROGRESS_COMPLETE != gPrevProgressInfo.partialProgress) + { + /* Inform user callback */ + __ApplFblMemReportProgress(&gProgressInfo); + + /* Remember reported progress */ + gPrevProgressInfo = gProgressInfo; + } + } +} + +/*********************************************************************************************************************** + * FblMemSetupProgress + **********************************************************************************************************************/ +/*! \brief Setup progress for new partial operation + * \details Stores the meta information (type, logical block address and segment count), sets up the percentage + * offset and current contribution of the total operation and stores the target value of the partial operation + * \param[in] type Type of partial operation + * \param[in] logicalAddress Logical start address of processed block + * \param[in] segmentCount Count of segment processed by partial operation, typically zero for erase and verification, + * segment index for programming and index of last segment incremented by one for concluding + * gap fill + * \param[in] totalOffset Percentage offset of total operation for current operation type + * \param[in] totalPercentage Percentage contribution to total operation of current operation type + * \param[in] target Expected maximum value of partial operation in arbitrary unit (e.g. bytes) + **********************************************************************************************************************/ +/* PRQA S 6060 1 */ /* MD_FblMem_6060 */ +static void FblMemSetupProgress( tFblMemProgressType type, tFblAddress logicalAddress, vuint32 segmentCount, + vuint8 totalOffset, vuint8 totalPercentage, vuint32 target ) +{ + /* Store meta information */ + gProgressInfo.type = type; + gProgressInfo.logicalAddress = logicalAddress; + gProgressInfo.segmentCount = segmentCount; + + /* Setup percentage offset and contribution of total operation */ + gProgressInfoInternal.totalOffset = totalOffset; + gProgressInfoInternal.totalPercentage = totalPercentage; + /* Store target value of partial operation */ + gProgressInfoInternal.target = target; + + /* Ensure first update is reported by setting default values for previously reported info */ + gProgressPrevRemainder = 0u; + gPrevProgressInfo.totalProgress = FBL_MEM_PROGRESS_INITIAL; + gPrevProgressInfo.partialProgress = FBL_MEM_PROGRESS_INITIAL; +} + +/*********************************************************************************************************************** + * FblMemOffsetProgress + **********************************************************************************************************************/ +/*! \brief Modify total percentages to reflect current progress + * \details During progress setup the total percentages reflect the complete contribution of all operations of the + * current type. This function offsets those values according to the current progress. + * \pre FblMemSetupProgress called before + * \param[in] totalDone Current total progress in arbitrary unit (e.g. bytes) + * \param[in] totalTarget Expected maximum value of total operation in arbitrary unit (e.g. bytes) + **********************************************************************************************************************/ +static void FblMemOffsetProgress( vuint32 totalDone, vuint32 totalTarget ) +{ + /* Update offset according to current progress */ + gProgressInfoInternal.totalOffset += + FblMemCalculateProgress(totalDone, totalTarget, gProgressInfoInternal.totalPercentage); + /* Cut down percentage contribution according to current progress */ + gProgressInfoInternal.totalPercentage = + FblMemCalculateProgress(gProgressInfoInternal.target, totalTarget, gProgressInfoInternal.totalPercentage); +} + +/*********************************************************************************************************************** + * FblMemUpdateProgress + **********************************************************************************************************************/ +/*! \brief Update the progress information + * \details Progress information is updated according to the progress of the current partial operation + * Update is performed in case any of the following applies: + * - First update + * - Progress increased by at least the configured threshold since previous update + * \pre FblMemSetupProgress and optionally FblMemOffsetProgress called before + * \param[in] remainderPart Remainder of current partial operation in arbitrary unit (e.g. bytes) + **********************************************************************************************************************/ +static void FblMemUpdateProgress( vuint32 remainderPart ) +{ + vuint32 done; + + /* Check for relevant changes since previous update */ + if ( (gProgressPrevRemainder < remainderPart) + || ((gProgressPrevRemainder - remainderPart) >= FBL_MEM_PROGRESS_THRESHOLD_BYTES) ) + { + /* Calculate current partial progress in arbitray unit */ + done = gProgressInfoInternal.target - remainderPart; + + /* Calculate progress percentages */ + gProgressInfo.totalProgress = + gProgressInfoInternal.totalOffset + + FblMemCalculateProgress(done, gProgressInfoInternal.target, gProgressInfoInternal.totalPercentage); + gProgressInfo.partialProgress = + FBL_MEM_PROGRESS_INITIAL + FblMemCalculateProgress(done, gProgressInfoInternal.target, FBL_MEM_PROGRESS_COMPLETE); + + /* Report updated progress */ + FblMemReportProgress(); + + /* Remember currently updated remainder value */ + gProgressPrevRemainder = remainderPart; + } +} + +/*********************************************************************************************************************** + * FblMemConcludeProgress + **********************************************************************************************************************/ +/*! \brief Conclude the current partial operation + * \details Explicitely set partial progress to maximum percentage and total progress according to the set up values + * \pre FblMemSetupProgress and optionally FblMemOffsetProgress called before + **********************************************************************************************************************/ +static void FblMemConcludeProgress( void ) +{ + /* Set progress percentages to maximum values */ + gProgressInfo.totalProgress = gProgressInfoInternal.totalOffset + gProgressInfoInternal.totalPercentage; + gProgressInfo.partialProgress = FBL_MEM_PROGRESS_COMPLETE; + + /* Report updated progress */ + FblMemReportProgress(); +} + +/*********************************************************************************************************************** + * FblMemProgressRead + **********************************************************************************************************************/ +/*! \brief Update verification progress + * \details Read operations of output verification are re-routed through this function to update the progress + * information according the current read address + * \param[in] address Memory address to read out + * \param[out] buffer Target buffer + * \param[in] length Number of bytes to read + * \return Number of actually copied bytes + **********************************************************************************************************************/ +# if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) +# if defined( FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM ) +/* Parameters order changed in comparison to HIS security module specification */ +static tFblMemVerifySize FblMemProgressRead( tFblMemVerifyAddr address, tFblMemVerifySize length, tFblMemVerifyDataPtr buffer ) +# else +/* Parameters order as defined by HIS security module specification */ +static tFblMemVerifySize FblMemProgressRead( tFblMemVerifyAddr address, tFblMemVerifyDataPtr buffer, tFblMemVerifySize length ) +# endif /* FBL_MEM_ENABLE_SWITCH_READMEMORY_PARAM */ +{ + vuint32 position; + + /* Calculate position relative to block start address */ + position = address - gBlockInfo.targetAddress; + /* Update progress with remainder */ + FblMemUpdateProgress(gBlockInfo.targetLength - position); + + /* Perform actual read operation */ + return gBlockInfo.readFct(address, buffer, length); +} +# endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblMemInitPowerOnExt + **********************************************************************************************************************/ +/*! \brief Initialize module + * \param[in] preambleLen Length of preamble stored during buffer switch + * \param[in] sourceHandle Handle of input source + * \return Pointer to initial input buffer + **********************************************************************************************************************/ +tFblMemRamData FblMemInitPowerOnExt( tFblLength preambleLen, tFblMemInputSource sourceHandle ) +{ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + vuintx idx; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH ) +# else + (void)preambleLen; +# endif /* FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH */ +# if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +# else + (void)sourceHandle; +# endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) + /* Verify source handle lies within range */ + assertFblUser(sourceHandle < FBL_MEM_SOURCE_COUNT, kFblMemAssertParameterOutOfRange); +#endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Verify job prio mapping array */ + assertFblInternal((vuintx)kFblMemJobType_Max == (FBL_MEM_ARRAY_SIZE(gJobPrio) - 1u), kFblMemAssertParameterOutOfRange); /* PRQA S 2742, 2880 */ /* MD_FblMem_AssertJobMax, MD_MSR_Unreachable */ +#endif /* FBL_MEM_ENABLE_PROC_QUEUE */ +#if defined( FBL_MEM_ENABLE_SEGMENTATION ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Verify length limit mapping array */ + assertFblInternal((vuintx)kFblMemJobType_Max == (FBL_MEM_ARRAY_SIZE(gLengthLimits) - 1u), kFblMemAssertParameterOutOfRange); /* PRQA S 2742, 2880 */ /* MD_FblMem_AssertJobMax, MD_MSR_Unreachable */ +#endif /* FBL_MEM_ENABLE_SEGMENTATION || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + + +#if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Initialize data processing info */ + FblMemInitJob(&gProcWriteJob, gProcBuffer.data, FBL_MEM_ARRAY_SIZE(gProcBuffer.data), kFblMemJobType_ProcWrite); + /* Overwrite net size, to exclude overhead for remainder and padding */ + gProcWriteJob.netSize = FBL_MEM_PROC_BUFFER_SIZE; + /* Initialize info to trigger data processing finalization */ + FblMemInitJob(&gProcFinalizeJob, FBL_MEM_BUFFER_NULL, 0, kFblMemJobType_ProcFinalize); + + /* + Always provide full configured segmentation size to data processing, + regardless of any remainder + */ + gProcParam.dataOutMaxLength = (vuint16)FBL_MEM_INTERNAL_PROC_SEGMENTATION; +# if defined( FBL_MEM_ENABLE_EXT_TRIGGER_DATA_PROC ) + gProcParam.wdTriggerFct = &FblMemTriggerWatchdogExt; +# else + gProcParam.wdTriggerFct = FblMemTriggerWatchdog; +# endif /* FBL_MEM_ENABLE_EXT_TRIGGER_DATA_PROC */ +#endif /* FBL_ENABLE_DATA_PROCESSING */ + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + /* Initialize stream output info */ +# if defined( FBL_ENABLE_DATA_PROCESSING ) + FblMemInitJob(&gStreamProcJob, gProcBuffer.data, FBL_MEM_ARRAY_SIZE(gProcBuffer.data), kFblMemJobType_StreamProc); + /* Overwrite net size, to exclude overhead for remainder and padding */ + gStreamProcJob.netSize = FBL_MEM_PROC_BUFFER_SIZE; +# endif /* FBL_ENABLE_DATA_PROCESSING */ + /* Initialize info to trigger stream output finalization */ + FblMemInitJob(&gStreamFinalizeJob, FBL_MEM_BUFFER_NULL, 0, kFblMemJobType_StreamFinalize); + + gStreamParam.outputData = FBL_MEM_BUFFER_NULL; + gStreamParam.outputSize = 0u; + gStreamParam.watchdog = &FblMemTriggerWatchdog; +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + + +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + /* Initialize gap fill job */ + FblMemInitJob(&gGapFillJob, FBL_MEM_BUFFER_NULL, FBL_MEM_ARRAY_SIZE(gGapFillBuffer.data), kFblMemJobType_GapFill); + + /* Fill gap fill buffer with fill character */ + for (idx = 0u; idx < FBL_MEM_ARRAY_SIZE(gGapFillBuffer.data); idx++) + { + gGapFillBuffer.data[idx] = kFillChar; + } +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) + gActiveSource = sourceHandle; +#endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ + +#if defined( FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH ) + gPreambleLength[FBL_MEM_ACTIVE_SOURCE] = preambleLen; /* PRQA S 2842 */ /* MD_FblMem_2842 */ +#endif /* FBL_MEM_ENABLE_DYNAMIC_PREAMBLE_LENGTH */ + + /* Perform additional initialization and return initial buffer */ + return FblMemInitInternal(); +} + +/*********************************************************************************************************************** + * FblMemInitPowerOn + **********************************************************************************************************************/ +/*! \brief Initialize module + * \return Pointer to initial input buffer + **********************************************************************************************************************/ +tFblMemRamData FblMemInitPowerOn( void ) +{ + /* Perform initialization and return initial buffer */ + return FblMemInitPowerOnExt(FBL_MEM_DEFAULT_PREAMBLE_LENGTH, FBL_MEM_SOURCE_HANDLE_DEFAULT); +} + +/*********************************************************************************************************************** + * FblMemInit + **********************************************************************************************************************/ +/*! \brief (Re)-initialize input buffers + * \details Should be called before performing additional tasks in case a previous operation failed + * \pre FblMemInitPowerOn executed before + * \return Pointer to active input buffer + **********************************************************************************************************************/ +tFblMemRamData FblMemInit( void ) +{ + tFblMemRamData activeBuffer; + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* + Active fill buffer may change + Store preamble so operation is transparent for caller + */ + FblMemStorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + + /* Perform re-initialization and get active buffer */ + activeBuffer = FblMemInitInternal(); + + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* + Active fill buffer may have changed + Restore previously stored preamble so operation is transparent for caller + */ + FblMemRestorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + + return activeBuffer; +} + +/*********************************************************************************************************************** + * FblMemDeinit + **********************************************************************************************************************/ +/*! \brief De-initialize module + * \details Should be called when memory driver is de-initialized + **********************************************************************************************************************/ +void FblMemDeinit( void ) +{ + /* No further operations allowed, reset states */ + FblMemInitStates(); +} + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +/*********************************************************************************************************************** + * FblMemLockInputSource + **********************************************************************************************************************/ +/*! \brief Lock input to specific source + * \param[in] sourceHandle Handle of input source + **********************************************************************************************************************/ +void FblMemLockInputSource( tFblMemInputSource sourceHandle ) +{ + /* Verify source handle lies within range */ + assertFblInternal(sourceHandle < FBL_MEM_SOURCE_COUNT, kFblMemAssertParameterOutOfRange); + + gActiveSource = sourceHandle; +} +#endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ + +/*********************************************************************************************************************** + * FblMemGetActiveBuffer + **********************************************************************************************************************/ +/*! \brief Return active input buffer, which can be used for current data reception + * \details Buffer pointer includes previously set offset to accommodate for alignment requirements + * \pre FblMemInitPowerOn executed before + * \return Pointer to active input buffer + **********************************************************************************************************************/ +tFblMemRamData FblMemGetActiveBuffer( void ) +{ + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * inputJob; + + /* Get pending job info */ + inputJob = FblMemGetPendingInputJob(); + /* Reset position to current offset */ + inputJob->position = inputJob->offset; + + /* Return pointer to active fill buffer */ + return FblMemGetBuffer(inputJob); +} + +/*********************************************************************************************************************** + * FblMemBlockEraseIndication + **********************************************************************************************************************/ +/*! \brief Indicate start of a new block (just before first segment) + * \pre FblMemInitPowerOn executed before + * \param[in] block Pointer to block information structure + * Only address and length members have to be initialized + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +tFblMemStatus FblMemBlockEraseIndication( const V_MEMRAM1 tFblMemBlockInfo V_MEMRAM2 V_MEMRAM3 * block ) +{ + tFblMemStatus retVal; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_BLOCK_ERASE, FBL_MEM_ALLOWED_NONE)) + { + FBL_MEM_SET_STATUS(BlockEraseSequence, retVal); + } + else + { +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Setup erase progress */ + FblMemSetupProgress(kFblMemProgressType_Erase, block->logicalAddress, 0u, + FBL_MEM_PROGRESS_INITIAL, FBL_MEM_PROGRESS_ERASE, block->targetLength); + /* Report initial progress */ + FblMemUpdateProgress(block->targetLength); + + /* Explicitely enable progress information for erase operation */ + gProgressState = kFblMemProgressState_Enabled; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + /* Perform erase */ + retVal = FblMemEraseRegionInternal(block->targetAddress, block->targetLength); + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Conclude erase progress */ + FblMemConcludeProgress(); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + } + + if (kFblMemStatus_Ok == retVal) + { + /* Allow block start / erase indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_BLOCK_START | FBL_MEM_ALLOWED_BLOCK_ERASE); + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemBlockStartIndication + **********************************************************************************************************************/ +/*! \brief Indicate start of a new block (just before first segment) + * \details Block may consist of one or more segments + * \pre FblMemInitPowerOn executed before + * FblMemInit executed before in case previous cycle failed + * \param[in] block Pointer to block information structure + * Required members depending on configuration + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +tFblMemStatus FblMemBlockStartIndication( V_MEMRAM1 tFblMemBlockInfo V_MEMRAM2 V_MEMRAM3 * block ) /* PRQA S 3673 */ /* MD_FblMem_3673 */ +{ + tFblMemStatus retVal; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if defined( FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO ) +# else + (void)block; +# endif /* FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + retVal = kFblMemStatus_Ok; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_BLOCK_START, FBL_MEM_ALLOWED_BLOCK_START)) + { + FBL_MEM_SET_STATUS(BlockStartSequence, retVal); + } + else + { +#if defined( FBL_ENABLE_SYSTEM_CHECK ) && \ + defined( FBL_MEM_ENABLE_VERIFICATION ) + /* At least one of the configured verification variants should be active */ +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + if (FBL_MEM_VERIFY_FCT_INPUT_NULL != block->verifyRoutinePipe.function) + { + } + else +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +# if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) + if (FBL_MEM_VERIFY_FCT_OUTPUT_NULL != block->verifyRoutineOutput.function) + { + } + else +# endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + { + FBL_MEM_SET_STATUS(BlockStartParam, retVal); + } +#endif /* FBL_ENABLE_SYSTEM_CHECK && FBL_MEM_ENABLE_VERIFICATION */ + } + +#if defined( FBL_ENABLE_FUNC_VIRTUAL_MEMORY ) + /* PRQA S 3415 1 */ /* MD_FblMem_3415 */ + if ((kFblMemStatus_Ok == retVal) && (IO_E_OK == MemDriver_IsVirtualMem(block->targetAddress))) + { + if (IO_E_OK != MemDriver_RVirtualMemInitSync(block->targetAddress)) + { + FBL_MEM_SET_STATUS(BlockStartSequence, retVal); + } + } +#endif /* FBL_ENABLE_FUNC_VIRTUAL_MEMORY */ + + if (kFblMemStatus_Ok == retVal) + { + /* Store block information */ +#if defined( FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO ) + gBlockInfo = *block; +#endif /* FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO */ +#if defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) + /* Reset segment list */ + gBlockInfo.segmentList->nrOfSegments = 0u; +#endif /* FBL_MEM_ENABLE_SEGMENT_HANDLING */ + + /* Setup index of first segment */ + gSegInfo.nextIndex = 0u; + + /* Allow segment start indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_SEGMENT_START); + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemBlockEndIndication + **********************************************************************************************************************/ +/*! \brief Indicate end of current block (after last segment) + * \details Finalize verification if configured + * \pre FblMemSegmentEndIndication executed before + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6050, 6080 1 */ /* MD_MSR_STCAL, MD_MSR_STMIF */ +tFblMemStatus FblMemBlockEndIndication( void ) +{ + tFblMemStatus retVal; +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + tFblAddress baseAddress; + tFblLength baseLength; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + + retVal = kFblMemStatus_Ok; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_BLOCK_END, FBL_MEM_ALLOWED_BLOCK_END)) + { + FBL_MEM_SET_STATUS(BlockEndSequence, retVal); + } + else + { +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + /* No gap fill required for volatile memory */ + if (kFblMemType_RAM != gSegInfo.input.type) + { + /* Address range information of last segment */ + baseAddress = gBlockInfo.segmentList->segmentInfo[gSegInfo.ownIndex].targetAddress; + baseLength = gBlockInfo.segmentList->segmentInfo[gSegInfo.ownIndex].length; + + /* Include padding previously applied to end of last segment */ + baseLength += FblMemPadLength(baseAddress, baseLength); + + /* Length till end of block + Subtract offset of segment start and length of segment (including padding) from block length + to prevent range overflow */ + gGapFillJob.used = (gBlockInfo.targetLength - (baseAddress - gBlockInfo.targetAddress)) - baseLength; + + /* Gap fill not necessary when segment ends at last block address */ + if (gGapFillJob.used > 0u) + { + /* Setup concluding gap fill from end of last segment to end of block */ + gGapFillJob.position = 0u; + /* Gap fill starts after end of last segment */ + gGapFillJob.baseAddress = baseAddress + baseLength; + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Setup gap fill progress */ + FblMemSetupProgress(kFblMemProgressType_GapFill, gBlockInfo.logicalAddress, gSegInfo.nextIndex, + FBL_MEM_PROGRESS_INITIAL + FBL_MEM_PROGRESS_ERASE, FBL_MEM_PROGRESS_PROGRAM, gGapFillJob.used); + /* Adjust total percentages */ + FblMemOffsetProgress((gGapFillJob.baseAddress - gBlockInfo.targetAddress), gBlockInfo.targetLength); + /* Report initial progress */ + FblMemUpdateProgress(gGapFillJob.used); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + /* Trigger concluding gap fill */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gGapFillJob, gSegInfo.ownIndex); + + /* Continue operation */ + fblMemProgState = kFblMemProgState_Pending; + + /* Finish processing of all pending buffers */ + FblMemFlushQueueByPrio((tFblMemQueuePrio)kFblMemJobPrio_Write); + } + } +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Conclude any pending progress (programming or gap fill) */ + FblMemConcludeProgress(); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Null pointer passed as verification function disables functionality */ + if (FBL_MEM_VERIFY_FCT_INPUT_NULL != gBlockInfo.verifyRoutinePipe.function) + { + /* No additional segments for this block, trigger finalization of pipelined verification + Add to processing queue as other jobs may still be pending */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gVerifyPipeFinalizeJob, gSegInfo.ownIndex); + + /* Continue operation */ + fblMemProgState = kFblMemProgState_Pending; + } + else +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + { + /* Concluding else */ + } + } + + if (kFblMemStatus_Ok == retVal) + { + /* Allow block verify */ + FblMemSetAllowed(FBL_MEM_ALLOWED_BLOCK_VERIFY); + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemBlockVerify + **********************************************************************************************************************/ +/*! \brief Finalize block verification by calling extended API with options to abort + * verification in case of failure + * \details Hint: also call function if verification not configured + * \pre FblMemBlockEndIndication executed before + * \param[in] verifyData Pointer to verification structure + * Required members dependent on configuration + * \param[out] verifyResult Pointer to extended verification result + * Null pointer if no extended result required + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +tFblMemStatus FblMemBlockVerify( const V_MEMRAM1 tFblMemBlockVerifyData V_MEMRAM2 V_MEMRAM3 * verifyData, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * verifyResult ) +{ + return FblMemBlockVerifyExtended(verifyData, verifyResult, 0u); +} + +/*********************************************************************************************************************** + * FblMemBlockVerifyExtended + **********************************************************************************************************************/ +/*! \brief Finalize block verification + * \details Hint: also call function if verification not configured + * \pre FblMemBlockEndIndication executed before + * \param[in] verifyData Pointer to verification structure + * Required members dependent on configuration + * \param[in] option Indication which verification routines shall always be performed, + regardless of previous result. + 0 if verification shall be aborted as soon as a step fails (default) + * \param[out] verifyResult Pointer to extended verification result + * Null pointer if no extended result required + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +tFblMemStatus FblMemBlockVerifyExtended( const V_MEMRAM1 tFblMemBlockVerifyData V_MEMRAM2 V_MEMRAM3 * verifyData, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * verifyResult, const tFblMemVerifyOption option ) +{ + tFblMemStatus retVal; + tFblMemVerifyStatus localResult; +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) + tFblMemVerifyStatus verifyOutputResult; +# if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH ) +# else + const V_MEMRAM1 tFblMemSegmentListEntry V_MEMRAM2 V_MEMRAM3 * lastSegment; +# endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH */ +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ +# if !defined( FBL_MEM_ENABLE_VERIFICATION ) + (void)option; + (void)verifyData; +# endif /* !FBL_MEM_ENABLE_VERIFICATION */ +#endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + retVal = kFblMemStatus_Ok; + localResult = FBL_MEM_VERIFY_OK; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_BLOCK_VERIFY, FBL_MEM_ALLOWED_NONE)) + { + FBL_MEM_SET_STATUS(BlockVerifySequence, retVal); + } + else + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + /* Finish processing of all pending verification jobs */ + FblMemFlushQueueByPrio((tFblMemQueuePrio)kFblMemJobPrio_Lowest); + + /* Check for error condition */ + if (kFblMemProgState_Error == fblMemProgState) + { + /* Report error set by programming routines (previous or current) */ + retVal = gErrorStatus; + } + else +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + { +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) + if ((retVal == kFblMemStatus_Ok) || FBL_MEM_CHK_OPTION(option, FBL_MEM_VERIFY_PIPE_OPT)) /* PRQA S 2991, 2995 */ /* MD_FblMem_2991_2995 */ + { + /* Pipelined verification is used + Finalize by comparing with the transferred signature */ + if (kFblMemStatus_Ok != FblMemVerifyInput( &gBlockInfo.verifyRoutinePipe, &verifyData->verifyDataPipe, + FBL_MEM_VERIFY_STATE_VERIFY, &localResult )) + { + FBL_MEM_SET_STATUS(BlockVerifyPipeVerify, retVal); + } + } +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) + if ((retVal == kFblMemStatus_Ok) || FBL_MEM_CHK_OPTION(option, FBL_MEM_VERIFY_OUTPUT_OPT)) /* PRQA S 2991, 2995 */ /* MD_FblMem_2991_2995 */ + { + /* Null pointer passed as verification function disables functionality */ + if (FBL_MEM_VERIFY_FCT_OUTPUT_NULL != gBlockInfo.verifyRoutineOutput.function) + { + /* Initialize verification parameter structure */ +# if defined( FBL_MEM_ENABLE_EXT_TRIGGER_OUTPUT_VERIFY ) + gBlockInfo.verifyRoutineOutput.param->wdTriggerFct = (tFblMemVerifyWdFct)&FblMemTriggerWatchdogExt; /* PRQA S 0313 */ /* MD_FblMem_0313 */ +# else + gBlockInfo.verifyRoutineOutput.param->wdTriggerFct = (tFblMemVerifyWdFct)&FblMemTriggerWatchdog; +# endif /* FBL_MEM_ENABLE_EXT_TRIGGER_OUTPUT_VERIFY */ +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Setup erase progress */ + FblMemSetupProgress(kFblMemProgressType_Verify, gBlockInfo.logicalAddress, 0u, + FBL_MEM_PROGRESS_INITIAL + FBL_MEM_PROGRESS_ERASE + FBL_MEM_PROGRESS_PROGRAM, FBL_MEM_PROGRESS_VERIFY, + gBlockInfo.targetLength); + /* Report initial progress */ + FblMemUpdateProgress(gBlockInfo.targetLength); + + /* Overwrite read function to keep track of progress */ + gBlockInfo.verifyRoutineOutput.param->readMemory = &FblMemProgressRead; +#else + gBlockInfo.verifyRoutineOutput.param->readMemory = gBlockInfo.readFct; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + gBlockInfo.verifyRoutineOutput.param->verificationData = verifyData->verifyDataOutput.data; + + gBlockInfo.verifyRoutineOutput.param->blockStartAddress = gBlockInfo.targetAddress; +# if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH ) + gBlockInfo.verifyRoutineOutput.param->blockLength = gBlockInfo.targetLength; +# else + /* Total length covered by all programmed segments (from block start) */ + lastSegment = &(gBlockInfo.segmentList->segmentInfo[gBlockInfo.segmentList->nrOfSegments - 1u]); + + /* Segments have to be stored in increasing address order */ + gBlockInfo.verifyRoutineOutput.param->blockLength = (lastSegment->targetAddress - gBlockInfo.targetAddress) + + lastSegment->length; +# endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH */ + + /* Call verification function */ + verifyOutputResult = gBlockInfo.verifyRoutineOutput.function(gBlockInfo.verifyRoutineOutput.param); + localResult |= verifyOutputResult; /* PRQA S 2986 */ /* MD_FblMem_2986 */ + if (FBL_MEM_VERIFY_OK != verifyOutputResult) + { + FBL_MEM_SET_STATUS(BlockVerifyOutputVerify, retVal); + } + } + } +#else + { + /* Concluding else */ + } +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Conclude pending verification progress */ + FblMemConcludeProgress(); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + } + } + + if (kFblMemStatus_Ok == retVal) + { + /* Allow new block start / erase indication */ + FblMemAddAllowed(FBL_MEM_ALLOWED_BLOCK_START | FBL_MEM_ALLOWED_BLOCK_ERASE); + } + + if (FBL_MEM_VERIFY_STATUS_NULL != verifyResult) + { + /* Pass extended result */ + *verifyResult = localResult; + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemSegmentStartIndication + **********************************************************************************************************************/ +/*! \brief Indicate start of a new segment + * \details Segment may consist of one or more chunks of input data programmed into a contiguous memory range + * Update verification with logical address and length if configured + * Initialize data processing if configured + * \pre FblMemBlockStartIndication executed before + * \param[in] segment Pointer to segment information + * Target address (program operation) + * Target length (program operation) + * either unprocessed data length actually written to memory or processed data length of input + * data + * Logical address (verification operation) + * Logical length (verification operation) + * Type (RAM / ROM) + * Data format identifier (data processing) + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050, 6080 1 */ /* MD_MSR_STMIF, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL */ +tFblMemStatus FblMemSegmentStartIndication( const V_MEMRAM1 tFblMemSegmentInfo V_MEMRAM2 V_MEMRAM3 * segment ) +{ + tFblMemStatus retVal; +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) && \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * verifyJob; +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED && FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH */ +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + tFblAddress baseAddress; + tFblLength baseLength; +#endif /* FBL_MEM_ENABLE_GAP_FILL */ +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + tFblAddress progressAddress; + tFblLength progressRemainder; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + retVal = kFblMemStatus_Ok; + +#if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Remember input buffer type: write through */ + gSegInfo.jobType = kFblMemJobType_InputWrite; +#endif /* FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_PASSTHROUGH || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_SEGMENT_START, FBL_MEM_ALLOWED_SEGMENT_START)) + { + FBL_MEM_SET_STATUS(SegmentStartSequence, retVal); + } +#if defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) + else if (gBlockInfo.segmentList->nrOfSegments >= gBlockInfo.maxSegments) + { + /* Maximum number of segment list entries exceeded */ + FBL_MEM_SET_STATUS(SegmentStartSegmentCount, retVal); + } +#endif /* FBL_MEM_ENABLE_SEGMENT_HANDLING */ + else + { +#if defined( FBL_MEM_ENABLE_VERIFY_STREAM ) + /* Initialize verification on first segment */ + if (0u == gSegInfo.nextIndex) + { + /* Initialize the calculation */ + if (kFblMemStatus_Ok != FblMemInitVerifyInput()) + { + /* Overwrites previous error code */ + FBL_MEM_SET_STATUS(SegmentStartVerifyInit, retVal); + } + } + + if (kFblMemStatus_Ok == retVal) +#endif /* FBL_MEM_ENABLE_VERIFY_STREAM */ +#if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) + { + { +# if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) && \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) +# if defined( __ApplFblMemVerifyPipelinedIsAddressAndLengthIncluded ) + /* Skip update of signature information? */ + if (kFblOk == __ApplFblMemVerifyPipelinedIsAddressAndLengthIncluded(&gBlockInfo, segment)) +# endif + { + /* Get first free job + At least one (additional) job should be free at this point as the previous data indication(s) + unblocked the pipelined verification queue */ + verifyJob = FblMemPrepareVerifyPipeJob(gSegInfo.nextIndex, segment->targetAddress); + + /* Check for null pointer */ + if (FBL_MEM_JOB_NULL != verifyJob) + { + /* Switch job type to include segment information */ + verifyJob->type = kFblMemJobType_VerifyPipeInfo; + verifyJob->used = FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE; + verifyJob->netSize = FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE; + verifyJob->totalSize = FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE; + /* Do not remove verification job as it is reused for the read-back */ + verifyJob->completion = kFblMemOperationMode_Finalize; + + FblMemSetInteger(FBL_MEM_VERIFY_ADDRESS_LENGTH_SIZE, segment->logicalAddress, &verifyJob->buffer[0u]); + FblMemSetInteger(FBL_MEM_VERIFY_ADDRESS_LENGTH_SIZE, segment->logicalLength, &verifyJob->buffer[FBL_MEM_VERIFY_ADDRESS_LENGTH_SIZE]); + } + } +# endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED && FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH */ + } + } + + if (kFblMemStatus_Ok == retVal) +#endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ + { + /* Check whether data processing is requested */ + if (kFblOk == __ApplFblMemIsDataProcessingRequired(segment->dataFormat)) + { +#if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Remember input buffer type: data processing */ + gSegInfo.jobType = kFblMemJobType_ProcInput; + + /* Initialize user specific processing of received data */ + gProcParam.mode = segment->dataFormat; + + /* Check result */ + if (kFblOk != ApplFblInitDataProcessing(&gProcParam)) + { + FBL_MEM_SET_STATUS(SegmentStartDataProcInit, retVal); + } +#else + /* Data processing not supported, refuse indication */ + FBL_MEM_SET_STATUS(SegmentStartDataProcInit, retVal); +#endif /* FBL_ENABLE_DATA_PROCESSING */ + } + } + +#if defined( __ApplFblMemIsStreamOutputRequired ) + if (kFblMemStatus_Ok == retVal) + { + /* Check whether stream output is requested */ + if (kFblOk == __ApplFblMemIsStreamOutputRequired(segment->dataFormat)) + { +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) +# if defined( FBL_ENABLE_DATA_PROCESSING ) + if (kFblOk == __ApplFblMemIsDataProcessingRequired(segment->dataFormat)) + { + /* Input buffer type (data processing) already set */ + } + else +# endif /* FBL_ENABLE_DATA_PROCESSING */ + { + /* Remember input buffer type: stream output */ + gSegInfo.jobType = kFblMemJobType_StreamInput; + } + + + /* Initialize user specific stream output of received data */ + gStreamParam.mode = segment->dataFormat; + gStreamParam.baseAddress = segment->targetAddress; + gStreamParam.baseLength = gBlockInfo.targetLength - (segment->targetAddress - gBlockInfo.targetAddress); + + /* Check result */ + if (kFblOk != ApplFblInitStreamOutput(&gStreamParam)) + { + FBL_MEM_SET_STATUS(SegmentStartStreamOutInit, retVal); + } +# else + /* Stream output not supported, refuse indication */ + FBL_MEM_SET_STATUS(SegmentStartStreamOutInit, retVal); +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + } + } +#endif /* __ApplFblMemIsStreamOutputRequired */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Progress information for segment (without gap fill) */ + progressAddress = segment->targetAddress; + progressRemainder = segment->targetLength; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +#if defined( FBL_MEM_ENABLE_GAP_FILL ) + if (kFblMemStatus_Ok == retVal) + { + /* No gap fill required for volatile memory */ + if (kFblMemType_RAM != segment->type) + { + /* First segment of block? */ + if (0u == gSegInfo.nextIndex) + { + /* Fill from beginning of block */ + baseAddress = gBlockInfo.targetAddress; + baseLength = 0u; + } + else + { + /* Fill from end of previous segment */ + baseAddress = gBlockInfo.segmentList->segmentInfo[gSegInfo.ownIndex].targetAddress; + baseLength = gBlockInfo.segmentList->segmentInfo[gSegInfo.ownIndex].length; + } + + /* Include padding applied to end of previous segment */ + baseLength += FblMemPadLength(baseAddress, baseLength); + + /* Segments in ascending order? */ + assertFblInternal((segment->targetAddress >= baseAddress), kFblMemAssertParameterOutOfRange); + assertFblInternal(((segment->targetAddress - baseAddress) >= baseLength), kFblMemAssertParameterOutOfRange); + + /* Length till start of current segment + Subtract length of previous segment (including padding) from offset between segments + to prevent range overflow */ + gGapFillJob.used = (segment->targetAddress - baseAddress) - baseLength; + + /* Gap fill not necessary when segment starts directly after previous segment */ + if (gGapFillJob.used > 0u) + { + /* Setup gap fill */ + gGapFillJob.position = 0u; + /* Gap fill starts after end of previous segment */ + gGapFillJob.baseAddress = baseAddress + baseLength; + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Include gap fill range in progress information */ + progressAddress = gGapFillJob.baseAddress; + progressRemainder += gGapFillJob.used; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + /* Trigger gap fill */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gGapFillJob, gSegInfo.nextIndex); + +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + /* Process operation in task */ + fblMemProgState = kFblMemProgState_Pending; +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + } + } + } +#endif /* FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Setup programming progress (may include gap fill) */ + FblMemSetupProgress(kFblMemProgressType_Program, gBlockInfo.logicalAddress, gSegInfo.nextIndex, + FBL_MEM_PROGRESS_INITIAL + FBL_MEM_PROGRESS_ERASE, FBL_MEM_PROGRESS_PROGRAM, progressRemainder); + /* Adjust total percentages */ + FblMemOffsetProgress((progressAddress - gBlockInfo.targetAddress), gBlockInfo.targetLength); + /* Report initial progress */ + FblMemUpdateProgress(progressRemainder); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + } + + if (kFblMemStatus_Ok == retVal) + { + /* Copy input parameters to local variable */ + gSegInfo.input = *segment; + + /* Initialize internal attributes */ + gSegInfo.writeAddress = segment->targetAddress; + gSegInfo.writeRemainder = 0u; +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Available length from start of segment to end of block */ + gSegInfo.writeLength = gBlockInfo.targetLength - (segment->targetAddress - gBlockInfo.targetAddress); + gSegInfo.writtenLength = 0u; +#else + gSegInfo.writeLength = segment->targetLength; +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) + /* Sliding input address required for remainder calculation */ + gSegInfo.inputAddress = segment->targetAddress; +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +#if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + /* Running input length required for early overflow detection */ + gSegInfo.inputLength = segment->targetLength; +#endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ + + gSegInfo.ownIndex = gSegInfo.nextIndex; + gSegInfo.nextIndex++; + + /* Allow data indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_DATA_IND); + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemSegmentEndIndication + **********************************************************************************************************************/ +/*! \brief Indicate end of current segment + * \details Finish processing of all pending buffers, finalize data + * processing and program any remainder + * \pre FblMemDataIndication executed before + * \param[out] writeLength Pointer to length actually written + * \return Result of operation (potentially remapped to OEM specific NRC) + * May return error generated by background task operation + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050 1 */ /* MD_MSR_STMIF, MD_MSR_STPTH, MD_MSR_STCAL */ +tFblMemStatus FblMemSegmentEndIndication( V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * writeLength ) +{ + tFblMemStatus retVal; +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB ) || \ + defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) || \ + defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB || FBL_ENABLE_UNALIGNED_DATA_TRANSFER || FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ +#if defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) + V_MEMRAM1 tFblMemSegmentListEntry V_MEMRAM2 V_MEMRAM3 * activeSegment; +#endif /* FBL_MEM_ENABLE_SEGMENT_HANDLING */ + + retVal = kFblMemStatus_Ok; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_SEGMENT_END, FBL_MEM_ALLOWED_DATA_IND | FBL_MEM_ALLOWED_SEGMENT_END)) + { + FBL_MEM_SET_STATUS(SegmentEndSequence, retVal); + } + else + { +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* Active fill buffer may change + Store preamble so operation is transparent for caller */ + FblMemStorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB ) + /* Active input job may be used as finalization trigger (flush remainder) */ + activeJob = FblMemGetPendingInputJob(); +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB */ + + { +#if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + if (kFblMemProgState_Error != fblMemProgState) + { +# if defined( FBL_ENABLE_DATA_PROCESSING ) + /* Data processing active? */ + if (kFblOk == __ApplFblMemIsDataProcessingRequired(gSegInfo.input.dataFormat)) + { + /* Do not remove finalize job until no data is produced anymore */ + gProcFinalizeJob.completion = kFblMemOperationMode_Finalize; + + /* No additional data in this segment, trigger finalization of data processing + Add to queue as some jobs may still be pending */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gProcFinalizeJob, gSegInfo.ownIndex); + } +# endif /* FBL_ENABLE_DATA_PROCESSING */ + +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + /* Stream output active? */ + if (kFblOk == __ApplFblMemIsStreamOutputRequired(gSegInfo.input.dataFormat)) + { + /* Do not remove finalize job until no data is produced anymore */ + gStreamFinalizeJob.completion = kFblMemOperationMode_Finalize; + + /* No additional data in this segment, trigger finalization of stream output + Add to queue as some jobs may still be pending */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gStreamFinalizeJob, gSegInfo.ownIndex); + } + /* Skip write finalization */ + else +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + { +# if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) +# if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + /* Insert dummy info into queue to trigger finalization of write */ + (void)FblMemQueueDefaultPrioInsert(gProcessingQueue, &gWriteFinalizeJob, gSegInfo.ownIndex); +# else + /* Enable switch combination equals FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB */ + + /* Re-use active input job as finalization trigger (flush remainder) + Change job type, all other members already have a consistent value */ + activeJob->type = kFblMemJobType_WriteFinalize; +# endif /* FBL_MEM_ENABLE_PROC_QUEUE */ +# endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING */ + } + +# if defined( FBL_MEM_ENABLE_PROC_QUEUE ) + if (!FblMemQueueIsEmpty(gProcessingQueue)) +# endif /* FBL_MEM_ENABLE_PROC_QUEUE */ + { + /* Continue operation */ + fblMemProgState = kFblMemProgState_Pending; + } + } +#endif /* FBL_ENABLE_DATA_PROCESSING || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + } + +#if defined( FBL_MEM_ENABLE_PROC_QUEUE ) || \ + defined( FBL_MEM_ENABLE_REMAINDER_HANDLING ) + /* Finish processing of all pending buffers */ + FblMemFlushQueueByPrio((tFblMemQueuePrio)kFblMemJobPrio_Write); + + /* Check for error condition */ + if (kFblMemProgState_Error == fblMemProgState) + { + /* Report error set by programming routines (previous or current) */ + retVal = gErrorStatus; + } + else +#endif /* FBL_MEM_ENABLE_PROC_QUEUE || FBL_MEM_ENABLE_REMAINDER_HANDLING */ + { +#if defined( FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB ) + /* Remainder handling finished, restore original job type */ + activeJob->type = kFblMemJobType_InputWrite; +#endif /* FBL_MEM_ENABLE_REMAINDER_HANDLING_SINGLE_JOB */ + +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Requested data should be completely provided at this point */ + if (0u != gSegInfo.inputLength) +#else + /* Requested data should be completely programmed at this point */ + if (0u != gSegInfo.writeLength) +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + { + FBL_MEM_SET_STATUS(SegmentEndInsufficientData, retVal); + } +#if defined( __ApplFblMemPostSegmentEnd ) + else + { + /* Perform actions directly after segment end */ + if (kFblOk != __ApplFblMemPostSegmentEnd()) + { + FBL_MEM_SET_STATUS(SegmentEndPost, retVal); + } + } +#endif /* __ApplFblMemPostSegmentEnd */ + + /* Return written length */ +#if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + *writeLength = gSegInfo.writtenLength; +#else + *writeLength = gSegInfo.input.targetLength - gSegInfo.writeLength; +#endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + FblMemConcludeProgress(); +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + } + +#if defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) + /* Add segment to list */ + if (kFblMemStatus_Ok == retVal) + { + activeSegment = &(gBlockInfo.segmentList->segmentInfo[gBlockInfo.segmentList->nrOfSegments]); + activeSegment->targetAddress = gSegInfo.input.targetAddress; + activeSegment->transferredAddress = gSegInfo.input.logicalAddress; + activeSegment->length = *writeLength; + gBlockInfo.segmentList->nrOfSegments++; + } +#endif /* FBL_MEM_ENABLE_SEGMENT_HANDLING */ + +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) || \ + defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + /* Restore default offset to align actual data to platform requirements */ + activeJob = FblMemGetPendingInputJob(); + activeJob->offset = FBL_MEM_PREAMBLE_OFFSET(FBL_MEM_PREAMBLE_LENGTH); +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER || FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* + Active fill buffer may have changed + Restore previously stored preamble so operation is transparent for caller + */ + FblMemRestorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + } + + /* Check result of final programming */ + if (kFblMemStatus_Ok == retVal) + { + /* Allow additional segment start or block end indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_SEGMENT_START | FBL_MEM_ALLOWED_BLOCK_END); + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemDataIndication + **********************************************************************************************************************/ +/*! \brief Indicate new chunk of input data + * \details If pipelined programming is configured queue buffer and immediately return in case another input buffer + * is available + * Otherwise finish processing of one pending input buffer + * In non-pipelined mode indicated input buffer is directly processed + * \pre FblMemSegmentStartIndication executed before, provided buffer + * and data offset equal the parameters of active input buffer + * \param[in] buffer Pointer to input buffer (including preamble) + * \param[in] offset Offset of actual data (after preamble) + * \param[in] length Length of data (without preamble) + * \return Result of operation (potentially remapped to OEM specific NRC) + * May return error generated by background task operation + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6050, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STCAL, MD_MSR_STMIF */ +tFblMemStatus FblMemDataIndication( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ) +{ + tFblMemStatus retVal; +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) || \ + defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + V_MEMRAM1 tFblMemJob V_MEMRAM2 V_MEMRAM3 * activeJob; +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER || FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ +#if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + tFblLength inputLength; + + /* Do not update running input length unless data is unprocessed */ + inputLength = 0u; /* PRQA S 2982 */ /* MD_FblMem_2982 */ +#endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ + + retVal = kFblMemStatus_Ok; + + /* Check allowed states */ + if (kFblOk != FblMemCheckAllowed(FBL_MEM_ALLOWED_DATA_IND, FBL_MEM_ALLOWED_DATA_IND | FBL_MEM_ALLOWED_SEGMENT_END)) + { + FBL_MEM_SET_STATUS(DataIndSequence, retVal); + } + else + { +#if defined( FBL_ENABLE_SYSTEM_CHECK ) || \ + defined( FBL_MEM_ENABLE_INPUT_LENGTH ) +# if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) + /* Unconditionally check input length */ + { +# else +# if defined( FBL_ENABLE_DATA_PROCESSING ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + { + /* + Data processed in any way? + Unprocessed data directly written through + */ +# if defined( FBL_ENABLE_DATA_PROCESSING ) + if (kFblOk == __ApplFblMemIsDataProcessingRequired(gSegInfo.input.dataFormat)) + { + } + else +# endif /* FBL_ENABLE_DATA_PROCESSING */ +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + if (kFblOk == __ApplFblMemIsStreamOutputRequired(gSegInfo.input.dataFormat)) + { + } + else +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ +# else + { +# endif /* FBL_ENABLE_DATA_PROCESSING ||FBL_MEM_ENABLE_STREAM_OUTPUT */ +# endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ + { + /* + Verify newly provided data does not exceed length requested + in segment info + */ +# if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + /* Unprocessed data: Update running input data length */ + inputLength = length; + + if (gSegInfo.inputLength < length) +# else + if (gSegInfo.writeLength < length) +# endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ + { + FBL_MEM_SET_STATUS(DataIndOverflow, retVal); + } + } + } +#endif /* FBL_ENABLE_SYSTEM_CHECK || FBL_ENABLE_PROCESSED_DATA_LENGTH */ + } + + if (kFblMemStatus_Ok == retVal) + { +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* + Active fill buffer may change + Store preamble so operation is transparent for caller + */ + FblMemStorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + + /* Queue the active buffer for further processing */ + retVal = FblMemQueueBuffer(buffer, offset, length); + if (kFblMemStatus_Ok == retVal) + { +#if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + /* Keep track of expected input data length */ + gSegInfo.inputLength -= inputLength; +#endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ + +#if defined( FBL_MEM_ENABLE_INPUT_DATA_FLUSH ) +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) + if (kFblOk == __ApplFblMemIsPipelinedProgrammingDisabled(&gBlockInfo, &(gSegInfo.input))) +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + { + /* Directly process all input data */ + FblMemFlushQueueByPrio((tFblMemQueuePrio)kFblMemJobPrio_Write); + } + + /* Check for programming error */ + if (kFblMemProgState_Error == fblMemProgState) + { + retVal = gErrorStatus; + } + else +#endif /* FBL_MEM_ENABLE_INPUT_DATA_FLUSH */ + { +#if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) || \ + defined( FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER ) + /* Restore default offset to align actual data to platform requirements */ + activeJob = FblMemGetPendingInputJob(); + activeJob->offset = FBL_MEM_PREAMBLE_OFFSET(FBL_MEM_PREAMBLE_LENGTH); + +# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) + /* Remainder handling neither required for volatile memory nor for processed data */ + if (kFblMemType_RAM == gSegInfo.input.type) + { + } + else +# if defined( FBL_ENABLE_DATA_PROCESSING ) + if (kFblOk == __ApplFblMemIsDataProcessingRequired(gSegInfo.input.dataFormat)) + { + } + else +# endif /* FBL_ENABLE_DATA_PROCESSING */ +# if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) + if (kFblOk == __ApplFblMemIsStreamOutputRequired(gSegInfo.input.dataFormat)) + { + } + else +# endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + { + /* Align active input buffer to current remainder */ + activeJob->offset += FblMemGetWriteRemainder(gSegInfo.inputAddress, length); + + /* Update sliding input address */ + gSegInfo.inputAddress += length; + } +# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +#endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER || FBL_MEM_ENABLE_SEGMENTED_INPUT_BUFFER */ + } + } + +#if defined( FBL_MEM_ENABLE_PREAMBLE_HANDLING ) + /* + Active fill buffer may have changed + Restore previously stored preamble so operation is transparent for caller + */ + FblMemRestorePreamble(); +#endif /* FBL_MEM_ENABLE_PREAMBLE_HANDLING */ + } + + if (kFblMemStatus_Ok == retVal) + { +#if defined( FBL_MEM_ENABLE_INPUT_LENGTH ) + /* No more data is expected, all data has been processed within the last chunk of data */ + if (gSegInfo.inputLength == 0u) + { + FblMemSetAllowed(FBL_MEM_ALLOWED_SEGMENT_END); + } + else +#endif /* FBL_MEM_ENABLE_INPUT_LENGTH */ + { + /* Allow additional data or segment end indication */ + FblMemSetAllowed(FBL_MEM_ALLOWED_DATA_IND | FBL_MEM_ALLOWED_SEGMENT_END); + } + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemTask + **********************************************************************************************************************/ +/*! \brief Perform background tasks + * \details If pipelined programming is configured pending buffers are processed until the operation is suspended by + * a Rx notification + * \pre FblMemInitPowerOn executed before + **********************************************************************************************************************/ +void FblMemTask( void ) +{ +#if defined( FBL_MEM_ENABLE_PIPELINING ) + switch (fblMemProgState) + { + /* Operation pending */ + case kFblMemProgState_Pending: + { + /* Switch to background context + * Affects watchdog and suspend handling */ + gProgContext = kFblMemContext_Background; + + /* + Loop while processing isn't paused by external event (e.g. data reception) + and buffers are pending + */ + while (kFblMemProgState_Pending == fblMemProgState) + { + /* Execute processing cycle */ + FblMemProcessQueue(kFblMemOperationMode_Normal); + } + + /* Suspend request received during processing */ + if (kFblMemProgState_SuspendPending == fblMemProgState) + { + fblMemProgState = kFblMemProgState_Suspended; + } + + /* Switch back (foreground) service context + * Affects watchdog and suspend handling */ + gProgContext = kFblMemContext_Service; + + break; + } + /* No operation pending */ + case kFblMemProgState_Idle: + case kFblMemProgState_Error: + /* Operation suspended by external event */ + case kFblMemProgState_Suspended: + case kFblMemProgState_SuspendPending: + /* Operation suspended by internal checkpoint event */ + case kFblMemProgState_Checkpoint: + /* Unknown state value */ + default: + { + /* Nothing to do */ + break; + } + } +#endif /* FBL_MEM_ENABLE_PIPELINING */ +} + +/*********************************************************************************************************************** + * FblMemFlushInputData + **********************************************************************************************************************/ +/*! \brief Flush any pending input data + * \details Process and program any pending input data passed via DataIndication. Pipelined verification tasks + * may still be pending afterwards. + * \pre FblMemInitPowerOn executed before + **********************************************************************************************************************/ +void FblMemFlushInputData( void ) +{ + /* Process all pending input data */ + FblMemFlushQueueByPrio((tFblMemQueuePrio)kFblMemJobPrio_Write); +} + +#define FBLLIB_MEM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# define FBLLIB_MEM_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FblMemResumeIndication + **********************************************************************************************************************/ +/*! \brief Resume suspended operation + * \details If pipelined programming is configured a pending operation which was suspended earlier through a RX + * notification will be resumed + * \pre FblMemInitPowerOn executed before + **********************************************************************************************************************/ +void FblMemResumeIndication( void ) +{ +#if defined( FBL_MEM_ENABLE_PIPELINING ) + /* Resume any pending operations */ + if (FblMemTaskIsPending()) + { + /* Continue operation on next call cycle of task + Note: fblMemProgState may already be pending and isn't necessarily suspended */ + fblMemProgState = kFblMemProgState_Pending; + } +#endif /* FBL_MEM_ENABLE_PIPELINING */ +} + +#if defined( FBL_MEM_ENABLE_PIPELINING ) +/*********************************************************************************************************************** + * FblMemRxNotification + **********************************************************************************************************************/ +/*! \brief Suspend any pending programming operation + * \details If memory driver supports pausing of active operation call respective user callback too + * \pre FblMemInitPowerOn executed before + **********************************************************************************************************************/ +void FblMemRxNotification( void ) +{ + /* + Notification may be executed in interrupt context + Critical section secures access to programming state + */ + __ApplFblMemEnterCriticalSection(); + + /* + Actions only necessary if programming is pending + Condition equals ((fblMemProgState == kFblMemProgState_Pending) || (fblMemProgState == kFblMemProgState_Checkpoint)) + */ + if (fblMemProgState >= kFblMemProgState_Checkpoint) + { + /* Suspend programming to handle received request */ + fblMemProgState = kFblMemProgState_SuspendPending; + + } + + /* Leave critical section */ + __ApplFblMemLeaveCriticalSection(); +} +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +# define FBLLIB_MEM_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLLIB_MEM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + + +/*********************************************************************************************************************** + * FblMemEraseRegion + **********************************************************************************************************************/ +/*! \brief Performs erase operation in non-volatile memory + * \details All memory segments fully or partially covered by given region are affected. Gaps in the memory segment + * definition are skipped. + * \pre Memory driver initialized + * \param[in] eraseAddress Start address of erase region + * \param[in] eraseLength Length of erase region + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +tFblMemStatus FblMemEraseRegion( tFblAddress eraseAddress, tFblLength eraseLength ) +{ + tFblMemStatus retVal; + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) + /* Disable progress information */ + gProgressState = kFblMemProgressState_Disabled; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + + retVal = FblMemEraseRegionInternal(eraseAddress, eraseLength); + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemProgramBuffer + **********************************************************************************************************************/ +/*! \brief Performs program operation to non-volatile memory + * \details If the length is not aligned to the segment size the odd bytes are padded with the configured fill + * character. + * Programming may be suspended by an external event. In this case parameter programLength will be + * updated to reflect the length actually programmed + * \pre Memory driver initialized, address aligned to memory segment size + * \param[in] programAddress Program address + * \param[in,out] programLength Length of data (output: length actually programmed) + * \param[in,out] programData Pointer to program data (contents are padded in case length is not aligned to memory + * segment size!) + * \return Result of operation (potentially remapped to OEM specific NRC) + **********************************************************************************************************************/ +tFblMemStatus FblMemProgramBuffer( tFblAddress programAddress, + V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, tFblMemRamData programData ) +{ + tFblMemProgState activeProgState; + tFblMemStatus retVal; + + { + /* Remember active programming state */ + activeProgState = fblMemProgState; + + /* Operation potentially paused during previous execution cycle */ + fblMemProgState = kFblMemProgState_Pending; + + /* Perform actual programming */ + retVal = FblMemProgramBufferInternal(programAddress, programLength, programData, kFblMemProgState_Pending); + + /* Restore previous programming state */ + fblMemProgState = activeProgState; + } + + return retVal; +} + +/*********************************************************************************************************************** + * FblMemSetInteger + **********************************************************************************************************************/ +/*! \brief Convert given integer value to big-endian byte array + * \param[in] count Number of relevant bytes + * \param[in] input Input value + * \param[out] buffer Pointer to output buffer + **********************************************************************************************************************/ +void FblMemSetInteger( vuintx count, vuint32 input, tFblMemRamData buffer ) +{ + vuint32 localInput = input; + vuintx localCount = count; + + /* Integer to array conversion only supported for up to 32-bit values */ + assertFblInternal(count <= sizeof(vuint32), kFblMemAssertParameterOutOfRange); + + /* Loop relevant bytes */ + while (localCount > 0u) + { + localCount--; + /* Store most significant byte first */ + buffer[localCount] = (vuint8)(localInput & 0xFFu); + /* Shift in next byte */ + localInput >>= 8u; + } +} + +/*********************************************************************************************************************** + * FblMemGetInteger + **********************************************************************************************************************/ +/*! \brief Convert given big-endian byte array to integer value + * \param[in] count Number of relevant bytes + * \param[in] buffer Pointer to input buffer + * \return Integer value + **********************************************************************************************************************/ +vuint32 FblMemGetInteger( vuintx count, tFblMemConstRamData buffer ) +{ + vuint32 output = 0u; + vuintx idx = 0u; + vuintx localCount = count; + + /* Array to integer conversion only supported for up to 32-bit values */ + assertFblInternal(count <= sizeof(vuint32), kFblMemAssertParameterOutOfRange); + + /* Loop relevant bytes */ + while (localCount > 0u) + { + /* Most significant byte first */ + output <<= 8u; + /* Add current byte */ + output |= (vuint32)buffer[idx]; + + idx++; + localCount--; + } + + return output; +} + +#define FBLLIB_MEM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblMem_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. + + MD_FblMem_0310_3305: + Reason: Snapshot stored in byte buffer. This way caller doesn't need to know specific structure type. + Risk: Byte buffer size or alignment not suitable for direct access through structure pointer. + Prevention: Offset calculated to align pointer to platform requirements. + Effective size after alignment checked against actual structure requirements. + + MD_FblMem_0313: + Reason: Functions pointers may be cast to different types if function parameters or function return values + are not used by callers. + Risk: Calling a function with erroneus call context or without a return value while expecting a return value + Prevention: Check if new type is compatible with target type: + - in case of function parameter change: Are paremeters of new type compatible with parameters of + target type or are function parameters of target type unused in active configuration? + - in case of return type change: is return value of target type compatible with return value of new + type or is a return value from target type never expected if target type returns void? + + MD_FblMem_0314_0326_MemCpy: + Reason: The copy function have a void pointer as a function parameter and an integer is casted to pointer void. + Risk: No risk, because the underlying pointer type is known and the cast is safe. + Prevention: No prevention necessary. + + MD_FblMem_0488: + Reason: Calling instance passes an arbitrary buffer pointer. Relative offset to internal buffer has to be + calculated. + Risk: 1) Range overflow caused by subtraction. + 2) Accessing memory outside of allocated buffer. + Prevention: Input and internal pointer have exact same type + 1) Input pointer compared against internal buffer before subtraction. + 2) Pointer arithmetic not used to access data directly. Instead calculated offset and input length are verified + against constraints given by internal buffer. Actual data accesses use array indexing. + + MD_FblMem_0602_0603: + Reason: Usage of reserved identifiers with leading underscores is accepted for compatibility reasons. + Risk: Name conflicts. + Prevention: Compile and link of the different variants in the component and integration test. + + MD_FblMem_0724_EnumValNotUnique: + Reason: The same numerical value is associated to different enum entries, to allows each entry value to be used in + the appropriate context, keeping a better code structure and understanding. + Risk: Enum values can potentially be assigned with the same value unintentionally. + Prevention: Correct design. + + MD_FblMem_2822: + Reason: Apparent NULL pointer which are actually correctly assigned at runtime. + Risk: The pointer is not initialized. + Prevention: A correct design prevent missing or uncorrect initialization. + + MD_FblMem_2842: + Reason: Checks over out of boundary for arrays are usually done at compile time through Assertions, therefore there + is no need to perform further checks at runtime. + Risk: An out of boundary access is not detected through assertions and happens at runtime. + Prevention: The code shall be correctly designed in order to avoid any kind of out of boundary access. + + MD_FblMem_2889: + Reason: Multiple return paths are used to reduce code complexity, increase readability and reducing nesting level. + Risk: Some operations intended to conclude the function (e.g. states cleaning) can be unintentionally jumped. + Prevention: Code inspection and runtime tests. + + MD_FblMem_2982: + Reason: Depending on configuration different paths may be executed. Initialization makes sure no invalid variable + contents are used accidentally. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMem_2986: + Reason: Code is only redundant in certain configurations. + Risk: No identifiable risk + Prevention: No prevention required. + + MD_FblMem_2991_2995: + Reason: The result of this logical operation might not always be true depending on configuration. Check is kept + to avoid excessive encapsulation which might decrease readability. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMem_3205_IdentifierNotUsed: + Reason: Some enumerations are not used in all the configurations or just define the extreme limits of the enumeration (MIN, MAX). + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMem_3218: + Reason: The local data buffers of this module are kept at a central location for a better overview and maintenance. + Risk: Scope is larger than required (whole file instead of one function). Some other function could access + the variable. + Prevention: Restrict the functionality in this module to the intended purpose. Don't add functions which shall not + be able to access the local data buffers. + + MD_FblMem_3415: + Reason: If condition relies on lazy evaluation, second argument only executed if ROM download is active. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMem_3673: + Reason: Depending on configuration the parameter is actually modified inside the calling hierarchy. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblMem_6060: + Reason: Reducing the number of parameters can only be achieved by using a data grouping structure (i.e. structs) + or by splitting the function in different sub-functions, but both will affect the readability and the + maintenability of the function. + Risk: Stack usage and runtime too high for target uC. + Prevention: Test of resulting code on target uC. User must check stack usage in project context. + + MD_FblMem_AssertJobMax: + Reason: For certain configurations this check is always false. However, this check can only be done at runtime. + Risk: No risk. + Prevention: No prevention required. (Note: assertions are disabled in production software). + + MD_FblMem_FalseFinding + Reason: Manual evaluation shows that QAC throws a false finding. This was confirmed by using a different + QAC version with the same MISRA ruleset. + Risk: No risk. + Prevention: No prevention required. +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MEM.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_mem.h b/Source/bsw/Fbl/fbl_mem.h new file mode 100644 index 0000000..6904e99 --- /dev/null +++ b/Source/bsw/Fbl/fbl_mem.h @@ -0,0 +1,1151 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Library containing common functionality for memory programming: + * - Erase of memory region + * - Data processing (e.g. decryption and decompression) + * - Segmentation and alignment + * - Signature / checksum verification over RAM contents + * - Pipelined programming + * + * Used by OEM dependent diagnostics to program incoming download data. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-03-23 visjhg - Initial release + * 01.00.01 2012-03-26 visjhg - Added description to file header + * 01.01.00 2012-04-05 visjhg ESCAN00057963 No changes + * Changes and optimizations after code review + * 01.02.00 2012-04-27 visjhg ESCAN00058452 Added support for processed length + * ESCAN00058453 Removed fbl_mem_cfg.h include + * ESCAN00058621 No changes + * 01.03.00 2012-06-22 visjhg ESCAN00059475 No changes + * ESCAN00059477 No changes + * 01.04.00 2013-02-01 visjhg ESCAN00064290 Extensions for multi processor systems (pass-through) + * Rework of block start indication interface + * Pass additional info in structure + * visjhg ESCAN00064292 Added block erase + * visjhg ESCAN00064296 Preamble length switchable at runtime + * visjhg ESCAN00064301 Added signature verification on ROM contents + * Rework of block verify interface + * Keep track of segment history (structure provided externally) + * visjhg - Added additional error codes for new functionality + * visjhg ESCAN00061335 No changes + * visjhg ESCAN00064333 No changes + * visjhg ESCAN00061764 No changes + * visjhg ESCAN00061814 No changes + * visjhg ESCAN00064338 Added post handler for SegmentEndIndication + * visach ESCAN00062919 Adapted comments to use Doxygen + * visjhg ESCAN00064334 Added interface to remap error codes to OEM dependent value + * visjhg ESCAN00064339 Segmented data processing: data produced during one cycle may be + * smaller than buffer size + * visjhg ESCAN00064330 Explicit resume of suspended operation + * Added state "suspend pending" + * Added active operation check + * visjhg ESCAN00064343 Added support for multiple input sources + * visjhg - Added additional error codes for new functionality + * visjhg - Additional integration time checks + * visjhg ESCAN00064543 No changes + * visjhg ESCAN00064720 Replaced __ApplFblMemCheckDfi by __ApplFblMemIsDataProcessingRequired + * 01.05.00 2013-04-10 visjhg ESCAN00064871 No changes + * visjhg ESCAN00064890 No changes + * visjhg - No changes + * visjhg ESCAN00065830 No changes + * visjhg ESCAN00066375 No changes + * visjhg ESCAN00066377 Encapsulate erase functionality + * visjhg ESCAN00066379 Added interface version compatibility check + * visjhg ESCAN00066380 Exported FblMemInit + * 01.06.00 2013-07-22 visase ESCAN00066743 No changes + * visjhg ESCAN00067433 Added FblMemDeinit + * Updated interface version + * visjhg ESCAN00068321 Force response pending for erase operation + * visjhg ESCAN00069161 Added pipelined verification + * Rework of block start and verify interface + * Changed verification configuration options and error codes + * Updated interface version (incompatible changes) + * visjhg ESCAN00069190 No changes + * 01.07.00 2013-08-16 visjhg ESCAN00069507 No changes + * visjhg ESCAN00069803 Updated interface version (enable/disable verification at run-time) + * ESCAN00069781 No changes + * ESCAN00069797 No changes + * visjhg ESCAN00069843 No changes + * 02.00.00 2013-12-12 visjhg ESCAN00069945 No changes + * visjhg ESCAN00072568 Error / status for BlockStartVerifyInit replaced by SegmentStartVerifyInit + * visjhg ESCAN00071344 No changes + * visjhg ESCAN00072569 Raised major version to match API version + * visjhg ESCAN00072156 No changes + * visjhg ESCAN00072570 No changes + * visjhg ESCAN00072631 No changes + * 02.01.00 2014-03-12 visjhg ESCAN00073504 Changed signature of input verification function type + * visjhg ESCAN00074066 No changes + * 02.02.00 2014-05-09 visjhg ESCAN00075225 No changes + * visjhg - Removed some integration time checks + * 03.00.00 2015-03-03 visjhg - Changed compatibility remapping for extended status (SegmentStartVerifyInit) + * visjhg ESCAN00076591 Updated interface version (support for external stream output) + * visjhg ESCAN00077689 No changes + * visjhg ESCAN00077891 No changes + * visjhg ESCAN00081491 Added support for resumable programming + * visjhg ESCAN00081494 Added support for verification on processed input data + * visjhg ESCAN00081493 Added selective pipelined programming (forced flush when disabled) + * 03.01.00 2015-04-23 visjhg ESCAN00082572 No changes + * visjhg ESCAN00082605 Added support for reporting of progress information + * visjhg ESCAN00082606 Added support for gap fill (requires ordered segments) + * 03.01.01 2015-04-27 visjhg ESCAN00082700 No changes + * 03.01.02 2015-05-27 visjhg ESCAN00083138 No changes + * 03.01.03 2015-06-13 visjhg ESCAN00083358 No changes + * visjhg ESCAN00083390 No changes + * visjhg ESCAN00083391 No changes + * visjhg ESCAN00083392 Updated interface version + * 03.02.00 2015-07-21 visjhg ESCAN00084101 No changes + * visjhg ESCAN00084102 Added parameter type structure for stream processing + * 03.02.01 2015-08-19 visjhg ESCAN00084279 No changes + * visjhg ESCAN00084559 No changes + * visjhg ESCAN00084560 No changes + * 03.02.02 2015-09-04 visjhg ESCAN00084994 No changes + * 04.00.00 2015-09-17 visjhg ESCAN00085249 Support combination of input and processed verification + * Updated interface version + * visjhg ESCAN00085250 No changes + * visjhg ESCAN00085251 No changes + * 04.01.00 2016-04-01 visjhg ESCAN00087997 Updated interface version + * visjhg ESCAN00088935 No changes + * 04.02.00 2016-10-06 visjhg ESCAN00090120 No changes + * vishrf ESCAN00091253 No changes + * 04.02.01 2017-05-31 visjhg ESCAN00094695 No changes + * visjhg ESCAN00095201 No changes + * visjhg ESCAN00095356 No changes + * visjhg - Updated interface version + * 04.03.00 2017-07-26 visjhg ESCAN00095772 No changes + * visjhg ESCAN00095774 Added FblMemFlushInputData + * Updated interface version + * visjhg ESCAN00095683 Place FblMemResumeIndication in RAMCODE section + * visjhg ESCAN00096075 No changes + * 04.03.01 2017-08-07 visjhg ESCAN00096209 No changes + * 04.04.00 2018-08-22 visjhg ESCAN00100464 No changes + * visjhg ESCAN00097115 No changes + * visjhg ESCAN00100482 Updated interface version (addition of __ApplFblMemConditionCheck) + * 04.04.01 2018-09-25 visjhg ESCAN00100850 Updated interface version (preamble for MCMP download use-case) + * 04.05.00 2018-11-30 visjhg ESCAN00101500 Added custom error codes to tFblMemStatus + * Updated interface version + * 04.05.01 2019-01-23 visjhg ESCAN00101568 No changes + * 04.05.02 2019-08-20 vistbe ESCAN00103967 Updated interface version + * 04.05.03 2019-10-02 visrie ESCAN00104203 Fixed resumable pipelined verification + * 04.06.00 2019-10-29 vistmo FBL-813 Migration to MISRA 2012 + * 04.06.01 2020-03-18 visrie ESCAN00105683 No changes + * 04.06.02 2020-05-11 visjdn ESCAN00105967 No changes + * 04.06.03 2020-07-03 vistmo ESCAN00106050 No changes + * 04.07.00 2021-04-12 lhopfhauer FBL-2187 Added/adapted MemMap sections + * 04.08.00 2021-06-11 visjdn FBL-3560 Add support for more than 256 download segments + * 04.09.00 2021-07-09 lhopfhauer FBL-3442 Add option to avoid abortion of verification procedure in case of error + * Updated MISRA justifications + * 04.09.01 2021-11-05 lhopfhauer ESCAN00110663 No changes + * 04.10.00 2022-05-02 lhopfhauer FBL-5067 No changes + * 04.10.01 2022-08-03 fmenke ESCAN00112185 No changes + * 04.10.02 2023-05-08 lhopfhauer ESCAN00114573 No changes + * 04.11.00 2023-08-04 visrie FBL-5709 No changes + * 04.12.00 2023-09-04 vistmo FBL-7572 Allow processed verification in combination with stream output + * 04.12.01 2024-02-02 lhopfhauer ESCAN00116407 Out of bounds write access + * ESCAN00116408 Resume may not work + * ESCAN00116457 No changes + * 04.13.00 2025-09-16 pharring FBL-10120 Add support for FblLib_Logger + * 04.13.01 2025-11-07 aeller ESCAN00121551 No changes + * ESCAN00121700 No changes + * 04.14.00 2025-11-25 fmenke FBL-11808 No changes + **********************************************************************************************************************/ + +#ifndef FBL_MEM_H +#define FBL_MEM_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_Mem CQComponent : Implementation */ +#define FBLLIB_MEM_VERSION 0x0414u +#define FBLLIB_MEM_RELEASE_VERSION 0x00u + +/* Interface version */ +/** Major interface version identifies incompatible changes */ +#define FBL_MEM_API_VERSION_MAJOR 0x04u +/** Minor interface version identifies backward compatible changes */ +#define FBL_MEM_API_VERSION_MINOR 0x07u +/** Release interface version identifies cosmetic changes */ +#define FBL_MEM_API_VERSION_RELEASE 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_mem_oem.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* FblLib_Logger defines */ + +/** + Check for pending operations + Enter task on states "pending", "suspend pending" and "suspended" + Condition equals + ( (fblMemProgState == kFblMemProgState_Pending) || (fblMemProgState == kFblMemProgState_Checkpoint) + || (fblMemProgState == kFblMemProgState_SuspendPending) || (fblMemProgState == kFblMemProgState_Suspended) ) +*/ +#define FblMemTaskIsPending() (fblMemProgState >= kFblMemProgState_Suspended) +/** + Check for active operations + Condition equals + ( (fblMemProgState == kFblMemProgState_Pending) || (fblMemProgState == kFblMemProgState_Checkpoint) + || (fblMemProgState == kFblMemProgState_SuspendPending) ) +*/ +#define FblMemTaskIsActive() (fblMemProgState >= kFblMemProgState_SuspendPending) + +/** Default source handle */ +#define FBL_MEM_SOURCE_HANDLE_DEFAULT 0u + +#if defined( FBL_MEM_SOURCE_COUNT ) +# if (FBL_MEM_SOURCE_COUNT > 1u) +# if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +# else +/** Multiple input sources */ +# define FBL_MEM_ENABLE_MULTI_SOURCE +# endif /* FBL_MEM_ENABLE_MULTI_SOURCE */ +# endif /* FBL_MEM_SOURCE_COUNT > 1u */ +#endif /* FBL_MEM_SOURCE_COUNT */ + +/* No additional remapping required, simply cast to expected type */ +# define FblMemRemapStatus(status) ((FBL_MEM_STATUS_TYPE)(status)) + +#if defined( FBL_MEM_PROC_SEGMENTATION ) +#else +/** Set data processing segmentation to default value */ +# define FBL_MEM_PROC_SEGMENTATION FBL_MEM_PROC_BUFFER_SIZE +#endif /* FBL_MEM_PROC_SEGMENTATION */ + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** If the read-verify operation takes a long time and delays the download of a logical block, this define can be + * overwritten to shift the delay by read-verify towards the end of the logical block download. The total time for + * the logical block download will NOT change, however. The value of this define should be at most the maximum number + * of download segments - 1 */ +# if defined( FBL_MEM_VERIFY_PIPELINED_JOB_COUNT ) +# else /* FBL_MEM_VERIFY_PIPELINED_JOB_COUNT */ +# define FBL_MEM_VERIFY_PIPELINED_JOB_COUNT 1u +# endif /* FBL_MEM_VERIFY_PIPELINED_JOB_COUNT */ +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +/*-- Compatibility remapping of configuration switches-----------------------*/ + + +#if defined( FBL_ENABLE_GAP_FILL ) +# if defined( FBL_MEM_ENABLE_GAP_FILL) || \ + defined( FBL_MEM_DISABLE_GAP_FILL ) +/* Gap fill handling explicitly defined outside */ +# else +# define FBL_MEM_ENABLE_GAP_FILL +# endif /* FBL_MEM_ENABLE_GAP_FILL */ +#endif /* FBL_ENABLE_GAP_FILL */ + + +/*-- Remap configuration switches--------------------------------------------*/ +#if ( defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) && \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH ) ) +/** On-the-fly verification includes address and length information */ +# define FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH +/** Size of address and length information */ +# define FBL_MEM_VERIFY_ADDRESS_LENGTH_SIZE 4u +/** Size of address and length information */ +# define FBL_MEM_VERIFY_ADDRESS_LENGTH_BUFFER_SIZE (2u * FBL_MEM_VERIFY_ADDRESS_LENGTH_SIZE) +#endif /* (FBL_MEM_ENABLE_VERIFY_INPUT && FBL_MEM_ENABLE_VERIFY_INPUT_ADDRESS_LENGTH) || (FBL_MEM_ENABLE_VERIFY_PIPELINED && FBL_MEM_ENABLE_VERIFY_PIPELINED_ADDRESS_LENGTH) */ + +#if defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +# if defined( FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH ) +/** Reserve an additional entry for address information */ +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ (FBL_MEM_VERIFY_PIPELINED_JOB_COUNT + 1u) +# else /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ +/** Reserve one entry in dedicated queue per job */ +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ (FBL_MEM_VERIFY_PIPELINED_JOB_COUNT) +# endif /* FBL_MEM_ENABLE_VERIFY_ADDRESS_LENGTH */ +/** Reserve configured number of entries for read, update and finalization jobs */ +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE (FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE_READ + 2u) +#else /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ +# define FBL_MEM_QUEUE_ENTRIES_VERIFY_PIPE 0u +#endif /* FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) +/** Pipelined operation */ +# define FBL_MEM_ENABLE_PIPELINING +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING || FBL_MEM_ENABLE_VERIFY_PIPELINED */ + +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_GAP_FILL ) +# if defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) || \ + defined( FBL_MEM_DISABLE_SEGMENT_HANDLING ) +/* Segment handling explicitly defined outside + If segments are required by signature/checksum verification on output data + but segment handlings is disabled the correct segments have to be handled outside! */ +# else +/** Segment handling required for signature/checksum verification on output data */ +# define FBL_MEM_ENABLE_SEGMENT_HANDLING +# endif /* FBL_MEM_ENABLE_SEGMENT_HANDLING */ +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT || FBL_MEM_ENABLE_GAP_FILL */ + +#if defined( FBL_MEM_ENABLE_VERIFY_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_VERIFY_PIPELINED ) || \ + defined( FBL_MEM_ENABLE_SEGMENT_HANDLING ) || \ + defined( FBL_ENABLE_PROCESSED_DATA_LENGTH ) || \ + defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) || \ + defined( FBL_MEM_ENABLE_GAP_FILL ) || \ + defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/** Persistent storage of block information */ +# define FBL_MEM_ENABLE_GLOBAL_BLOCK_INFO +#endif /* FBL_MEM_ENABLE_VERIFY_OUTPUT || FBL_MEM_ENABLE_VERIFY_INPUT || FBL_MEM_ENABLE_VERIFY_PIPELINED || FBL_MEM_ENABLE_SEGMENT_HANDLING || FBL_MEM_ENABLE_PASSTHROUGH || FBL_ENABLE_PROCESSED_DATA_LENGTH || FBL_MEM_ENABLE_STREAM_OUTPUT || FBL_MEM_ENABLE_GAP_FILL || FBL_MEM_ENABLE_PROGRESS_INFO */ + +/* + Allow overwrite of certain data types or defines by using + FBL_MEM_VERIFY__OVERWRITE defines / macros +*/ +/*-- On-the-fly verification ------------------------------------------------*/ +#if defined( FBL_MEM_VERIFY_OK_OVERWRITE ) +#define FBL_MEM_VERIFY_OK (FBL_MEM_VERIFY_OK_OVERWRITE) +#else +#define FBL_MEM_VERIFY_OK (tFblMemVerifyStatus)(SECM_OK) +#endif +#if defined( FBL_MEM_VERIFY_STATE_INIT_OVERWRITE ) +#define FBL_MEM_VERIFY_STATE_INIT (FBL_MEM_VERIFY_STATE_INIT_OVERWRITE) +#else +#define FBL_MEM_VERIFY_STATE_INIT kHashInit +#endif +#if defined( FBL_MEM_VERIFY_STATE_COMPUTE_OVERWRITE ) +#define FBL_MEM_VERIFY_STATE_COMPUTE (FBL_MEM_VERIFY_STATE_COMPUTE_OVERWRITE) +#else +#define FBL_MEM_VERIFY_STATE_COMPUTE kHashCompute +#endif +#if defined( FBL_MEM_VERIFY_STATE_FINALIZE_OVERWRITE ) +#define FBL_MEM_VERIFY_STATE_FINALIZE (FBL_MEM_VERIFY_STATE_FINALIZE_OVERWRITE) +#else +#define FBL_MEM_VERIFY_STATE_FINALIZE kHashFinalize +#endif +#if defined( FBL_MEM_VERIFY_STATE_VERIFY_OVERWRITE ) +#define FBL_MEM_VERIFY_STATE_VERIFY (FBL_MEM_VERIFY_STATE_VERIFY_OVERWRITE) +#else +#define FBL_MEM_VERIFY_STATE_VERIFY kSigVerify +#endif + +/*-- Error handling ---------------------------------------------------------*/ + +/* Helper macros for status definitions */ +#define FBL_MEM_STATUS_NAME(name) kFblMemStatus_ ## name /* PRQA S 0342 */ /* MD_MSR_Rule20.10_0342 */ +#define FBL_MEM_STATUS_DEFINE(name) FBL_MEM_STATUS_ ## name /* PRQA S 0342 */ /* MD_MSR_Rule20.10_0342 */ + +#if defined( FBL_MEM_ENABLE_STATUS_OVERWRITE ) +/** Overwrite error codes by OEM dependent value */ +# define FBL_MEM_STATUS_DEFINITION(name) FBL_MEM_STATUS_NAME(name) = FBL_MEM_STATUS_DEFINE(name) +#else +/** Use automatically numbered error codes */ +# define FBL_MEM_STATUS_DEFINITION(name) FBL_MEM_STATUS_NAME(name) +#endif /* FBL_MEM_ENABLE_STATUS_OVERWRITE */ + +#if defined( FBL_MEM_ENABLE_STATUS_OVERWRITE ) + + + +# if defined( FBL_MEM_STATUS_ProgramOverflow ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ProgramOverflow FBL_MEM_STATUS_Failed +# endif + + +# if defined( FBL_MEM_STATUS_VerifyCompute ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_VerifyCompute +# endif + +# if defined( FBL_MEM_STATUS_VerifyFinalize ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_VerifyFinalize +# endif + +# if defined( FBL_MEM_STATUS_SegmentStartVerifyInit ) +# else +# if defined( FBL_MEM_STATUS_BlockStartVerifyInit ) +/* Compatibility remapping (API < 2.2.0) */ +# define FBL_MEM_STATUS_SegmentStartVerifyInit FBL_MEM_STATUS_BlockStartVerifyInit +# else +# error Status overwrite value missing: FBL_MEM_STATUS_SegmentStartVerifyInit +# endif +# endif +# if defined( FBL_MEM_EXT_STATUS_BlockStartVerifyInit ) +/* Compatibility remapping (API < 2.2.0) */ +# define FBL_MEM_EXT_STATUS_SegmentStartVerifyInit(status) FBL_MEM_EXT_STATUS_BlockStartVerifyInit(status) +# endif + +# if defined( FBL_MEM_STATUS_BlockEndVerifyFinalize ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_BlockEndVerifyFinalize +# endif + +# if defined( FBL_MEM_STATUS_BlockVerifyInputVerify ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_BlockVerifyInputVerify FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_BlockVerifyPipeVerify ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_BlockVerifyPipeVerify +# endif + +# if defined( FBL_MEM_STATUS_BlockVerifyOutputVerify ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_BlockVerifyOutputVerify +# endif + +# if defined( FBL_MEM_STATUS_BlockStartParam ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_BlockStartParam +# endif + +# if defined( FBL_MEM_STATUS_SegmentStartVerifyCompute ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_SegmentStartVerifyCompute +# endif + +# if defined( FBL_MEM_STATUS_DataProc ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_DataProc +# endif + +# if defined( FBL_MEM_STATUS_DataProcConsume ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_DataProcConsume +# endif + +# if defined( FBL_MEM_STATUS_DataProcDeinit ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_DataProcDeinit +# endif + +# if defined( FBL_MEM_STATUS_SegmentStartStreamOutInit ) +# else +/* Status code not defined: remap to data processing code */ +# define FBL_MEM_STATUS_SegmentStartStreamOutInit FBL_MEM_STATUS_SegmentStartDataProcInit +# endif + +# if defined( FBL_MEM_STATUS_StreamOutput ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_StreamOutput FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_StreamOutputConsume ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_StreamOutputConsume FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_StreamOutputOverflow ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_StreamOutputOverflow FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_StreamOutputDeinit ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_StreamOutputDeinit FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_DriverResumeWrite ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_DriverResumeWrite FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_DriverRemainder ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_DriverRemainder FBL_MEM_STATUS_Failed +# endif + +# if defined( FBL_MEM_STATUS_BlockEraseSequence ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_BlockEraseSequence +# endif + +# if defined( FBL_MEM_STATUS_EraseOutsideFbt ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_EraseOutsideFbt +# endif + +# if defined( FBL_MEM_STATUS_EraseDriverNotReady ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_EraseDriverNotReady +# endif + +# if defined( __ApplFblMemPreErase ) +# if defined( FBL_MEM_STATUS_ErasePreErase ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_ErasePreErase +# endif +# else +# if defined( FBL_MEM_STATUS_ErasePreErase ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ErasePreErase FBL_MEM_STATUS_Failed +# endif +# endif /* FBL_MEM_ENABLE_ERASE && __ApplFblMemPreErase */ + +# if defined( __ApplFblMemPostErase ) +# if defined( FBL_MEM_STATUS_ErasePostErase ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_ErasePostErase +# endif +# else +# if defined( FBL_MEM_STATUS_ErasePostErase ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ErasePostErase FBL_MEM_STATUS_Failed +# endif +# endif /* FBL_MEM_ENABLE_ERASE && __ApplFblMemPostErase */ + +# if defined( __ApplFblMemDriverReady ) +# if defined( FBL_MEM_STATUS_EraseDriverNotReady ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_EraseDriverNotReady +# endif +# else +# if defined( FBL_MEM_STATUS_EraseDriverNotReady ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_EraseDriverNotReady FBL_MEM_STATUS_Failed +# endif +# endif /* FBL_MEM_ENABLE_ERASE && __ApplFblMemDriverReady */ + +# if defined( FBL_MEM_STATUS_SegmentStartSegmentCount ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_SegmentStartSegmentCount +# endif + +# if defined( __ApplFblMemPostSegmentEnd ) +# if defined( FBL_MEM_STATUS_SegmentEndPost ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_SegmentEndPost +# endif +# else +# if defined( FBL_MEM_STATUS_SegmentEndPost ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_SegmentEndPost FBL_MEM_STATUS_Failed +# endif +# endif /* __ApplFblMemPostSegmentEnd */ + +# if defined( __ApplFblMemDriverReady ) +# if defined( FBL_MEM_STATUS_ProgramDriverNotReady ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_ProgramDriverNotReady +# endif +# else +# if defined( FBL_MEM_STATUS_ProgramDriverNotReady ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ProgramDriverNotReady FBL_MEM_STATUS_Failed +# endif +# endif /* __ApplFblMemDriverReady */ + +# if defined( __ApplFblMemPreWrite ) +# if defined( FBL_MEM_STATUS_ProgramPreWrite ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_ProgramPreWrite +# endif +# else +# if defined( FBL_MEM_STATUS_ProgramPreWrite ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ProgramPreWrite FBL_MEM_STATUS_Failed +# endif +# endif /* __ApplFblMemPreWrite */ + +# if defined( __ApplFblMemPostWrite ) +# if defined( FBL_MEM_STATUS_ProgramPostWrite ) +# else +# error Status overwrite value missing: FBL_MEM_STATUS_ProgramPostWrite +# endif +# else +# if defined( FBL_MEM_STATUS_ProgramPostWrite ) +# else +/* Status code not required: remap to default */ +# define FBL_MEM_STATUS_ProgramPostWrite FBL_MEM_STATUS_Failed +# endif +# endif /* __ApplFblMemPostWrite */ + +#endif /* FBL_MEM_ENABLE_STATUS_OVERWRITE || FBL_MEM_ENABLE_STATUS_REMAPPING */ + + +/* Options for extended verification API */ +#define FBL_MEM_VERIFY_INPUT_OPT 0u +#define FBL_MEM_VERIFY_PROC_OPT 1u +#define FBL_MEM_VERIFY_PIPE_OPT 2u +#define FBL_MEM_VERIFY_OUTPUT_OPT 3u + +#define FBL_MEM_CHK_OPTION(a, b) (( a & (1u << b) ) != 0u) + +#define FBL_MEM_OPT_INPUT_MASK (1u << FBL_MEM_VERIFY_INPUT_OPT) +#define FBL_MEM_OPT_PROC_MASK (1u << FBL_MEM_VERIFY_PROC_OPT) +#define FBL_MEM_OPT_Pipe_MASK (1u << FBL_MEM_VERIFY_PIPE_OPT) +#define FBL_MEM_OPT_OUTPUT_MASK (1u << FBL_MEM_VERIFY_OUTPUT_OPT) + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ +/*-- On-the-fly verification ------------------------------------------------*/ +#if defined( FBL_MEM_VERIFY_STATUS_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_STATUS_TYPE_OVERWRITE tFblMemVerifyStatus; +#else +typedef SecM_StatusType tFblMemVerifyStatus; +#endif /* FBL_MEM_VERIFY_STATUS_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_PARAM_TYPE_INPUT_OVERWRITE ) +typedef FBL_MEM_VERIFY_PARAM_TYPE_INPUT_OVERWRITE tFblMemVerifyParamInput; +#else +typedef SecM_SignatureParamType tFblMemVerifyParamInput; +#endif /* FBL_MEM_VERIFY_PARAM_TYPE_INPUT_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_PARAM_TYPE_OUTPUT_OVERWRITE ) +typedef FBL_MEM_VERIFY_PARAM_TYPE_OUTPUT_OVERWRITE tFblMemVerifyParamOutput; +#else +typedef SecM_VerifyParamType tFblMemVerifyParamOutput; +#endif /* FBL_MEM_VERIFY_PARAM_TYPE_OUTPUT_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_LENGTH_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_LENGTH_TYPE_OVERWRITE tFblMemVerifyLength; +#else +typedef SecM_LengthType tFblMemVerifyLength; +#endif /* FBL_MEM_VERIFY_LENGTH_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_SIZE_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_SIZE_TYPE_OVERWRITE tFblMemVerifySize; +#else +typedef SecM_SizeType tFblMemVerifySize; +#endif /* FBL_MEM_VERIFY_SIZE_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_ADDRESS_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_ADDRESS_TYPE_OVERWRITE tFblMemVerifyAddr; +#else +typedef SecM_AddrType tFblMemVerifyAddr; +#endif /* FBL_MEM_VERIFY_ADDRESS_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_DATA_PTR_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_DATA_PTR_TYPE_OVERWRITE tFblMemVerifyDataPtr; +#else +typedef V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tFblMemVerifyDataPtr; +#endif /* FBL_MEM_VERIFY_DATA_PTR_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_WD_FCT_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_WD_FCT_TYPE_OVERWRITE tFblMemVerifyWdFct; +#else +typedef FL_WDTriggerFctType tFblMemVerifyWdFct; +#endif /* FBL_MEM_VERIFY_WD_FCT_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_READ_FCT_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_READ_FCT_TYPE_OVERWRITE tFblMemVerifyReadFct; +#else +typedef FL_ReadMemoryFctType tFblMemVerifyReadFct; +#endif /* FBL_MEM_VERIFY_READ_FCT_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_FCT_INPUT_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_FCT_INPUT_TYPE_OVERWRITE(tFblMemVerifyFctInput); +#else +typedef FBL_CALL_TYPE tFblMemVerifyStatus (*tFblMemVerifyFctInput) (V_MEMRAM1 tFblMemVerifyParamInput V_MEMRAM2 V_MEMRAM3 *fp); +#endif /* FBL_MEM_VERIFY_FCT_INPUT_TYPE_OVERWRITE */ +#if defined( FBL_MEM_VERIFY_FCT_OUTPUT_TYPE_OVERWRITE ) +typedef FBL_MEM_VERIFY_FCT_OUTPUT_TYPE_OVERWRITE(tFblMemVerifyFctOutput); +#else +typedef FBL_CALL_TYPE tFblMemVerifyStatus (*tFblMemVerifyFctOutput) (V_MEMRAM1 tFblMemVerifyParamOutput V_MEMRAM2 V_MEMRAM3 *fp); +#endif /* FBL_MEM_VERIFY_FCT_OUTPUT_TYPE_OVERWRITE */ + +#if defined( FBL_MEM_SEGMENT_LIST_TYPE_OVERWRITE ) +typedef FBL_MEM_SEGMENT_LIST_TYPE_OVERWRITE tFblMemSegmentList; +#else +typedef FL_SegmentListType tFblMemSegmentList; +#endif /* FBL_MEM_SEGMENT_LIST_TYPE_OVERWRITE */ +#if defined( FBL_MEM_SEGMENT_LIST_ENTRY_TYPE_OVERWRITE ) +typedef FBL_MEM_SEGMENT_LIST_ENTRY_TYPE_OVERWRITE tFblMemSegmentListEntry; +#else +typedef FL_SegmentInfoType tFblMemSegmentListEntry; +#endif /* FBL_MEM_SEGMENT_LIST_ENTRY_TYPE_OVERWRITE */ + +/* Options type for extended verification API */ +typedef vuint8 tFblMemVerifyOption; + +/** Error codes reported by FblMem routines */ +typedef enum +{ + /* Define status codes: kFblMemStatus_ */ + /* Default */ + FBL_MEM_STATUS_DEFINITION(Ok) /* 0x00 */ + ,FBL_MEM_STATUS_DEFINITION(Failed) /* 0x01 */ + /* BlockErase indication */ + ,FBL_MEM_STATUS_DEFINITION(BlockEraseSequence) /* 0x02 */ + /* BlockStart indication */ + ,FBL_MEM_STATUS_DEFINITION(BlockStartSequence) /* 0x03 */ + ,FBL_MEM_STATUS_DEFINITION(BlockStartParam) /* 0x04 */ + /* BlockEnd indication */ + ,FBL_MEM_STATUS_DEFINITION(BlockEndSequence) /* 0x05 */ + ,FBL_MEM_STATUS_DEFINITION(BlockEndVerifyFinalize) /* 0x06 */ + /* BlockVerify */ + ,FBL_MEM_STATUS_DEFINITION(BlockVerifySequence) /* 0x07 */ + ,FBL_MEM_STATUS_DEFINITION(BlockVerifyInputVerify) /* 0x08 */ + ,FBL_MEM_STATUS_DEFINITION(BlockVerifyProcessedVerify) /* 0x09 */ + ,FBL_MEM_STATUS_DEFINITION(BlockVerifyPipeVerify) /* 0x0A */ + ,FBL_MEM_STATUS_DEFINITION(BlockVerifyOutputVerify) /* 0x0B */ + /* SegmentStart indication */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartSequence) /* 0x0C */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartDataProcInit) /* 0x0D */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartStreamOutInit) /* 0x0E */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartVerifyInit) /* 0x0F */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartVerifyCompute) /* 0x10 */ + ,FBL_MEM_STATUS_DEFINITION(SegmentStartSegmentCount) /* 0x11 */ + /* SegmentEnd indication */ + ,FBL_MEM_STATUS_DEFINITION(SegmentEndSequence) /* 0x12 */ + ,FBL_MEM_STATUS_DEFINITION(SegmentEndInsufficientData) /* 0x13 */ + ,FBL_MEM_STATUS_DEFINITION(SegmentEndPost) /* 0x14 */ + /* Data indication */ + ,FBL_MEM_STATUS_DEFINITION(DataIndSequence) /* 0x15 */ + ,FBL_MEM_STATUS_DEFINITION(DataIndParam) /* 0x16 */ + ,FBL_MEM_STATUS_DEFINITION(DataIndOverflow) /* 0x17 */ + /* Data processing */ + ,FBL_MEM_STATUS_DEFINITION(DataProc) /* 0x18 */ + ,FBL_MEM_STATUS_DEFINITION(DataProcConsume) /* 0x19 */ + ,FBL_MEM_STATUS_DEFINITION(DataProcDeinit) /* 0x1A */ + /* Stream output */ + ,FBL_MEM_STATUS_DEFINITION(StreamOutput) /* 0x1B */ + ,FBL_MEM_STATUS_DEFINITION(StreamOutputConsume) /* 0x1C */ + ,FBL_MEM_STATUS_DEFINITION(StreamOutputOverflow) /* 0x1D */ + ,FBL_MEM_STATUS_DEFINITION(StreamOutputDeinit) /* 0x1E */ + /* Memory driver */ + ,FBL_MEM_STATUS_DEFINITION(DriverResumeWrite) /* 0x1F */ + ,FBL_MEM_STATUS_DEFINITION(DriverWrite) /* 0x20 */ + ,FBL_MEM_STATUS_DEFINITION(DriverErase) /* 0x21 */ + ,FBL_MEM_STATUS_DEFINITION(DriverRemainder) /* 0x22 */ + ,FBL_MEM_STATUS_DEFINITION(DriverSuspendWrite) /* 0x23 */ + /* Programming operation */ + ,FBL_MEM_STATUS_DEFINITION(ProgramOverflow) /* 0x24 */ + ,FBL_MEM_STATUS_DEFINITION(ProgramOutsideFbt) /* 0x25 */ + ,FBL_MEM_STATUS_DEFINITION(ProgramUnalignedAddress) /* 0x26 */ + ,FBL_MEM_STATUS_DEFINITION(ProgramDriverNotReady) /* 0x27 */ + ,FBL_MEM_STATUS_DEFINITION(ProgramPreWrite) /* 0x28 */ + ,FBL_MEM_STATUS_DEFINITION(ProgramPostWrite) /* 0x29 */ + /* Erase operation */ + ,FBL_MEM_STATUS_DEFINITION(EraseOutsideFbt) /* 0x2A */ + ,FBL_MEM_STATUS_DEFINITION(EraseDriverNotReady) /* 0x2B */ + ,FBL_MEM_STATUS_DEFINITION(ErasePreErase) /* 0x2C */ + ,FBL_MEM_STATUS_DEFINITION(ErasePostErase) /* 0x2D */ + /* On-the-fly verification */ + ,FBL_MEM_STATUS_DEFINITION(VerifyCompute) /* 0x2E */ + ,FBL_MEM_STATUS_DEFINITION(VerifyFinalize) /* 0x2F */ + /* Pass-through */ + ,FBL_MEM_STATUS_DEFINITION(PassThroughLocal) /* 0x30 */ + ,FBL_MEM_STATUS_DEFINITION(PassThroughRemote) /* 0x31 */ +#if defined( FBL_MEM_STATUS_ConditionCheck0 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck0) /* 0x32 */ +#endif /* FBL_MEM_STATUS_ConditionCheck0 */ +#if defined( FBL_MEM_STATUS_ConditionCheck1 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck1) /* 0x33 */ +#endif /* FBL_MEM_STATUS_ConditionCheck1 */ +#if defined( FBL_MEM_STATUS_ConditionCheck2 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck2) /* 0x34 */ +#endif /* FBL_MEM_STATUS_ConditionCheck2 */ +#if defined( FBL_MEM_STATUS_ConditionCheck3 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck3) /* 0x35 */ +#endif /* FBL_MEM_STATUS_ConditionCheck3 */ +#if defined( FBL_MEM_STATUS_ConditionCheck4 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck4) /* 0x36 */ +#endif /* FBL_MEM_STATUS_ConditionCheck4 */ +#if defined( FBL_MEM_STATUS_ConditionCheck5 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck5) /* 0x37 */ +#endif /* FBL_MEM_STATUS_ConditionCheck5 */ +#if defined( FBL_MEM_STATUS_ConditionCheck6 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck6) /* 0x38 */ +#endif /* FBL_MEM_STATUS_ConditionCheck6 */ +#if defined( FBL_MEM_STATUS_ConditionCheck7 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck7) /* 0x39 */ +#endif /* FBL_MEM_STATUS_ConditionCheck7 */ +#if defined( FBL_MEM_STATUS_ConditionCheck8 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck8) /* 0x3A */ +#endif /* FBL_MEM_STATUS_ConditionCheck8 */ +#if defined( FBL_MEM_STATUS_ConditionCheck9 ) + ,FBL_MEM_STATUS_DEFINITION(ConditionCheck9) /* 0x3B */ +#endif /* FBL_MEM_STATUS_ConditionCheck9 */ +} tFblMemStatus; + +/** Memory type */ +typedef enum +{ + kFblMemType_RAM = 0u, /* Volatile memory */ + kFblMemType_ROM /* Non-volatile memory */ +} tFblMemType; + +/** State of programming operation */ +typedef enum +{ + kFblMemProgState_Idle = 0u, + kFblMemProgState_Error, + kFblMemProgState_Suspended, + kFblMemProgState_SuspendPending, + kFblMemProgState_Checkpoint, + kFblMemProgState_Pending +} tFblMemProgState; + +/** Pointer type to byte data in RAM */ +typedef V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tFblMemRamData; +/** Pointer type to constant byte data in RAM */ +typedef const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tFblMemConstRamData; + +/** Data format identifier */ +typedef vuint8 tFblMemDfi; + +/** Input verification routine */ +typedef struct +{ + tFblMemVerifyFctInput function; + V_MEMRAM1 tFblMemVerifyParamInput V_MEMRAM2 V_MEMRAM3 * param; +} tFblMemVerifyRoutineInput; + +/** Output verification routine */ +typedef struct +{ + tFblMemVerifyFctOutput function; + V_MEMRAM1 tFblMemVerifyParamOutput V_MEMRAM2 V_MEMRAM3 * param; +} tFblMemVerifyRoutineOutput; + +/** Information passed in block erase / start indication */ +typedef struct +{ + tFblAddress targetAddress; /**< Target address (erase operation) */ + tFblLength targetLength; /**< Target length (erase operation) */ + /* Used for signature verification */ + tFblAddress logicalAddress; /**< Logical address (verification operation) */ + tFblLength logicalLength; /**< Logical length (verification operation) */ + tFblMemVerifyRoutineInput verifyRoutineInput; /**< On-the-fly verification on input data */ + tFblMemVerifyRoutineInput verifyRoutineProcessed; /**< On-the-fly verification on processed data */ + tFblMemVerifyRoutineInput verifyRoutinePipe; /**< Pipelined verification on output data */ + tFblMemVerifyRoutineOutput verifyRoutineOutput; /**< Verification on output data */ + tFblMemVerifyReadFct readFct; /**< Memory read function, used by pipelined and output verification */ + V_MEMRAM1 tFblMemSegmentList V_MEMRAM2 V_MEMRAM3 * segmentList; /**< List of programmed segments, used by output verification */ + vuint32 maxSegments; /**< Maximum number of entries in segment list */ +} tFblMemBlockInfo; + +/** Verification data */ +typedef struct +{ + tFblMemRamData data; /**< Pointer to verification data (signature/checksum) */ + tFblLength length; /**< Length of verification data */ +} tFblMemVerifyData; + +/** Information passed in block verify */ +typedef struct +{ + tFblMemVerifyData verifyDataInput; /**< On-the-fly verification on input data */ + tFblMemVerifyData verifyDataProcessed; /**< On-the-fly verification on processed data */ + tFblMemVerifyData verifyDataPipe; /**< Pipelined verification on output data */ + tFblMemVerifyData verifyDataOutput; /**< Verification on output data */ +} tFblMemBlockVerifyData; + +/** Information passed in segment start indication */ +typedef struct +{ + tFblAddress targetAddress; /* Target address (program operation) */ + tFblLength targetLength; /* Target length (program operation) */ + /* Used for signature verification */ + tFblAddress logicalAddress; /* Logical address (verification operation) */ + tFblLength logicalLength; /* Logical length (verification operation) */ + /* Handling info */ + tFblMemType type; /* Type (RAM / ROM) */ + tFblMemDfi dataFormat; /* Data format identifier (data processing) */ +} tFblMemSegmentInfo; + +/** Return type for watchdog trigger */ +#if defined( FBL_MEM_TRIGGER_STATUS_OVERWRITE ) +typedef FBL_MEM_TRIGGER_STATUS_OVERWRITE tFblMemTriggerStatus; +#else +typedef vuint8 tFblMemTriggerStatus; +#endif + +/** Input source handle */ +typedef vuintx tFblMemInputSource; + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/** Operation types reported in progress information */ +typedef enum +{ + kFblMemProgressType_Erase, /**< Erase operation */ + kFblMemProgressType_Program, /**< Programming operation (may include gap fill) */ + kFblMemProgressType_GapFill, /**< Concluding gap fill operation */ + kFblMemProgressType_Verify, /**< Verification operation */ + kFblMemProgressType_Undefined /**< Undefined, used internally */ +} tFblMemProgressType; + +/** Progress information */ +typedef struct +{ + tFblMemProgressType type; /**< Operation type */ + tFblAddress logicalAddress; /**< Logical block address */ + vuint32 segmentCount; /**< Segment count + Typically zero for erase and verification, + segment index for programming and + index of last segment incremented by one for concluding gap fill */ + vuint8 totalProgress; /**< Total operation progress (current block) */ + vuint8 partialProgress; /**< Partial operation progress */ +} tFblMemProgressInfo; +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) +typedef struct +{ + tFblAddress baseAddress; /**< Address of base memory region allowed to be modified */ + tFblLength baseLength; /**< Length of base memory region allowed to be modified */ + tFblAddress address; /**< Current programming address (based on previously produced length) */ + tFblLength length; /**< Current programming remainder (based on previously produced length) */ + tFblMemConstRamData inputData; /**< Pointer to input data buffer */ + tFblMemRamData outputData; /**< Pointer to output data buffer (not used for stream output) */ + void (* watchdog)(void); /**< Watchdog trigger function */ + tFblLength inputLength; /**< Length of input data */ + tFblLength outputSize; /**< Size of output data buffer (not used for stream output) */ + tFblLength consumedLength; /**< Number of consumed input data bytes */ + tFblLength producedLength; /**< Number of produced output data bytes (stream output: directly programmed to memory) */ + vuint8 mode; /**< Applied data processing mode*/ +} tFblMemStreamProcessing; +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + +/*-- Resumable programming --------------------------------------------------*/ + +#define FBLLIB_MEM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#if defined( __cplusplus ) +extern "C" { +#endif + +tFblMemRamData FblMemInitPowerOn( void ); +tFblMemRamData FblMemInitPowerOnExt( tFblLength preambleLen, tFblMemInputSource sourceHandle ); +tFblMemRamData FblMemInit( void ); +void FblMemDeinit( void ); +tFblMemRamData FblMemGetActiveBuffer( void ); +tFblMemStatus FblMemBlockEraseIndication( const V_MEMRAM1 tFblMemBlockInfo V_MEMRAM2 V_MEMRAM3 * block ); +tFblMemStatus FblMemBlockStartIndication( V_MEMRAM1 tFblMemBlockInfo V_MEMRAM2 V_MEMRAM3 * block ); +tFblMemStatus FblMemBlockEndIndication( void ); +tFblMemStatus FblMemBlockVerify( const V_MEMRAM1 tFblMemBlockVerifyData V_MEMRAM2 V_MEMRAM3 * verifyData, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * verifyResult ); +tFblMemStatus FblMemBlockVerifyExtended( const V_MEMRAM1 tFblMemBlockVerifyData V_MEMRAM2 V_MEMRAM3 * verifyData, + V_MEMRAM1 tFblMemVerifyStatus V_MEMRAM2 V_MEMRAM3 * verifyResult, const tFblMemVerifyOption option ); +tFblMemStatus FblMemSegmentStartIndication( const V_MEMRAM1 tFblMemSegmentInfo V_MEMRAM2 V_MEMRAM3 * segment ); +tFblMemStatus FblMemSegmentEndIndication( V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * writeLength ); +tFblMemStatus FblMemDataIndication( tFblMemConstRamData buffer, tFblLength offset, tFblLength length ); +void FblMemTask( void ); +void FblMemFlushInputData( void ); + +/* Low level memory operations */ +tFblMemStatus FblMemEraseRegion( tFblAddress eraseAddress, tFblLength eraseLength ); +tFblMemStatus FblMemProgramBuffer( tFblAddress programAddress,V_MEMRAM1 tFblLength V_MEMRAM2 V_MEMRAM3 * programLength, + tFblMemRamData programData ); + +/* Helper functions */ +void FblMemSetInteger( vuintx count, vuint32 input, tFblMemRamData buffer ); +vuint32 FblMemGetInteger( vuintx count, tFblMemConstRamData buffer ); + +#if defined( FBL_MEM_ENABLE_MULTI_SOURCE ) +void FblMemLockInputSource( tFblMemInputSource sourceHandle ); +#endif + + + +#define FBLLIB_MEM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLLIB_MEM_RAMCODE_START_SEC_CODE_EXPORT +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +void FblMemResumeIndication( void ); +#if defined( FBL_MEM_ENABLE_PIPELINING ) +void FblMemRxNotification( void ); +#endif /* FBL_MEM_ENABLE_PIPELINING */ + +#define FBLLIB_MEM_RAMCODE_STOP_SEC_CODE_EXPORT +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( __cplusplus ) +} /* extern "C" */ +#endif + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLLIB_MEM_START_SEC_VAR_EXPORT +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 extern V_MEMRAM1 tFblMemProgState V_MEMRAM2 fblMemProgState; + +#define FBLLIB_MEM_STOP_SEC_VAR_EXPORT +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ + +/* Plausibility checks of configuration settings *****************************/ +/*-- Integration time -------------------------------------------------------*/ + + + + + + + + + + + + + + + + + + + + +/*-- Compatibility remapping of configuration switches-----------------------*/ + + + +/*-- Compile time -----------------------------------------------------------*/ +#if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) || \ + defined( FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP ) +# if defined( FBL_MEM_WRITE_SEGMENTATION ) +# else +# error Write segmentation not defined +# endif +# if defined( FBL_ENABLE_UNALIGNED_DATA_TRANSFER ) +# else +# if ( (FBL_MEM_WRITE_SEGMENTATION & (FBL_MAX_SEGMENT_SIZE - 1u)) != 0u ) +# error Write segmentation has to be multiple of segment size +# endif +# endif /* FBL_ENABLE_UNALIGNED_DATA_TRANSFER */ +#endif /* FBL_ENABLE_PIPELINED_PROGRAMMING || FBL_ENABLE_ADAPTIVE_DATA_TRANSFER_RCRRP */ + +# if defined( FBL_ENABLE_PIPELINED_PROGRAMMING ) +# if defined( FBL_MEM_PIPE_PROG_BUFFER_COUNT ) +# if ( FBL_MEM_PIPE_PROG_BUFFER_COUNT < 2 ) +# error Number of pipelined programming buffers has to be at least two +# endif +# endif /* FBL_MEM_PIPE_PROG_BUFFER_COUNT */ +# endif /* FBL_ENABLE_PIPELINED_PROGRAMMING */ + +#if defined( FBL_ENABLE_DATA_PROCESSING ) +# if defined( FBL_MEM_PROC_BUFFER_SIZE ) +# else +# error Data processing buffer size not defined +# endif +# if ( FBL_MEM_PROC_SEGMENTATION > 0xFFFFu ) +# error Data processing segmentation exceeds interface constraints +# endif +# if ( FBL_MEM_PROC_SEGMENTATION > FBL_MEM_PROC_BUFFER_SIZE ) +# error Data processing segmentation exceeds buffer size +# endif +# if ( FBL_MEM_PROC_SEGMENTATION == FBL_MEM_PROC_BUFFER_SIZE ) +# else +# endif +#endif /* FBL_ENABLE_DATA_PROCESSING */ + + +#if defined( FBL_MEM_BUFFER_SIZE ) +#else +# error Input buffer size not defined +#endif /* FBL_MEM_BUFFER_SIZE */ + +#if defined( FBL_MEM_DEFAULT_PREAMBLE_LENGTH ) +#else +# error Default preamble length not defined +#endif /* FBL_MEM_DEFAULT_PREAMBLE_LENGTH */ + +#if defined( FBL_MEM_MAX_PREAMBLE_LENGTH ) +#else +# error Maximum preamble length not defined +#endif /* FBL_MEM_MAX_PREAMBLE_LENGTH */ + +#if defined( FBL_MEM_WD_TRIGGER_DEFAULT ) +#else +# error Default watchdog trigger return code not defined +#endif /* FBL_MEM_WD_TRIGGER_DEFAULT */ + + +#if defined( FBL_MEM_ENABLE_STATUS_OVERWRITE ) +# if defined( FBL_MEM_STATUS_Ok ) && \ + defined( FBL_MEM_STATUS_Failed ) +# else +# error Status overwrite or remapping enabled, but actual values missing +# endif +#endif /* FBL_MEM_ENABLE_STATUS_OVERWRITE || FBL_MEM_ENABLE_STATUS_REMAPPING */ + +#if defined( FBL_MEM_STATUS_Ok ) || \ + defined( FBL_MEM_STATUS_Failed ) +# if defined( FBL_MEM_ENABLE_STATUS_OVERWRITE ) +# else +# error Status values defined, but neither status overwrite nor remapping enabled +# endif +#endif /* FBL_MEM_STATUS_Ok || FBL_MEM_STATUS_Failed */ + +#if defined( FBL_MEM_ENABLE_EXT_STATUS ) +# if defined( FBL_MEM_EXT_STATUS_Ok ) && \ + defined( FBL_MEM_EXT_STATUS_Failed ) +# else +# error Extended status enabled, but actual macros missing +# endif +#endif /* FBL_MEM_ENABLE_EXT_STATUS */ + +#if defined( FBL_MEM_EXT_STATUS_Ok ) || \ + defined( FBL_MEM_EXT_STATUS_Failed ) +# if defined( FBL_MEM_ENABLE_EXT_STATUS ) +# else +# error Extended status macros defined, but feature not enabled +# endif +#endif /* FBL_MEM_EXT_STATUS_Ok || FBL_MEM_EXT_STATUS_Failed */ + + +#if defined( FBL_MEM_ENABLE_STREAM_OUTPUT ) +# if defined( __ApplFblMemIsStreamOutputRequired ) +# else +# error Stream output enabled, but data format check not specified +# endif +#endif /* FBL_MEM_ENABLE_STREAM_OUTPUT */ + +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +# if defined( FBL_ENABLE_PROCESSED_DATA_LENGTH) +# error Combination of progress information with processed data length not supported +# endif /* FBL_ENABLE_PROCESSED_DATA_LENGTH */ +# if defined( __ApplFblMemReportProgress ) +# else +# error Progress information enabled, but report callout not specified +# endif /* __ApplFblMemReportProgress */ +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +#endif /* FBL_MEM_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_mem_oem.h b/Source/bsw/Fbl/fbl_mem_oem.h new file mode 100644 index 0000000..25c76f9 --- /dev/null +++ b/Source/bsw/Fbl/fbl_mem_oem.h @@ -0,0 +1,453 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief OEM dependent configuration for FblLib_Mem + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * TEMPLATE REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-03-23 visjhg - Initial release + * 01.00.01 2012-03-26 visjhg - Additional comments + * 01.01.00 2012-04-05 visjhg - Changes after code review + * 01.02.00 2012-04-27 visjhg - Updated type casts in macros using ternary operator + * 01.04.00 2013-02-01 visach ESCAN00062919 Adapted comments to use Doxygen + * visach - Correct macro __ApplFblMemDriverReady + * visjhg ESCAN00064292 Added pre and post handlers for erase routine + * visjhg ESCAN00064296 Renamed default preamble length define + * visjhg ESCAN00064301 Split verify functions for RAM and ROM verification + * visjhg ESCAN00064333 Differentiate watchdog trigger w/ and w/o status + * visjhg ESCAN00064334 Added interface to remap error codes to OEM dependent value + * visjhg - Added additional error codes for new functionality + * visjhg ESCAN00064720 Replaced __ApplFblMemCheckDfi by __ApplFblMemIsDataProcessingRequired + * 01.05.00 2013-04-10 visjhg ESCAN00066379 Added interface version compatibility check + * visjhg ESCAN00066377 Added additional error codes for new functionality + * 01.06.00 2013-07-22 visjhg ESCAN00067433 Updated interface version (added FblMemDeinit) + * visjhg ESCAN00069161 Updated interface version (added pipelined verification) + * Changed verification error codes + * 01.07.00 2013-08-16 visjhg ESCAN00069803 Updated interface version (enable/disable verification at run-time) + * visjhg - Corrected name of parameter type overwrite + * 02.00.00 2013-12-12 visjhg ESCAN00072568 Updated interface version (initialize verification in segment start) + * Error / status for BlockStartVerifyInit replaced by SegmentStartVerifyInit + * visjhg ESCAN00072569 Raised major version to match API version + * 02.01.00 2014-03-12 visjhg ESCAN00073504 Corrected overwrite macro names for verification functions + * 03.00.00 2015-03-03 visjhg ESCAN00076591 Added support for external stream output + * Added __ApplFblMemIsStreamOutputRequired + * Added additional error codes + * Updated interface version + * visjhg ESCAN00081493 Added __ApplFblMemIsPipelinedProgrammingDisabled + * 03.01.00 2015-04-23 visjhg ESCAN00082606 Added __ApplFblMemReportProgress + * 03.01.03 2015-06-15 visjhg ESCAN00083392 Added FBL_MEM_ENABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH + * Added SEC_ENABLE_VERIFICATION_ADDRESS_LENGTH check + * Updated interface version + * 03.02.00 2015-07-21 visjhg ESCAN00084102 Updated interface version (parameter type structure for stream processing) + * 04.00.00 2015-09-17 visjhg ESCAN00085249 Updated interface version (explicit parameters for processed verification) + * visjhg ESCAN00085250 Run-time decision whether address and length info is included in verification + * Added __ApplFblMemVerifyInputIsAddressAndLengthIncluded, + * __ApplFblMemVerifyProcessedIsAddressAndLengthIncluded and + * __ApplFblMemVerifyPipelinedIsAddressAndLengthIncluded + * visjhg ESCAN00085251 Pass external segment info to __ApplFblMemIsPipelinedProgrammingDisabled + * 04.01.00 2016-04-01 visjhg ESCAN00087997 Added __ApplFblMemEnterCriticalSection and __ApplFblMemLeaveCriticalSection + * Updated interface version + * 04.02.01 2017-05-31 visjhg - Removed deprecated SEC_VER_DISABLE_LENGTH_AND_ADDRESS_INPUT + * Updated interface version + * 04.03.00 2017-07-06 visjhg ESCAN00095774 Added FblMemFlushInputData + * Updated interface version + * 04.04.00 2018-08-22 visjhg ESCAN00100482 Added hook __ApplFblMemConditionCheck + * Updated interface version + * 04.04.01 2018-09-25 visjhg ESCAN00100850 Matching preamble length for MCMP download use-case + * Updated interface version + * 04.05.00 2018-11-30 visjhg ESCAN00101500 Added custom error codes (typically used by __ApplFblMemConditionCheck) + * Updated interface version + * 04.05.02 2019-08-20 vistbe ESCAN00103967 Updated interface version + * 04.06.00 2019-10-29 vistmo FBL-813 Migration to MISRA 2012 + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +#ifndef FBL_MEM_OEM_H +#define FBL_MEM_OEM_H + + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* PRQA S 0602, 0603 TAG_FblMemOem_0602_0603_1 */ /* MD_FblMemOem_0602_0603 */ + +/*-- Version information ----------------------------------------------------*/ + +/* Reference interface version */ +/** Major interface version identifies incompatible changes */ +#define FBL_MEM_API_REFERENCE_VERSION_MAJOR 0x04u +/** Minor interface version identifies backward compatible changes */ +#define FBL_MEM_API_REFERENCE_VERSION_MINOR 0x05u +/** Release interface version identifies cosmetic changes */ +#define FBL_MEM_API_REFERENCE_VERSION_RELEASE 0x00u + +/*-- Buffer configuration ---------------------------------------------------*/ + +/** Input buffer size */ +#define FBL_MEM_BUFFER_SIZE FBL_DIAG_BUFFER_LENGTH + +/** Preamble length for UDS download */ +#define FBL_MEM_PREAMBLE_LENGTH_UDS 2u +/** Preamble length for MCMP download */ +#define FBL_MEM_PREAMBLE_LENGTH_MCMP 1u + +/** Preamble length of default source */ +#if defined( FBL_MEM_SOURCE_PREAMBLE_LENGTH ) +/* Allow override for non-standard use-cases */ +#else +# if defined( MCMP_MEM_MODE_DYNAMIC ) +/* Mixed download over UDS and MCMP + UDS is default source */ +# define FBL_MEM_SOURCE_PREAMBLE_LENGTH FBL_MEM_PREAMBLE_LENGTH_UDS +# elif defined( MCMP_MEM_MODE_SLAVE ) +/* MCMP-only download */ +# define FBL_MEM_SOURCE_PREAMBLE_LENGTH FBL_MEM_PREAMBLE_LENGTH_MCMP +# else +/* UDS-only download */ +# define FBL_MEM_SOURCE_PREAMBLE_LENGTH FBL_MEM_PREAMBLE_LENGTH_UDS +# endif /* MCMP_MEM_MODE_ */ +#endif /* FBL_MEM_SOURCE_PREAMBLE_LENGTH */ + +/** Length of default preamble */ +#define FBL_MEM_DEFAULT_PREAMBLE_LENGTH FBL_MEM_SOURCE_PREAMBLE_LENGTH +/** Maximum preamble length */ +#define FBL_MEM_MAX_PREAMBLE_LENGTH FBL_MEM_SOURCE_PREAMBLE_LENGTH + +/* Allow override in configuration */ +# if defined( __ApplFblMemIsDataProcessingRequired ) +# else +/** Check whether specific data format identifier implies the need for data processing */ +# define __ApplFblMemIsDataProcessingRequired(dataFormat) \ + ((tFblResult)((kDiagSubNoDataProcessing == (dataFormat)) ? kFblFailed : kFblOk)) +# endif /* __ApplFblMemIsDataProcessingRequired */ +# if defined( FBL_MEM_ENABLE_SELECTIVE_PIPELINED_PROGRAMMING ) +/* Allow override in configuration */ +# if defined( __ApplFblMemIsPipelinedProgrammingDisabled ) +# else +/* + This is just an example for the macro definition + Remove macro and disable feature if not applicable +*/ +/** Check whether pipelined programming has to be disabled for specific block / segment / data format identifier */ +# define __ApplFblMemIsPipelinedProgrammingDisabled(pBlockInfo, pSegmentInfo) ((tFblResult)kFblFailed) +# endif /* __ApplFblMemIsPipelinedProgrammingDisabled */ +# endif /* FBL_MEM_ENABLE_SELECTIVE_PIPELINED_PROGRAMMING */ + +/*-- Verification -----------------------------------------------------------*/ + +/** Calculate CRC total over complete block + Otherwise start of block until last address of last segment is covered */ +#define FBL_MEM_DISABLE_VERIFY_OUTPUT_FULL_BLOCK_LENGTH + +/** Size of temporary verification result buffer */ +#define FBL_MEM_SIG_RESULT_BUFFER_SIZE kDiagSigBufLength +/** Overwrite input verification function type */ +#define FBL_MEM_VERIFY_FCT_INPUT_TYPE_OVERWRITE(type) FBL_CALL_TYPE tFblMemVerifyStatus (*type) (V_MEMRAM1 tFblMemVerifyParamInput V_MEMRAM2 V_MEMRAM3 *) + +/*-- Memory driver ----------------------------------------------------------*/ +/* + Perform actions directly before and after memory driver write + Remove macro if not applicable +*/ +#define __ApplFblMemPreWrite() FblDiagMemPreWrite() +#define __ApplFblMemPostWrite() FblDiagMemPostWrite() +/* + Perform actions directly before and after memory driver erase + Remove macro if not applicable +*/ +#define __ApplFblMemPreErase() FblDiagMemPreWrite() +#define __ApplFblMemPostErase() FblDiagMemPostWrite() +/* + Perform actions directly after segment end indication + Remove macro if not applicable +*/ +/* #define __ApplFblMemPostSegmentEnd() */ + +/*-- Watchdog ---------------------------------------------------------------*/ +/* Default return code */ +#define FBL_MEM_WD_TRIGGER_DEFAULT (FBL_NO_TRIGGER) +/* + Overwrite status type returned by watchdog trigger function + Remove macro if not applicable +*/ +#define FBL_MEM_TRIGGER_STATUS_OVERWRITE vuint8 +/* + Default watchdog trigger + Remove macro if not applicable +*/ +#define __ApplFblMemWdTrigger() FblLookForWatchdog() +/* + Watchdog trigger including adaptive generation of RCR-RP + Remove macro if not applicable +*/ +#define __ApplFblMemAdaptiveRcrRp() FblRealTimeSupport() +/* + Check whether RCR-RP is already active + Remove macro if not applicable or required (e.g. if kForceSendRpIfNotInProgress is available) +*/ +#define __ApplFblMemIsRcrRpActive() ((tFblResult)(GetRcrRpInProgress() ? kFblOk : kFblFailed)) +/* + Forced generation of RCR-RP (hint: use kForceSendRpIfNotInProgress if available) + Remove macro if not applicable +*/ +#define __ApplFblMemForcedRcrRp() DiagExRCRResponsePending(kForceSendResponsePending) + +/* Pass watchdog trigger with extended status result to data processing */ +#define FBL_MEM_ENABLE_EXT_TRIGGER_DATA_PROC +/* Pass watchdog trigger with extended status result to signature verification over input data */ +#define FBL_MEM_DISABLE_EXT_TRIGGER_INPUT_VERIFY +/* Pass watchdog trigger with extended status result to signature verification over output data */ +#define FBL_MEM_DISABLE_EXT_TRIGGER_OUTPUT_VERIFY + +/*-- Gap filling ------------------------------------------------------------*/ +/* Gap fill handling of LibMem explicitly disabled */ +#define FBL_MEM_DISABLE_GAP_FILL + +/*-- Progress information ---------------------------------------------------*/ +#if defined( FBL_MEM_ENABLE_PROGRESS_INFO ) +/* Allow override in configuration */ +# if defined( __ApplFblMemReportProgress ) +# else +/** Progress information reporting */ +/*# define __ApplFblMemReportProgress(progressInfo)*/ +# endif /* __ApplFblMemReportProgress */ +#endif /* FBL_MEM_ENABLE_PROGRESS_INFO */ + +/*-- Critical sections ------------------------------------------------------*/ +/* Allow override in configuration */ +#if defined( __ApplFblMemEnterCriticalSection ) +#else +/** Enter critical section */ +# define __ApplFblMemEnterCriticalSection() +#endif /* __ApplFblMemEnterCriticalSection */ + +/* Allow override in configuration */ +#if defined( __ApplFblMemLeaveCriticalSection ) +#else +/** Leave critical section */ +# define __ApplFblMemLeaveCriticalSection() +#endif /* __ApplFblMemLeaveCriticalSection */ + +/*-- Error handling ---------------------------------------------------------*/ +/** Overwrite error codes by OEM dependent value */ +#define FBL_MEM_ENABLE_STATUS_OVERWRITE +/* Enable interface to remap error codes to OEM dependent value */ +#define FBL_MEM_DISABLE_STATUS_REMAPPING +/* OEM dependent status type */ +#define FBL_MEM_STATUS_TYPE vuint8 + +#if defined( FBL_MEM_ENABLE_STATUS_OVERWRITE ) +/* Default */ +# define FBL_MEM_STATUS_Ok kDiagErrorNone +# define FBL_MEM_STATUS_Failed kDiagNrcConditionsNotCorrect +/* BlockErase indication */ +# define FBL_MEM_STATUS_BlockEraseSequence kDiagNrcRequestSequenceError +/* BlockStart indication */ +# define FBL_MEM_STATUS_BlockStartSequence kDiagNrcConditionsNotCorrect +# define FBL_MEM_STATUS_BlockStartParam kDiagNrcConditionsNotCorrect +/* BlockEnd indication */ +# define FBL_MEM_STATUS_BlockEndSequence kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_BlockEndVerifyFinalize kDiagNrcGeneralProgrammingFailure +/* BlockVerify */ +# define FBL_MEM_STATUS_BlockVerifySequence kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_BlockVerifyInputVerify kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_BlockVerifyProcessedVerify kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_BlockVerifyPipeVerify kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_BlockVerifyOutputVerify kDiagNrcGeneralProgrammingFailure +/* SegmentStart indication */ +# define FBL_MEM_STATUS_SegmentStartSequence kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_SegmentStartDataProcInit kDiagNrcRequestOutOfRange +# define FBL_MEM_STATUS_SegmentStartStreamOutInit kDiagNrcRequestOutOfRange +# define FBL_MEM_STATUS_SegmentStartVerifyInit kDiagNrcConditionsNotCorrect +# define FBL_MEM_STATUS_SegmentStartVerifyCompute kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_SegmentStartSegmentCount kDiagNrcRequestOutOfRange +/* SegmentEnd indication */ +# define FBL_MEM_STATUS_SegmentEndSequence kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_SegmentEndInsufficientData kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_SegmentEndPost kDiagNrcConditionsNotCorrect +/* Data indication */ +# define FBL_MEM_STATUS_DataIndSequence kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_DataIndParam kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DataIndOverflow kDiagNrcTransferDataSuspended +/* Data processing */ +# define FBL_MEM_STATUS_DataProc kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DataProcConsume kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DataProcDeinit kDiagNrcGeneralProgrammingFailure +/* Stream output */ +# define FBL_MEM_STATUS_StreamOutput kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_StreamOutputConsume kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_StreamOutputOverflow kDiagNrcTransferDataSuspended +# define FBL_MEM_STATUS_StreamOutputDeinit kDiagNrcGeneralProgrammingFailure +/* Memory driver */ +# define FBL_MEM_STATUS_DriverResumeWrite kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DriverWrite kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DriverErase kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DriverRemainder kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_DriverSuspendWrite kDiagNrcGeneralProgrammingFailure +/* Programming operation */ +# define FBL_MEM_STATUS_ProgramOverflow kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_ProgramOutsideFbt kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_ProgramUnalignedAddress kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_ProgramDriverNotReady kDiagNrcRequestSequenceError +# define FBL_MEM_STATUS_ProgramPreWrite kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_ProgramPostWrite kDiagNrcGeneralProgrammingFailure +/* Erase operation */ +# define FBL_MEM_STATUS_EraseOutsideFbt kDiagNrcRequestOutOfRange +# define FBL_MEM_STATUS_EraseDriverNotReady kDiagNrcConditionsNotCorrect +# define FBL_MEM_STATUS_ErasePreErase kDiagNrcConditionsNotCorrect +# define FBL_MEM_STATUS_ErasePostErase kDiagNrcConditionsNotCorrect +/* On-the-fly verification */ +# define FBL_MEM_STATUS_VerifyCompute kDiagNrcGeneralProgrammingFailure +# define FBL_MEM_STATUS_VerifyFinalize kDiagNrcGeneralProgrammingFailure +/* Pass-through */ +# define FBL_MEM_STATUS_PassThroughLocal kDiagNrcConditionsNotCorrect +# define FBL_MEM_STATUS_PassThroughRemote kDiagNrcConditionsNotCorrect +#endif /* FBL_MEM_ENABLE_STATUS_OVERWRITE || FBL_MEM_ENABLE_STATUS_REMAPPING */ + +#if defined( FBL_ENABLE_DEBUG_STATUS ) +/** Enable extended error status handling */ +# define FBL_MEM_ENABLE_EXT_STATUS + +/* Default */ +# define FBL_MEM_EXT_STATUS_Ok(status) +# define FBL_MEM_EXT_STATUS_Failed(status) +/* BlockErase indication */ +# define FBL_MEM_EXT_STATUS_BlockEraseSequence(status) +/* BlockStart indication */ +# define FBL_MEM_EXT_STATUS_BlockStartSequence(status) +# define FBL_MEM_EXT_STATUS_BlockStartParam(status) +/* BlockEnd indication */ +# define FBL_MEM_EXT_STATUS_BlockEndSequence(status) +# define FBL_MEM_EXT_STATUS_BlockEndVerifyFinalize(status) +/* BlockVerify */ +# define FBL_MEM_EXT_STATUS_BlockVerifySequence(status) +# define FBL_MEM_EXT_STATUS_BlockVerifySigVerify(status) +# define FBL_MEM_EXT_STATUS_BlockVerifyInputVerify(status) +# define FBL_MEM_EXT_STATUS_BlockVerifyProcessedVerify(status) +# define FBL_MEM_EXT_STATUS_BlockVerifyPipeVerify(status) +# define FBL_MEM_EXT_STATUS_BlockVerifyOutputVerify(status) +/* SegmentStart indication */ +# define FBL_MEM_EXT_STATUS_SegmentStartSequence(status) +# define FBL_MEM_EXT_STATUS_SegmentStartDataProcInit(status) +# define FBL_MEM_EXT_STATUS_SegmentStartStreamOutInit(status) +# define FBL_MEM_EXT_STATUS_SegmentStartVerifyInit(status) +# define FBL_MEM_EXT_STATUS_SegmentStartVerifyCompute(status) +# define FBL_MEM_EXT_STATUS_SegmentStartSegmentCount(status) FblErrStatSetError(FBL_ERR_TOO_MANY_SEGMENTS_IN_MODULE) +/* SegmentEnd indication */ +# define FBL_MEM_EXT_STATUS_SegmentEndSequence(status) +# define FBL_MEM_EXT_STATUS_SegmentEndInsufficientData(status) +# define FBL_MEM_EXT_STATUS_SegmentEndPost(status) +/* Data indication */ +# define FBL_MEM_EXT_STATUS_DataIndSequence(status) +# define FBL_MEM_EXT_STATUS_DataIndParam(status) +# define FBL_MEM_EXT_STATUS_DataIndOverflow(status) FblErrStatSetState(FBL_ERR_DATA_OVERFLOW) +/* Data processing */ +# define FBL_MEM_EXT_STATUS_DataProc(status) +# define FBL_MEM_EXT_STATUS_DataProcConsume(status) +# define FBL_MEM_EXT_STATUS_DataProcDeinit(status) +/* Stream output */ +# define FBL_MEM_EXT_STATUS_StreamOutput(status) +# define FBL_MEM_EXT_STATUS_StreamOutputConsume(status) +# define FBL_MEM_EXT_STATUS_StreamOutputOverflow(status) +# define FBL_MEM_EXT_STATUS_StreamOutputDeinit(status) +/* Memory driver */ +# define FBL_MEM_EXT_STATUS_DriverResumeWrite(status) +/* Status contains flash driver error code */ +# define FBL_MEM_EXT_STATUS_DriverWrite(status) { FblErrStatSetFlashDrvError(status); FblErrStatSetError(FBL_ERR_FLASH_PROG_ERROR); } +# define FBL_MEM_EXT_STATUS_DriverErase(status) { FblErrStatSetFlashDrvError(status); FblErrStatSetError(FBL_ERR_FLASH_ERASE_ERROR); } +# define FBL_MEM_EXT_STATUS_DriverRemainder(status) +# define FBL_MEM_EXT_STATUS_DriverSuspendWrite(status) +/* Programming operation */ +# define FBL_MEM_EXT_STATUS_ProgramOverflow(status) FblErrStatSetState(FBL_ERR_DATA_OVERFLOW) +# define FBL_MEM_EXT_STATUS_ProgramOutsideFbt(status) FblErrStatSetError(FBL_ERR_NO_MEMORY_REGION_FOUND) +# define FBL_MEM_EXT_STATUS_ProgramUnalignedAddress(status) FblErrStatSetError(FBL_ERR_FLASH_PROG_ERROR) +# define FBL_MEM_EXT_STATUS_ProgramDriverNotReady(status) FblErrStatSetError(FBL_ERR_FLASHCODE_INIT_FAILED) +# define FBL_MEM_EXT_STATUS_ProgramPreWrite(status) +# define FBL_MEM_EXT_STATUS_ProgramPostWrite(status) +/* Erase operation */ +# define FBL_MEM_EXT_STATUS_EraseOutsideFbt(status) FblErrStatSetError(FBL_ERR_NO_MEMORY_REGION_FOUND) +# define FBL_MEM_EXT_STATUS_EraseDriverNotReady(status) FblErrStatSetError(FBL_ERR_FLASHCODE_INIT_FAILED) +# define FBL_MEM_EXT_STATUS_ErasePreErase(status) +# define FBL_MEM_EXT_STATUS_ErasePostErase(status) +/* On-the-fly verification */ +# define FBL_MEM_EXT_STATUS_VerifyCompute(status) +# define FBL_MEM_EXT_STATUS_VerifyFinalize(status) +/* Pass-through */ +# define FBL_MEM_EXT_STATUS_PassThroughLocal(status) +# define FBL_MEM_EXT_STATUS_PassThroughRemote(status) + +/* Extended info: status contains current address */ +# define FBL_MEM_EXT_STATUS_ProgramAddress(status) FblErrStatSetAddress(status) +# define FBL_MEM_EXT_STATUS_EraseAddress(status) FblErrStatSetAddress(status) +#endif /* FBL_ENABLE_DEBUG_STATUS */ + +/* PRQA L:TAG_FblMemOem_0602_0603_1 */ +/* PRQA L:TAG_FblMemOem_3453_1 */ + +#endif /* FBL_MEM_OEM_H */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblMemOem_0602_0603: + Reason: Usage of reserved identifiers with leading underscores is accepted for compatibility reasons. + Risk: Name conflicts. + Prevention: Compile and link of the different variants in the component and integration test. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_MEM_OEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_nvpattern_oem.c b/Source/bsw/Fbl/fbl_nvpattern_oem.c new file mode 100644 index 0000000..4e4abf3 --- /dev/null +++ b/Source/bsw/Fbl/fbl_nvpattern_oem.c @@ -0,0 +1,131 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of pattern/mask based non-volatile information storage + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * TEMPLATE REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.04.00 2019-01-25 viskjs ESCAN00101824 Added patterns that can be validated multiple times + * ESCAN00101823 Added feature to store arbitrary values at end of logical block + * 01.04.01 2019-03-26 viskjs ESCAN00102200 No changes + * ESCAN00102204 No changes + * ESCAN00102646 No changes + * 01.04.02 2019-07-22 vistbe ESCAN00103605 No changes + * 01.04.03 2020-05-07 visjdn ESCAN00106002 No changes + * 01.04.04 2021-03-03 visrie ESCAN00108616 No changes + * ESCAN00108753 No changes + * FBL-3129 Added/adapted MemMap sections + * Update to MISRA 2012 + * 01.04.05 2021-03-16 visrie ESCAN00108859 No changes + * 01.05.00 2021-06-16 visrie FBL-3641 Support OTA use case and user extension + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +#define FBL_NVPATTERN_OEM_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_nvpattern_oem.h" + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLNVPATTERN_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined ( FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION ) +V_MEMROM0 V_MEMROM1 vuint8 V_MEMROM2 fblNvPatternMultiplicity[] = +{ + 1u, /**< kFblNvPatternId_PartitionValidity can be validated/invalidated once after erasure */ + 1u, /**< kFblNvPatternId_ModuleValidity can be validated/invalidated once after erasure */ +# if defined( FBL_ENABLE_FLASH_ERASED_DETECTION ) + 1u, /**< kFblNvPatternId_ErasedState can be validated/invalidated once after erasure */ +# endif + FBL_NVPATTERN_USER_PATTERN_MULTIPLICITY +}; +#endif /* FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION */ + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +V_MEMROM0 V_MEMROM1 tFblBlockProperty V_MEMROM2 fblNvBlockProperties[] = +{ + FBL_NVPATTERN_USER_PROPERTY_ENTRY +}; +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +#define FBLNVPATTERN_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblNvPatternOem_0724_EnumValNotUnique: + Reason: The same numerical value is associated to different enum entries, to allows each entry value to be used in + the appropriate context, keeping a better code structure and understanding. + Risk: Enum values can potentially be assigned with the same value unintentionally. + Prevention: Correct design. + + MD_FblNvPatternOem_3684: + Reason: The size of the array is determined only at compile time. + Risk: The code is less clear and require more analysis for a deep understanding. + Prevention: No prevention defined. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_NVPATTERN_OEM.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_nvpattern_oem.h b/Source/bsw/Fbl/fbl_nvpattern_oem.h new file mode 100644 index 0000000..4fb87f4 --- /dev/null +++ b/Source/bsw/Fbl/fbl_nvpattern_oem.h @@ -0,0 +1,196 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of pattern/mask based non-volatile information storage + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * TEMPLATE REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2017-02-24 visci - Initial version + * 01.01.00 2018-06-15 visci ESCAN00099699 No changes + * 01.02.00 2018-09-24 visrr ESCAN00100837 No changes + * 01.03.00 2018-12-07 visshs ESCAN00101559 No changes + * 01.04.00 2019-01-25 viskjs ESCAN00101824 Added patterns that can be validated multiple times + * ESCAN00101823 Added feature to store arbitrary values at end of logical block + * 01.04.01 2019-03-26 viskjs ESCAN00102200 No changes + * ESCAN00102204 No changes + * ESCAN00102646 No changes + * 01.04.02 2019-07-22 vistbe ESCAN00103605 No changes + * 01.04.03 2020-05-07 visjdn ESCAN00106002 No changes + * 01.04.04 2021-03-03 visrie ESCAN00108616 No changes + * ESCAN00108753 No changes + * FBL-3129 Added/adapted MemMap sections + * Update to MISRA 2012 + * 01.04.05 2021-03-16 visrie ESCAN00108859 No changes + * 01.05.00 2021-06-16 visrie FBL-3641 Support OTA use case and user extension + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +#ifndef FBLLIB_NVPATTERN_OEM_H +#define FBLLIB_NVPATTERN_OEM_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Check if multiple validation feature was explicitly enabled externally */ +# if !defined( FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION ) +/* Disables NvPatterns which can be validated multiple times after erasing a logical block */ +# define FBL_NVPATTERN_DISABLE_MULTIPLE_VALIDATION +# endif /* !FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION */ + +/* Check if block properties feature was explicitly enabled externally */ +# if !defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +/* Disables storing arbitrary data at the end of logical blocks */ +# define FBL_NVPATTERN_DISABLE_BLOCK_PROPERTIES +# endif /* !FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +/* Disable user patterns if they are not explicitly defined */ +#if !defined( FBL_NVPATTERN_USER_PATTERN_ID ) +# define FBL_NVPATTERN_USER_PATTERN_ID +#endif /* FBL_NVPATTERN_USER_PATTERN_ID */ +#if !defined( FBL_NVPATTERN_USER_PATTERN_MULTIPLICITY ) +# define FBL_NVPATTERN_USER_PATTERN_MULTIPLICITY +#endif /* FBL_NVPATTERN_USER_PATTERN_MULTIPLICITY */ +#if !defined( FBL_NVPATTERN_USER_PROPERTY_ID ) +# define FBL_NVPATTERN_USER_PROPERTY_ID +#endif /* FBL_NVPATTERN_USER_PROPERTY_ID */ +#if !defined( FBL_NVPATTERN_USER_PROPERTY_ENTRY ) +# define FBL_NVPATTERN_USER_PROPERTY_ENTRY +#endif /* FBL_NVPATTERN_USER_PROPERTY_ENTRY */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/* + * This module is used to store NvPatterns and block properties at the end of logical blocks. + * Block properties are used to store arbitrary data of the length defined in fblNvPatternElementLength to memory. + * Block properties can be written once after erasure of the logical block. + * NvPatterns are used to store a boolean value (valid/invalid). They can be set to valid + * several times if the respective value in fblNvPatternMultiplicity is set to > 1. + * + * MEMORY LAYOUT: + * + * |--------------------------------| <-- UPPER END of pattern/property area (usually end of logical block) + * | kFblNvPatternId_First | First NvPattern + * | ... | + * | kFblNvPatternId_Final | + * | kFblNvPatternId_Separator | <-- SEPARATOR between patterns and block properties (do NOT delete this entry) + * | kFblNvProperty_First | First block property + * | ... | + * | kFblNvProperty_Final | + * | kFblNvPatternId_Last | <-- LOWER END of pattern/property area (do NOT delete this entry) + * | | + * + * Note: the actual pattern/block property size is determined by the page size. + * All data elements are aligned to multiples of the page size of the respective device! + */ + +/* PRQA S 0724 TAG_FblNvPatternOem_0724 */ /* MD_FblNvPatternOem_0724_EnumValNotUnique */ +/* Identifiers for patterns and block properties */ +typedef enum +{ + kFblNvPatternId_Invalid = 0u /* do NOT change this entry */ + + /* PartitionValidity (OTA) and ApplValidity (BM) uses the same value */ + ,kFblNvPatternId_PartitionValidity + ,kFblNvPatternId_ApplValidity = kFblNvPatternId_PartitionValidity + + /* ModuleValidity (OTA) and BlockValidity (BM) uses the same value */ + ,kFblNvPatternId_ModuleValidity + ,kFblNvPatternId_BlockValidity = kFblNvPatternId_ModuleValidity +#if defined( FBL_ENABLE_FLASH_ERASED_DETECTION ) + ,kFblNvPatternId_ErasedState +#endif + + FBL_NVPATTERN_USER_PATTERN_ID + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) + ,kFblNvPatternId_Separator /* do NOT delete this entry */ + FBL_NVPATTERN_USER_PROPERTY_ID +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + ,kFblNvPatternId_Last /* do NOT delete this entry */ +} tFblNvPatternId; +/* PRQA L:TAG_FblNvPatternOem_0724 */ + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +typedef struct +{ + IO_SizeType length; + tFblNvPatternId dependentPattern; +} tFblBlockProperty; +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLNVPATTERN_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined ( FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION ) +/* PRQA S 3684 1 */ /* MD_FblNvPatternOem_3684 */ +V_MEMROM0 extern V_MEMROM1 vuint8 V_MEMROM2 fblNvPatternMultiplicity[]; +#endif /* FBL_NVPATTERN_ENABLE_MULTIPATTERNS */ + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +/* PRQA S 3684 1 */ /* MD_FblNvPatternOem_3684 */ +V_MEMROM0 extern V_MEMROM1 tFblBlockProperty V_MEMROM2 fblNvBlockProperties[]; +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +#define FBLNVPATTERN_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBLLIB_NVPATTERN_OEM_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_NVPATTERN_OEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_ramio.c b/Source/bsw/Fbl/fbl_ramio.c new file mode 100644 index 0000000..6dce637 --- /dev/null +++ b/Source/bsw/Fbl/fbl_ramio.c @@ -0,0 +1,418 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief RAM driver functions + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2013-10-23 visjhg - Initial release + * 01.01.00 2015-11-27 visase ESCAN00086297 Allow to override the RAM buffer base address via configuration + * 01.02.00 2016-06-17 visci ESCAN00090364 Added support for flashCode use case + * 01.02.01 2018-03-22 visdkl ESCAN00098872 No changes + * 01.02.02 2021-03-08 vishor ESCAN00108134 Added/adapted MemMap sections + * 01.03.00 2022-03-17 visstn FBL-4366 Perform MISRA 2012 migration + **********************************************************************************************************************/ + +#define FBL_RAMIO_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_ramio_inc.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLWRAPPERFLASH_XRAMHIS_VERSION != 0x0103u ) || \ + ( FBLWRAPPERFLASH_XRAMHIS_RELEASE_VERSION != 0x00u ) +# error "Error in FBL_RAMIO.C: Source and header file are inconsistent!" +#endif + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ + +/* Check if buffer size is correctly defined */ +#if defined( RAM_DRV_BUFFER_SIZE ) && ( RAM_DRV_BUFFER_SIZE > 0u ) +#else +# error "Error in FBL_RAMIO.C: Missing or wrong configuration of RAM_DRV_BUFFER_SIZE." +#endif + +/* Check if segment size and buffer size match each other */ +#if defined( RAM_DRV_SEGMENT_SIZE ) +# if ( RAM_DRV_SEGMENT_SIZE > 1u ) +# if ( 0u != (RAM_DRV_BUFFER_SIZE & (RAM_DRV_SEGMENT_SIZE - 1u)) ) +# error "Error in FBL_RAMIO.C: Inconsistent configuration of RAM_DRV_SEGMENT_SIZE and RAM_DRV_BUFFER_SIZE." +# endif +# endif +#endif + +/* Check if segment size has reasonable / supported value */ +#if defined( RAM_DRV_SEGMENT_SIZE ) +# if ( RAM_DRV_SEGMENT_SIZE == 1u ) || ( RAM_DRV_SEGMENT_SIZE == 2u ) || ( RAM_DRV_SEGMENT_SIZE == 4u ) +# else +# error "Error in FBL_RAMIO.C: Wrong configuration of RAM_DRV_SEGMENT_SIZE." +# endif +#endif + +#if defined( RAM_DRV_SEGMENT_SIZE ) && \ + defined( RAM_DRV_BASE_ADDRESS_OVERRIDE ) +/* Check alignment of base address */ +# if ( 0u != (RAM_DRV_BASE_ADDRESS_OVERRIDE & (RAM_DRV_SEGMENT_SIZE - 1u)) ) +# error "Error in FBL_RAMIO.C: Inconsistent configuration of RAM_DRV_SEGMENT_SIZE and RAM_DRV_BASE_ADDRESS_OVERRIDE." +# endif +#endif + +#if defined( RAM_DRV_POLLING_INTERVAL ) +# if ( 0u == RAM_DRV_POLLING_INTERVAL ) || \ + ( 0u != (RAM_DRV_POLLING_INTERVAL & (RAM_DRV_POLLING_INTERVAL - 1u)) ) +# error "Error in FBL_RAMIO.C: Wrong configuration of RAM_DRV_POLLING_INTERVAL (shall be 2^n)." +# endif +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( RAM_DRV_EXT_BUFFER ) +# define RAM_DRV_BUFFER RAM_DRV_EXT_BUFFER +#else +# define RAM_DRV_BUFFER g_RamData +#endif + +#if defined( RAM_DRV_BASE_ADDRESS_OVERRIDE ) +/** Allow to override the base address via fbl_ramio_cfg.h, e.g. if RAM_DRV_BUFFER shall be located at an arbitrary address */ +# define RAM_DRV_BASE_ADDRESS RAM_DRV_BASE_ADDRESS_OVERRIDE +#else +/** Base address of accessible RAM area */ +# define RAM_DRV_BASE_ADDRESS ((IO_PositionType)RAM_DRV_BUFFER) +#endif + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#if defined( RAM_DRV_EXT_BUFFER ) +#else +# define FBLRAMIO_START_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/** Global data buffer that can be accessed via RamDriver interface */ +V_MEMRAM0 static V_MEMRAM1 IO_U8 V_MEMRAM2 g_RamData[RAM_DRV_BUFFER_SIZE]; + +# define FBLRAMIO_STOP_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* RAM_DRV_EXT_BUFFER */ + +#define FBLRAMIO_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +static IO_ErrorType V_API_NEAR RamDriver_GetOffset( IO_SizeType length, IO_PositionType address, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pOffset ); + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * RamDriver_GetOffset + **********************************************************************************************************************/ +/*! \brief Get the local buffer offset + * \param[in] length The number of bytes to be modified + * \param[in] address The start address + * \param[out] offset The returned offset + * \return IO_E_OK if succeeded, IO_E_NOT_OK otherwise + **********************************************************************************************************************/ +static IO_ErrorType V_API_NEAR RamDriver_GetOffset( IO_SizeType length, IO_PositionType address, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pOffset ) +{ + IO_ErrorType result; + IO_SizeType offset; + + result = IO_E_NOT_OK; + + /* Avoid compiler warning (comparison against 0 always true) */ +#if defined( RAM_DRV_BASE_ADDRESS_OVERRIDE ) +# if ( 0u != RAM_DRV_BASE_ADDRESS ) + if (address >= RAM_DRV_BASE_ADDRESS) /* PRQA S 0306 */ /* MD_FblRamio_0306 */ +# endif +#endif + { + offset = address - RAM_DRV_BASE_ADDRESS; /* PRQA S 0306 */ /* MD_FblRamio_0306 */ + + if ( (length <= RAM_DRV_BUFFER_SIZE) + && (offset <= (RAM_DRV_BUFFER_SIZE - length)) ) + { + *pOffset = offset; + result = IO_E_OK; + } + } + + return result; +} + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * RamDriver_InitSync + **********************************************************************************************************************/ +/*! \brief Initialize the RAM algorithm + * \param[in] address Unused parameter for HIS interface compliance + * \return The return code shows the success of the initialization + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +IO_ErrorType V_API_NEAR RamDriver_InitSync( void * address ) +{ + IO_ErrorType result; +#if defined( RAM_DRV_ENABLE_MEM_INIT ) + IO_U32 i; +#endif + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)address; +#endif + + result = IO_E_OK; + +#if defined( RAM_DRV_BASE_ADDRESS_OVERRIDE ) + /* Alignment check executed by preprocessor (see configuration checks section) */ +#else + /* PRQA S 2992, 2996, 0306 1 */ /* MD_FblRamio_2992_2996, MD_FblRamio_2992_2996, MD_FblRamio_0306 */ + if (0u != (RAM_DRV_BASE_ADDRESS & (RAM_DRV_SEGMENT_SIZE - 1u))) + { + /* RAM buffer is not aligned with configured segment size */ + result = IO_E_NOT_OK; + } +#endif /* RAM_DRV_BASE_ADDRESS_OVERRIDE */ + +#if defined( RAM_DRV_ENABLE_MEM_INIT ) + if (IO_E_OK == result) /* PRQA S 2991, 2995 */ /* MD_FblRamio_2991_2995 */ + { + for (i = 0u; i < (RAM_DRV_BUFFER_SIZE / RAM_DRV_SEGMENT_SIZE); i++) + { +# if ( RAM_DRV_SEGMENT_SIZE == 1u ) + ((IO_U8 *)RAM_DRV_BUFFER)[i] = 0u; +# elif ( RAM_DRV_SEGMENT_SIZE == 2u ) + ((IO_U16 *)RAM_DRV_BUFFER)[i] = 0u; /* PRQA S 0310, 3305 */ /* MD_FblRamio_0310_3305 */ +# elif ( RAM_DRV_SEGMENT_SIZE == 4u ) + ((IO_U32 *)RAM_DRV_BUFFER)[i] = 0u; /* PRQA S 0310, 3305 */ /* MD_FblRamio_0310_3305 */ +# endif + +# if defined( RAM_DRV_POLLING_INTERVAL ) + /* PRQA S 2985, 2991, 2995 1 */ /* MD_FblRamio_2985, MD_FblRamio_2991_2995, MD_FblRamio_2991_2995 */ + if (0u == (i & (RAM_DRV_POLLING_INTERVAL - 1u))) + { + RAM_DRV_POLLING_FUNCTION(); + } +# endif /* RAM_DRV_POLLING_INTERVAL */ + } + } +#endif /* RAM_DRV_ENABLE_MEM_INIT */ + + return result; +} + +/*********************************************************************************************************************** + * RamDriver_DeinitSync + **********************************************************************************************************************/ +/*! \brief Deinitialize the RAM algorithm + * \param[in] address Unused parameter for HIS interface compliance + * \return The return code shows the success of the deinitialization + **********************************************************************************************************************/ +IO_ErrorType V_API_NEAR RamDriver_DeinitSync( void * address ) +{ + IO_ErrorType result; + + /* Clean-up memory */ + result = RamDriver_InitSync(address); + + return result; +} + +/*********************************************************************************************************************** + * RamDriver_RWriteSync + **********************************************************************************************************************/ +/*! \brief Program RAM memory + * \param[in] writeBuffer Write data buffer + * \param[in] writeLength Number of bytes to be written + * \param[in] writeAddress The write address + * \return Status of RAM programming + **********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_MSR_Rule8.13 */ +IO_ErrorType V_API_NEAR RamDriver_RWriteSync( IO_MemPtrType writeBuffer, IO_SizeType writeLength, IO_PositionType writeAddress ) +{ + IO_ErrorType result; + IO_SizeType offset; + IO_SizeType i; + + result = RamDriver_GetOffset(writeLength, writeAddress, &offset); + + if (IO_E_OK == result) + { + for (i = 0u; i < writeLength; i++) + { +#if defined( RAM_DRV_POLLING_INTERVAL ) + /* PRQA S 2985, 2991, 2995 1 */ /* MD_FblRamio_2985, MD_FblRamio_2991_2995, MD_FblRamio_2991_2995 */ + if (0u == (i & (RAM_DRV_POLLING_INTERVAL - 1u))) + { + RAM_DRV_POLLING_FUNCTION(); + } +#endif /* RAM_DRV_POLLING_INTERVAL */ + + RAM_DRV_BUFFER[offset] = writeBuffer[i]; + offset++; + } + } + + return result; +} + +/*********************************************************************************************************************** + * RamDriver_REraseSync + **********************************************************************************************************************/ +/*! \brief Erase RAM memory + * \pre RAM driver has to be initialized + * \param[in] eraseLength Number of bytes to be erased + * \param[in] eraseAddress The erase address + * \return Status of RAM erase + **********************************************************************************************************************/ +IO_ErrorType V_API_NEAR RamDriver_REraseSync( IO_SizeType eraseLength, IO_PositionType eraseAddress ) +{ +#if defined( RAM_DRV_DELETED ) + IO_ErrorType result; + IO_SizeType offset; + IO_SizeType i; + + result = RamDriver_GetOffset(eraseLength, eraseAddress, &offset); + + if (IO_E_OK == result) + { + for (i = 0u; i < eraseLength; i++) + { +# if defined( RAM_DRV_POLLING_INTERVAL ) + /* PRQA S 2985, 2991, 2995 1 */ /* MD_FblRamio_2985, MD_FblRamio_2991_2995, MD_FblRamio_2991_2995 */ + if (0u == (i & (RAM_DRV_POLLING_INTERVAL - 1u))) + { + RAM_DRV_POLLING_FUNCTION(); + } +# endif /* RAM_DRV_POLLING_INTERVAL */ + + RAM_DRV_BUFFER[offset] = RAM_DRV_DELETED; + offset++; + } + } + + return result; +#else /* ! RAM_DRV_DELETED */ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)eraseLength; + (void)eraseAddress; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + return IO_E_OK; +#endif /* ! RAM_DRV_DELETED */ +} + +/*********************************************************************************************************************** + * RamDriver_RReadSync + **********************************************************************************************************************/ +/*! \brief Read RAM memory + * \pre RAM driver has to be initialized + * \param[out] readBuffer Read data buffer + * \param[in] readLength Number of bytes to be read + * \param[in] readAddress The read address + * \return Status of RAM read + **********************************************************************************************************************/ +IO_ErrorType V_API_NEAR RamDriver_RReadSync( IO_MemPtrType readBuffer, IO_SizeType readLength, IO_PositionType readAddress ) +{ + IO_ErrorType result; + IO_SizeType offset; + IO_SizeType i; + + result = RamDriver_GetOffset(readLength, readAddress, &offset); + + if (IO_E_OK == result) + { + for (i = 0u; i < readLength; i++) + { +#if defined( RAM_DRV_POLLING_INTERVAL ) + /* PRQA S 2985, 2991, 2995 1 */ /* MD_FblRamio_2985, MD_FblRamio_2991_2995, MD_FblRamio_2991_2995 */ + if (0u == (i & (RAM_DRV_POLLING_INTERVAL - 1u))) + { + RAM_DRV_POLLING_FUNCTION(); + } +#endif /* RAM_DRV_POLLING_INTERVAL */ + + readBuffer[i] = RAM_DRV_BUFFER[offset]; + offset++; + } + } + + return result; +} + + +#define FBLRAMIO_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Module specific MISRA deviations: + + MD_FblRamio_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. + + MD_FblRamio_0310_3305: + Reason: Pointer is casted as different memory access sizes are utilized due to performance reasons. + Risk: Wrong pointer access is performed. + Prevention: Code inspection and test of the different variants in the component test. + + MD_FblRamio_2985: + Reason: Depending on configuration, RAM_DRV_POLLING_INTERVAL might be zero and thus + i & (RAM_DRV_POLLING_INTERVAL - 1u) might be redundant. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblRamio_2991_2995: + Reason: Depending on configuration, the controlling expression might always be true. This code structure maintains + readbillity. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblRamio_2992_2996: + Reason: Depending on configuration, the controlling expression might always be false. This code structure + maintains readbillity. + Risk: No identifiable risk. + Prevention: No prevention required. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_RAMIO.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_ramio.h b/Source/bsw/Fbl/fbl_ramio.h new file mode 100644 index 0000000..6a37445 --- /dev/null +++ b/Source/bsw/Fbl/fbl_ramio.h @@ -0,0 +1,92 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief RAM driver functions + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2013-10-23 visjhg - Initial release + * 01.01.00 2015-11-27 visase ESCAN00086297 No changes + * 01.02.00 2016-06-17 visci ESCAN00090364 No changes + * 01.02.01 2018-03-22 visdkl ESCAN00098872 No changes + * 01.02.02 2021-03-08 vishor ESCAN00108134 Added/adapted MemMap sections + * 01.03.00 2022-03-17 visstn FBL-4366 Perform MISRA 2012 migration + **********************************************************************************************************************/ + +#ifndef FBL_RAMIO_H +#define FBL_RAMIO_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblWrapperFlash_XRamHis CQComponent : Implementation */ +#define FBLWRAPPERFLASH_XRAMHIS_VERSION 0x0103u +#define FBLWRAPPERFLASH_XRAMHIS_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define IO_DRIVERMODUS SYNCRON +#define IO_DEVICETYPE RANDOM + +#ifndef V_API_NEAR +# define V_API_NEAR +#endif + +#define RAM_DRIVER_VERSION_MAJOR ((FBLWRAPPERFLASH_XRAMHIS_VERSION >> 8u) & 0xFFu) +#define RAM_DRIVER_VERSION_MINOR ((FBLWRAPPERFLASH_XRAMHIS_VERSION >> 0u) & 0xFFu) +#define RAM_DRIVER_VERSION_PATCH FBLWRAPPERFLASH_XRAMHIS_RELEASE_VERSION + +/* RAM driver properties */ +#if defined( RAM_DRV_SEGMENT_SIZE ) +# define RAM_SEGMENT_SIZE RAM_DRV_SEGMENT_SIZE /**< Smallest writeable segment */ +#endif +#if defined( RAM_DRV_DELETED ) +# define FBL_RAM_DELETED RAM_DRV_DELETED /**< Erase value of RAM memory */ +#endif + +#define RamDriver_GetVersionOfDriver() ((IO_U32)(RAM_DRIVER_VERSION_MAJOR << 16u) | \ + (IO_U32)(RAM_DRIVER_VERSION_MINOR << 8u) | \ + RAM_DRIVER_VERSION_PATCH) + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLRAMIO_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +IO_ErrorType V_API_NEAR RamDriver_InitSync( void * address); +IO_ErrorType V_API_NEAR RamDriver_DeinitSync( void * address ); +IO_ErrorType V_API_NEAR RamDriver_RReadSync( IO_MemPtrType readBuffer, IO_SizeType readLength, IO_PositionType readAddress ); +IO_ErrorType V_API_NEAR RamDriver_RWriteSync( IO_MemPtrType writeBuffer, IO_SizeType writeLength, IO_PositionType writeAddress ); +IO_ErrorType V_API_NEAR RamDriver_REraseSync( IO_SizeType eraseLength, IO_PositionType eraseAddress ); + +#define FBLRAMIO_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBL_RAMIO_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_RAMIO.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_ramio_inc.h b/Source/bsw/Fbl/fbl_ramio_inc.h new file mode 100644 index 0000000..6644f2d --- /dev/null +++ b/Source/bsw/Fbl/fbl_ramio_inc.h @@ -0,0 +1,49 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief RAM driver functions + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2013-10-23 visjhg - Initial release + * 01.01.00 2015-11-27 visase ESCAN00086297 No changes + * 01.02.00 2016-06-17 visci ESCAN00090364 No changes + * 01.02.01 2018-03-22 visdkl ESCAN00098872 No changes + * 01.02.02 2021-03-08 vishor ESCAN00108134 No changes + * 01.03.00 2022-03-17 visstn FBL-4366 Perform MISRA 2012 migration + **********************************************************************************************************************/ + +#ifndef FBL_RAMIO_INC_H +#define FBL_RAMIO_INC_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "iotypes.h" +#include "fbl_ramio_cfg.h" +#include "fbl_ramio.h" + +#endif /* FBL_RAMIO_INC_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_RAMIO_INC.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_sfr.h b/Source/bsw/Fbl/fbl_sfr.h new file mode 100644 index 0000000..282119e --- /dev/null +++ b/Source/bsw/Fbl/fbl_sfr.h @@ -0,0 +1,112 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Register definitions for AWR1 and AWR2 + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.04.00 2020-12-21 visrie FBL-2517 Added support for AWR1 + * 01.05.00 2021-01-28 visjdn FBL-2824 Added support for TPR12 + * 01.06.00 2021-05-19 visjdn FBL-3038 No changes + * 01.07.00 2021-05-31 visjdn FBL-3545 No changes + * 01.08.00 2021-07-08 visjdn FBL-3694 No changes + * 01.09.00 2021-11-22 vistmo FBL-4275 No changes + * 01.10.00 2022-01-12 visjdn FBL-3720 No changes + * 01.11.00 2022-03-09 visrie FBL-4770 No changes + * 01.12.00 2022-07-18 visjdn FBL-5115 No changes + * 01.13.00 2023-02-09 fmenke FBL-6162 No changes + * ESCAN00113692 No changes + * 01.14.00 2023-04-20 jschmitding FBL-5733 No changes + * 01.15.00 2023-07-12 fmenke FBL-6966 No changes + * 01.16.00 2024-01-01 fmenke FBL-7559 No changes + * ESCAN00116504 No changes + * 01.17.00 2024-09-27 jschmitding FBL-9330 Add support Sitara AM263x + * 01.17.01 2024-10-22 visrie ESCAN00118141 No changes + * 01.18.00 2024-12-02 fmenke FBL-9747 No changes + * 01.19.00 2025-11-19 jostravsky FBL-11077 No changes + **********************************************************************************************************************/ + +#ifndef FBL_SFR_H +#define FBL_SFR_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if defined( FBL_SFR_BASE_ADRESSES_PRECONFIGURED ) +#else +# error "Error in fbl_sfr.h: Please add base addresses for your derivative to the .pcu file." +#endif /* FBL_SFR_BASE_ADRESSES_PRECONFIGURED */ + +/* PRQA S 3453 TAG_SfrDefinitionMacros */ /* MD_MSR_FctLikeMacro */ + +#ifndef FBL_IOS +# define FBL_IOS(type, base, offset) (*((volatile type *)((base) + (offset)))) +#endif + +/* RTI Registers */ +#define FBL_RTI_GCTRL FBL_IOS(vuint32, FBL_RTI_BASE, 0x0000uL) /** RTI Global Control */ +#define FBL_RTI_TBCTRL FBL_IOS(vuint32, FBL_RTI_BASE, 0x0004uL) /** RTI Timebase Control */ +#define FBL_RTI_CAPCTRL FBL_IOS(vuint32, FBL_RTI_BASE, 0x0008uL) /** RTI Capture Control */ +#define FBL_RTI_COMPCTRL FBL_IOS(vuint32, FBL_RTI_BASE, 0x000CuL) /** RTI Compare Control */ +#define FBL_RTI_FRC(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0010uL + ((x) * 0x0020uL)) /** RTI Free Running Counter */ +#define FBL_RTI_UC(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0014uL + ((x) * 0x0020uL)) /** RTI Up Counter */ +#define FBL_RTI_CPUC(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0018uL + ((x) * 0x0020uL)) /** RTI Compare Up Counter */ +#define FBL_RTI_CAFRC(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0020uL + ((x) * 0x0020uL)) /** RTI Capture Free Running Counter */ +#define FBL_RTI_CAUC(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0024uL + ((x) * 0x0020uL)) /** RTI Capture Up Counter */ +#define FBL_RTI_COMP(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0050uL + ((x) * 0x0008uL)) /** RTI Compare */ +#define FBL_RTI_UDCP(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x0054uL + ((x) * 0x0008uL)) /** RTI Update Compare */ +#define FBL_RTI_INTFLAG FBL_IOS(vuint32, FBL_RTI_BASE, 0x0088uL) /** RTI Interrupt Flag */ +#define FBL_RTI_CMPCLR(x) FBL_IOS(vuint32, FBL_RTI_BASE, 0x00B0uL + ((x) * 0x0004uL)) /** RTI Compare Clear */ + +#define FBL_RTI_TIMER_MS 0u /* Timer used for milliseconds */ +#define FBL_RTI_TIMER_FREE 1u /* Timer used as free running */ +#define FBL_RTI_GCTRL_TIMER_ENABLE 0x00000003uL /* Enable bits for timer 1 and 2 */ +#define FBL_RTI_COMPCTRL_TIMER_SELECT 1uL /* Select bit for Compare0 */ + +/* GPIO handling */ +#if defined( FBL_GIO_BASE ) +# define FBLHW_ENABLE_GPIO_HANDLING +#else +# define FBLHW_DISABLE_GPIO_HANDLING +#endif /* FBL_GIO_BASE */ + +#if defined( FBLHW_ENABLE_GPIO_HANDLING ) +/* GPIO Registers */ +# define FBL_GIO_GCR FBL_IOS(vuint32, FBL_GIO_BASE, 0x0000uL) /** GIO reset */ +# define FBL_GIO_WDN FBL_IOS(vuint32, FBL_GIO_BASE, 0x0004uL) /** GIO power down mode register */ +# define FBL_GIO_DIR(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0034uL + ((x) * 0x0020uL)) /** GIO data direction of pins */ +# define FBL_GIO_DIN(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0038uL + ((x) * 0x0020uL)) /** GIO data input for pins */ +# define FBL_GIO_DOUT(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x003CuL + ((x) * 0x0020uL)) /** GIO data output for pins */ +# define FBL_GIO_SET(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0040uL + ((x) * 0x0020uL)) /** GIO data set */ +# define FBL_GIO_CLR(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0044uL + ((x) * 0x0020uL)) /** GIO data clear */ +# define FBL_GIO_PDR(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0048uL + ((x) * 0x0020uL)) /** GIO open drain */ +# define FBL_GIO_PULDIS(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x004CuL + ((x) * 0x0020uL)) /** GIO pul disable */ +# define FBL_GIO_PSL(x) FBL_IOS(vuint32, FBL_GIO_BASE, 0x0050uL + ((x) * 0x0020uL)) /** GIO pul select */ +#endif /* FBLHW_ENABLE_GPIO_HANDLING */ + +/* PRQA L:TAG_SfrDefinitionMacros */ + +#endif /* FBL_SFR_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_SFR.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_valstruct.c b/Source/bsw/Fbl/fbl_valstruct.c new file mode 100644 index 0000000..1576694 --- /dev/null +++ b/Source/bsw/Fbl/fbl_valstruct.c @@ -0,0 +1,1171 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of a download check by using an embedded validation structure + * Declaration of functions, variables and constants + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-07-01 visci - Initial version + * 01.01.00 2017-02-03 visci ESCAN00093858 Added support for compatibility check + * vacel Added blank check functionality + * Added API for external public key + * Reworked return value handling + * 01.01.01 2017-11-09 visci ESCAN00096836 Compiler warning: Function declared but not used + * 01.01.02 2018-03-23 visdkl ESCAN00097287 Bootloader does not properly use configuration of CLASS_DDD + * 01.02.00 2018-06-15 visci ESCAN00098963 Corrected return value for public key read failure + * 2018-09-24 visrr ESCAN00100838 Added user callout for different erase values in OTA use case + * 01.03.00 2019-01-25 visci ESCAN00098904 Improved verification sequence + * ESCAN00101065 Alignment for Blank Check is not applied correctly + * ESCAN00101321 Added option to skip download segment check + * 01.03.01 2019-02-06 visci ESCAN00102005 Signature is not taken into account when comparing segments + * 01.04.00 2019-06-14 visci ESCAN00102956 Internal checksum option fails if validation structure is not the + * last segment + * ESCAN00102957 Potential buffer overflow during internal checksum calculation + * 01.05.00 2019-06-25 visdlm ESCAN00103492 Added gap fill mechanism + * 01.05.01 2021-01-18 visjdn ESCAN00107640 Memory read error leads always to invalid format error + * 01.05.02 2021-06-01 vishor ESCAN00109198 The verification key will not be cleared from memory (RAM) after usage + * 01.06.00 2022-04-28 visstn FBL-4366 Perform MISRA 2012 migration + * 01.07.00 2022-10-12 visjdn FBL-5694 Support of Xiaomi validation structure + * 01.08.00 2022-11-25 vistbe FBL-6055 Extend configurability of checksum and signature + * 01.08.01 2023-02-02 vistbe ESCAN00113401 No changes + **********************************************************************************************************************/ + +#define FBL_VALSTRUCT_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_valstruct.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLVALSTRUCT_VERSION != 0x0108u ) || \ + ( FBLVALSTRUCT_RELEASE_VERSION != 0x01u ) +# error "Error in fbl_valstruct.c: Source and header file are inconsistent!" +#endif + +#if ( FBLVALSTRUCT_VERSION != _FBLVALSTRUCT_VERSION ) || \ + ( FBLVALSTRUCT_RELEASE_VERSION != _FBLVALSTRUCT_RELEASE_VERSION ) +# error "Error in fbl_valstruct.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +/*** Validation structure defines ***/ +# define FBL_VALSTRUCT_PROLOG_SIZE (FBL_VALSTRUCT_TAG_SIZE + FBL_VALSTRUCT_VERSION_SIZE + FBL_VALSTRUCT_BLOCKCOUNT_SIZE + FBL_VALSTRUCT_ALFI_SIZE) +# define FBL_VALSTRUCT_BLOCKINFO_SIZE (FBL_VALSTRUCT_BLOCKADDRESS_SIZE + FBL_VALSTRUCT_BLOCKLENGTH_SIZE + FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE) +# define FBL_VALSTRUCT_EPILOG_SIZE (FBL_VALSTRUCT_TAG_SIZE + FBL_VALSTRUCT_VALIDATESUM_SIZE) +# define FBL_VALSTRUCT_MAX_SIZE (FBL_VALSTRUCT_PROLOG_SIZE + (FBL_VALSTRUCT_BLOCKCOUNT_MAX * FBL_VALSTRUCT_BLOCKINFO_SIZE) + FBL_VALSTRUCT_EPILOG_SIZE) + +/* Offset values for validation struct members */ +# define FBL_VALSTRUCT_TAGBEGIN_OFFSET (0x00u) +# define FBL_VALSTRUCT_VERSION_OFFSET (FBL_VALSTRUCT_TAGBEGIN_OFFSET + FBL_VALSTRUCT_TAG_SIZE) +# define FBL_VALSTRUCT_BLOCKCOUNT_OFFSET (FBL_VALSTRUCT_VERSION_OFFSET + FBL_VALSTRUCT_VERSION_SIZE) +# define FBL_VALSTRUCT_ALFI_OFFSET (FBL_VALSTRUCT_BLOCKCOUNT_OFFSET + FBL_VALSTRUCT_BLOCKCOUNT_SIZE) +# define FBL_VALSTRUCT_BLOCKADDRESS_OFFSET(index) (FBL_VALSTRUCT_ALFI_OFFSET + FBL_VALSTRUCT_ALFI_SIZE + ((index) * FBL_VALSTRUCT_BLOCKINFO_SIZE)) +# define FBL_VALSTRUCT_BLOCKLENGTH_OFFSET(index) (FBL_VALSTRUCT_BLOCKADDRESS_OFFSET(index) + FBL_VALSTRUCT_BLOCKADDRESS_SIZE) +# define FBL_VALSTRUCT_BLOCKCHECKSUM_OFFSET(index) (FBL_VALSTRUCT_BLOCKLENGTH_OFFSET(index) + FBL_VALSTRUCT_BLOCKLENGTH_SIZE) +# define FBL_VALSTRUCT_TAGEND_OFFSET(blockcount) (FBL_VALSTRUCT_BLOCKADDRESS_OFFSET(0u) + ((blockcount) * FBL_VALSTRUCT_BLOCKINFO_SIZE)) +# define FBL_VALSTRUCT_VALIDATESUM_OFFSET(blockcount) (FBL_VALSTRUCT_TAGEND_OFFSET(blockcount) + FBL_VALSTRUCT_TAG_SIZE) + +/* Access macros to extract validation struct information from a RAM buffer */ +/* Note: this macro requires that the validation structure is built in big-endian mode! */ +# define FblValStructGetUint32(buffer) FblMemGetInteger(sizeof(vuint32), (buffer)) +# define FblValStructGetUint16(buffer) ((vuint16)(FblMemGetInteger(sizeof(vuint16), (buffer)) & 0xFFFFu)) +# define FblValStructGetUint8(buffer) ((vuint8)(FblMemGetInteger(sizeof(vuint8), (buffer)) & 0xFFu)) +# define FblValStructGetTagBegin(buffer) FblValStructGetUint32(&(buffer)[FBL_VALSTRUCT_TAGBEGIN_OFFSET]) +# define FblValStructGetVersion(buffer) FblValStructGetUint16(&(buffer)[FBL_VALSTRUCT_VERSION_OFFSET]) +# if (FBL_VALSTRUCT_BLOCKCOUNT_SIZE == 1u) +# define FblValStructGetBlockCount(buffer) FblValStructGetUint8(&(buffer)[FBL_VALSTRUCT_BLOCKCOUNT_OFFSET]) +# elif (FBL_VALSTRUCT_BLOCKCOUNT_SIZE == 2u) +# define FblValStructGetBlockCount(buffer) FblValStructGetUint16(&(buffer)[FBL_VALSTRUCT_BLOCKCOUNT_OFFSET]) +# endif +# if (FBL_VALSTRUCT_ALFI_SIZE == 1u) +# define FblValStructGetAlfi(buffer) FblValStructGetUint8(&(buffer)[FBL_VALSTRUCT_ALFI_OFFSET]) +# endif +# define FblValStructGetBlockAddress(buffer, index) FblValStructGetUint32(&(buffer)[FBL_VALSTRUCT_BLOCKADDRESS_OFFSET(index)]) +# define FblValStructGetBlockLength(buffer, index) FblValStructGetUint32(&(buffer)[FBL_VALSTRUCT_BLOCKLENGTH_OFFSET(index)]) +# define FblValStructGetBlockChecksum(buffer, index, cs) (void)MEMCPY(cs, &(buffer)[FBL_VALSTRUCT_BLOCKCHECKSUM_OFFSET(index)], FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE) +# define FblValStructGetTagEnd(buffer, blockcount) FblValStructGetUint32(&(buffer)[FBL_VALSTRUCT_TAGEND_OFFSET(blockcount)]) +# define FblValStructGetValidateSum(buffer, blockcount) FblValStructGetUint16(&(buffer)[FBL_VALSTRUCT_VALIDATESUM_OFFSET(blockcount)]) + +/* Calculate the actual size of the validation structure based on the given block count */ +# define FblValStructGetTotalSize(blockcount) (FBL_VALSTRUCT_PROLOG_SIZE + ((blockcount) * FBL_VALSTRUCT_BLOCKINFO_SIZE) + FBL_VALSTRUCT_EPILOG_SIZE) + +/* Macros used to retrieve the requested ValStruct processing options */ +# define FblValStructOptionChecksumInternal(opt) (((opt) & FBL_VALSTRUCT_OPTION_CHECKSUM_INTERNAL) == FBL_VALSTRUCT_OPTION_CHECKSUM_INTERNAL) +# define FblValStructOptionBlankCheck(opt) (((opt) & FBL_VALSTRUCT_OPTION_BLANKCHECK) == FBL_VALSTRUCT_OPTION_BLANKCHECK) +# define FblValStructOptionGapFill(opt) (((opt) & FBL_VALSTRUCT_OPTION_GAP_FILL) == FBL_VALSTRUCT_OPTION_GAP_FILL) + +/* Configuration specific definition of output buffer size for verification */ +# if defined( SEC_ENABLE_SECURITY_CLASS_DDD ) +# if defined( SEC_ENABLE_CRC_WRITTEN_CLASS_DDD ) +# define FBL_VALSTRUCT_VERIFY_SIZE (FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE + SEC_SIZE_CHECKSUM_CRC) +# else +# define FBL_VALSTRUCT_VERIFY_SIZE (FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE) +# endif +# endif + +# if !defined( FBL_VALSTRUCT_GAP_FILL_SEGMENTATION ) +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +# define FBL_VALSTRUCT_GAP_FILL_SEGMENTATION FBL_MAX_SEGMENT_SIZE +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ +# endif + +/* If signature support is not explictily enabled or disabled set it based on the security class */ +# if !defined( FBL_VALSTRUCT_ENABLE_SIGNATURE ) && !defined( FBL_VALSTRUCT_DISABLE_SIGNATURE ) +# if (SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC) +# define FBL_VALSTRUCT_ENABLE_SIGNATURE +# endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ +# endif /* !FBL_VALSTRUCT_ENABLE_SIGNATURE */ + +# if defined( FBL_VALSTRUCT_ENABLE_SIGNATURE ) && defined( FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY ) +# if !defined( FblValStructClrPublicKey ) +# define FblValStructClrPublicKey(x) +# endif /* FblValStructClrPublicKey */ +# endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ +#endif /* FBL_ENABLE_VALSTRUCT */ + +/* Evaluate size of common buffer which is used for memory read/write operations. */ +#if !defined( FBL_VALSTRUCT_READ_BUFFER_SIZE ) +# if defined( FBL_ENABLE_VALSTRUCT ) +# if ((defined(FBL_VALSTRUCT_ENABLE_SIGNATURE)) && (FBL_VALSTRUCT_SIGNATURE_SIZE > FBL_VALSTRUCT_MAX_SIZE)) + /* Set buffer size to signature size */ +# define FBL_VALSTRUCT_READ_BUFFER_SIZE FBL_VALSTRUCT_SIGNATURE_SIZE +# else + /* Set buffer size to maximum possible size of validation structure */ + # define FBL_VALSTRUCT_READ_BUFFER_SIZE FBL_VALSTRUCT_MAX_SIZE +# endif +# endif /* FBL_ENABLE_VALSTRUCT */ +#endif + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +typedef struct +{ + vuintx alignDummy; + vuint8 data[FBL_VALSTRUCT_READ_BUFFER_SIZE]; +} tAlignedReadBuffer; + +/** Structure which keeps segment information */ +typedef tDiagSegmentList tVsSegInfo; + +/** Structure which keeps information about/from the validation structure */ +typedef struct +{ + tFblAddress address; /**< Start address of validation structure */ + tFblLength length; /**< Total length of validation structure */ + tVsSegInfo segInfo; /**< Segment information contained in validation structure */ + vuint8 vsSeg; /**< Index of segment which keeps the validation structure */ +} tVsInfo; +#endif /* FBL_ENABLE_VALSTRUCT */ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +# define FBL_VALSTRUCT_START_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 static V_MEMRAM1 tAlignedReadBuffer V_MEMRAM2 readBuffer; /* PRQA S 3218 */ /* MD_FblValStruct_3218 */ +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +V_MEMRAM0 static V_MEMRAM1 vuint8 V_MEMRAM2 gapFillBuffer[FBL_VALSTRUCT_GAP_FILL_SEGMENTATION]; +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ +# define FBL_VALSTRUCT_STOP_SEC_VAR +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_ENABLE_VALSTRUCT */ + +/*********************************************************************************************************************** + * PROTOTYPES + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +# define FBL_VALSTRUCT_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +# if ( FBL_VALSTRUCT_VALIDATESUM_SIZE > 0u ) +static vuint16 FblValStructCalculateByteChecksum( const vuint8* address, tFblLength size ); +# endif +static tFblValStructResult FblValStructGetSegmentInfo( tVsInfo * vsInfo ); +static void FblValStructRemoveStructSegment( const tVsInfo * vsInfo, tDiagSegmentList * blockSegInfo ); +# if defined ( FBL_VALSTRUCT_ENABLE_SIGNATURE ) +static tFblValStructResult FblValStructVerification( const tVsInfo * vsInfo, + SecM_ByteType * verifyData ); +# endif /* FBL_VALSTRUCT_ENABLE_SIGNATURE */ +# if defined( FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL ) +static void FblValStructLocateStructSegment( tVsInfo * vsInfo ); +static tFblValStructResult FblValStructChecksumInternal( tVsInfo * vsInfo, + tDiagSegmentList * blockSegInfo ); +# endif +static tFblValStructResult FblValStructChecksumExternal( const tBlockDescriptor * blockDescriptor, + tVsInfo * vsInfo, + tDiagSegmentList * blockSegInfo); +static tFblValStructResult FblValStructCompareSegmentLocation( tVsInfo * vsInfo, + const tDiagSegmentList * blockSegInfo); +static tFblValStructResult FblValStructCompareSegmentChecksum( const tVsSegInfo * vsSegInfo, + const tDiagSegmentList * blockSegInfo ); +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) +static tFblValStructResult FblValStructBlankCheck( tFblAddress memAddress, tFblLength memLength ); +# endif /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK */ + +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +static tFblValStructResult FblValStructGapFill( tFblAddress memAddress, tFblLength memLength ); +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) || \ + defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +static tFblAddress FblValStructSkipFilledArea( tFblAddress address, vsint16 memSeg ); +static tFblValStructResult FblValStructGapProcessing( const tBlockDescriptor * blockDescriptor, + const tDiagSegmentList * blockSegInfo ); +# endif +# define FBL_VALSTRUCT_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_ENABLE_VALSTRUCT */ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +# define FBL_VALSTRUCT_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +# if ( FBL_VALSTRUCT_VALIDATESUM_SIZE > 0u ) +/*********************************************************************************************************************** + * FblValStructCalculateByteChecksum + **********************************************************************************************************************/ +/*! \brief Calculate a 16-bit sized byte checksum over the buffer content. + * \param[in] address Pointer to data buffer in RAM + * \param[in] size Size of data in buffer + * \return Calculated checksum value + **********************************************************************************************************************/ +static vuint16 FblValStructCalculateByteChecksum( const vuint8 * address, tFblLength size ) +{ + const vuint8 * bytePtr = address; + vuint16 byteChecksum = 0u; + + while (bytePtr < (&address[size])) + { + byteChecksum += *bytePtr; + bytePtr = &bytePtr[1u]; + + /* Keep up bootloader timing and watchdog service */ + if (((tFblAddress)bytePtr & 0xFu) == 0u) /* PRQA S 0306 */ /* MD_FblValStruct_0306 */ + { + /* Call service function every 16th loop cycle */ + (void)FblLookForWatchdog(); + } + } + + return byteChecksum; +} +# endif /* FBL_VALSTRUCT_VALIDATESUM_SIZE > 0u */ + +/*********************************************************************************************************************** + * FblValStructGetSegmentInfo + **********************************************************************************************************************/ +/*! \brief Check presence and integrity of the validation structure and extract the segment information. + * \param[in,out] vsInfo Start address (in) and length (out) of validation structure, segment information (out) + * \return kFblValStructOk = validation structure has been read successfully + * other value = reading of validation structure failed + **********************************************************************************************************************/ +/* PRQA S 6010, 6030 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC */ +static tFblValStructResult FblValStructGetSegmentInfo( tVsInfo * vsInfo ) +{ + tFblValStructResult result; + tFblLength vsTotalSize; + vuint16 segIndex, vsSegCount; +# if ( FBL_VALSTRUCT_VALIDATESUM_SIZE > 0u ) + vuint16 validateSum; +# endif + + /* Initialize return value */ + result = kFblValStructOk; + + /* Initialize total size */ + vsTotalSize = 0u; + + /* Read begin tag, version and block count of validation structure */ + if (FblReadProm(vsInfo->address, readBuffer.data, FBL_VALSTRUCT_PROLOG_SIZE) != FBL_VALSTRUCT_PROLOG_SIZE) + { + /* Memory read error (e.g. invalid memory region) */ + result = kFblValStructMemoryReadError; + } + +# if ( FBL_VALSTRUCT_TAG_SIZE > 0u ) + if (kFblValStructOk == result) + { + /* Check begin tag */ + if (FblValStructGetTagBegin(readBuffer.data) != FBL_VALSTRUCT_TAGBEGIN_PATTERN) + { + /* Begin tag invalid */ + result = kFblValStructInvalidFormat; + } + } +# endif + +# if ( FBL_VALSTRUCT_VERSION_SIZE > 0u ) + if (kFblValStructOk == result) + { + /* Check if structure version is supported */ + if (FblValStructIsVersionSupported(FblValStructGetVersion(readBuffer.data)) != kFblValStructOk) + { + /* Begin tag invalid */ + result = kFblValStructInvalidFormat; + } + } +# endif + + if (kFblValStructOk == result) + { + /* Check block count */ + vsSegCount = FblValStructGetBlockCount(readBuffer.data); + if (vsSegCount <= FBL_VALSTRUCT_BLOCKCOUNT_MAX) + { + vsInfo->segInfo.nrOfSegments = (vuint8)vsSegCount; + } + else + { + /* Maximum block count exceeded */ + result = kFblValStructInvalidFormat; + } + } + +# if (FBL_VALSTRUCT_ALFI_SIZE == 1u) + if (kFblValStructOk == result) + { + /* Check ALFI */ + if (FblValStructGetAlfi(readBuffer.data) != (FBL_VALSTRUCT_BLOCKADDRESS_SIZE + (FBL_VALSTRUCT_BLOCKLENGTH_SIZE << 4u))) + { + /* ALFI is invalid */ + result = kFblValStructInvalidFormat; + } + } +# endif + + if (kFblValStructOk == result) + { + /* Calculate total validation struct size */ + vsTotalSize = FblValStructGetTotalSize((vuint32) vsInfo->segInfo.nrOfSegments); /* PRQA S 2985 */ /* MD_FblValStruct_2985 */ + + /* Block count value OK, read the rest of the validation structure */ + if (FblReadProm((vsInfo->address + FBL_VALSTRUCT_PROLOG_SIZE), + &(readBuffer.data[FBL_VALSTRUCT_PROLOG_SIZE]), + (vsTotalSize - FBL_VALSTRUCT_PROLOG_SIZE)) != (vsTotalSize - FBL_VALSTRUCT_PROLOG_SIZE)) + { + /* Memory read error (e.g. invalid memory region) */ + result = kFblValStructMemoryReadError; + } + } + +# if ( FBL_VALSTRUCT_TAG_SIZE > 0u ) + if (kFblValStructOk == result) + { + /* Check end tag */ + if (FblValStructGetTagEnd(readBuffer.data, vsInfo->segInfo.nrOfSegments) != FBL_VALSTRUCT_TAGEND_PATTERN) + { + /* End tag invalid */ + result = kFblValStructInvalidFormat; + } + } +# endif + +# if ( FBL_VALSTRUCT_VALIDATESUM_SIZE > 0u ) + if (kFblValStructOk == result) + { + /* Check integrity of validation structure (verify byte checksum) */ + validateSum = FblValStructCalculateByteChecksum(readBuffer.data, (vsTotalSize - FBL_VALSTRUCT_VALIDATESUM_SIZE)); + if (validateSum != FblValStructGetValidateSum(readBuffer.data, vsInfo->segInfo.nrOfSegments)) + { + /* Validation information corrupt */ + result = kFblValStructInvalidFormat; + } + } +# endif + + if (kFblValStructOk == result) + { + /* Extract block information. This separate step ensures correct data */ + /* interpretation regardless of endianess and structure alignment. */ + for (segIndex = 0; segIndex < vsInfo->segInfo.nrOfSegments; segIndex++) + { + vsInfo->segInfo.segmentInfo[segIndex].targetAddress = FblValStructGetBlockAddress(readBuffer.data, segIndex); + vsInfo->segInfo.segmentInfo[segIndex].length = FblValStructGetBlockLength(readBuffer.data, segIndex); + /* PRQA S 0314 1 */ /* MD_FblValStruct_0314 */ + FblValStructGetBlockChecksum(readBuffer.data, segIndex, vsInfo->segInfo.segmentInfo[segIndex].checksum); + } + } + + /* Return total length of structure */ + vsInfo->length = vsTotalSize; + + return result; +} + +/*********************************************************************************************************************** + * FblValStructRemoveStructSegment + **********************************************************************************************************************/ +/*! \brief Determine download segment which keeps the validation structure and remove it from the list + * \pre vsInfo->vsSeg has to be set before (validation structure segment) + * \param[in] vsInfo Structure which keeps information about validation structure (out: vsSeg) + * \param[in,out] blockSegInfo Output segment list which contains the newly calculated checksum values + * \return kFblValStructOk = validation structure identified and removed + * other value = validation structure not found + **********************************************************************************************************************/ +static void FblValStructRemoveStructSegment( const tVsInfo * vsInfo, tDiagSegmentList * blockSegInfo ) +{ + vuint8 segIdx; + + /* Remove ValStruct segment from list */ + for (segIdx = vsInfo->vsSeg + 1u; segIdx < blockSegInfo->nrOfSegments; segIdx++) + { + blockSegInfo->segmentInfo[segIdx - 1u] = blockSegInfo->segmentInfo[segIdx]; + } + + /* Fix number of segments */ + blockSegInfo->nrOfSegments--; +} + +# if defined( FBL_VALSTRUCT_ENABLE_SIGNATURE ) +/*********************************************************************************************************************** + * FblValStructVerification + **********************************************************************************************************************/ +/*! \brief The flash memory content is verified according to the configured CCC algorithm + * \param[in] vsInfo Structure which keeps information about validation structure + * \param[in] verifyData Input buffer which keeps the signature data for comparison with the calculated value + * \return kFblValStructOk = Authentication succeeded + * other value = Authentication failed (or memory access error) + **********************************************************************************************************************/ +static tFblValStructResult FblValStructVerification( const tVsInfo * vsInfo, SecM_ByteType * verifyData ) +{ +# if defined( FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY ) + SecM_AsymKeyType publicKey; +# endif + SecM_VerifyParamType verifyParam; + FL_SegmentInfoType verifySegmentInfo[1u]; + SecM_StatusType secStatus; + tFblValStructResult result; + + result = kFblValStructOk; + + /* Configure segment which shall be verified */ + verifySegmentInfo[0u].targetAddress = vsInfo->address; + verifySegmentInfo[0u].transferredAddress = verifySegmentInfo[0u].targetAddress; + verifySegmentInfo[0u].length = vsInfo->length; + verifyParam.segmentList.segmentInfo = verifySegmentInfo; + verifyParam.segmentList.nrOfSegments = 1u; + verifyParam.blockStartAddress = verifySegmentInfo[0u].targetAddress; + verifyParam.blockLength = verifySegmentInfo[0u].length; + verifyParam.verificationData = verifyData; + verifyParam.wdTriggerFct = (FL_WDTriggerFctType)FblRealTimeSupport; /* PRQA S 0313 */ /* MD_FblValStruct_0313_WDTriggerFctType */ + verifyParam.readMemory = (FL_ReadMemoryFctType)FblReadProm; +# if defined( FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY ) + publicKey.shared.size = sizeof(SecM_RsaMod); + publicKey.individual.size = sizeof(SecM_RsaExp); + + if (kFblOk == FblValStructGetPublicKey(&publicKey)) + { + verifyParam.key = &publicKey; /* PRQA S 0315 */ /* MD_FblValStruct_0315 */ + } + else + { + /* An error occured and the key was not able to be retrieved */ + result = kFblValStructKeyError; + } +# else + /* Use the internal key */ + verifyParam.key = SEC_VERIFY_KEY_NULL; +# endif /* FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY */ + + if (kFblValStructOk == result) /* PRQA S 2991, 2995 */ /* MD_FblValStruct_2991_2995 */ + { + /* Perform hash calculation and compare with decrypted signature */ + secStatus = FblValStructSignatureVerification(&verifyParam); + if (SECM_VER_OK != secStatus) + { + /* An error occurred during signature verification or the signature check failed */ + result = kFblValStructNotAuthentic; + } + } +# if defined( FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY ) + FblValStructClrPublicKey(&publicKey); +# endif /* FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY */ + + return result; +} +# endif /* FBL_VALSTRUCT_ENABLE_SIGNATURE */ + +# if defined( FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL ) +/*********************************************************************************************************************** + * FblValStructLocateStructSegment + **********************************************************************************************************************/ +/*! \brief Locate the position of the validation structure in the segment list of the validation structure + * \param[in,out] vsInfo Structure which keeps information about validation structure (out: vsSeg) + **********************************************************************************************************************/ +static void FblValStructLocateStructSegment( tVsInfo * vsInfo ) +{ + vuint8 segIdx; + vuint8 vsFound; + + /* Locate validation structure segment in segment list */ + segIdx = vsInfo->segInfo.nrOfSegments; + vsFound = 0u; + while (segIdx > 0u) + { + segIdx--; + if (vsInfo->address > vsInfo->segInfo.segmentInfo[segIdx].targetAddress) + { + /* Validation structure located above the current segment */ + vsInfo->vsSeg = segIdx + 1u; + vsFound = 1u; + break; + } + } + + if (vsFound == 0u) + { + /* Validation structure must be located in front of the first entry */ + vsInfo->vsSeg = 0u; + } +} + +/*********************************************************************************************************************** + * FblValStructChecksumInternal + **********************************************************************************************************************/ +/*! \brief Calculate the checksum (or CRC/hash) values for all segments in the validation structure + * \param[in,out] vsInfo Structure which keeps information about validation structure (out: vsSeg) + * \param[in,out] blockSegInfo Output segment list which contains the newly calculated checksum values + * \return kFblValStructOk = Checksum calculation successfully finished, information in blockSegInfo is valid + * other value = Error during checksum calculation, information in blockSegInfo is not valid + **********************************************************************************************************************/ +static tFblValStructResult FblValStructChecksumInternal( tVsInfo * vsInfo, tDiagSegmentList * blockSegInfo ) +{ + static SecM_ByteType verifyOutputBuf[FBL_VALSTRUCT_VERIFY_SIZE]; + tFblValStructResult result; + SecM_VerifyParamType localVerifyParam; + FL_SegmentInfoType verifySegmentInfo[1]; + vuint8 segIdx; + vuint8 vsInserted; + + result = kFblValStructOk; + + /* Locate validation structure segment (required for blank check!) */ + FblValStructLocateStructSegment(vsInfo); + + /* Add one segment for validation structure */ + blockSegInfo->nrOfSegments = vsInfo->segInfo.nrOfSegments + 1u; + + /* Iterate over all segments which are defined in the validation structure */ + vsInserted = 0u; + for (segIdx = 0u; segIdx < blockSegInfo->nrOfSegments; segIdx++) + { + if (segIdx == vsInfo->vsSeg) + { + /* Insert validation structure */ + blockSegInfo->segmentInfo[segIdx].targetAddress = vsInfo->address; + blockSegInfo->segmentInfo[segIdx].length = vsInfo->length; + vsInserted = 1u; + } + else + { + /* Copy address/length information */ + blockSegInfo->segmentInfo[segIdx].targetAddress = vsInfo->segInfo.segmentInfo[segIdx - vsInserted].targetAddress; + blockSegInfo->segmentInfo[segIdx].length = vsInfo->segInfo.segmentInfo[segIdx - vsInserted].length; + } + + /* Prepare input data for checksum calculation */ + verifySegmentInfo[0].length = blockSegInfo->segmentInfo[segIdx].length; + verifySegmentInfo[0].targetAddress = blockSegInfo->segmentInfo[segIdx].targetAddress; + verifySegmentInfo[0].transferredAddress = blockSegInfo->segmentInfo[segIdx].targetAddress; + localVerifyParam.segmentList.nrOfSegments = 1u; + localVerifyParam.segmentList.segmentInfo = verifySegmentInfo; + localVerifyParam.verificationData = verifyOutputBuf; + localVerifyParam.crcTotal = 0u; + localVerifyParam.wdTriggerFct = (FL_WDTriggerFctType)FblRealTimeSupport; /* PRQA S 0313 */ /* MD_FblValStruct_0313_WDTriggerFctType */ + localVerifyParam.readMemory = (FL_ReadMemoryFctType)FblReadProm; + + /* Do checksum verification */ + if (FblValStructChecksumVerification(&localVerifyParam) == SECM_VER_OK) + { + /* Copy checksum into segment list */ + (void)MEMCPY(blockSegInfo->segmentInfo[segIdx].checksum, /* PRQA S 0314 */ /* MD_FblValStruct_0314 */ + &verifyOutputBuf[FBL_VALSTRUCT_BLOCKCHECKSUM_VERIFY_OFFSET], + FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE); + } + else + { + result = kFblValStructMemoryReadError; + break; + } + } + + return result; +} +# endif /* FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL */ + +/*********************************************************************************************************************** + * FblValStructChecksumExternal + **********************************************************************************************************************/ +/*! \brief Request segment information from external instance and check against validation structure + * \param[in] blockDescriptor Block descriptor structure + * \param[in,out] vsInfo Structure which keeps information about validation structure + * \param[in,out] blockSegInfo Download segment list + * \return kFblValStructOk = Passed segment information matches the information in the validation structure + * other value = Invalid number of segments passed or segment locations don't match + **********************************************************************************************************************/ +/* PRQA S 3673 3 */ /* MD_MSR_Rule8.13 */ +static tFblValStructResult FblValStructChecksumExternal( const tBlockDescriptor * blockDescriptor, + tVsInfo * vsInfo, + tDiagSegmentList * blockSegInfo ) +{ + tFblValStructResult result; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameter not used (configuration dependent): avoid compiler warning */ + (void)blockDescriptor; /* PRQA S 3112 */ /* MD_MSR_DummyStmt */ +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + /* Get download segments which are associated with this logical block */ + (void)FblValStructGetSegmentList(blockDescriptor->blockNr, blockSegInfo); + + /* Check the amount of segments which have been downloaded */ + if (blockSegInfo->nrOfSegments == (vsInfo->segInfo.nrOfSegments + 1u)) + { + /* Number of downloaded segments (excluding the ValStruct segment) matches the number in the ValStruct */ + result = FblValStructCompareSegmentLocation(vsInfo, blockSegInfo); + } + else + { + /* Mismatch between number of downloaded segments and blocks in validation structure; abort verification */ + result = kFblValStructBlockNumberMismatch; + } + + return result; +} + +/*********************************************************************************************************************** + * FblValStructCompareSegmentLocation + **********************************************************************************************************************/ +/*! \brief Compare the segment information from download and validation structure, remove ValStruct from list + * \param[in,out] vsInfo Structure which keeps information about validation structure (out: vsSeg) + * \param[in] blockSegInfo Download segment list + * \return kFblValStructOk = all segments are identical + * other value = address or length differences detected + **********************************************************************************************************************/ +static tFblValStructResult FblValStructCompareSegmentLocation( tVsInfo * vsInfo, + const tDiagSegmentList * blockSegInfo) +{ + tFblValStructResult result; + vuint8 segIdx, vsFound; + + result = kFblValStructOk; + vsInfo->vsSeg = 0u; + vsFound = 0u; + + for (segIdx = 0u; segIdx < blockSegInfo->nrOfSegments; segIdx++) + { + /* Check address and length against block info in validation structure */ + if ((blockSegInfo->segmentInfo[segIdx].targetAddress != vsInfo->segInfo.segmentInfo[segIdx - vsFound].targetAddress) || + (blockSegInfo->segmentInfo[segIdx].length != vsInfo->segInfo.segmentInfo[segIdx - vsFound].length)) + { + /* Check if the mismatch is caused by the segment which keeps the validation structure */ + if ((vsFound == 0u) && (blockSegInfo->segmentInfo[segIdx].targetAddress == vsInfo->address)) + { + if (blockSegInfo->segmentInfo[segIdx].length == vsInfo->length) + { + /* Validation structure segment found */ + vsInfo->vsSeg = segIdx; + vsFound = 1u; + } + else + { + /* Invalid length of validation structure */ + result = kFblValStructInvalidFormat; + } + } + else + { + /* Address/or length mismatch between download and validation structure */ + result = kFblValStructBlockMismatch; + } + } + + if (result != kFblValStructOk) + { + break; + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblValStructCompareSegmentChecksum + **********************************************************************************************************************/ +/*! \brief Compare the segment information from download and validation structure + * \param[in] vsSegInfo Segment list from validation structure + * \param[in] blockSegInfo Download segment list + * \return kFblValStructOk = all segments are identical + * other value = checksum differences detected + **********************************************************************************************************************/ +static tFblValStructResult FblValStructCompareSegmentChecksum( const tVsSegInfo * vsSegInfo, const tDiagSegmentList * blockSegInfo ) +{ + tFblValStructResult result; + vuint8 segIdx, csIdx; + + result = kFblValStructOk; + + for (segIdx = 0; segIdx < vsSegInfo->nrOfSegments; segIdx++) + { + /* Compare calculated checksum/hash with value from validation structure */ + for (csIdx = 0; csIdx < FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE; csIdx++) + { + if (vsSegInfo->segmentInfo[segIdx].checksum[csIdx] != blockSegInfo->segmentInfo[segIdx].checksum[csIdx]) + { + /* Checksum values differ, abort verification */ + result = kFblValStructChecksumValueMismatch; + break; + } + } + } + + return result; +} + +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) +/*********************************************************************************************************************** + * FblValStructBlankCheck + **********************************************************************************************************************/ +/*! \brief Check whether the given memory area is erased (contains the respective erased value) + * \param[in] memAddress Start address of the memory area + * \param[in] memLength Length of the memory area + * \return kFblValStructOk = inter-segment memory areas are in state 'erased' + * kFblValStructBlankCheckFailed = non-erased memory area detected + **********************************************************************************************************************/ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +static tFblValStructResult FblValStructBlankCheck( tFblAddress memAddress, tFblLength memLength ) +{ + tFblValStructResult result; + tFblLength readLength; + IO_ErrorType memDrvResult; + vuint16 bufIdx; + vuint8 erasedVal; + tFblAddress localMemAddress = memAddress; + tFblLength localMemLength = memLength; + + /* Note: By definition, a logical block must be homogeneous (single memory device) and contiguous (no gaps) */ + memSegment = FblMemSegmentNrGet(localMemAddress); + + if (memSegment >= 0) + { + result = kFblValStructOk; + erasedVal = memDrvLst[FlashBlock[memSegment].device].erasedValue; + + while ((localMemLength > 0u) && (kFblValStructOk == result)) + { + readLength = (localMemLength >= FBL_VALSTRUCT_READ_BUFFER_SIZE) ? FBL_VALSTRUCT_READ_BUFFER_SIZE : localMemLength; + memDrvResult = MemDriver_RReadSync(readBuffer.data, readLength, localMemAddress); + + if ((IO_E_OK == memDrvResult) || (IO_E_ERASED == memDrvResult)) + { + for (bufIdx = 0u; bufIdx < readLength; bufIdx++) + { + /* Check if the pattern is in its initial state (i. e. the memory at the + pattern address is erased) */ + if (readBuffer.data[bufIdx] != (vuint8)erasedVal) + { + /* Memory content has been modified - return with negative result */ + result = kFblValStructBlankCheckFailed; + break; + } + } + + localMemAddress += readLength; + localMemLength -= readLength; + } + else + { + /* Failure reported by read function */ + result = kFblValStructBlankCheckFailed; + } + } + } + else + { + /* Invalid memory segment */ + result = kFblValStructBlankCheckFailed; + } + + return result; +} +# endif /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK */ + +# if defined ( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +/*********************************************************************************************************************** + * FblValStructGapFill + **********************************************************************************************************************/ +/*! \brief Fill gaps between programmed segments with kFillChar + * \param[in] memAddress Start address of the memory area + * \param[in] memLength Length of the memory area + * \return kFblValStructOk = inter-segment memory areas are filled successfully + * kFblValStructGapFillFailed = gap filling failed + **********************************************************************************************************************/ +static tFblValStructResult FblValStructGapFill(tFblAddress memAddress, tFblLength memLength) +{ + tFblValStructResult result; + tFblLength writeLength; + tFblAddress localMemAddress = memAddress; + tFblLength localMemLength = memLength; + + result = kFblValStructOk; + + while (localMemLength > 0u) + { + writeLength = (localMemLength >= FBL_VALSTRUCT_GAP_FILL_SEGMENTATION) ? FBL_VALSTRUCT_GAP_FILL_SEGMENTATION : localMemLength; + + if (kFblMemStatus_Ok == FblMemProgramBuffer(localMemAddress, &writeLength, gapFillBuffer)) + { + localMemAddress += writeLength; + localMemLength -= writeLength; + } + else + { + result = kFblValStructGapFillFailed; + break; + } + } + + return result; +} +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) || \ + defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +/*********************************************************************************************************************** + * FblValStructSkipFilledArea + **********************************************************************************************************************/ +/*! \brief Skip memory area at segment end which has been filled with kFillChar + * \param[in] address Start address of the memory area + * \param[in] memSeg Index of memory segment in flash block table which relates to the specified address + * \return Aligned address + **********************************************************************************************************************/ +static tFblAddress FblValStructSkipFilledArea( tFblAddress address, vsint16 memSeg ) +{ + vuint16 segSize; + tFblLength unalignedLength; + tFblAddress alignedAddress = address; + + /* Retrieve write segment size of the respective memory device */ + segSize = memDrvLst[FlashBlock[memSeg].device].segmentSize; + + /* ESCAN00101065: Check alignment of read address */ + if ((address & (segSize - 1uL)) != 0uL) + { + /* Skip data which has been filled with kFillChar */ + unalignedLength = segSize - (address & (segSize - 1uL)); + alignedAddress += unalignedLength; + } + + return alignedAddress; +} + +/*********************************************************************************************************************** + * FblValStructGapProcessing + **********************************************************************************************************************/ +/*! \brief Depending on the configuration either blank check or gap filling will be executed + * \param[in] blockDescriptor Block descriptor structure + * \param[in] blockSegInfo Download segment list + * \return kFblValStructOk = processing successfully performed + * other value = either blank check or gap filling failed + **********************************************************************************************************************/ +static tFblValStructResult FblValStructGapProcessing( const tBlockDescriptor * blockDescriptor, + const tDiagSegmentList * blockSegInfo ) +{ + tFblValStructResult result; + tFblAddress procAddress; + tFblLength remainingLength; + vuint8 segIdx; + tBlockDescriptor localBlockDescriptor; +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + tFblLength idx; +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + + localBlockDescriptor = *blockDescriptor; + +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + /* Fill gap fill buffer with fill character */ + for (idx = 0u; idx < FBL_VALSTRUCT_GAP_FILL_SEGMENTATION; idx++) + { + gapFillBuffer[idx] = kFillChar; + } +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + + /* Adjust the size of the logical block according to presence pattern size */ + (void)ApplFblAdjustLbtBlockData(&localBlockDescriptor); + + procAddress = localBlockDescriptor.blockStartAddress; + /* Note: By definition, a logical block must be homogeneous (single memory device) and contiguous (no gaps) */ + memSegment = FblMemSegmentNrGet(procAddress); + + if (memSegment >= 0) + { + result = kFblValStructOk; + + for (segIdx = 0; segIdx < blockSegInfo->nrOfSegments; segIdx++) + { + /* Skip memory area at segment end which has been filled with kFillChar */ + procAddress = FblValStructSkipFilledArea(procAddress, memSegment); + + if (procAddress < blockSegInfo->segmentInfo[segIdx].targetAddress) + { + remainingLength = blockSegInfo->segmentInfo[segIdx].targetAddress - procAddress; + +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + result = FblValStructGapFill(procAddress, remainingLength); +# else /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK */ + result = FblValStructBlankCheck(procAddress, remainingLength); +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + + if (kFblValStructOk != result) + { + break; + } + } + + procAddress = blockSegInfo->segmentInfo[segIdx].targetAddress + + blockSegInfo->segmentInfo[segIdx].length; + } + + if (kFblValStructOk == result) + { + /* Skip memory area at segment end which has been filled with kFillChar */ + procAddress = FblValStructSkipFilledArea(procAddress, memSegment); + + /* Check remaining part of logical block */ + if (procAddress < (localBlockDescriptor.blockStartAddress + localBlockDescriptor.blockLength)) + { + remainingLength = (localBlockDescriptor.blockStartAddress + localBlockDescriptor.blockLength) - procAddress; + +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + result = FblValStructGapFill(procAddress, remainingLength); +# else /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK */ + result = FblValStructBlankCheck(procAddress, remainingLength); +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + } + } + } + else + { + /* Invalid memory segment */ +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + result = kFblValStructGapFillFailed; +# else /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK */ + result = kFblValStructBlankCheckFailed; +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ + } + + return result; +} +# endif /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK || FBL_VALSTRUCT_ENABLE_GAP_FILL */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblValStructValidateBlockExtended + **********************************************************************************************************************/ +/*! \brief The flash memory content is verified according to the information in the validation structure + * \pre Complete file must be successfully downloaded + * \param[in] blockDescriptor Block descriptor structure + * \param[in] option Parameter to influence the execution sequence + * \return kFblValStructOk = verification successfully performed + * other value = verification failed + **********************************************************************************************************************/ +/* PRQA S 6050 1 */ /* MD_MSR_STCAL */ +tFblValStructResult FblValStructValidateBlockExtended( const tBlockDescriptor * blockDescriptor, + const tFblValStructOption option ) +{ + static tVsInfo vsInfo; + static tDiagSegmentList blockSegInfo; + tFblValStructResult result; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)option; +# endif + /* Check if requested options can be handled with current pre-compile config */ +# if defined( FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL ) +# else + assertFblUser(! FblValStructOptionChecksumInternal(option), kFblSysAssertParameterOutOfRange); +# endif +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) +# else + assertFblUser(! FblValStructOptionBlankCheck(option), kFblSysAssertParameterOutOfRange); +# endif +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +# else + assertFblUser(! FblValStructOptionGapFill(option), kFblSysAssertParameterOutOfRange); +# endif + + vsInfo.address = FblValStructGetVsAddress(blockDescriptor); + + /* Extract the block information from the validation structure */ + result = FblValStructGetSegmentInfo(&vsInfo); + +# if defined( FBL_VALSTRUCT_ENABLE_SIGNATURE ) + if (kFblValStructOk == result) + { + /* Read verification data from downloaded logical block */ + result = FblValStructGetSignature(blockDescriptor, readBuffer.data); /* PRQA S 0306 */ /* MD_FblValStruct_0306 */ + if (kFblValStructOk == result) + { + /* Check integrity and authenticity of validation structure */ + result = FblValStructVerification(&vsInfo, readBuffer.data); + } + } +# endif /* FBL_VALSTRUCT_ENABLE_SIGNATURE */ + + if (kFblValStructOk == result) + { + /* ESCAN00102005: Adapt validation structure dimension to match the respective data segment + * (required if signature is attached to validation structure segment) */ + vsInfo.address = FblValStructGetVsSegAddress(blockDescriptor); + vsInfo.length = FblValStructGetVsSegLength(vsInfo.length); + +# if defined( FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL ) + /* Decide whether the segment checksums shall be calculated internally or requested externally */ + if (FblValStructOptionChecksumInternal(option)) + { + /* Calculate the checksum of all segments and fill blockSegInfo structure */ + result = FblValStructChecksumInternal(&vsInfo, &blockSegInfo); + } + else +# endif /* FBL_VALSTRUCT_ENABLE_CHECKSUM_INTERNAL */ + { + /* Request segment information from external instance and check against validation structure */ + result = FblValStructChecksumExternal(blockDescriptor, &vsInfo, &blockSegInfo); + } + } + +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) || \ + defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) + if (kFblValStructOk == result) + { + if ((FblValStructOptionBlankCheck(option)) || (FblValStructOptionGapFill(option))) + { + /* Perform gap processing (blank check or gap fill) */ + result = FblValStructGapProcessing(blockDescriptor, &blockSegInfo); + } + } +# endif /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK || FBL_VALSTRUCT_ENABLE_GAP_FILL */ + + if (kFblValStructOk == result) + { + /* Remove validation structure segment */ + FblValStructRemoveStructSegment(&vsInfo, &blockSegInfo); + + /* Proceed with checking the checksum/hash of all blocks in the structure */ + result = FblValStructCompareSegmentChecksum(&vsInfo.segInfo, &blockSegInfo); + } + + return result; +} + +/*********************************************************************************************************************** + * FblValStructValidateBlock + **********************************************************************************************************************/ +/*! \brief The flash memory content is verified according to the information in the validation structure + * \pre Complete file must be successfully downloaded + * \param[in] blockDescriptor Block descriptor structure + * \return kFblValStructOk = verification successfully performed + * other value = verification failed + **********************************************************************************************************************/ +tFblValStructResult FblValStructValidateBlock( const tBlockDescriptor * blockDescriptor ) +{ + return FblValStructValidateBlockExtended(blockDescriptor, FBL_VALSTRUCT_OPTION_DEFAULT); +} +# define FBL_VALSTRUCT_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBL_ENABLE_VALSTRUCT */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* module specific MISRA deviations: + + MD_FblValStruct_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation-defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. + + MD_FblValStruct_0314: + Reason: The copy function have a void pointer as a function parameter and an integer is casted to pointer void. + Risk: No risk, because the underlying pointer type is known and the cast is safe. + Prevention: No prevention necessary. + + MD_FblValStruct_0315: + Reason: The underling type of verifyParam.key is pointer to void. As the type is defined outside the package, the + implicit conversion is necessary. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblValStruct_0313_WDTriggerFctType: + Reason: Security module expects a watchdog handler with return type 'void'. The usage of a wrapper function is + avoided due to higher voted requirements for minimized stack and runtime usage applied on the code. + Risk: Potentially undefined behavior of the used compiler which usually leads to a warning or error during + compilation. + Prevention: The respective functionality is part of integration testing and will hence be verified before delivery. + + MD_FblValStruct_2985: + Reason: Based on the configuration, some constants are zero, which leads to constant control expression. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FblValStruct_2991_2995: + Reason: The value of the if-controlling expression depends on the configuration. + Risk: No risk. + Prevention: No prevention necessary. + + MD_FblValStruct_3218: + Reason: Variable is accessed from multiple functions (configuration dependent). + Risk: Scope is larger than required (whole file instead of one function). Some other function could access + the variable. + Prevention: Restrict the functionality in this module to the intended purpose. Don't add functions which shall not + be able to access the local data buffers. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_VALSTRUCT.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_valstruct.h b/Source/bsw/Fbl/fbl_valstruct.h new file mode 100644 index 0000000..46c72bb --- /dev/null +++ b/Source/bsw/Fbl/fbl_valstruct.h @@ -0,0 +1,171 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of a download check by using an embedded validation structure + * Declaration of functions, variables and constants + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2023 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-07-01 visci - Initial version + * 01.01.00 2017-02-03 visci ESCAN00093858 Added support for compatibility check + * vacel Added blank check functionality + * Added API for external public key + * Reworked return value handling + * 01.01.01 2017-11-09 visci ESCAN00096836 No changes + * 01.01.02 2018-03-23 visdkl ESCAN00097287 Bootloader does not properly use configuration of CLASS_DDD + * 01.02.00 2018-06-15 visci ESCAN00098963 No changes + * 01.03.00 2019-01-25 visci ESCAN00098904 Improved verification sequence + * ESCAN00101065 Alignment for Blank Check is not applied correctly + * ESCAN00101321 Added option to skip download segment check + * 01.03.01 2019-02-06 visci ESCAN00102005 No changes + * 01.04.00 2019-06-14 visci ESCAN00102956 No changes + * ESCAN00102957 No changes + * 01.05.00 2019-06-25 visdlm ESCAN00103492 Added gap fill mechanism + * 01.05.01 2021-01-18 visjdn ESCAN00107640 No changes + * 01.05.02 2021-06-01 vishor ESCAN00109198 No changes + * 01.06.00 2022-04-28 visstn FBL-4366 Perform MISRA 2012 migration + * 01.07.00 2022-10-12 visjdn FBL-5694 Support of Xiaomi validation structure + * 01.08.00 2022-11-25 vistbe FBL-6055 Extend configurability of checksum and signature + * 01.08.01 2023-02-02 vistbe ESCAN00113401 Compiler error: error directive "Unsupported blockcount size" + **********************************************************************************************************************/ + +#ifndef FBL_VALSTRUCT_H +#define FBL_VALSTRUCT_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_ValStruct CQComponent : Implementation */ +#define FBLVALSTRUCT_VERSION 0x0108u +#define FBLVALSTRUCT_RELEASE_VERSION 0x01u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_valstruct_oem.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Defines used to request specific ValStruct processing options */ +#define FBL_VALSTRUCT_OPTION_NONE (0x00u) +#define FBL_VALSTRUCT_OPTION_CHECKSUM_INTERNAL FBL_BIT0 +#define FBL_VALSTRUCT_OPTION_BLANKCHECK FBL_BIT1 +#define FBL_VALSTRUCT_OPTION_GAP_FILL FBL_BIT2 + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/* Define dedicated return value type based on tFblResult to indicate the deviation: + * - The return value in case of successful execution matches kFblOk + * - The negative return values (!= kFblOk) are module specific error codes (see fbl_valstruct_oem.h) + */ +typedef tFblResult tFblValStructResult; + +/* Data type which is used to pass processing options to FblValStructValidateBlockExtended() */ +typedef vuint8 tFblValStructOption; + +/*********************************************************************************************************************** + * PROTOTYPES + **********************************************************************************************************************/ + +#define FBL_VALSTRUCT_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +tFblValStructResult FblValStructValidateBlockExtended( const tBlockDescriptor * blockDescriptor, + const tFblValStructOption option ); +tFblValStructResult FblValStructValidateBlock( const tBlockDescriptor * blockDescriptor ); +#define FBL_VALSTRUCT_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) +# if defined( FBL_VALSTRUCT_READ_BUFFER_SIZE ) + /* Pre-defined buffer size, check validity */ +# if ( FBL_VALSTRUCT_READ_BUFFER_SIZE < FBL_VALSTRUCT_MAX_SIZE ) +# error "Validation structure: structure does not fit into read buffer" +# endif +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) && (FBL_VALSTRUCT_READ_BUFFER_SIZE < SEC_VERIFY_CLASS_CCC_VERIFY_SIZE) +# error "Validation structure: signature does not fit into read buffer" +# endif +# endif /* FBL_VALSTRUCT_READ_BUFFER_SIZE */ + +# if ( FBL_VALSTRUCT_BLOCKCOUNT_MAX > 254 ) +# error "Validation functionality: invalid maximum block count configured (max. value: 254)" +# endif + +/* Automatic definition of verification output buffer size (FBL_VALSTRUCT_VERIFY_SIZE) currently supports Class DDD + * with option "CRC Written" only */ +# if !defined( SEC_ENABLE_SECURITY_CLASS_DDD ) || \ + defined( SEC_ENABLE_CRC_TOTAL ) || \ + defined( SEC_ENABLE_VENDOR_CHECKSUM ) +# error "Validation structure: unsupported verification configuration" +# endif + +/* Check if blank check and gap filling functionality are enabled at the same time */ +# if defined( FBL_VALSTRUCT_ENABLE_BLANK_CHECK ) && \ + defined( FBL_VALSTRUCT_ENABLE_GAP_FILL ) +# error "Validation structure: unsupported validation structure processing configuration" +# endif /* FBL_VALSTRUCT_ENABLE_BLANK_CHECK && FBL_VALSTRUCT_ENABLE_GAP_FILL */ + +/* Check the size of the Blockcount to be 1 or 2 */ +# if (FBL_VALSTRUCT_BLOCKCOUNT_SIZE != 1u) && (FBL_VALSTRUCT_BLOCKCOUNT_SIZE != 2u) +# error "Unsupported blockcount size" +# endif /* (FBL_VALSTRUCT_BLOCKCOUNT_SIZE != 1u) && (FBL_VALSTRUCT_BLOCKCOUNT_SIZE != 2u) */ +#endif /* FBL_ENABLE_VALSTRUCT */ + +/* Automatic definition of the Alfi size in case it is not previously defined */ +#if !defined(FBL_VALSTRUCT_ALFI_SIZE) +# define FBL_VALSTRUCT_ALFI_SIZE 0x00u +#endif + +/* Default definition for checksum and signature size and function (can be overwritten) */ +#if !defined( FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE ) +# define FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE SEC_VERIFY_CLASS_DDD_VERIFY_SIZE +#endif + +#if !defined( FBL_VALSTRUCT_BLOCKCHECKSUM_VERIFY_OFFSET ) +# define FBL_VALSTRUCT_BLOCKCHECKSUM_VERIFY_OFFSET SEC_VERIFY_CLASS_DDD_VERIFY_OFFSET +#endif + +#if !defined( FblValStructChecksumVerification ) +# define FblValStructChecksumVerification SecM_VerificationClassDDD +#endif + +#if !defined( FBL_VALSTRUCT_SIGNATURE_SIZE ) +# define FBL_VALSTRUCT_SIGNATURE_SIZE SEC_VERIFY_CLASS_CCC_VERIFY_SIZE +#endif + +#if !defined( FblValStructSignatureVerification ) +# define FblValStructSignatureVerification SecM_VerificationClassCCC +#endif + +#endif /* FBL_VALSTRUCT_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_VALSTRUCT.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_valstruct_oem.h b/Source/bsw/Fbl/fbl_valstruct_oem.h new file mode 100644 index 0000000..daa1db3 --- /dev/null +++ b/Source/bsw/Fbl/fbl_valstruct_oem.h @@ -0,0 +1,178 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of a download check by using an embedded validation structure + * Declaration of functions, variables and constants + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2026 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * TEMPLATE REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2016-07-01 visci - Initial version + * 01.01.00 2017-02-03 vadcel ESCAN00093858 Added support for compatibility check + * Added blank check functionality + * Added API for external public key + * Reworked return value handling + * 01.01.01 2017-11-09 visci ESCAN00096836 No changes + * 01.01.02 2018-03-23 visdkl ESCAN00097287 Bootloader does not properly use configuration of CLASS_DDD + * 01.02.00 2018-06-15 visci ESCAN00098963 Corrected return value for public key read failure + * 01.03.00 2019-01-25 visci ESCAN00098904 Improved verification sequence + * ESCAN00101065 Alignment for Blank Check is not applied correctly + * ESCAN00101321 Added option to skip download segment check + * 01.03.01 2019-02-06 visci ESCAN00102005 No changes + * 01.04.00 2019-06-14 visci ESCAN00102956 No changes + * ESCAN00102957 No changes + * 01.05.00 2019-06-25 visdlm ESCAN00103492 Added gap fill mechanism + * -------------------------------------------------------------------------------------------------------------------- + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2022-08-15 vistmo FBL-5514 Support Additional OTA functionality + * ESCAN00112435 No changes + * ESCAN00112575 No changes + * 05.01.00 2022-10-04 jschmitding FBL-5917 No changes + * ESCAN00113919 No changes + * 05.01.01 2022-10-17 fmenke ESCAN00112879 No changes + * 05.01.02 2023-01-13 fmenke ESCAN00112890 No changes + * ESCAN00113612 No changes + * 05.02.00 2023-02-09 vistmo ESCAN00112972 No changes + * ESCAN00113292 No changes + * ESCAN00113835 No changes + * ESCAN00113843 No changes + * ESCAN00113764 No changes + * FBL-6438 No changes + * 05.02.01 2023-05-11 fmenke ESCAN00113831 No changes + * 05.03.00 2023-07-24 fmenke FBL-7335 No changes + * 05.03.01 2023-08-31 lhopfhauer ESCAN00115494 No changes + * 05.03.02 2024-07-16 erizk ESCAN00117344 No changes + * 05.03.03 2025-02-06 virchl ESCAN00118587 No changes + * 05.04.00 2025-02-28 jjohnson FBL-10065 No changes + * 05.04.01 2025-06-10 jostravsky ESCAN00120315 No changes + * 05.04.02 2025-07-08 visarcmijo ESCAN00119833 No changes + * 05.05.00 2025-09-01 fmenke FBL-11218 No changes + * ESCAN00120917 No changes + * 05.06.00 2025-10-28 mpatil FBL-11690 No changes + * 05.07.00 2026-01-13 dganesh FBL-12162 No changes + **********************************************************************************************************************/ + +#ifndef FBL_VALSTRUCT_OEM_H +#define FBL_VALSTRUCT_OEM_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( FBL_ENABLE_VALSTRUCT ) + +/** Specify default options for validation structure processing */ +# define FBL_VALSTRUCT_OPTION_DEFAULT (FBL_VALSTRUCT_OPTION_NONE) + +/** Maximum number of blocks in validation struct */ +# if !defined( FBL_VALSTRUCT_BLOCKCOUNT_MAX ) +/* At least two segments required for SBL */ +# define FBL_VALSTRUCT_BLOCKCOUNT_MAX (SWM_DATA_MAX_NOAR - 2u) +# endif + +/** Size of validation struct members */ +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +# define FBL_VALSTRUCT_TAG_SIZE 0x00u +# define FBL_VALSTRUCT_VERSION_SIZE 0x02u +# define FBL_VALSTRUCT_BLOCKCOUNT_SIZE 0x02u +# define FBL_VALSTRUCT_BLOCKADDRESS_SIZE 0x04u +# define FBL_VALSTRUCT_BLOCKLENGTH_SIZE 0x04u +# define FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE 0x20u +# define FBL_VALSTRUCT_VALIDATESUM_SIZE 0x00u +# else +# define FBL_VALSTRUCT_TAG_SIZE 0x04u +# define FBL_VALSTRUCT_VERSION_SIZE 0x00u +# define FBL_VALSTRUCT_BLOCKCOUNT_SIZE 0x02u +# define FBL_VALSTRUCT_BLOCKADDRESS_SIZE 0x04u +# define FBL_VALSTRUCT_BLOCKLENGTH_SIZE 0x04u +# define FBL_VALSTRUCT_BLOCKCHECKSUM_SIZE 0x02u +# define FBL_VALSTRUCT_VALIDATESUM_SIZE 0x02u +# endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + +/** Supported Valstruct version can be overwritten */ +# ifndef FBL_VALSTRUCT_VERSION +# define FBL_VALSTRUCT_VERSION 0x0000u +# endif /* FBL_VALSTRUCT_VERSION */ + +/** Define supported structure versions */ +# define FblValStructIsVersionSupported(ver) ((FBL_VALSTRUCT_VERSION == (ver)) ? kFblValStructOk : kFblValStructNotAuthentic) + +/** Provide base address of validation structure and signature as well as the respective download segment dimension */ + +/****** Ford (CCC + DDD use case, signature embedded before validation structure ******/ +# if ( SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC ) +/* Block header points to the verification structure, the signature is located below */ +# define FblValStructGetSigAddress(block) ((block)->headerAddress - SEC_VERIFY_CLASS_CCC_VERIFY_SIZE) +# define FblValStructGetVsAddress(block) ((block)->headerAddress) +# define FblValStructGetVsSegAddress(block) FblValStructGetSigAddress(block) +# define FblValStructGetVsSegLength(vsLength) (SEC_VERIFY_CLASS_CCC_VERIFY_SIZE + (vsLength)) + +/* Provide signature data */ +# define FblValStructGetSignature(block, buffer) (tFblValStructResult)((SEC_VERIFY_CLASS_CCC_VERIFY_SIZE == \ + FblReadProm(FblValStructGetSigAddress(block), (buffer), SEC_VERIFY_CLASS_CCC_VERIFY_SIZE)) ? \ + kFblValStructOk : kFblValStructMemoryReadError) + +# if defined( FBL_VALSTRUCT_ENABLE_EXTERNAL_KEY ) +/** Provide public key */ +# define FblValStructGetPublicKey(key) ApplFblReadVerificationKey(key) +# endif +# else /* SEC_ENABLE_SECURITY_CLASS_DDD */ +/* Block header points to the verification structure */ +# define FblValStructGetVsAddress(block) ((block)->headerAddress) +# define FblValStructGetVsSegAddress(block) FblValStructGetVsAddress(block) +# define FblValStructGetVsSegLength(vsLength) (vsLength) +# endif /* SEC_SECURITY_CLASS_VERIFY == SEC_CLASS_CCC */ + +/** Provide segment list with address, length and checksum for each segment */ +# define FblValStructGetSegmentList(block, segList) FblDiagGetSegmentList(block, segList) + +/** Options only relevant for OTA */ + +# if defined( FBL_ENABLE_GAP_FILL ) +# if defined( FBL_VALSTRUCT_ENABLE_GAP_FILL) || \ + defined( FBL_VALSTRUCT_DISABLE_GAP_FILL ) +/* Valstruct gap fill handling explicitly defined outside */ +# else +# define FBL_VALSTRUCT_ENABLE_GAP_FILL +# endif /* FBL_VALSTRUCT_ENABLE_GAP_FILL */ +# endif /* FBL_ENABLE_GAP_FILL */ + +#endif /* FBL_ENABLE_VALSTRUCT */ + +/** OEM specific return code mapping (tFblValStructResult) */ +#define kFblValStructOk 0u +#define kFblValStructNotAuthentic 1u +#define kFblValStructInvalidFormat 2u +#define kFblValStructBlockNumberMismatch 3u +#define kFblValStructChecksumValueMismatch 4u +#define kFblValStructMemoryReadError 5u +#define kFblValStructBlockMismatch 6u +#define kFblValStructKeyError 7u +#define kFblValStructBlankCheckFailed 8u +#define kFblValStructGapFillFailed 9u + +#endif /* FBL_VALSTRUCT_OEM_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_VALSTRUCT_OEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_wd.c b/Source/bsw/Fbl/fbl_wd.c new file mode 100644 index 0000000..f4474e9 --- /dev/null +++ b/Source/bsw/Fbl/fbl_wd.c @@ -0,0 +1,264 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Watchdog functions + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 03.00.00 2018-02-09 visach ESCAN00097885 Rework configuration + * 03.01.00 2019-08-13 vistbe FBL-370 Added support for generic MCMP slave + * 03.02.00 2019-11-01 visrcn FBL-512 Perform MISRA analysis + * 03.03.00 2022-01-20 visstn FBL-4299 Encapsulate ApplFblWDInit call + Update to MISRA2012 + * 03.04.00 2023-04-25 jschmitding FBL-6948 Improve P2* timeout timer define handling + * 03.05.00 2025-11-03 pharring FBL-11473 Add generic asynchronous routine handling + **********************************************************************************************************************/ + +#define FBL_WD_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLWD_VERSION != 0x0305u ) || \ + ( FBLWD_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_wd.c: Source and header file are inconsistent!" +#endif + +#if ( FBLWD_VERSION != _FBLWD_VERSION ) || \ + ( FBLWD_RELEASE_VERSION != _FBLWD_RELEASE_VERSION ) +# error "Error in fbl_wd.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +# if !defined ( kFblGenericEventMargin ) +# if defined( kFblDiagP2StarMinThreshold ) +# define kFblGenericEventMargin kFblDiagP2StarMinThreshold +# else +# define kFblGenericEventMargin (kFblDiagTimeP2Star/2u) /**< Default value for P2 retransmit timings. */ +# endif /* kFblDiagP2StarMinThreshold */ +# endif /* kFblGenericEventMargin */ + +# define PerformGenericEventAction() \ + { \ + if (GetRcrRpInProgress()) \ + { \ + FblCwRetransmitRP(); \ + SetP2Timer(kFblDiagTimeP2Star); \ + } \ + } + + +/*********************************************************************************************************************** + * LOCAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLWD_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 V_MEMRAM1 vuint16 V_MEMRAM2 P2Timer; /**< P2 timeout timer, mapped to wdGenericEventTimer in header file */ + +V_MEMRAM0 V_MEMRAM1 vuint8 V_MEMRAM2 WDInitFlag; /**< Watchdog initialized flag */ + +#if defined( FBL_WATCHDOG_ON ) +/* PRQA S 1514 1 */ /* MD_FblWd_1514 */ +V_MEMRAM0 V_MEMRAM1 tWdTime V_MEMRAM2 WDTimer; /**< Counts timer events until next watchdog triggering */ +#endif /* FBL_WATCHDOG_ON */ + +/*********************************************************************************************************************** + * EXTERNAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#if defined( FBL_WATCHDOG_ON ) +#endif /* FBL_WATCHDOG_ON */ +#define FBLWD_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#define FBLWD_INIT_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblInitWatchdog + **********************************************************************************************************************/ +/*! \brief Initialize module + * \return Reports if initialization was successful. + **********************************************************************************************************************/ +void V_API_NEAR FblInitWatchdog( void ) +{ + wdGenericEventTimer = 0x00u; + SetWDInit(); + +#if defined( FBL_DEF_ENABLE_NON_KB_MAIN ) +# if defined( FBL_WATCHDOG_ON ) + ApplFblWDInit(); +# endif /* FBL_WATCHDOG_ON */ +#endif /* FBL_DEF_ENABLE_NON_KB_MAIN */ +} +#define FBLWD_INIT_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLWD_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblLookForWatchdogVoid + **********************************************************************************************************************/ +/*! \brief Polling of watchdog during longer operations. + * \details This function executes watchdog and timer handling code from RAM. Depending on the Bootloader + * configuration, additionally some communication tasks can be handled by this function. The return + * value of FblLookForWatchdog() is not returned by this function so it could be used by libraries which + * expect a void return value. + * \pre Watchdog code was copied to RAM, watchdog handling is initialized. + **********************************************************************************************************************/ +void V_API_NEAR FblLookForWatchdogVoid( void ) +{ + (void)FblLookForWatchdog(); +} +#define FBLWD_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLWD_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblLookForWatchdog + **********************************************************************************************************************/ +/*! \brief Polling of watchdog during longer operations. + * \details This function executes watchdog and timer handling code from RAM. Depending on the Bootloader + * configuration, additionally some communication tasks can be handled by this function. + * \pre Watchdog code was copied to RAM, watchdog handling is initialized. + * \return FBL_NO_TRIGGER if no timer/watchdog expired, FBL_TM_TRIGGERED if the millisecond timer expired, + * FBL_WD_TRIGGERED if watchdog handling code was called. + **********************************************************************************************************************/ +vuint8 V_API_NEAR FblLookForWatchdog( void ) /* PRQA S 6080 */ /* MD_MSR_STMIF */ +{ + vuint8 retValue = FBL_NO_TRIGGER; + + if (GetWDInit()) /* Check if watchdog already initialized */ + { + if (FblTimerGet() != 0x00u) + { + FblTimerReset(); + retValue |= FBL_TM_TRIGGERED; + + if (wdGenericEventTimer > 0x00u) + { + wdGenericEventTimer--; + if (wdGenericEventTimer < kFblGenericEventMargin) + { + PerformGenericEventAction(); + } + } + +# if defined( FBL_WATCHDOG_ON ) + if (WDTimer != 0x00u) + { + WDTimer--; + if (WDTimer == 0x00u) + { + ApplFblWDTrigger(); + WDTimer = FBL_WATCHDOG_TIME; + retValue |= FBL_WD_TRIGGERED; + } + } +# endif /* FBL_WATCHDOG_ON */ + + /* Check if the FBL or FD (erase/write) is active */ + if (0u != FblCwIsTimerTaskAllowed()) + { + /* the FBL is active, this task can now be called e.g. from the FLASH */ + FblCwTimerTask(); + } + + +# if defined( FBL_WD_TIMER_TASK ) + /* Execute configurable timer task + Task is not active until timer and watchdog have been initialized + Has to be executed from RAM or a lock mechanism needs to be implemented in macro to prevent execution while flash + operations are active */ + FBL_WD_TIMER_TASK(); +# endif /* FBL_WD_TIMER_TASK */ + } /* if (FblTimerGet() != 0x00u) */ + } /* if (GetWDInit()) */ + + /* Check if the FBL or FD (erase/write) is active */ + if (0u != FblCwIsStateTaskAllowed()) + { + /* the FBL is active, this task can now be called e.g. from FLASH */ + FblCwStateTask(); + } + +# if defined( FBL_WD_STATE_TASK ) + /* Execute configurable state task + Task is active immediately and will be executed on every function call + Has to be executed from RAM or a lock mechanism needs to be implemented in macro to prevent execution while flash + operations are active */ + FBL_WD_STATE_TASK(); +# endif /* FBL_WD_STATE_TASK */ + +# if defined( FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE ) + /* Check if the FblRepeat is reached */ + if (FblMainGetFblRepeatStarted()) + { + /* Call the async routines */ + FblDiagAsyncRoutineHandler(); + } +# endif /* FBL_DIAG_ENABLE_CORE_ASYNC_ROUTINE */ + + return retValue; +} +#define FBLWD_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblWd_1514: + Reason: The variable is used by other modules and can't be declared static. + Risk: Name conflicts. + Prevention: Compile and link of the different variants in the component and integration test. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_WD.C + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/fbl_wd.h b/Source/bsw/Fbl/fbl_wd.h new file mode 100644 index 0000000..be15331 --- /dev/null +++ b/Source/bsw/Fbl/fbl_wd.h @@ -0,0 +1,118 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Header file for the watchdog functions + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 03.00.00 2018-02-09 visach ESCAN00097885 Rework configuration + * 03.01.00 2019-08-13 vistbe FBL-370 No changes + * 03.02.00 2019-11-01 visrcn FBL-512 Perform MISRA analysis + * 03.03.00 2022-01-20 visstn FBL-4299 Encapsulate ApplFblWDInit call + Update to MISRA2012 + * 03.04.00 2023-04-25 jschmitding FBL-6948 No changes + * 03.05.00 2025-11-03 pharring FBL-11473 No changes + **********************************************************************************************************************/ + +#ifndef FBL_WD_H +#define FBL_WD_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblWd CQComponent : Implementation */ +#define FBLWD_VERSION 0x0305u +#define FBLWD_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + + +/* Return values of LookForWatchdog */ +/* Indicates its internal action */ +#define FBL_NO_TRIGGER 0x00u /* No action performed (just watching the timer) */ +#define FBL_WD_TRIGGERED 0x03u /* Watchdog has been triggered */ +#define FBL_TM_TRIGGERED 0x02u /* Timer has expired and was re-triggered */ + +/* Macros for watchdog initialization */ +#define GetWDInit() (WDInitFlag == 0x01u) +#define SetWDInit() (WDInitFlag = 0x01u) +#define ClrWDInit() (WDInitFlag = 0x00u) + +/* Map wdGenericEventTimer to P2 timeout timer */ +# define wdGenericEventTimer P2Timer +/* Define P2Timer access macros */ +# define GetP2Timer() (P2Timer) +# define SetP2Timer(val) (P2Timer = (val)) +# define ClrP2Timer() (P2Timer = 0x00u) + +/*********************************************************************************************************************** + * GLOBAL DATA PROTOTYPES + **********************************************************************************************************************/ + +#define FBLWD_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 extern V_MEMRAM1 vuint16 V_MEMRAM2 P2Timer; +V_MEMRAM0 extern V_MEMRAM1 vuint8 V_MEMRAM2 WDInitFlag; + +#if defined( FBL_WATCHDOG_ON ) +# if ( FBL_WATCHDOG_TIME > 255u ) +typedef vuint16 tWdTime; +# else +typedef vuint8 tWdTime; +# endif + +V_MEMRAM0 extern V_MEMRAM1 tWdTime V_MEMRAM2 WDTimer; +#endif /* FBL_WATCHDOG_ON */ + +#define FBLWD_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLWD_INIT_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +void V_API_NEAR FblInitWatchdog ( void ); +#define FBLWD_INIT_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLWD_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +void V_API_NEAR FblLookForWatchdogVoid( void ); +#define FBLWD_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#define FBLWD_RAMCODE_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +vuint8 V_API_NEAR FblLookForWatchdog( void ); +#define FBLWD_RAMCODE_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +#endif /* FBL_WD_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_WD.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/flashdrv.h b/Source/bsw/Fbl/flashdrv.h new file mode 100644 index 0000000..ced273d --- /dev/null +++ b/Source/bsw/Fbl/flashdrv.h @@ -0,0 +1,92 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Flash Driver wrapper functions using an Autosar FLS driver + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2022 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-08-15 vistbe Initial version + * 01.01.00 2020-08-12 visrie FBL-1953 Add support for downloadable driver + * 01.02.00 2022-01-21 visjdn FBL-4535 Support secondary/tertiary use-case + **********************************************************************************************************************/ + +#ifndef FBLDRVFLASH_ASRFLSHIS_H +#define FBLDRVFLASH_ASRFLSHIS_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Fbl_Cfg.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* Flash driver specific version information */ +#define FLASH_DRIVER_VERSION_MAJOR (tFlashUint8)(FBLWRAPPERFLASH_ASRFLSHIS_VERSION >> 8u) +#define FLASH_DRIVER_VERSION_MINOR (tFlashUint8)(FBLWRAPPERFLASH_ASRFLSHIS_VERSION & 0xFFu) +#define FLASH_DRIVER_VERSION_PATCH (tFlashUint8)(FBLWRAPPERFLASH_ASRFLSHIS_RELEASE_VERSION) + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Flash Driver hardware information */ +#define FLASH_DRIVER_VERSION_MCUTYPE 0x5Cu +#define FLASH_DRIVER_VERSION_MASKTYPE 0x00u +#define FLASH_DRIVER_VERSION_INTERFACE 0x00u + +/* Defines to access version and type information */ +#define FLASH_DRIVER_MCUTYPE(flashCode) (*(tFlashUint8*)((flashCode) + 0x03u)) +#define FLASH_DRIVER_MASKTYPE(flashCode) (*(tFlashUint8*)((flashCode) + 0x02u)) +#define FLASH_DRIVER_INTERFACE(flashCode) (*(tFlashUint8*)((flashCode) + 0x00u)) + +/* Flash driver is relocatable */ +#define FLASH_DRIVER_RELOCATABLE + +/* Minimum number of bytes that has to be programmed at a time */ +#if !defined( FLASH_SEGMENT_SIZE ) +# define FLASH_SEGMENT_SIZE 256u +#endif + +/* Value of deleted flash memory, usually 0xFF */ +#if !defined( FBL_FLASH_DELETED ) +# define FBL_FLASH_DELETED 0xFFu + +#endif +/* Common error codes */ +#define kFlashOk 0x00u /**< Function call successful */ +#define kFlashFailed 0x01u /**< Function call failed */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef unsigned short tFlashErrorCode; +typedef unsigned char tFlashUint8; /**< equivalent to vuint8 */ +typedef unsigned long tFlashUint32; /**< equivalent to vuint32 */ + +#endif /* FBLDRVFLASH_ASRFLSHIS_H */ + +/*********************************************************************************************************************** + * END OF FILE: FLASHDRV.H + **********************************************************************************************************************/ diff --git a/Source/bsw/Fbl/v_ver.h b/Source/bsw/Fbl/v_ver.h new file mode 100644 index 0000000..99ba339 --- /dev/null +++ b/Source/bsw/Fbl/v_ver.h @@ -0,0 +1,176 @@ +/*---------------------------------------------------------------------------- + * License information: + * - Serialnumber: CBD2501331 + ---------------------------------------------------------------------------- + * Software is licensed for: + * Flex Automotive GmbH + * Package: FBL Ford SLP7 - in the project "On-Board charger (OBC)" for Ford + * Micro: AM263P4AFONFZCZRQ1 + * Compiler: Texas Instruments (LLVM-based) 3.2.0 LTS + ---------------------------------------------------------------------------*/ + +#ifndef __V_VER_H +# define __V_VER_H + + +/*---------------------------------------------------------------------------- + SIP version + ---------------------------------------------------------------------------*/ + +# define _VECTOR_SIP_VERSION 0x3407u +# define _VECTOR_SIP_RELEASE_VERSION 0x08u +# define _VECTOR_SIP_BUILD_VERSION 0x00u + + +/*---------------------------------------------------------------------------- + DrvMem_Mem_30_FblHis + ---------------------------------------------------------------------------*/ +# define _DRVMEM_MEM_30_FBLHIS_VERSION 0x0101u +# define _DRVMEM_MEM_30_FBLHIS_RELEASE_VERSION 0x01u + +/*---------------------------------------------------------------------------- + FblBm_Hdr + ---------------------------------------------------------------------------*/ +# define _FBLBM_HDR_VERSION 0x0202u +# define _FBLBM_HDR_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblBm_Main + ---------------------------------------------------------------------------*/ +# define _FBLBM_MAIN_VERSION 0x0612u +# define _FBLBM_MAIN_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblDiag_14229_Ford + ---------------------------------------------------------------------------*/ +# define _FBLDIAG_OEM_VERSION 0x0507u +# define _FBLDIAG_OEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblHal_Arm32 + ---------------------------------------------------------------------------*/ +# define _FBLHAL_ARM32_VERSION 0x0119u +# define _FBLHAL_ARM32_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_VERSION 0x0217u +# define _FBLKBAPI_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_Brs + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_HW_VERSION 0x0203u +# define _FBLKBAPI_HW_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_Ford + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_OEM_VERSION 0x0911u +# define _FBLKBAPI_OEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_Frame_Ford + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_FRAME_OEM_VERSION 0x0505u +# define _FBLKBAPI_FRAME_OEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_FrameDiag_Ford + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_FRAMEDIAG_OEM_VERSION 0x0611u +# define _FBLKBAPI_FRAMEDIAG_OEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_FrameNv_Ford + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_FRAMENV_OEM_VERSION 0x0706u +# define _FBLKBAPI_FRAMENV_OEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblKbApi_FrameWd + ---------------------------------------------------------------------------*/ +# define _FBLKBAPI_FRAMEWD_VERSION 0x0311u +# define _FBLKBAPI_FRAMEWD_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_Fsm + ---------------------------------------------------------------------------*/ +# define _FBLLIB_FSM_VERSION 0x0102u +# define _FBLLIB_FSM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_Lbt + ---------------------------------------------------------------------------*/ +# define _FBLLIB_LBT_VERSION 0x0105u +# define _FBLLIB_LBT_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_Mem + ---------------------------------------------------------------------------*/ +# define _FBLLIB_MEM_VERSION 0x0414u +# define _FBLLIB_MEM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_NvPattern + ---------------------------------------------------------------------------*/ +# define _FBLLIB_NVPATTERN_VERSION 0x0201u +# define _FBLLIB_NVPATTERN_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_SecBoot_vHsm + ---------------------------------------------------------------------------*/ +# define _FBLLIB_SECBOOT_VHSM_VERSION 0x0206u +# define _FBLLIB_SECBOOT_VHSM_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblLib_ValStruct + ---------------------------------------------------------------------------*/ +# define _FBLVALSTRUCT_VERSION 0x0108u +# define _FBLVALSTRUCT_RELEASE_VERSION 0x01u + +/*---------------------------------------------------------------------------- + FblMain + ---------------------------------------------------------------------------*/ +# define _FBL_MAIN_VERSION 0x0608u +# define _FBL_MAIN_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblMio + ---------------------------------------------------------------------------*/ +# define _FBLMIO_VERSION 0x0104u +# define _FBLMIO_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblUpd_Main + ---------------------------------------------------------------------------*/ +# define _FBLUPD_MAIN_VERSION 0x0607u +# define _FBLUPD_MAIN_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblWd + ---------------------------------------------------------------------------*/ +# define _FBLWD_VERSION 0x0305u +# define _FBLWD_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblWrapperCom_PduR + ---------------------------------------------------------------------------*/ +# define _FBLWRAPPERCOM_PDUR_VERSION 0x0709u +# define _FBLWRAPPERCOM_PDUR_RELEASE_VERSION 0x00u + +/*---------------------------------------------------------------------------- + FblWrapperFlash_XVirtualHis + ---------------------------------------------------------------------------*/ +# define _FBLWRAPPERFLASH_VIRTUALIO_VERSION 0x0100u +# define _FBLWRAPPERFLASH_VIRTUALIO_RELEASE_VERSION 0x01u + +/*---------------------------------------------------------------------------- + SysService_SecModHis + ---------------------------------------------------------------------------*/ +# define _SYSSERVICE_SECMODHIS_VERSION 0x0315u +# define _SYSSERVICE_SECMODHIS_RELEASE_VERSION 0x00u + +#endif + diff --git a/Source/bsw/FblAsrStubs/BswM.h b/Source/bsw/FblAsrStubs/BswM.h new file mode 100644 index 0000000..23c5a6b --- /dev/null +++ b/Source/bsw/FblAsrStubs/BswM.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief BswM ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef BSWM_H +#define BSWM_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define BswM_RequestMode(ModuleId, ErrorId) + +#endif /* BSWM_H */ + +/*********************************************************************************************************************** +* END OF FILE: BSWM.H +**********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/ComM.h b/Source/bsw/FblAsrStubs/ComM.h new file mode 100644 index 0000000..8720e1c --- /dev/null +++ b/Source/bsw/FblAsrStubs/ComM.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief ComM ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef COMM_H +#define COMM_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte_ComM_Type.h" + +#endif /* COMM_H */ + +/*********************************************************************************************************************** +* END OF FILE: COMM.H +**********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/ComM_BusSM.h b/Source/bsw/FblAsrStubs/ComM_BusSM.h new file mode 100644 index 0000000..edcd5bf --- /dev/null +++ b/Source/bsw/FblAsrStubs/ComM_BusSM.h @@ -0,0 +1,50 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief ComM_BusSM ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef COMM_BUSSM_H +#define COMM_BUSSM_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "ComM_Types.h" + +/*********************************************************************************************************************** + * EXTERNAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLASRSTUBS_COMM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +FUNC(void, COMM_CODE) ComM_BusSM_ModeIndication(NetworkHandleType Channel, P2VAR(ComM_ModeType, AUTOMATIC, COMM_APPL_VAR) ComMode); +#define FBLASRSTUBS_COMM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* COMM_BUSSM_H */ + +/*********************************************************************************************************************** +* END OF FILE: COMM_BUSSM.H +**********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/ComM_Types.h b/Source/bsw/FblAsrStubs/ComM_Types.h new file mode 100644 index 0000000..dc81e58 --- /dev/null +++ b/Source/bsw/FblAsrStubs/ComM_Types.h @@ -0,0 +1,47 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief ComM_Types ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef COMM_TYPES_H +#define COMM_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "ComStack_Types.h" /* Include standard types */ +#include "ComM_GenTypes.h" + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef uint8 ComM_ModeType; + +#endif /* COMM_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: COMM_TYPES.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Dem.c b/Source/bsw/FblAsrStubs/Dem.c new file mode 100644 index 0000000..3cdfc87 --- /dev/null +++ b/Source/bsw/FblAsrStubs/Dem.c @@ -0,0 +1,80 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Dem ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Dem.h" +#include "fbl_inc.h" + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#define FBLASRSTUBS_DEM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * Dem_ReportErrorStatus + **********************************************************************************************************************/ +/*! \brief Report error status dummy function + * \param[in] EventId + * \param[in] EventStatus + **********************************************************************************************************************/ +void Dem_ReportErrorStatus(Dem_EventIdType EventId, Dem_EventStatusType EventStatus) +{ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)EventId; + (void)EventStatus; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ +} + +/*********************************************************************************************************************** + * Dem_SetEventStatus + **********************************************************************************************************************/ +/*! \brief Set event status dummy function + * \param[in] EventId + * \param[in] EventStatus + **********************************************************************************************************************/ +Std_ReturnType Dem_SetEventStatus(Dem_EventIdType EventId, Dem_EventStatusType EventStatus) +{ + Std_ReturnType retval = E_OK; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + (void)EventId; + (void)EventStatus; +# endif /* V_ENABLE_USE_DUMMY_STATEMENT */ + + return retval; +} + +#define FBLASRSTUBS_DEM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * END OF FILE: DEM.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Dem.h b/Source/bsw/FblAsrStubs/Dem.h new file mode 100644 index 0000000..fed671b --- /dev/null +++ b/Source/bsw/FblAsrStubs/Dem.h @@ -0,0 +1,82 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Dem ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef DEM_H +#define DEM_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Std_Types.h" /* AUTOSAR standard types */ +#include "FblAsrStubs_Cfg.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#define DEM_AR_RELEASE_MAJOR_VERSION 4u +#define DEM_AR_RELEASE_MINOR_VERSION 3u +#define DEM_AR_RELEASE_REVISION_VERSION 0u + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +#define DEM_EVENT_STATUS_FAILED 1 +#define DEM_EVENT_STATUS_PASSED 2 +#define DEM_EVENT_STATUS_PREPASSED 3 +#define DEM_EVENT_STATUS_PREFAILED 4 + +#define Dem_FR_E_ACCESS 5 +#define Dem_FRIF_E_JLE_SYNC 6 +#define Dem_FRSM_E_CLUSTER_STARTUP 7 + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +typedef uint16 Dem_EventIdType; +typedef uint8 Dem_EventStatusType; + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define FBLASRSTUBS_DEM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +extern void Dem_ReportErrorStatus( Dem_EventIdType EventId, Dem_EventStatusType EventStatus); +extern Std_ReturnType Dem_SetEventStatus(Dem_EventIdType EventId, Dem_EventStatusType EventStatus); + +#define FBLASRSTUBS_DEM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* DEM_H */ + +/*********************************************************************************************************************** + * END OF FILE: DEM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/FblAsrStubs.h b/Source/bsw/FblAsrStubs/FblAsrStubs.h new file mode 100644 index 0000000..b3349f8 --- /dev/null +++ b/Source/bsw/FblAsrStubs/FblAsrStubs.h @@ -0,0 +1,50 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main header file of FblASrStubs + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 05.00.00 2021-03-12 vishor FBL-3157 Removed EcuM, Os and SchM stubs for proper handling of BRS for FBL + * 05.00.01 2021-03-31 visrie FBL-3000 Added ASR stubs: vHsm_Types, Rte_KeyM_Type + * Added/adapted MemMap sections + * 05.00.02 2022-09-26 visrie FBL-5936 Added byte order defines to v_cfg.h + * 05.00.03 2023-04-24 vismix ESCAN00113852 Memory abstraction doesn't work as expected if BswM_LinTp.h is used + * 05.00.04 2023-10-25 visrie ESCAN00107438 Compiler warning: typedef name has already been declared (with + * same type) for Csm_ResultType + * ESCAN00112632 No changes + * ESCAN00115668 Compiler error: Com_Types.h and Com_Cbk.h files are missing + * 06.00.00 2024-03-20 vishor FBL-7833 Add generator to create stub config files + * ESCAN00116488 Compiler error: Unresolved external Dem_SetEventStatus and AUTOSAR + * Software Specification Version missing + * 06.00.01 2024-04-18 viswmo ESCAN00117142 Compiler error: Undefined symbols ComM_LimitChannelToNoComMode + * and Rte_ModeType_ComMMode + * 06.01.00 2024-08-06 vistbe FBL-9077 Add BswM stubs for DoIP/DoIPInt + **********************************************************************************************************************/ + +#ifndef FBLASRSTUBS_H +#define FBLASRSTUBS_H + +#endif /* FBLASRSTUBS_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBLASRSTUBS.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/MemIf.h b/Source/bsw/FblAsrStubs/MemIf.h new file mode 100644 index 0000000..4967895 --- /dev/null +++ b/Source/bsw/FblAsrStubs/MemIf.h @@ -0,0 +1,46 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief MemIf ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef MEMIF_H +#define MEMIF_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ +#include "MemIf_Types.h" + +/********************************************************************************************************************** + * VERSION + *********************************************************************************************************************/ + +#define MEMIF_AR_RELEASE_MAJOR_VERSION 4u +#define MEMIF_AR_RELEASE_MINOR_VERSION 0u + +#endif /* MEMIF_H */ + +/*********************************************************************************************************************** + * END OF FILE: MEMIF.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/MemIf_Types.h b/Source/bsw/FblAsrStubs/MemIf_Types.h new file mode 100644 index 0000000..3aa14f3 --- /dev/null +++ b/Source/bsw/FblAsrStubs/MemIf_Types.h @@ -0,0 +1,112 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief MemIf_Types ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef MEMIF_TYPES_H +#define MEMIF_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Std_Types.h" + +/********************************************************************************************************************** + * VERSION + *********************************************************************************************************************/ + +#define MEMIF_TYPES_AR_RELEASE_MAJOR_VERSION 4u +#define MEMIF_TYPES_AR_RELEASE_MINOR_VERSION 0u + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* A memory hardware abstraction module's state is denoted in + * this type. Mainly used in MemIf_GetStatus and related + * APIs of memory hardware abstraction modules. + */ +typedef enum +{ + MEMIF_UNINIT = 0, + MEMIF_IDLE, + MEMIF_BUSY, + MEMIF_BUSY_INTERNAL +} MemIf_StatusType; + +/* A requested job can have one these values after it has been + * processed. Use in MemIf_GetJobResult and related memory + * hardware abstraction module APIs. + */ +typedef enum +{ + MEMIF_JOB_OK = 0, + MEMIF_JOB_FAILED, + MEMIF_JOB_PENDING, + MEMIF_JOB_CANCELED, + MEMIF_BLOCK_INCONSISTENT, + MEMIF_BLOCK_INVALID +} MemIf_JobResultType; + + +/* Specifies the processing speed of requested jobs. The exact + * processing duration in the different modes depends on + * configuration of the underlying memory hardware abstraction + * modules. + */ +typedef enum +{ + MEMIF_MODE_SLOW = 0, + MEMIF_MODE_FAST +} MemIf_ModeType; + +/* Workaround for AUTOSAR Release 2.0 Flash Drivers: + * + * Fls assumes, that MemIf provides MemIf_AddressType and MemIf_LenghthType. + * Eep assumes, that it should define its address types on its own. + * MemIf assumes, that Eep is right and hence does NOT provide these + * types. However, there are some implementations, that did not recognize + * this inconsistency, so we have to provide these types in order to + * get Flash drivers and Flash Eeprom Emulation integrated with the + * other BSW Modules. In order to minimize the risk of limiting the + * address range of underlying flash drivers, both types are based + * on 32bit-address range (allowing 4GB of data, which should be + * considerably adequate). This might not be the optimum data type + * on all platforms, but it's the safest. + */ +typedef uint32 MemIf_AddressType; +typedef uint32 MemIf_LengthType; + +/* + * Because of different spelling in AUTOSAR specifications both MEMIF_JOB_CANCELLED + * and MEMIF_JOB_CANCELED are supported for reasons of compatibility. + */ +#define MEMIF_JOB_CANCELLED MEMIF_JOB_CANCELED + +#endif /* MEMIF_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: MEMIF_TYPES.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/NvM_Cbk.h b/Source/bsw/FblAsrStubs/NvM_Cbk.h new file mode 100644 index 0000000..7f7f6e5 --- /dev/null +++ b/Source/bsw/FblAsrStubs/NvM_Cbk.h @@ -0,0 +1,34 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief NvM_Cbk ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef NVM_CBK_H +#define NVM_CBK_H + +#endif /* NVM_CBK_H */ + +/*********************************************************************************************************************** + * END OF FILE: NVM_CBK.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte.h b/Source/bsw/FblAsrStubs/Rte.h new file mode 100644 index 0000000..77595ac --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_H +#define RTE_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Std_Types.h" + +#endif /* RTE_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte_ComM.h b/Source/bsw/FblAsrStubs/Rte_ComM.h new file mode 100644 index 0000000..d9946bf --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte_ComM.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte_ComM ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_COMM_H +#define RTE_COMM_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte_ComM_Type.h" + +#endif /* RTE_COMM_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE_COMM.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte_ComM_Type.h b/Source/bsw/FblAsrStubs/Rte_ComM_Type.h new file mode 100644 index 0000000..171a147 --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte_ComM_Type.h @@ -0,0 +1,62 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte_ComM_type ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_COMM_TYPE_H +#define RTE_COMM_TYPE_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte_Type.h" + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef ComM_ModeType Rte_ModeType_ComMMode; + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#ifndef COMM_NO_COMMUNICATION +# define COMM_NO_COMMUNICATION 0U +#endif + +#ifndef COMM_SILENT_COMMUNICATION +# define COMM_SILENT_COMMUNICATION 1U +#endif + +#ifndef COMM_FULL_COMMUNICATION +# define COMM_FULL_COMMUNICATION 2U +#endif + +#endif /* RTE_COMM_TYPE_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE_COMM_TYPE.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte_Csm_Type.h b/Source/bsw/FblAsrStubs/Rte_Csm_Type.h new file mode 100644 index 0000000..ad41aea --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte_Csm_Type.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte_Csm_type ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_CSM_TYPE_H +#define RTE_CSM_TYPE_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte_Type.h" + +#endif /* RTE_CSM_TYPE_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE_CSM_TYPE.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte_EcuM_Type.h b/Source/bsw/FblAsrStubs/Rte_EcuM_Type.h new file mode 100644 index 0000000..34b9aaa --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte_EcuM_Type.h @@ -0,0 +1,40 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte_EcuM_type ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_ECUM_TYPE_H +#define RTE_ECUM_TYPE_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte_Type.h" + +#endif /* RTE_ECUM_TYPE_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE_ECUM_TYPE.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/Rte_Type.h b/Source/bsw/FblAsrStubs/Rte_Type.h new file mode 100644 index 0000000..dbc53fa --- /dev/null +++ b/Source/bsw/FblAsrStubs/Rte_Type.h @@ -0,0 +1,50 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Rte_Type ASR4 stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef RTE_TYPE_H +#define RTE_TYPE_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Rte.h" + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef uint8 EcuM_ModeType; + +typedef uint8 ComM_InhibitionStatusType; +typedef uint8 ComM_UserHandleType; +typedef uint8 ComM_ModeType; + +#endif /* RTE_TYPE_H */ + +/*********************************************************************************************************************** + * END OF FILE: RTE_TYPE.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblAsrStubs/v_cfg.h b/Source/bsw/FblAsrStubs/v_cfg.h new file mode 100644 index 0000000..0ec8203 --- /dev/null +++ b/Source/bsw/FblAsrStubs/v_cfg.h @@ -0,0 +1,99 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief v_cfg stub for flash bootloader + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + **********************************************************************************************************************/ + +#ifndef V_CFG_H +#define V_CFG_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "Platform_Types.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#ifndef V_GEN_GENERATOR_MSR +# define V_GEN_GENERATOR_MSR +#endif + +#if defined( CPU_TYPE_64 ) +# if (CPU_TYPE == CPU_TYPE_64) +# if !defined( C_CPUTYPE_64BIT ) +# define C_CPUTYPE_64BIT +# endif +# endif +#endif + +#if (CPU_TYPE == CPU_TYPE_32) +# if !defined( C_CPUTYPE_32BIT ) +# define C_CPUTYPE_32BIT +# endif +#endif + +#if (CPU_TYPE == CPU_TYPE_16) +# if !defined( C_CPUTYPE_16BIT ) +# define C_CPUTYPE_16BIT +# endif +#endif + +#if (CPU_TYPE == CPU_TYPE_8) +# if !defined( C_CPUTYPE_8BIT ) +# define C_CPUTYPE_8BIT +# endif +#endif + +#if (CPU_BIT_ORDER == LSB_FIRST) +# if !defined( C_CPUTYPE_BITORDER_LSB2MSB ) +# define C_CPUTYPE_BITORDER_LSB2MSB +# endif +#endif + +#if (CPU_BIT_ORDER == MSB_FIRST) +# if !defined( C_CPUTYPE_BITORDER_MSB2LSB ) +# define C_CPUTYPE_BITORDER_MSB2LSB +# endif +#endif + +#if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# if !defined( C_CPUTYPE_LITTLEENDIAN ) +# define C_CPUTYPE_LITTLEENDIAN +# endif +#endif + +#if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# if !defined( C_CPUTYPE_BIGENDIAN ) +# define C_CPUTYPE_BIGENDIAN +# endif +#endif + +#endif /* V_CFG_H */ + +/*********************************************************************************************************************** + * END OF FILE: V_CFG.H + **********************************************************************************************************************/ + diff --git a/Source/bsw/FblBm/bm_main.c b/Source/bsw/FblBm/bm_main.c new file mode 100644 index 0000000..dd05e59 --- /dev/null +++ b/Source/bsw/FblBm/bm_main.c @@ -0,0 +1,2459 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2019-10-10 vistmo FBL-390 Adapt main function interface for vBaseEnv + * 04.00.01 2019-11-05 visrie ESCAN00104616 No changes + * ESCAN00104790 No changes + * 05.00.00 2019-12-04 visrie FBL-456 Added support for new FblLibSecBoot interface + * ESCAN00104644 Initialize DET module + * ESCAN00105176 Added support for VTT use case + * 05.01.00 2020-01-13 visrie ESCAN00104481 No changes + * FBL-953 No changes + * 05.02.00 2020-02-28 vistbe FBL-949 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 Support of EcuM functions + * 06.00.01 2020-04-08 visrie ESCAN00106837 Compiler error: wrong argument type at FblSb_VerifySegments + * 06.00.02 2020-10-28 visrcn ESCAN00107189 Compiler error: Wrong definition for FblMain function + * 06.01.00 2021-08-11 visrie FBL-3394 Move default implementation of CheckReprogFlag into FblBm_Ap + * Added/adapted MemMap sections + * 06.02.00 2022-02-04 visrie FBL-4602 Added support of new SecBoot API (VerifyHeaderRom) + * 06.02.01 2022-04-06 fmenke ESCAN00111029 [MCMP only] Compiler error: Label FblDiagInitPowerOn is not defined + * 06.03.00 2022-04-08 visrie FBL-4126 No changes + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 Add support for new MagicFlag value and Swap API + * 06.04.01 2022-04-28 fmenke ESCAN00111741 SecureBoot for Bootloader not checked during reprogramming + * request started by application + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 Encapsulate call of FblInterruptDisable + * 06.06.00 2022-07-13 fmenke FBL-5391 Add callout for missing optional dependency + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 FblSb_VerifySegments is needlessly called twice. + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 Adjust FBL LBT Check + * 06.08.00 2022-11-30 visrie FBL-6065 No changes + * 06.08.01 2024-03-04 visrie ESCAN00116460 Assertion missing in FblMemGet/SetInteger + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 Add support for OEM updater solution + * 06.10.00 2024-11-15 erizk FBL-9652 Optimize startup times for secure boot + * 06.11.00 2025-05-23 dganesh FBL-9715 Extend presence pattern to connect validity information + * 06.12.00 2025-09-23 pharring FBL-10124 Add support for FblLib_Logger + **********************************************************************************************************************/ + +#define BM_MAIN_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" + +#include "fbl_main_types.h" +#include "bm_main.h" +#include "fbl_fsm.h" + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# include "fbl_secboot.h" +#endif + +#include "EcuM.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLBM_MAIN_VERSION != 0x0612u ) || \ + ( FBLBM_MAIN_RELEASE_VERSION != 0x00u ) +# error "Error in bm_main.c: Source and Header file are inconsistent!" +#endif + +#if ( FBLBM_MAIN_VERSION != _FBLBM_MAIN_VERSION ) || \ + ( FBLBM_MAIN_RELEASE_VERSION != _FBLBM_MAIN_RELEASE_VERSION ) +# error "Error in bm_main.c: Source and v_ver.h are inconsistent!" +#endif + +/* Interface version compatibility check: General callouts */ +#if defined( FBLBM_AP_API_VERSION_MAJOR ) && \ + defined( FBLBM_AP_API_VERSION_MINOR ) +#else +# error "Error in bm_main.c: Interface version requirements not defined!" +#endif + +#if ( FBLBM_AP_API_VERSION_MAJOR != FBLBM_API_VERSION_MAJOR ) || \ + ( FBLBM_AP_API_VERSION_MINOR > FBLBM_API_VERSION_MINOR ) +# error "Error in bm_main.c: Interface version compatibility check failed!" +#endif + +/* Interface version compatibility check: platform-specific callouts */ +#if defined( FBLBM_AP_HW_API_VERSION_MAJOR ) +# if defined( FBLBM_AP_HW_API_VERSION_MINOR ) +# else +# error "Error in bm_main.c: Interface version requirements not defined!" +# endif + +# if ( FBLBM_AP_HW_API_VERSION_MAJOR != FBLBM_API_VERSION_MAJOR ) || \ + ( FBLBM_AP_HW_API_VERSION_MINOR > FBLBM_API_VERSION_MINOR ) +# error "Error in bm_main.c: Interface version compatibility check failed!" +# endif +#endif + +/* Interface version compatibility check: OEM-specific callouts */ +#if defined( FBLBM_AP_OEM_API_VERSION_MAJOR ) +# if defined( FBLBM_AP_OEM_API_VERSION_MINOR ) +# else +# error "Error in bm_main.c: Interface version requirements not defined!" +# endif + +# if ( FBLBM_AP_OEM_API_VERSION_MAJOR != FBLBM_API_VERSION_MAJOR ) || \ + ( FBLBM_AP_OEM_API_VERSION_MINOR > FBLBM_API_VERSION_MINOR ) +# error "Error in bm_main.c: Interface version compatibility check failed!" +# endif +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( _MICROSOFT_C_VTT_ ) +# define FBLBM_MAIN_ENABLE_VTT_USECASE +#endif /* _MICROSOFT_C_VTT_ */ + +/** Helper macro for filling state structures (enhance readability) */ +#define FBLBM_SIZE_AND_ARRAY(array) FBLBM_ARRAY_SIZE(array), (array) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if (!defined( FBLBM_DISABLE_USE_VERIFY_HEADER_ROM ) && \ + ( ( FBLSB_API_REFERENCE_VERSION_MAJOR > 0x02u ) || \ + (( FBLSB_API_REFERENCE_VERSION_MAJOR == 0x02u ) && ( FBLSB_API_REFERENCE_VERSION_MINOR >= 0x02u )))) +# define FBLBM_ENABLE_USE_VERIFY_HEADER_ROM +# endif +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) || defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) +# define FBLBM_DISABLE_EARLY_FBL_SEGMENTS_CHECK +#else +# define FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK +#endif + +/*********************************************************************************************************************** + * TYPEDEFS, ENUMS + **********************************************************************************************************************/ + +/** Bootmanager States */ /* PRQA S 3205 TAG_FblBmMain_3205_1 */ /* MD_FblBmMain_3205_UnusedIdentifiers */ +typedef enum +{ + FBLBM_STATE_POWER_ON, /* 0 */ + FBLBM_STATE_INIT, /* 1 */ + FBLBM_STATE_CHECK_FBL_VALIDITY, /* 2 */ + FBLBM_STATE_FAILSAFE_UPDATER_ENABLED, /* 3 */ + FBLBM_STATE_FAILSAFE_UPDATER_SEARCH_INIT, /* 4 */ + FBLBM_STATE_FAILSAFE_UPDATER_CHECK, /* 5 */ + FBLBM_STATE_FAILSAFE_UPDATER_SEARCH_NEXT, /* 6 */ + FBLBM_STATE_FAILSAFE_UPDATER_USER_CHECK, /* 7 */ + FBLBM_STATE_CALL_FAILSAFE_UPDATER, /* 8 */ + FBLBM_STATE_CHECK_PP_KEY_AVAILABILITY, /* 9 */ + FBLBM_STATE_CALL_FBL_PP_INIT_KEY, /* 10 */ + FBLBM_STATE_CHECK_SIGNED_PP_VALIDITY, /* 11 */ + FBLBM_STATE_SECURE_BOOT_ENABLED, /* 12 */ + FBLBM_STATE_CHECK_KEY_AVAILABILITY, /* 13 */ + FBLBM_STATE_CALL_FBL_INIT_KEY, /* 14 */ + FBLBM_STATE_INIT_FBL_MAC_ENABLED, /* 15 */ + FBLBM_STATE_CHECK_FBL_MAC_ERASED, /* 16 */ + FBLBM_STATE_CALL_FBL_INIT_CMAC, /* 17 */ + FBLBM_STATE_STAY_IN_BOOT_ENABLED, /* 18 */ + FBLBM_STATE_CHECK_APPL_START_FLAG, /* 19 */ + FBLBM_STATE_CHECK_FBL_LBT, /* 20 */ + FBLBM_STATE_CHECK_REPROG_FLAG, /* 21 */ + FBLBM_STATE_REPROG_LBT_ENABLED, /* 22 */ + FBLBM_STATE_CHECK_REPROG_LBT, /* 23 */ + FBLBM_STATE_TARGET_LIST_INIT, /* 24 */ + FBLBM_STATE_TARGET_CHECK, /* 25 */ + FBLBM_STATE_TARGET_LIST_NEXT, /* 26 */ + FBLBM_STATE_CALL_TARGET, /* 27 */ + FBLBM_STATE_CHECK_LATE_FBL_SEGMENTS, /* 28 */ + FBLBM_STATE_CHECK_FBL_VERIFICATION_STAY_IN_BOOT, /* 29 */ + FBLBM_STATE_CALL_FBL, /* 30 */ + FBLBM_STATE_CALL_FBL_STAY_IN_BOOT, /* 31 */ + FBLBM_STATE_CHECK_EARLY_FBL_SEGMENTS, /* 32 */ + FBLBM_STATE_FAIL /* 33 */ +} tFblBmState; + +/** Events for BM FSM: Only one Event "continue" */ +typedef enum +{ + FBLBM_EVENT_CONTINUE = kFblFsmDefaultEvent_Count /* 4 */ +} tFblBmEvent; +/* PRQA L:TAG_FblBmMain_3205_1 */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLBM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static void FblBmDeinit(void); + +/* Event Handlers */ +static tFblFsmGuard FblBmState_PowerOn_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_Init_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) || defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +static tFblFsmGuard FblBmState_CallFailsafeUpdater_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY) +static tFblFsmGuard FblBmState_CallFblInitKey_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) +static tFblFsmGuard FblBmState_CallTarget_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_BOOTTARGETLIST_SIZE > 0u */ +static tFblFsmGuard FblBmState_CallFbl_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +static tFblFsmGuard FblBmState_CallFblStayInBoot_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +static tFblFsmGuard FblBmState_CheckEarlyFblSegments (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_SECURE_BOOT */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +static tFblFsmGuard FblBmState_CallFblInitCmac_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +static tFblFsmGuard FblBmState_Fail_Entry (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +/* Guards */ +static tFblFsmGuard FblBmState_CheckFblValidity (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) +static tFblFsmGuard FblBmState_FailsafeUpdaterSearchInit (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_FailsafeUpdaterCheck (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_FailsafeUpdaterSearchNext (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#elif defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +static tFblFsmGuard FblBmState_FailsafeUpdaterUserCheck (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +static tFblFsmGuard FblBmState_CheckSignedPresPattKeyAvailability (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_CallFblInitKeySignedPresPatt (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_CheckSignedPresPattValidity (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + +static tFblFsmGuard FblBmState_CheckKeyAvailability (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +static tFblFsmGuard FblBmState_CheckFblMacErased (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +static tFblFsmGuard FblBmState_CheckApplStartFlag (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ +static tFblFsmGuard FblBmState_CheckReprogFlag (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_CheckFblLbt (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +static tFblFsmGuard FblBmState_CheckReprogLbt (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) +static tFblFsmGuard FblBmState_TargetListInit (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_TargetCheck (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +static tFblFsmGuard FblBmState_TargetListNext (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); +#endif /* FBLBM_BOOTTARGETLIST_SIZE > 0u */ +static tFblFsmGuard FblBmState_CheckLateFblSegments (tFblFsmContextPtr const pFsmContext, tFblFsmEvent event); + +#define FBLBM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLBM_HEADER_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** BM header data for access from application software */ +V_MEMROM0 V_MEMROM1 tFblBmHeader V_MEMROM2 FblBmHeader = /* PRQA S 1514 */ /* MD_FblBmMain_1514_BmHeader */ +{ + FBLBM_HEADER_MAGIC_VALUE, + FBLBM_HEADER_MAJOR_VERSION, + FBLBM_HEADER_MINOR_VERSION, + FBL_HEADER_ADDRESS, +#if defined( FBLBM_MAIN_ENABLE_FBL_START ) + (tFblStrtFct)&FblStart, +#else + (tFblStrtFct)V_NULL, +#endif +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) + (tApplStrtFct)&ApplStart, +#else + (tApplStrtFct)V_NULL, +#endif + 0u, /* Checksum is not yet used */ + FBLBM_HEADER_END_MAGIC_VALUE +}; +#define FBLBM_HEADER_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLBM_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** Block Info for the FBL block */ +V_MEMRAM0 static V_MEMRAM1 tFblBmBlockInfo V_MEMRAM2 fblBmBlockInfo; + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) +/** Local copy of FBL header structure */ +V_MEMRAM0 static V_MEMRAM1 tFblHeader V_MEMRAM2 fblBmFblHeader; /* PRQA S 3218 */ /* MD_FBL_3218_FileScopeStatic */ +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + +/** Context Structure of the Finite State Machine (FSM) */ +V_MEMRAM0 static V_MEMRAM1 tFblFsmContext V_MEMRAM2 g_BmFsmContext; /* PRQA S 3218 */ /* MD_FBL_3218_FileScopeStatic */ + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) || defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +/** Entry Point for Failsafe Updater */ +V_MEMRAM0 static V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 g_BmFailsafeUpdaterBmHeader; +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) +/** Counter for search for valid target */ +V_MEMRAM0 static V_MEMRAM1 vuintx V_MEMRAM2 g_BmTargetListIndex; +/** Entry Point for target */ +V_MEMRAM0 static V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 g_BmTargetBmHeader; +#endif /* FBLBM_BOOTTARGETLIST_SIZE > 0u */ + +/** Error Code */ +V_MEMRAM0 static V_MEMRAM1 tFblBmError V_MEMRAM2 g_BmError; + +#define FBLBM_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/***** State machine *****/ + +#define FBLBM_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/** State PowerOn (0) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_PowerOn[] = { + /* Initialize Memory and go directly to next step: Init + */ + FBL_FSM_TRIGGER_ENTRY(FblBmState_PowerOn_Entry), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_INIT) +}; + +/** State Init (1) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_Init[] = { + /* Call Init Routines + * GOTO next step on continue-event + */ + FBL_FSM_TRIGGER_ENTRY(FblBmState_Init_Entry), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CHECK_FBL_VALIDITY) +}; + +/** State CheckFblValidity (2) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckFblValidity[] = { + /* Configuration switch: + * IF Extended PP is enabled goto state CheckKeyPPAvailability + * ELSEIF FBL is valid goto state CheckSecureBootEnabled + * ELSE GOTO UpdaterEnabled + */ +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckFblValidity, FBLBM_STATE_CHECK_PP_KEY_AVAILABILITY), +#else + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckFblValidity, FBLBM_STATE_SECURE_BOOT_ENABLED), +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAILSAFE_UPDATER_ENABLED) +}; + +/** State FailsafeUpdaterEnabled (3) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_FailsafeUpdaterEnabled[] = { + /* Configuration switch: If Updater support is enabled search for updater. + * This state is reached when no valid FBL is available. This can only happen + * if a FBL-update process is interrupted. + */ +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAILSAFE_UPDATER_SEARCH_INIT) +#elif defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAILSAFE_UPDATER_USER_CHECK) +#else /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ +}; + +/** State FailsafeUpdaterSearchInit (4) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_FailsafeUpdaterSearchInit[] = { +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_FailsafeUpdaterSearchInit, FBLBM_STATE_FAILSAFE_UPDATER_CHECK), /* */ +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State FailsafeUpdaterCheck (5) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_FailsafeUpdaterCheck[] = { + /* If a update is aborted e.g. due to power loss, the FBL may be already erased. + * In this case: Search for a valid Updater and call it + */ +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_FailsafeUpdaterCheck, FBLBM_STATE_CALL_FAILSAFE_UPDATER), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAILSAFE_UPDATER_SEARCH_NEXT), +#else /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ +}; + +/** State FailsafeUpdaterSearchNext (6) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_FailsafeUpdaterSearchNext[] = { +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_FailsafeUpdaterSearchNext, FBLBM_STATE_FAILSAFE_UPDATER_CHECK), +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State FailsafeUpdaterUserCheck (7) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_FailsafeUpdaterUserCheck[] = { +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_FailsafeUpdaterUserCheck, FBLBM_STATE_CALL_FAILSAFE_UPDATER), +#endif + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CallFailsafeUpdater (8) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFailsafeUpdater[] = { + /* Start the Updater + */ +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) || defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFailsafeUpdater_Entry), +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + + +/** State CheckSignedPresPattKeyAvailability (9) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckSignedPresPattKeyAvailability[] = { + /* Check if a Key is already available. If not, FBL shall be called to initialize the key. + */ +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckSignedPresPattKeyAvailability, FBLBM_STATE_CHECK_SIGNED_PP_VALIDITY), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CALL_FBL_PP_INIT_KEY) +#else /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +}; + +/** State CallFblInitKeySignedPresPatt (10) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFblInitKeySignedPresPatt[] = { + /* Call FBL to initialize key */ +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFblInitKeySignedPresPatt), +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CheckSignedPresPattValidity with MAC (11) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckSignedPresPattValidity[] = { +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckSignedPresPattValidity, FBLBM_STATE_SECURE_BOOT_ENABLED), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAILSAFE_UPDATER_ENABLED) +#else /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +}; + +/** State SecureBootEnabled (12) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_SecureBootEnabled[] = { + /* Configuration switch: + * IF Secure Boot is enabled GOTO CheckKeyAvailability + * ELSE skip this step + */ +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_KEY_AVAILABILITY) +#else + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_EARLY_FBL_SEGMENTS) +#endif +}; + +/** State CheckKeyAvailability (13) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckKeyAvailability[] = { + /* Check if a Key is already available. If not, FBL shall be called to initialize the key. + */ + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckKeyAvailability, FBLBM_STATE_INIT_FBL_MAC_ENABLED), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CALL_FBL_INIT_KEY) +}; + +/** State CallFblInitKey (14) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFblInitKey[] = { + /* Call FBL to initialize key */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFblInitKey_Entry), +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State InitFblCmacEnabled (15) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_InitFblMacEnabled[] = { + /* Configuration switch: + * IF Secure Boot is enabled GOTO CheckFblMacErased + * ELSE skip this step + */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_FBL_MAC_ERASED) +#else /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_EARLY_FBL_SEGMENTS) +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +}; + +/** State CheckFblMacErased (16) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckFblMacErased[] = { + /* Check if a CMAC is available. If not, the FBL is probably written with a debugger and the CMAC area is in erased state. FBL shall be called to initialize the CMAC. + */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckFblMacErased, FBLBM_STATE_CALL_FBL_INIT_CMAC), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CHECK_EARLY_FBL_SEGMENTS) +#else /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +}; + +/** State CallFblInitCmac (17) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFblInitCmac[] = { + /* Call FBL and set Magicflag to make it init its CMAC. Shall be used only for debugging. + */ +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFblInitCmac_Entry), +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State StayInBootEnabled (18) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_StayInBootEnabled[] = { + /* Configuration Switch: If Stay in Boot is enabled, ApplStartMagicFlag must be evaluated to decide + * if the application shall be started. Otherwise this can be skipped. + */ +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT) + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_APPL_START_FLAG) +#else /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_FBL_LBT) +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + }; + +/** State CheckApplStartFlag (19) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckApplStartFlag[] = { + /* Evaluate ApplStartMagicFlag to decide if the application shall be started. + */ +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckApplStartFlag, FBLBM_STATE_CHECK_FBL_LBT), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CHECK_FBL_VERIFICATION_STAY_IN_BOOT) +#else /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ +}; + +/** State CheckFblLbt (20) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckFblLbt[] = { + /* Check validity and verification of FBL-LBT + * If it can't be verified/validated, something went wrong: The FBL (which contains the FBL-LBT) is valid but + * the LBT is not verified/valid => Fail + */ + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckFblLbt, FBLBM_STATE_REPROG_LBT_ENABLED), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CheckReprogFlag (21) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckReprogFlag[] = { + /* Check if Reprogramming Flag is set. If so, check if FBL is valid. + */ + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckReprogFlag, FBLBM_STATE_CHECK_LATE_FBL_SEGMENTS), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_STAY_IN_BOOT_ENABLED) +}; + +/** State ReprogLbtEnable (22) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_ReprogLbtEnabled[] = { + /* Configuration Switch: If a reprogrammable LBT is used... + */ +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) + FBL_FSM_TRIGGER_UNCONDITIONAL( FBLBM_STATE_CHECK_REPROG_LBT), +#else /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + FBL_FSM_TRIGGER_UNCONDITIONAL( FBLBM_STATE_TARGET_LIST_INIT) +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ +}; + +/** State CheckReprogLbt (23) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckReprogLbt[] = { + /* Check validity/verification of the reprogrammable LBT. If it is not usable, the application can not be found. + * Therefore the FBL is called as a fallback. + */ +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckReprogLbt, FBLBM_STATE_TARGET_LIST_INIT), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CHECK_LATE_FBL_SEGMENTS) +#else /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ +}; + +/** State TargetListInit (24) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_TargetListInit[] = { + /* Prepare searching the target list + */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_TargetListInit, FBLBM_STATE_TARGET_CHECK), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +#else /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_LATE_FBL_SEGMENTS) +#endif /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ +}; + +/** State TargetCheck (25) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_TargetCheck[] = { + /* Check one entry of the target list. If all conditions match, call the target. + * Otherwise go to "Next" + */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_TargetCheck, FBLBM_STATE_CALL_TARGET), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_TARGET_LIST_NEXT) +#else /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ +}; + +/** State TargetListNext (26) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_TargetListNext[] = { + /* Get next element form target list + */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_TargetListNext, FBLBM_STATE_TARGET_CHECK), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_CHECK_LATE_FBL_SEGMENTS) +#else /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_FAIL) +#endif /* FBLBM_BOOTTARGETLIST_SIZE == 0u */ +}; + +/** State CallTarget (27) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallTarget[] = { + /* Start the application/updater + */ +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallTarget_Entry), +#endif /* FBLBM_BOOTTARGETLIST_SIZE > 0u */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CheckLateFblSegments (28) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckLateFblSegments[] = { + /* If verification (CMAC) of FBL is successful, call it. Otherwise go to Fail state + */ + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckLateFblSegments, FBLBM_STATE_CALL_FBL), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CheckFblVerificationStayInBoot (29) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckFblVerificationStayInBoot[] = { + /* If verification (CMAC) of FBL is successful, call it. Otherwise go to Fail state + */ + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckLateFblSegments, FBLBM_STATE_CALL_FBL_STAY_IN_BOOT), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CallFbl (30) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFbl[] = { + /* Start FBL */ + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFbl_Entry), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CallFblStayInBoot (31) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CallFblStayInBoot[] = { + /* Start FBL (StayInBoot)*/ +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT) + FBL_FSM_TRIGGER_ENTRY(FblBmState_CallFblStayInBoot_Entry), +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +}; + +/** State CheckEarlyFblSegments (32) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_CheckEarlyFblSegments[] = { + /* Check if FBL-Segments are valid. + */ +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + FBL_FSM_TRIGGER_TRANSITION_ACTION(FBLBM_EVENT_CONTINUE, FblBmState_CheckEarlyFblSegments, FBLBM_STATE_CHECK_REPROG_FLAG), + FBL_FSM_TRIGGER_TRANSITION(FBLBM_EVENT_CONTINUE, FBLBM_STATE_FAIL) +#else /* FBLBM_ENABLE_SECURE_BOOT */ + FBL_FSM_TRIGGER_UNCONDITIONAL(FBLBM_STATE_CHECK_REPROG_FLAG) +#endif /* FBLBM_ENABLE_SECURE_BOOT */ +}; + +/** State Fail (33) */ +V_MEMROM0 static V_MEMROM1 tFblFsmEventEntry V_MEMROM2 g_BmState_Fail[] = { + /* Fail State + */ + FBL_FSM_TRIGGER_ENTRY(FblBmState_Fail_Entry) +}; + +/** List of all States */ +V_MEMROM0 static V_MEMROM1 tFblFsmStateDefinition V_MEMROM2 bmFsmStates[] = /* PRQA S 3218 */ /* MD_FBL_3218_FileScopeStatic */ +{ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_PowerOn) }, /* 0 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_Init) }, /* 1 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckFblValidity) }, /* 2 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_FailsafeUpdaterEnabled) }, /* 3 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_FailsafeUpdaterSearchInit) }, /* 4 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_FailsafeUpdaterCheck) }, /* 5 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_FailsafeUpdaterSearchNext) }, /* 6 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_FailsafeUpdaterUserCheck ) }, /* 7 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFailsafeUpdater) }, /* 8 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckSignedPresPattKeyAvailability) }, /* 9 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFblInitKeySignedPresPatt) }, /* 10 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckSignedPresPattValidity) }, /* 11 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_SecureBootEnabled) }, /* 12 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckKeyAvailability) }, /* 13 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFblInitKey) }, /* 14 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_InitFblMacEnabled) }, /* 15 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckFblMacErased) }, /* 16 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFblInitCmac) }, /* 17 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_StayInBootEnabled) }, /* 18 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckApplStartFlag) }, /* 19 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckFblLbt) }, /* 20 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckReprogFlag) }, /* 21 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_ReprogLbtEnabled) }, /* 22 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckReprogLbt) }, /* 23 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_TargetListInit) }, /* 24 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_TargetCheck) }, /* 25 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_TargetListNext) }, /* 26 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallTarget) }, /* 27 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckLateFblSegments) }, /* 28 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckFblVerificationStayInBoot) }, /* 29 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFbl) }, /* 30 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CallFblStayInBoot) }, /* 31 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_CheckEarlyFblSegments) }, /* 32 */ + { FBL_FSM_DEFAULT_STATE, FBLBM_SIZE_AND_ARRAY(g_BmState_Fail) } /* 33 */ +}; +#define FBLBM_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +#define FBLBM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * FblBmState_PowerOn_Entry + *********************************************************************************************************************/ +/*! \brief Called directly on PowerOn + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_PowerOn_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + g_BmError = FBLBM_ERROR_NO_ERROR; + + FBLBM_CALLOUT_POWER_ON_PRE_HW(); + FBLBM_CALLOUT_POWER_ON_PRE_OEM(); + FBLBM_CALLOUT_POWER_ON_PRE(); + +#if !defined( FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) + /* Disable global interrupt handling */ + FblInterruptDisable(); /* PRQA S 1006 */ /* MD_FblBmMain_1006 */ +#endif /* FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON */ + +#if defined( FBLBM_MAIN_ENABLE_VTT_USECASE ) +#else + /* Check if bootmanager header address is correctly configured in generation tool */ + /* PRQA S 0306 1 */ /* MD_FblBmMain_0306_FblBmHeader */ + assertFblGen(FblBmHeaderLocal == FblBmHeaderTable, kFblSysAssertParameterOutOfRange); +#endif /* FBL_MAIN_ENABLE_VTT_USECASE */ + + /* Power on initialization of core modules */ + ClrWDInit(); + + MemDriver_InitPowerOn(); + +#if !defined( FBLBM_ENABLE_STANDALONE_MODE ) + /* Initialize states of diagnostic layer */ + FblDiagInitPowerOn(); +#endif + + /* Initialize intermediate access layer for LBT */ + FblLbtInitPowerOn(); + +#if defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP ) + /* Initialize hardware swap module */ + FblSwapInitPowerOn(); +#endif + + /* Initialization callout */ + FBLBM_CALLOUT_POWER_ON_POST_HW(); + FBLBM_CALLOUT_POWER_ON_POST_OEM(); + FBLBM_CALLOUT_POWER_ON_POST(); + + return kFblFsmGuard_True; +} + +/********************************************************************************************************************** + * FblBmState_Init_Entry + *********************************************************************************************************************/ +/*! \brief Called as a 2nd step after PowerOn + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_Init_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Early initialization callout */ + FBLBM_CALLOUT_INIT_PRE_HW(); + FBLBM_CALLOUT_INIT_PRE_OEM(); + FBLBM_CALLOUT_INIT_PRE(); + + /* Initialize and activate watchdog */ + FblInitWatchdog(); + /* Initialize Timer */ + FblTimerInit(); + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) + EcuM_StartupTwo(); +#else + /* EcuM_StartupTwo is called by Bootloader + * Modules which should be already available in the Bootmanager should be placed in INIT_ZERO or INIT_ONE phase + */ +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + /* Initializes SecureBoot */ + FblSb_Init(); +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP ) + /* Execute the flash partition swap */ + (void)FblSwapActivate(); +#endif /* FBLBM_MAIN_ENABLE_HARDWARE_SWAP */ + + /* Late initialization callout */ + FBLBM_CALLOUT_INIT_POST_HW(); + FBLBM_CALLOUT_INIT_POST_OEM(); + FBLBM_CALLOUT_INIT_POST(); + + return kFblFsmGuard_True; +} + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) || defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +/********************************************************************************************************************** + * FblBmState_CallFailsafeUpdater_Entry + *********************************************************************************************************************/ +/*! \brief Call a failsafe updater + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFailsafeUpdater_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + /* Call Failsafe Updater */ + FBLBM_CALLOUT_CALL_FAILSAFE_UPDATER(&g_BmFailsafeUpdaterBmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) +/********************************************************************************************************************** + * FblBmState_CallFblInitKey_Entry + *********************************************************************************************************************/ +/*! \brief Call the FBL and set a magic flag to direct him to init the missing key + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFblInitKey_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + FblBmSetInitKeysMagicFlag(); + + /* Call Fbl */ + FBLBM_CALLOUT_CALL_FBL_INIT_KEYS(&fblBmBlockInfo.bmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ + +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) +/********************************************************************************************************************** + * FblBmState_CallTarget_Entry + *********************************************************************************************************************/ +/*! \brief Call a target (Application, Updater) + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallTarget_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +# endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + /* Call Appl */ + FBLBM_CALLOUT_CALL_TARGET(&g_BmTargetBmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} +#endif/* FBLBM_BOOTTARGETLIST_SIZE > 0u */ + +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +/********************************************************************************************************************** + * FblBmState_CallFblInitCmac_Entry + *********************************************************************************************************************/ +/*! \brief Call the FBL to initialize the FBL-CMAC(s) + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFblInitCmac_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + FblBmSetInitCmacMagicFlag(); + + /* Call Fbl */ + FBLBM_CALLOUT_CALL_FBL_INIT_CMAC(&fblBmBlockInfo.bmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + +/********************************************************************************************************************** + * FblBmState_CallFbl_Entry + *********************************************************************************************************************/ +/*! \brief Start the FBL + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFbl_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + /* Call Fbl */ + FBLBM_CALLOUT_CALL_FBL(&fblBmBlockInfo.bmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} + +# if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +/********************************************************************************************************************** + * FblBmState_CallFblStayInBoot_Entry + *********************************************************************************************************************/ +/*! \brief Start the FBL and set the magic flag that to check for a stay in boot message + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFblStayInBoot_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + FblBmSetStayInBootMagicFlag(); + + /* Call Fbl */ + FBLBM_CALLOUT_CALL_FBL(&fblBmBlockInfo.bmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +/********************************************************************************************************************** + * FblBmState_CheckEarlyFblSegments + *********************************************************************************************************************/ +/*! \brief Start Early check of FBL segments. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckEarlyFblSegments(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result = kFblFsmGuard_True; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +# endif + +# if defined( FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK ) + if (kFblOk != FblSb_VerifySegments(&fblBmBlockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_FBL_VERIFICATION_FAILED; + } +# endif /* FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK */ + + return result; +} +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +/********************************************************************************************************************** + * FblBmState_Fail_Entry + *********************************************************************************************************************/ +/*! \brief An error has happened. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_Fail_Entry(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + + FBLBM_CALLOUT_FATAL_ERROR(g_BmError); + + return kFblFsmGuard_False; +} + +/********************************************************************************************************************** + * FblBmCheckFblValidity + *********************************************************************************************************************/ +/*! \brief Checks the Header and the validity (e.g.: Presence Pattern) of the FBL + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckFblValidity(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + result = kFblFsmGuard_True; + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) + /* Read FBL header from configured memory location */ + + if (FblReadProm(FblBmHeader.fblHeaderAddress, (vuint8*) &fblBmFblHeader, sizeof(tFblHeader)) != sizeof(tFblHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_HEADER_READ_FAILED; + } + + /* Check magic flag of the FBL header */ + if (kFblFsmGuard_True == result) + { + if (fblBmFblHeader.magicFlag != FBL_MAIN_HEADER_MAGIC_FLAG) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_HEADER_MAGIC_FAILED; + } + } + + if (kFblFsmGuard_True == result) + { + /* Fill out the block descriptor for the FBL */ + fblBmBlockInfo.logicalBlock.blockStartAddress = fblBmFblHeader.fblStartAddress; + fblBmBlockInfo.logicalBlock.blockLength = fblBmFblHeader.fblLength; + fblBmBlockInfo.logicalBlock.bmHeaderAddress = (tFblAddress) fblBmFblHeader.bmHeader; /* PRQA S 0306 */ /* MD_FblBmMain_0306 */ + fblBmBlockInfo.logicalBlock.mandatoryType = TRUE; + fblBmBlockInfo.logicalBlock.blockNr = 0x00u; +# if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + /* Check if Presence Pattern is valid */ + if (kFblOk != FBLBM_CALLOUT_IS_VALIDPATTERN(FBLBMHDR_TARGET_FBL, &fblBmBlockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_VALIDITY_FAILED; + } +# else + /* Check if FBL is valid (e.g.: evaluate Presence Pattern) */ + if (kFblOk != FBLBM_CALLOUT_IS_VALIDBLOCK(FBLBMHDR_TARGET_FBL, &fblBmBlockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_VALIDITY_FAILED; + } +# endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + } + +#else + + /* Fill out the block descriptor for the FBL */ + fblBmBlockInfo.logicalBlock.blockStartAddress = FblHeader.fblStartAddress; + fblBmBlockInfo.logicalBlock.blockLength = FblHeader.fblLength; + fblBmBlockInfo.logicalBlock.bmHeaderAddress = (tFblAddress) FblHeader.bmHeader; /* PRQA S 0306 */ /* MD_FblBmMain_0306 */ + fblBmBlockInfo.logicalBlock.mandatoryType = TRUE; + fblBmBlockInfo.logicalBlock.blockNr = 0x00u; + + +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + + if (kFblFsmGuard_True == result) /* PRQA S 2991, 2995 */ /* MD_FblBmMain_2991_2995 */ + { + if (FBLBMHDR_CHKHDR_OK != FblBmHdrGetBmHeader(FBLBMHDR_TARGET_FBL, fblBmBlockInfo.logicalBlock.bmHeaderAddress, &fblBmBlockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_FBL_BMHEADER_INCORRECT; + } + } + + return result; +} + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) +/********************************************************************************************************************** + * FblBmState_FailsafeUpdaterSearchInit + *********************************************************************************************************************/ +/*! \brief Prepare the search for an failsafe Updater. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_UPDATER_FAILSAFE + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_FailsafeUpdaterSearchInit(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Get BmHeader address from callout. In case FBLBM_ENABLE_UPDATER_FAILSAFE is enabled, callout + * FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT is requested to return the next possible location + */ + if (kFblOk == FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT()) + { + result = kFblFsmGuard_True; + } + else + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_SEARCH_INIT_FAILED; + } + return result; +} + +/********************************************************************************************************************** + * FblBmState_CheckFailsafeUpdater + *********************************************************************************************************************/ +/*! \brief Check if failsafe updater is valid and can be verified. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_UPDATER_FAILSAFE + *********************************************************************************************************************/ +/* PRQA S 3673, 6010, 6030 1 */ /* MD_FBL_3673_PointerToConstParameter, MD_MSR_STPTH, MD_MSR_STCYC */ +static tFblFsmGuard FblBmState_FailsafeUpdaterCheck(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + tFblBmBlockInfo blockInfo = { 0 }; + vuint32 headerAddress; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + result = kFblFsmGuard_True; + if (kFblOk != FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS(&headerAddress)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_HEADER_ADDRESS; + } + + /* Hint: The order of checks is different than checking an application because the FBL-LBT can not be used here */ + if (kFblFsmGuard_True == result) + { + blockInfo.bmHeader.bmTargetHandle = FBLBMHDR_TARGET_FBLUPDATER; + blockInfo.bmHeader.bmBlockStartAddress = 0u; + blockInfo.bmHeader.bmBlockLength = 1u; + blockInfo.bmHeader.bmEntryAddress = 0u; + + /* Read BM header from flash */ + if (FblReadProm(headerAddress, (vuint8 *)&blockInfo.bmHeader, sizeof(tFblBmHdrHeader)) != sizeof(tFblBmHdrHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_HEADER_READ_ERROR; + } + } + + /* Check for correct target handle */ + if (kFblFsmGuard_True == result) + { + if (blockInfo.bmHeader.bmTargetHandle != FBLBMHDR_TARGET_FBLUPDATER) /* PRQA S 2992,2996 */ /* MD_FblBmMain_2880_2992_2996_FlashRead */ + { + result = kFblFsmGuard_False; /* PRQA S 2880 */ /* MD_FblBmMain_2880_2992_2996_FlashRead */ + g_BmError = FBLBM_ERROR_UPDATER_HEADER_TYPE; + } + } + + /* Check for consistency errors */ + if (kFblFsmGuard_True == result) + { + if ( kFblOk != FblBmHdrCheckConsistency(&blockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_HEADER_CONSISTENCY; + } + } + + /* Header seems to be OK, check if block is valid */ + if (kFblFsmGuard_True == result) + { + /* Initialize the logical block structure */ + blockInfo.logicalBlock.blockStartAddress = blockInfo.bmHeader.bmBlockStartAddress; + blockInfo.logicalBlock.blockLength = blockInfo.bmHeader.bmBlockLength; + + if (kFblOk != FBLBM_CALLOUT_IS_VALIDBLOCK(blockInfo.bmHeader.bmTargetHandle, &blockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_BLOCK_VALIDITY; + } + } + +# if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) + if (kFblFsmGuard_True == result) + { +# if defined( FBLBM_ENABLE_USE_VERIFY_HEADER_ROM ) + if (kFblOk != FblSb_VerifyHeaderRom(headerAddress, &blockInfo.bmHeader)) +# else + if (kFblOk != FblSb_VerifyHeader(&blockInfo.bmHeader)) +# endif /* FBLBM_ENABLE_USE_VERIFY_HEADER_ROM */ + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_HEADER_CMAC_VERIFY; + } + } +# endif /* FBLBM_ENABLE_HEADER_VERIFICATION */ + + if (kFblFsmGuard_True == result) + { + if (kFblOk != FblSb_VerifySegments(&blockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_VERIFY; + } + } +# endif /* FBLBM_ENABLE_SECURE_BOOT */ + + if (kFblFsmGuard_True == result) + { + g_BmFailsafeUpdaterBmHeader = blockInfo.bmHeader; + } + + return result; +} + +/********************************************************************************************************************** + * FblBmState_FailsafeUpdaterSearchNext + *********************************************************************************************************************/ +/*! \brief Get next possible location for a Failsafe Updater BmHeader + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_UPDATER_FAILSAFE + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_FailsafeUpdaterSearchNext(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + if (kFblOk == FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT()) + { + result = kFblFsmGuard_True; + } + else + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_UPDATER_SEARCH_NEXT_FINISHED; + } + + return result; +} +#elif defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +/********************************************************************************************************************** + * FblBmState_FailsafeUpdaterUserCheck + *********************************************************************************************************************/ +/*! \brief Prepare the search for an failsafe Updater. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_UPDATER_FAILSAFE_USER + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_FailsafeUpdaterUserCheck(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result = kFblFsmGuard_False; +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + if (FBLBM_CALLOUT_FAILSAFE_UPDATER_USER_CHECK(&g_BmFailsafeUpdaterBmHeader) == kFblOk) + { + result = kFblFsmGuard_True; + } + + return result; +} +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +/********************************************************************************************************************** + * FblBmState_CheckSignedPresPattKeyAvailability + *********************************************************************************************************************/ +/*! \brief Check if Key is available for MAC verification. If not, the FBL is called to initialize PP the key. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckSignedPresPattKeyAvailability(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + if (FBLBM_KEY_IS_NOT_AVAILABLE == FBLBM_CALLOUT_GET_PP_SIGN_KEYEMPTY()) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_KEY_NOT_AVAILABLE; + } + else + { + result = kFblFsmGuard_True; + } + return result; +} + +/********************************************************************************************************************** + * FblBmState_CallFblInitKeySignedPresPatt + *********************************************************************************************************************/ +/*! \brief Call the FBL and set a magic flag to direct him to init the missing signed presence pattern key + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CallFblInitKeySignedPresPatt(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Disable Timer etc. */ + FblBmDeinit(); /* PRQA S 2987 */ /* MD_FBL_2987_RedundantCode */ + + FblBmSetSignedPPMagicFlag(); + + /* Call Fbl */ + FBLBM_CALLOUT_CALL_FBL_INIT_SIGNED_PRESENCEPATTERN(&fblBmBlockInfo.bmHeader); + + /* This code is never reached */ + return kFblFsmGuard_True; +} + +/********************************************************************************************************************** + * FblBmState_CheckSignedPresPattValidity + *********************************************************************************************************************/ +/*! \brief Checks the Header and the validity (e.g.: signed Presence Pattern) of the FBL + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckSignedPresPattValidity(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + result = kFblFsmGuard_True; + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) + /* Read FBL header from configured memory location */ + + if (FblReadProm(FblBmHeader.fblHeaderAddress, (vuint8*) &fblBmFblHeader, sizeof(tFblHeader)) != sizeof(tFblHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_HEADER_READ_FAILED; + } + + /* Check magic flag of the FBL header */ + if (kFblFsmGuard_True == result) + { + if (fblBmFblHeader.magicFlag != FBL_MAIN_HEADER_MAGIC_FLAG) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_HEADER_MAGIC_FAILED; + } + } + + if (kFblFsmGuard_True == result) + { + /* Fill out the block descriptor for the FBL */ + fblBmBlockInfo.logicalBlock.blockStartAddress = fblBmFblHeader.fblStartAddress; + fblBmBlockInfo.logicalBlock.blockLength = fblBmFblHeader.fblLength; + fblBmBlockInfo.logicalBlock.bmHeaderAddress = (tFblAddress) fblBmFblHeader.bmHeader; /* PRQA S 0306 */ /* MD_FblBmMain_0306 */ + fblBmBlockInfo.logicalBlock.mandatoryType = TRUE; + fblBmBlockInfo.logicalBlock.blockNr = 0x00u; + + /* Check if FBL is valid (e.g.: evaluate Presence Pattern) */ + if (kFblOk != FBLBM_CALLOUT_IS_VALIDBLOCK(FBLBMHDR_TARGET_FBL, &fblBmBlockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_VALIDITY_FAILED; + } + } + +#else + + /* Fill out the block descriptor for the FBL */ + fblBmBlockInfo.logicalBlock.blockStartAddress = FblHeader.fblStartAddress; + fblBmBlockInfo.logicalBlock.blockLength = FblHeader.fblLength; + fblBmBlockInfo.logicalBlock.bmHeaderAddress = (tFblAddress) FblHeader.bmHeader; /* PRQA S 0306 */ /* MD_FblBmMain_0306 */ + fblBmBlockInfo.logicalBlock.mandatoryType = TRUE; + fblBmBlockInfo.logicalBlock.blockNr = 0x00u; + + +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + + if (kFblFsmGuard_True == result) /* PRQA S 2991, 2995 */ /* MD_FblBmMain_2991_2995 */ + { + if (FBLBMHDR_CHKHDR_OK != FblBmHdrGetBmHeader(FBLBMHDR_TARGET_FBL, fblBmBlockInfo.logicalBlock.bmHeaderAddress, &fblBmBlockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_FBL_BMHEADER_INCORRECT; + } + } + + return result; +} +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +/********************************************************************************************************************** + * FblBmState_CheckKeyAvailability + *********************************************************************************************************************/ +/*! \brief Check if Key is available for MAC verification. If not, the FBL is called to initialize the key. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckKeyAvailability(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) && \ + defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) + if (FBLBM_KEY_IS_NOT_AVAILABLE == FBLBM_CALLOUT_GET_KEYEMPTY()) + { + /* Key is not available */ + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_KEY_NOT_AVAILABLE; + } + else + { + result = kFblFsmGuard_True; + } +#else + /* No key needed or not configured to be checked, return OK to proceed */ + result = kFblFsmGuard_True; +#endif + return result; +} + +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +/********************************************************************************************************************** + * FblBmState_CheckFblMacErased + *********************************************************************************************************************/ +/*! \brief Check if a CMAC (even an invalid one) is written for the FBL - if not call FBL to write a CMAC. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckFblMacErased(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + if (FBLBM_MAC_IS_AVAILABLE == FBLBM_CALLOUT_GET_FBL_CMACERASED(&fblBmBlockInfo)) + { + /* FBL-CMAC is already written */ + result = kFblFsmGuard_False; + } + else + { + /* FBL-CMAC is not yet written */ + result = kFblFsmGuard_True; + } + return result; +} +#endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +/********************************************************************************************************************** + * FblBmState_CheckApplStartFlag + *********************************************************************************************************************/ +/*! \brief Check if the ApplStart flag is set + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBLBM_MAIN_ENABLE_STAY_IN_BOOT + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckApplStartFlag( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + if (FblBmChkApplStartMagicFlag()) + { + FblBmClrMagicFlag(); + result = kFblFsmGuard_True; + } + else + { + result = kFblFsmGuard_False; + } + + return result; +} +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + +/********************************************************************************************************************** + * FblBmState_CheckReprogFlag + *********************************************************************************************************************/ +/*! \brief Check if Reprogramming Flag is set + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBL_DISABLE_STAY_IN_BOOT + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckReprogFlag(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + /* Check if there is a reprogramming request (e.g. UDS, XCP, MCMP, OTA) */ + if (FBLBM_CALLOUT_CHECKREPROGFLAG() == kFblOk) + { + /* Do not clear flag, as the Bootloader requires it as well */ + + result = kFblFsmGuard_True; + } + else + { + result = kFblFsmGuard_False; + } + + return result; +} + +/********************************************************************************************************************** + * FblBmState_CheckFblLbt + *********************************************************************************************************************/ +/*! \brief Check the validity and verification of the FBL-LBT and / or FblBmHeader + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673, 6010 1 */ /* MD_FBL_3673_PointerToConstParameter, MD_MSR_STPTH */ +static tFblFsmGuard FblBmState_CheckFblLbt(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) + tFblFsmGuard result = kFblFsmGuard_True; + +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +# endif + +# if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) +# if defined( FBLBM_ENABLE_USE_VERIFY_HEADER_ROM ) + if (kFblOk != FblSb_VerifyHeaderRom(fblBmBlockInfo.logicalBlock.bmHeaderAddress, &fblBmBlockInfo.bmHeader)) +# else + if (kFblOk != FblSb_VerifyHeader(&fblBmBlockInfo.bmHeader)) +# endif /* FBLBM_ENABLE_USE_VERIFY_HEADER_ROM */ + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_FBL_BMHEADER_VERIFICATION_FAILED; + } + + if (kFblFsmGuard_False != result) +# endif /* FBLBM_ENABLE_HEADER_VERIFICATION */ + { +# if defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) + if (kFblOk != FblSb_VerifyFblLbt(&fblBmFblHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_LBT_VERIFY; + } + else +# endif /* FBLBM_ENABLE_FBLLBT_VERIFICATION */ +# else /* FBLBM_ENABLE_SECURE_BOOT */ + { +# endif /* FBLBM_ENABLE_SECURE_BOOT */ + { + /* Validation of FBL-LBT successful: Use Fbl-LBT */ + FblLbtActivateLbtBlockByAddress((tFblAddress)fblBmFblHeader.pLogicalBlockTable); /* PRQA S 0306 */ /* MD_FblBmMain_0306 */ + + /* Consistency check (BM-LBT <-> FBL-LBT) */ + /* Check if block count exceeds built-in maximum value */ + if (FblLbtGetBlockCount() > FBL_LBT_BLOCK_COUNT) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_LBT_TOO_LARGE; + } + else + { + result = kFblFsmGuard_True; + } + } + } + + if (kFblFsmGuard_True != result) + { + /* Failure - switch back to internal LBT */ + FblLbtInitPowerOn(); + } + + return result; +#else +# if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +# endif + + return kFblFsmGuard_True; +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ +} + +#if defined( FBL_LBT_ENABLE_REPROGRAMMABLE_LBT ) +/********************************************************************************************************************** + * FblBmState_CheckReprogLbt + *********************************************************************************************************************/ +/*! \brief Check if a Reprogrammable LBT is available. If so, use it. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + * \config FBL_LBT_ENABLE_REPROGRAMMABLE_LBT + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckReprogLbt( tFblFsmContextPtr const pFsmContext, tFblFsmEvent event ) +{ + tFblFsmGuard result; + tFblBmBlockInfo blockInfo; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + result = kFblFsmGuard_True; + + /* Get Reprog-LBT from FBL-LBT */ + if (kFblOk != FblLbtGetBlockDescriptorByNr(FBL_LBT_LBT_BLOCK_NUMBER, &blockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_DESCR; + } + + if (kFblFsmGuard_True == result) + { + if (kFblOk != FBLBM_CALLOUT_IS_VALIDBLOCK(FBLBMHDR_TARGET_REPROGLBT, &blockInfo.logicalBlock)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_INVALID; + } + } + + if (kFblFsmGuard_True == result) + { + if (FBLBMHDR_CHKHDR_OK != FblBmHdrGetBmHeader(FBLBMHDR_TARGET_REPROGLBT, blockInfo.logicalBlock.bmHeaderAddress, &blockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_BMHEADER_INCORRECT; + } + } + +# if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) + if (kFblFsmGuard_True == result) + { +# if defined( FBLBM_ENABLE_USE_VERIFY_HEADER_ROM ) + if (kFblOk != FblSb_VerifyHeaderRom(blockInfo.logicalBlock.bmHeaderAddress, &blockInfo.bmHeader)) +# else + if (kFblOk != FblSb_VerifyHeader(&blockInfo.bmHeader)) +# endif /* FBLBM_ENABLE_USE_VERIFY_HEADER_ROM */ + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_VERIFY_HEADER; + } + } +# endif/* FBLBM_ENABLE_HEADER_VERIFICATION */ + + if (kFblFsmGuard_True == result) + { + if (kFblOk != FblSb_VerifySegments(&blockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_VERIFY_SEGMENTS; + } + } +# endif /* FBLBM_ENABLE_SECURE_BOOT */ + + if (kFblFsmGuard_True == result) + { + tFblLbtMagicFlag originalMagicFlag = FblLbtGetMagicFlag(); + + FblLbtActivateLbtBlockByAddress(blockInfo.logicalBlock.blockStartAddress); + + if (originalMagicFlag != FblLbtGetMagicFlag()) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_MAGIC_FLAG; + } + else if (FblLbtGetBlockCount() > FBL_LBT_BLOCK_COUNT) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_REPROG_LBT_BLOCK_COUNT; + } + else + { + /* Nothing to do */ + } + + if (kFblFsmGuard_True != result) + { +# if defined( FBLBM_ENABLE_STANDALONE_MODE ) + /* Use LBT from FblHeader, if this point is reached it was already verified and checked for consistency */ + FblLbtActivateLbtBlockByAddress((tFblAddress)fblBmFblHeader.pLogicalBlockTable); +# else /* FBLBM_ENABLE_STANDALONE_MODE */ + FblLbtInitPowerOn(); +# endif /* FBLBM_ENABLE_STANDALONE_MODE */ + } + } + + return result; +} +#endif /* FBL_LBT_ENABLE_REPROGRAMMABLE_LBT */ + +#if ( FBLBM_BOOTTARGETLIST_SIZE > 0u ) +/********************************************************************************************************************** + * FblBmState_TargetListInit + *********************************************************************************************************************/ +/*! \brief Prepare target list search. Get target list via callout + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_TargetListInit(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + g_BmTargetListIndex = 0u; + result = kFblFsmGuard_True; + + return result; +} + +/********************************************************************************************************************** + * FblBmState_TargetCheck + *********************************************************************************************************************/ +/*! \brief Check validity and verification of a target and all its dependencies + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673, 6010, 6030, 6080 1 */ /* MD_FBL_3673_PointerToConstParameter, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static tFblFsmGuard FblBmState_TargetCheck(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + tFblResult fblSbResult; +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + tFblFsmGuard result; + tFblBmHdrTargetListEntry target; + tFblBmHdrTargetHandle targetHandle; + tFblBmBlockInfo blockInfoTarget = { 0 }; + tFblBmBlockInfo blockInfoDep; + vuintx index; + tFblBmHdrCheckBmHeaderResult findHeaderResult; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + target = FblBm_BootTargetList[g_BmTargetListIndex]; + targetHandle = target.target; + result = kFblFsmGuard_True; + + /* Check Application validity */ + if (kFblOk != FBLBM_CALLOUT_CHECK_TARGET_VALIDITY(targetHandle)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_INVALID; + } + + if (kFblFsmGuard_True == result) + { + if (FBLBMHDR_CHKHDR_OK != FblBmHdrFindValidHeader(targetHandle, &blockInfoTarget)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_NO_VALID_HEADER; + } + } + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) + if (kFblFsmGuard_True == result) + { +# if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) +# if defined( FBLBM_ENABLE_USE_VERIFY_HEADER_ROM ) + fblSbResult = FblSb_VerifyHeaderRom(blockInfoTarget.logicalBlock.bmHeaderAddress, &blockInfoTarget.bmHeader); +# else + fblSbResult = FblSb_VerifyHeader(&blockInfoTarget.bmHeader); +# endif /* FBLBM_ENABLE_USE_VERIFY_HEADER_ROM */ + + if (kFblOk == fblSbResult) +# endif /* FBLBM_ENABLE_HEADER_VERIFICATION */ + { + fblSbResult = FblSb_VerifySegments(&blockInfoTarget.bmHeader); + } + if (kFblOk != fblSbResult) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_VERIFICATION_FAILED; + } + } +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + + if (kFblFsmGuard_True == result) + { + /* Check all Mandatory dependencies */ + for (index = 0u; index < target.dependenciesSize; index++) + { + targetHandle = target.dependencies[index].target; + + findHeaderResult = FblBmHdrFindValidHeader(targetHandle, &blockInfoDep); + + if (FBLBMHDR_CHKHDR_OK == findHeaderResult) + { +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_HEADER_VERIFICATION ) +# if defined( FBLBM_ENABLE_USE_VERIFY_HEADER_ROM ) + fblSbResult = FblSb_VerifyHeaderRom(blockInfoDep.logicalBlock.bmHeaderAddress, &blockInfoDep.bmHeader); +# else + fblSbResult = FblSb_VerifyHeader(&blockInfoDep.bmHeader); +# endif /* FBLBM_ENABLE_USE_VERIFY_HEADER_ROM */ + + if (kFblOk == fblSbResult) +# endif/* FBLBM_ENABLE_HEADER_VERIFICATION */ + { + fblSbResult = FblSb_VerifySegments(&blockInfoDep.bmHeader); + } + if (kFblOk != fblSbResult) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_DEP_VERIFY_FAILED; + } +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + } + else + { + if (FBLBM_TARGET_TYPE_MANDATORY == target.dependencies[index].type) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_DEP_MANDATORY_MISSING; + } + else + { + /* Ignore this block, it is optional */ + FBLBM_CALLOUT_IS_OPTIONALBLOCK(targetHandle, &blockInfoDep.logicalBlock); + } + } + if (kFblFsmGuard_False == result) + { + break; + } + } /* END FOR */ + } + + /* Check if the target address is valid */ + if (kFblFsmGuard_True == result) + { + if (blockInfoTarget.bmHeader.bmEntryAddress == FBLBMHDR_ENTRY_ADDRESS_INVALID) /* PRQA S 2962 */ /* MD_FBL_2962_UninitializedVariable */ + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_TARGET_INVALID_ADDRESS; + assertFbl(0u, kFblSysAssertParameterOutOfRange); /* PRQA S 2741, 4558 */ /* MD_FBL_2741_4558_Assert */ + } + } + + if (kFblFsmGuard_True == result) + { + /* Store BmHeader of target */ + g_BmTargetBmHeader = blockInfoTarget.bmHeader; + } + + return result; +} + +/********************************************************************************************************************** + * FblBmState_TargetListNext + *********************************************************************************************************************/ +/*! \brief Get next target entry from target list. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_TargetListNext(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + + g_BmTargetListIndex++; + if (FBLBM_BOOTTARGETLIST_SIZE > g_BmTargetListIndex) + { + result = kFblFsmGuard_True; + } + else + { + /* End of list reached */ + result = kFblFsmGuard_False; + } + + return result; +} +#endif /* FBLBM_BOOTTARGETLIST_SIZE > 0u */ + +/********************************************************************************************************************** + * FblBmState_CheckLateFblSegments + *********************************************************************************************************************/ +/*! \brief Verify the whole FBL segments. + * \param[in] pFsmContext Pointer to context of state machine + * \param[in] event Event that caused handler execution + * \return - kFblFsmGuard_True if transition to next configured state is allowed, + * - kFblFsmGuard_False otherwise (transition prohibited, check further event handlers) + *********************************************************************************************************************/ +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +static tFblFsmGuard FblBmState_CheckLateFblSegments(tFblFsmContextPtr const pFsmContext, tFblFsmEvent event) +{ + tFblFsmGuard result; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ + (void)pFsmContext; + (void)event; +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK ) + /* Segments are already verified during the Check Early Fbl Segments state */ +# else /* FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK */ + if (kFblOk != FblSb_VerifySegments(&fblBmBlockInfo.bmHeader)) + { + result = kFblFsmGuard_False; + g_BmError = FBLBM_ERROR_FBL_VERIFICATION_FAILED; + } + else +# endif /* FBLBM_ENABLE_EARLY_FBL_SEGMENTS_CHECK */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + { + result = kFblFsmGuard_True; + } + + return result; +} + +/********************************************************************************************************************** + * FblBmDeinit + *********************************************************************************************************************/ +/*! \brief Deinitialize e.g. stop the timer before calling a target. + *********************************************************************************************************************/ +static void FblBmDeinit(void) +{ + FBLBM_CALLOUT_DEINIT_PRE_OEM(); + FBLBM_CALLOUT_DEINIT_PRE_HW(); + FBLBM_CALLOUT_DEINIT_PRE(); + +#if defined( FBL_WATCHDOG_ON ) + /* Synchronize watchdog before application start */ + ApplFblWDLong(); +#endif /* FBL_WATCHDOG_ON */ + /* Stop timer to avoid a timer interrupt after application start */ + FblTimerStopp(); + + FBLBM_CALLOUT_DEINIT_POST_OEM(); + FBLBM_CALLOUT_DEINIT_POST_HW(); + FBLBM_CALLOUT_DEINIT_POST(); +} + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*-- Bootmanager helper functions ----------------------------------------------------------------------------------------*/ + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) +/*********************************************************************************************************************** + * FblMemSetInteger + **********************************************************************************************************************/ +/*! \brief Convert given integer value to big-endian byte array + * \param[in] count Number of relevant bytes + * \param[in] input Input value + * \param[out] buffer Pointer to output buffer + **********************************************************************************************************************/ +void FblMemSetInteger( vuintx count, vuint32 input, tFblMemRamData buffer) +{ + vuint32 localInput = input; + vuintx localCount = count; + + /* Integer to array conversion only supported for up to 32-bit values */ + assertFblInternal(count <= sizeof(vuint32), kFblSysAssertParameterOutOfRange); + + /* Loop relevant bytes */ + while (localCount > 0u) + { + localCount--; + /* Store most significant byte first */ + buffer[localCount] = (vuint8) (localInput & 0xFFu); + /* Shift in next byte */ + localInput >>= 8u; + } +} + +/*********************************************************************************************************************** + * FblMemGetInteger + **********************************************************************************************************************/ +/*! \brief Convert given big-endian byte array to integer value + * \param[in] count Number of relevant bytes + * \param[in] buffer Pointer to input buffer + * \return Integer value + **********************************************************************************************************************/ +vuint32 FblMemGetInteger( vuintx count, tFblMemConstRamData buffer) +{ + vuint32 output = 0u; + vuintx idx = 0u; + vuintx localCount = count; + + /* Array to integer conversion only supported for up to 32-bit values */ + assertFblInternal(count <= sizeof(vuint32), kFblSysAssertParameterOutOfRange); + + /* Loop relevant bytes */ + while (localCount > 0u) + { + /* Most significant byte first */ + output <<= 8u; + /* Add current byte */ + output |= (vuint32)buffer[idx]; + + idx++; + localCount--; + } + + return output; +} +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + +/*-- Main functions --------------------------------------------------------------------------------------------------*/ + +/*********************************************************************************************************************** + * FblMain + **********************************************************************************************************************/ +/*! \brief Initializes the system and runs the bootmanager. + **********************************************************************************************************************/ +/* PRQA S 5209 1 */ /* MD_FblBmMain_5209_Main */ +void V_API_NEAR FblMain(void) +{ + /* Initialize state machine */ + FblFsmInitPowerOn(); + + /* Start State Machine */ + g_BmFsmContext.stateDefinitions = bmFsmStates; + g_BmFsmContext.stateCount = FBLBM_ARRAY_SIZE(bmFsmStates); + FblFsmInit(&g_BmFsmContext, (tFblFsmState) FBLBM_STATE_POWER_ON); + + while (g_BmFsmContext.state != (tFblFsmState) FBLBM_STATE_FAIL) + { + /* Request next step */ + FblFsmTriggerEvent(&g_BmFsmContext, (tFblFsmEvent) FBLBM_EVENT_CONTINUE); + FblFsmStateTask(&g_BmFsmContext); + } + + FBLBM_CALLOUT_FATAL_ERROR(FBLBM_ERROR_END_OF_MAIN_REACHED); +} + +#define FBLBM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBLBM_MAIN_ENABLE_FBL_START ) +# define FBLBM_FBLSTART_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblStart + **********************************************************************************************************************/ +/*! \brief Transition from application into flash boot loader + * \pre Valid application program running + * \param[in] channel Specify the channel of the reprogramming request (e.g. UDS, XCP, MCMP, OTA) + * \param[in] pFblStartParam Pointer to OEM specific parameter structure + * \param[in] length Length of OEM specific parameter structure [Bytes] + **********************************************************************************************************************/ +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +/* PRQA S 3673 2 */ /* MD_FBL_3673_PointerToConstParameter */ +void FblStart( FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_FIRST + V_MEMRAM1 void V_MEMRAM2 V_MEMRAM3 * pFblStartParam, vuint8 length ) +# else +void FblStart( FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_ONLY ) +# endif /* FBL_MAIN_ENABLE_FBLSTART_PARAM */ +{ +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) + vuintx i; +# endif + +# if !defined( FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) + FblInterruptDisable(); /* PRQA S 1006 */ /* MD_FblBmMain_1006 */ +# endif /* FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON */ + + /* Restore bootmanager context - e.g. small data area base registers */ + FblHwRestoreFblContext(); /* PRQA S 1006 */ /* MD_FblBmMain_1006 */ + +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) + /* Copy parameter to reset safe variable */ + for (i = 0u; i < length; i++) + { + /* PRQA S 0316 1 */ /* MD_FblBmMain_0316 */ + ((volatile vuint8*)&fblBmFblStartParameter)[i] = ((vuint8*)pFblStartParam)[i]; + } +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ + +#if defined( FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL ) + fblBmFblStartChannel = FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE; +#endif /* FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL */ + + /* Set FblStart magic flag + Please pay attention: The FblStart magic flag does not use a shared memory area so that the buffer may overlap + with the application stack. */ + FblBmSetFblStartMagicFlag(); + + /* Generate reset */ + FBLBM_CALLOUT_RESET(); +} +# define FBLBM_FBLSTART_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_FBL_START */ + +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +# define FBLBM_APPLSTART_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * ApplStart + **********************************************************************************************************************/ +/*! \brief Transition from flash boot loader into application + * \pre Valid FBL program running + * \param[in] pApplStartParam Pointer to OEM specific parameter structure + * \param[in] length Length of OEM specific parameter structure [Bytes] + **********************************************************************************************************************/ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +/* PRQA S 3673 1 */ /* MD_FBL_3673_PointerToConstParameter */ +void ApplStart( V_MEMRAM1 void V_MEMRAM2 V_MEMRAM3 * pApplStartParam, vuint8 length ) +# else +void ApplStart( void ) +# endif /* FBLBM_MAIN_ENABLE_APPLSTART_PARAM */ +{ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) + vuintx i; +# endif + +# if !defined( FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) + FblInterruptDisable(); /* PRQA S 1006 */ /* MD_FblBmMain_1006 */ +# endif /* FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON */ + + /* Restore bootmanager context - e.g. small data area base registers */ + FblHwRestoreFblContext(); /* PRQA S 1006 */ /* MD_FblBmMain_1006 */ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) + /* Copy parameter to reset safe variable */ + for (i = 0u; i < length; i++) + { + /* PRQA S 0316 1 */ /* MD_FblBmMain_0316 */ + ((volatile vuint8*)&fblBmApplStartParameter)[i] = ((vuint8*)pApplStartParam)[i]; + } +# endif /* FBLBM_MAIN_ENABLE_APPLSTART_PARAM */ + + /* Set ApplStart magic flag + Please pay attention: The ApplStart magic flag does not use a shared memory area so that the buffer may overlap + with the application stack. */ + FblBmSetApplStartMagicFlag(); + + /* Generate reset */ + FBLBM_CALLOUT_RESET(); +} +# define FBLBM_APPLSTART_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + +/*********************************************************************************************************************** + * CONFIGURATION CHECKS + **********************************************************************************************************************/ + +#if ( defined( FBLBM_ENABLE_HEADER_VERIFICATION ) && !defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) ) +# error "Configuration not supported" +#endif + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblBmMain_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. + + MD_FblBmMain_0306_FblBmHeader: + Reason: A memory address is compared to a configured value. The configured value is interpreted as an integer. + Risk: The comparison may fail due to different data types. + Prevention: If this check fails, the configuration checks done by assertions have to verified manually. + + MD_FblBmMain_0316: + Reason: API is defined with pointer to void parameter, so pointer has to be casted to or from void. + Risk: Wrong data access or undefiend behavior for platforms where the byte alignment is not arbitrary. + Prevention: Code inspection. + + MD_FblBmMain_1006: + Reason: Interrupts are enabled/disabled using assembler code. + Risk: The code is not portable for different compilers. + Prevention: The assembler code provided by each FblHw module has to be tested. + + MD_FblBmMain_1514_BmHeader: + Reason: MISRA: The object FblBmHeader is only referenced by function ..., in the translation unit where it is defined + This object is exported globally to other modules. + Risk: Name space pollution + Prevention: No Prevention necessary + + MD_FBL_2962_UninitializedVariable: + Reason: The variable is actually initialzed at runtime. The successive code will never be executed over not initialzed data. + Risk: Some potential case not detected during development can lead to read a content which is not valid. + Prevention: Write robust code which doesn't allow to read a non initialzed content. + + MD_FBL_2987_RedundantCode: + Reason: QAC misinterprets the code which actually has side effects (i.e. hardware registers are written and read). + Risk: No identifiable risk + Prevention: No prevention required. + + MD_FblBmMain_2991_2995: + Reason: The value of the if-controlling expression depends on the configuration. + Risk: No risk. + Prevention: No prevention necessary. + + MD_FblBmMain_2880_2992_2996_FlashRead: + Reason: QAC does not interpret this correctly. The compared data is read from flash (and may therefore contain deviating values). + Risk: No risk. + Prevention: No prevention required. + + MD_FblBmMain_3205_UnusedIdentifiers + Reason: Depending on the configuration some values of the enum definition are not referenced by the code. + For clarity theses values are not omitted but kept as a place holder. + Risk: No identifiable risk. + Prevention: No prevention required. + + MD_FBL_3218_FileScopeStatic: + Reason: Configuration constants/tables are kept at a central location for a better overview and maintenance. + Risk: Unintended use of object in wrong scope. + Prevention: Architectural pattern supports prevention of incorrect use of objects in wrong context. + Code inspection focus on correct use of objects. + + MD_FBL_3673_PointerToConstParameter: + Reason: Many standards like AUTOSAR, ISO, but also OEM specifications specify the function prototypes without + const statement. We have to comply to this standards. + Risk: Unintended read or write access into memory location. + Prevention: Code inspection focus on correct access to expected memory location + + MD_FBL_2741_4558_Assert: + Reason: The assertion macro has been designed to have an invariant condition and not using bool variable. + Risk: No identifiable risk. Assertion macro are disable in production code. + Prevention: No prevention required. + + MD_FblBmMain_5209_Main: + Reason: The Vector standard API for main function follows ANSI C typical definition of main function returning int. + Risk: No identifiable risk. + Prevention: No prevention required. + + */ + +/*********************************************************************************************************************** + * END OF FILE: BM_MAIN.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBm/bm_main.h b/Source/bsw/FblBm/bm_main.h new file mode 100644 index 0000000..2ada6cb --- /dev/null +++ b/Source/bsw/FblBm/bm_main.h @@ -0,0 +1,200 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2019-10-10 vistmo FBL-390 Adapt main function interface for vBaseEnv + * 04.00.01 2019-11-05 visrie ESCAN00104616 No changes + * ESCAN00104790 No changes + * 05.00.00 2019-12-04 visrie FBL-456 No changes + * ESCAN00104644 No changes + * ESCAN00105176 No changes + * 05.01.00 2020-01-13 visrie ESCAN00104481 Fixed redeclaration issue + * FBL-953 Reworked handling of AP include files + * 05.02.00 2020-02-28 vistbe FBL-949 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.00.01 2020-04-08 visrie ESCAN00106837 No changes + * 06.00.02 2020-10-28 visrcn ESCAN00107189 Compiler error: Wrong definition for FblMain function + * 06.01.00 2021-08-11 visrie FBL-3394 Added/adapted MemMap sections + * 06.02.00 2022-02-04 visrie FBL-4602 No changes + * 06.02.01 2022-04-06 fmenke ESCAN00111029 No changes + * 06.03.00 2022-04-08 visrie FBL-4126 No changes + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 Changed external switches to internal switches + * 06.04.01 2022-04-28 fmenke ESCAN00111741 No changes + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.06.00 2022-07-13 fmenke FBL-5391 No changes + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 No changes + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 No changes + * 06.08.00 2022-11-30 visrie FBL-6065 Encapsulate FblMain declaration + * 06.08.01 2024-03-04 visrie ESCAN00116460 No changes + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 No changes + * 06.10.00 2024-11-15 erizk FBL-9652 No changes + * 06.11.00 2025-05-23 dganesh FBL-9715 No changes + * 06.12.00 2025-09-23 pharring FBL-10124 Add support for FblLib_Logger + **********************************************************************************************************************/ + +#ifndef BM_MAIN_H +#define BM_MAIN_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblBm_Main CQComponent : Implementation */ +#define FBLBM_MAIN_VERSION 0x0612u +#define FBLBM_MAIN_RELEASE_VERSION 0x00u + +/* Interface version */ +/** Major interface version identifies incompatible changes */ +#define FBLBM_API_VERSION_MAJOR 0x03u +/** Minor interface version identifies backward compatible changes */ +#define FBLBM_API_VERSION_MINOR 0x00u +/** Release interface version identifies cosmetic changes */ +#define FBLBM_API_VERSION_RELEASE 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "bm_types.h" +#if defined( FBLBM_ENABLE_HARDWARE_CONFIGURATION ) +# include "bm_hw_ap.h" +#endif +#if defined( FBLBM_ENABLE_OEM_CONFIGURATION ) +# include "bm_oem_ap.h" +#endif +#if defined( FBLBM_ENABLE_GENERIC_CONFIGURATION ) +# include "bm_ap.h" +#endif +#include "bm_hdr.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/** Helper macro to get number of array entries */ /* PRQA S 3453 1 */ /* MD_MSR_FctLikeMacro */ +#define FBLBM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0u])) + +/** Undefined hook function */ +#define FBLBM_HOOK_NONE (tFblBmFunc)0 + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) && \ + defined( FBLBM_INSTANCE_BOOTMANAGER ) +/** Pointer type to byte data in RAM */ +typedef V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tFblMemRamData; +/** Pointer type to constant byte data in RAM */ +typedef const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * tFblMemConstRamData; + +/** Response pending state (never active) */ +# define GetRcrRpInProgress() ((vuint8)0x00u) + +# if defined( FBL_CW_LOCKS_TASKS ) || \ + defined( FBLCW_LOCKS_TASKS ) +/*********************************************************************************************************************** +* COM WRAPPER COMPATIBILITY DEFINITIONS +**********************************************************************************************************************/ +/* Define interface version for classic FblWrapperCom modules */ +# if !defined( FBL_CW_API_REFERENCE_VERSION_MAJOR ) +/** Major interface version identifies incompatible changes */ +# define FBL_CW_API_REFERENCE_VERSION_MAJOR 0x01u +/** Minor interface version identifies backward compatible changes */ +# define FBL_CW_API_REFERENCE_VERSION_MINOR 0x00u +/** Release interface version identifies cosmetic changes */ +# define FBL_CW_API_REFERENCE_VERSION_RELEASE 0x00u +# endif +# if !defined( FBL_CW_CFG_PTR ) +# define FBL_CW_CFG_PTR V_NULL +# endif +# else +# define FBL_CW_LOCKS_TASKS +# define FBLCW_LOCKS_TASKS +# define FblCwIsTimerTaskAllowed() ((vuint8)0x00u) +# define FblCwIsStateTaskAllowed() ((vuint8)0x00u) +# define FblCwRetransmitRP() +# define FblCwClrInit() +# define FblCwTimerTask() +# define FblCwStateTask() +# endif /* FBL_CW_LOCKS_TASKS || FBLCW_LOCKS_TASKS */ +#endif /* FBLBM_ENABLE_STANDALONE_MODE && FBLBM_INSTANCE_BOOTMANAGER */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#define FBLBM_HEADER_START_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMROM0 extern V_MEMROM1 tFblBmHeader V_MEMROM2 FblBmHeader; +#define FBLBM_HEADER_STOP_SEC_CONST +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLBM_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Helper functions */ +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) && \ + defined( FBLBM_INSTANCE_BOOTMANAGER ) +void FblMemSetInteger( vuintx count, vuint32 input, tFblMemRamData buffer ); +vuint32 FblMemGetInteger( vuintx count, tFblMemConstRamData buffer ); +#endif /* FBLBM_ENABLE_STANDALONE_MODE && FBLBM_INSTANCE_BOOTMANAGER */ + +#if defined( FBLBM_INSTANCE_BOOTMANAGER ) +void V_API_NEAR FblMain(void); /* PRQA S 5209 */ /* MD_FblBmMain_5209_Main */ +#endif /* FBLBM_INSTANCE_BOOTMANAGER */ + +#define FBLBM_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBLBM_MAIN_ENABLE_FBL_START ) +# define FBLBM_FBLSTART_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +void V_CALLBACK_NEAR FblStart( FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_FIRST + V_MEMRAM1 void V_MEMRAM2 V_MEMRAM3 * pFblStartParam, vuint8 length ); +# else +void V_CALLBACK_NEAR FblStart( FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_ONLY ); +# endif /* FBL_MAIN_ENABLE_FBLSTART_PARAM */ +# define FBLBM_FBLSTART_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_FBL_START */ + +#if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +# define FBLBM_APPLSTART_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +void ApplStart( V_MEMRAM1 void V_MEMRAM2 V_MEMRAM3 * pApplStartParam, vuint8 length ); +# else +void ApplStart( void ); +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# define FBLBM_APPLSTART_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + +#endif /* BM_MAIN_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_MAIN.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBm/bm_shared.c b/Source/bsw/FblBm/bm_shared.c new file mode 100644 index 0000000..248c8fc --- /dev/null +++ b/Source/bsw/FblBm/bm_shared.c @@ -0,0 +1,93 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2019-10-10 vistmo FBL-390 No changes + * 04.00.01 2019-11-05 visrie ESCAN00104616 Fixed include structure + * ESCAN00104790 Fixed variable types + * 05.00.00 2019-12-04 visrie FBL-456 No changes + * ESCAN00104644 No changes + * ESCAN00105176 No changes + * 05.01.00 2020-01-13 visrie ESCAN00104481 No changes + * FBL-953 No changes + * 05.02.00 2020-02-28 vistbe FBL-949 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.00.01 2020-04-08 visrie ESCAN00106837 No changes + * 06.00.02 2020-10-28 visrcn ESCAN00107189 No changes + * 06.01.00 2021-08-11 visrie FBL-3394 No changes + * 06.02.00 2022-02-04 visrie FBL-4602 No changes + * 06.02.01 2022-04-06 fmenke ESCAN00111029 No changes + * 06.03.00 2022-04-08 visrie FBL-4126 No changes + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 No changes + * 06.04.01 2022-04-28 fmenke ESCAN00111741 No changes + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.06.00 2022-07-13 fmenke FBL-5391 No changes + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 No changes + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 No changes + * 06.08.00 2022-11-30 visrie FBL-6065 No changes + * 06.08.01 2024-03-04 visrie ESCAN00116460 No changes + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 No changes + * 06.10.00 2024-11-15 erizk FBL-9652 No changes + * 06.11.00 2025-05-23 dganesh FBL-9715 No changes + * 06.12.00 2025-09-23 pharring FBL-10124 No changes + **********************************************************************************************************************/ + +#define BM_SHARED_SOURCE + +/*********************************************************************************************************************** +* INCLUDES +**********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "bm_shared.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#if defined( FBLBM_MAIN_ENABLE_MAGICFLAG ) +# define FBLBM_MAIN_MAGICFLAG_START_SEC_VAR_NOINIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/** Reprogramming request storage variable */ +V_MEMRAM0 volatile V_MEMRAM1 vuint8 V_MEMRAM2 fblBmMagicFlag[kFblBmNoOfMagicBytes]; +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL ) +V_MEMRAM0 volatile V_MEMRAM1 vuint8 V_MEMRAM2 fblBmFblStartChannel; +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +V_MEMRAM0 volatile V_MEMRAM1 tFblBmFblStartParameter V_MEMRAM2 fblBmFblStartParameter; +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +V_MEMRAM0 volatile V_MEMRAM1 tFblBmApplStartParameter V_MEMRAM2 fblBmApplStartParameter; +# endif /* FBLBM_MAIN_ENABLE_APPLSTART_PARAM */ +# define FBLBM_MAIN_MAGICFLAG_STOP_SEC_VAR_NOINIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_MAGICFLAG */ + +/*********************************************************************************************************************** + * END OF FILE: BM_SHARED.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBm/bm_shared.h b/Source/bsw/FblBm/bm_shared.h new file mode 100644 index 0000000..eaab7fb --- /dev/null +++ b/Source/bsw/FblBm/bm_shared.h @@ -0,0 +1,272 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2019-10-10 vistmo FBL-390 No changes + * 04.00.01 2019-11-05 visrie ESCAN00104616 No changes + * ESCAN00104790 No changes + * 05.00.00 2019-12-04 visrie FBL-456 No changes + * ESCAN00104644 No changes + * ESCAN00105176 No changes + * 05.01.00 2020-01-13 visrie ESCAN00104481 No changes + * FBL-953 No changes + * 05.02.00 2020-02-28 vistbe FBL-949 No changes + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.00.01 2020-04-08 visrie ESCAN00106837 No changes + * 06.00.02 2020-10-28 visrcn ESCAN00107189 No changes + * 06.01.00 2021-08-11 visrie FBL-3394 No changes + * 06.02.00 2022-02-04 visrie FBL-4602 No changes + * 06.02.01 2022-04-06 fmenke ESCAN00111029 No changes + * 06.03.00 2022-04-08 visrie FBL-4126 No changes + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 Add support for new MagicFlag value and Swap API + * 06.04.01 2022-04-28 fmenke ESCAN00111741 No changes + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 Encapsulate call of FblInterruptDisable + * 06.06.00 2022-07-13 fmenke FBL-5391 No changes + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 No changes + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 No changes + * 06.08.00 2022-11-30 visrie FBL-6065 No changes + * 06.08.01 2024-03-04 visrie ESCAN00116460 No changes + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 No changes + * 06.10.00 2024-11-15 erizk FBL-9652 No changes + * 06.11.00 2025-05-23 dganesh FBL-9715 Extend presence pattern to connect validity information + * 06.12.00 2025-09-23 pharring FBL-10124 No changes + **********************************************************************************************************************/ + +#ifndef BM_SHARED_H +#define BM_SHARED_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Remap of FBL specific switch to BM switch */ +#if !defined( FBLBM_MAIN_ENABLE_FBL_START ) && \ + !defined( FBLBM_MAIN_DISABLE_FBL_START ) +# if defined( FBL_ENABLE_FBL_START ) +# define FBLBM_MAIN_ENABLE_FBL_START +# endif +#endif + +#if !defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) && \ + !defined( FBLBM_MAIN_DISABLE_STAY_IN_BOOT ) +# if defined( FBL_ENABLE_STAY_IN_BOOT ) +# define FBLBM_MAIN_ENABLE_STAY_IN_BOOT +# endif +#endif + +#if !defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP ) && \ + !defined( FBLBM_MAIN_DISABLE_HARDWARE_SWAP ) +# if defined( FBL_ENABLE_HARDWARE_SWAP ) +# define FBLBM_MAIN_ENABLE_HARDWARE_SWAP +# endif +#endif + +#if !defined( FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) && \ + !defined( FBLBM_MAIN_DISABLE_INTERRUPT_DISABLE_AT_POWER_ON ) +# if defined( FBL_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON ) +# define FBLBM_MAIN_ENABLE_INTERRUPT_DISABLE_AT_POWER_ON +# endif +#endif + +#if !defined( FBLBM_MAIN_ENABLE_MAGICFLAG ) && \ + !defined( FBLBM_MAIN_DISABLE_MAGICFLAG ) +# if defined( FBLBM_MAIN_ENABLE_FBL_START ) || \ + defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) || \ + (defined( FBLBM_ENABLE_SECURE_BOOT ) && \ + (defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) || \ + defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) || \ + defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP )) \ + ) +/** Enable magic flag in case of known magic flag configuration */ +# define FBLBM_MAIN_ENABLE_MAGICFLAG +# endif +#endif + +/*********************************************************************************************************************** + * DEFINES (MAGIC FLAG) + **********************************************************************************************************************/ + +#if defined( FBLBM_MAIN_ENABLE_MAGICFLAG ) +# define kFblBmNoOfMagicBytes 8u +# define kFblBmClearMagicByte 0x00u +# define FblBmClrMagicFlag() \ +{ \ + fblBmMagicFlag[0u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[1u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[2u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[3u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[4u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[5u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[6u] = kFblBmClearMagicByte; \ + fblBmMagicFlag[7u] = kFblBmClearMagicByte; \ +} +/* PRQA S 0342 11 */ /* MD_MSR_Rule20.10_0342 */ +# define FblBmSetMagicFlag(infix) \ +{ \ + fblBmMagicFlag[0u] = kFblBm ## infix ## MagicByte0; \ + fblBmMagicFlag[1u] = kFblBm ## infix ## MagicByte1; \ + fblBmMagicFlag[2u] = kFblBm ## infix ## MagicByte2; \ + fblBmMagicFlag[3u] = kFblBm ## infix ## MagicByte3; \ + fblBmMagicFlag[4u] = kFblBm ## infix ## MagicByte4; \ + fblBmMagicFlag[5u] = kFblBm ## infix ## MagicByte5; \ + fblBmMagicFlag[6u] = kFblBm ## infix ## MagicByte6; \ + fblBmMagicFlag[7u] = kFblBm ## infix ## MagicByte7; \ +} +/* PRQA S 0342 9 */ /* MD_MSR_Rule20.10_0342 */ +# define FblBmChkMagicFlag(infix) \ + (( (fblBmMagicFlag[0u] == kFblBm ## infix ## MagicByte0) \ + && (fblBmMagicFlag[1u] == kFblBm ## infix ## MagicByte1) \ + && (fblBmMagicFlag[2u] == kFblBm ## infix ## MagicByte2) \ + && (fblBmMagicFlag[3u] == kFblBm ## infix ## MagicByte3) \ + && (fblBmMagicFlag[4u] == kFblBm ## infix ## MagicByte4) \ + && (fblBmMagicFlag[5u] == kFblBm ## infix ## MagicByte5) \ + && (fblBmMagicFlag[6u] == kFblBm ## infix ## MagicByte6) \ + && (fblBmMagicFlag[7u] == kFblBm ## infix ## MagicByte7)) ? 1u : 0u) + +# if defined( FBLBM_MAIN_ENABLE_FBL_START ) +/* Define pattern for magic flags used for UDS reprogramming indication */ +# define kFblBmFblStartMagicByte0 0x50u /* 'P' */ +# define kFblBmFblStartMagicByte1 0x72u /* 'r' */ +# define kFblBmFblStartMagicByte2 0x6Fu /* 'o' */ +# define kFblBmFblStartMagicByte3 0x67u /* 'g' */ +# define kFblBmFblStartMagicByte4 0x53u /* 'S' */ +# define kFblBmFblStartMagicByte5 0x69u /* 'i' */ +# define kFblBmFblStartMagicByte6 0x67u /* 'g' */ +# define kFblBmFblStartMagicByte7 0x6Eu /* 'n' */ +# define FblBmSetFblStartMagicFlag() FblBmSetMagicFlag(FblStart) +# define FblBmChkFblStartMagicFlag() FblBmChkMagicFlag(FblStart) +# endif /* FBLBM_MAIN_ENABLE_FBL_START */ + +# if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +/* Define pattern for magic flags used if Bootloader should initialize the PP keys and generate/write CMAC */ +# define kFblBmSignedPPMagicByte0 0x53u /* 'S' */ +# define kFblBmSignedPPMagicByte1 0x69u /* 'i' */ +# define kFblBmSignedPPMagicByte2 0x67u /* 'g' */ +# define kFblBmSignedPPMagicByte3 0x70u /* 'p' */ +# define kFblBmSignedPPMagicByte4 0x70u /* 'p' */ +# define kFblBmSignedPPMagicByte5 0x4Bu /* 'k' */ +# define kFblBmSignedPPMagicByte6 0x65u /* 'e' */ +# define kFblBmSignedPPMagicByte7 0x79u /* 'y' */ +# define FblBmSetSignedPPMagicFlag() FblBmSetMagicFlag(SignedPP) +# define FblBmChkSignedPPMagicFlag() FblBmChkMagicFlag(SignedPP) +# endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + +# if defined( FBLBM_MAIN_ENABLE_STAY_IN_BOOT ) +/* Define pattern for magic flags used for application start */ +# define kFblBmApplStartMagicByte0 0x41u /* 'A' */ +# define kFblBmApplStartMagicByte1 0x70u /* 'p' */ +# define kFblBmApplStartMagicByte2 0x70u /* 'p' */ +# define kFblBmApplStartMagicByte3 0x6Cu /* 'l' */ +# define kFblBmApplStartMagicByte4 0x53u /* 'S' */ +# define kFblBmApplStartMagicByte5 0x69u /* 'i' */ +# define kFblBmApplStartMagicByte6 0x67u /* 'g' */ +# define kFblBmApplStartMagicByte7 0x6Eu /* 'n' */ +# define FblBmSetApplStartMagicFlag() FblBmSetMagicFlag(ApplStart) +# define FblBmChkApplStartMagicFlag() FblBmChkMagicFlag(ApplStart) + +/* Define pattern for magic flags used if Bootloader should check for stay in boot message */ +# define kFblBmStayInBootMagicByte0 0x53u /* 'S' */ +# define kFblBmStayInBootMagicByte1 0x74u /* 't' */ +# define kFblBmStayInBootMagicByte2 0x61u /* 'a' */ +# define kFblBmStayInBootMagicByte3 0x79u /* 'y' */ +# define kFblBmStayInBootMagicByte4 0x42u /* 'B' */ +# define kFblBmStayInBootMagicByte5 0x6Fu /* 'o' */ +# define kFblBmStayInBootMagicByte6 0x6Fu /* 'o' */ +# define kFblBmStayInBootMagicByte7 0x74u /* 't' */ +# define FblBmSetStayInBootMagicFlag() FblBmSetMagicFlag(StayInBoot) +# define FblBmChkStayInBootMagicFlag() FblBmChkMagicFlag(StayInBoot) +# endif /* FBLBM_MAIN_ENABLE_STAY_IN_BOOT */ + +# if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) +/* Define pattern for magic flags used if Bootloader should initialize the keys and generate/write CMAC */ +# define kFblBmInitKeysMagicByte0 0x49u /* 'I' */ +# define kFblBmInitKeysMagicByte1 0x6Eu /* 'n' */ +# define kFblBmInitKeysMagicByte2 0x69u /* 'i' */ +# define kFblBmInitKeysMagicByte3 0x74u /* 't' */ +# define kFblBmInitKeysMagicByte4 0x4Bu /* 'K' */ +# define kFblBmInitKeysMagicByte5 0x65u /* 'e' */ +# define kFblBmInitKeysMagicByte6 0x79u /* 'y' */ +# define kFblBmInitKeysMagicByte7 0x73u /* 's' */ +# define FblBmSetInitKeysMagicFlag() FblBmSetMagicFlag(InitKeys) +# define FblBmChkInitKeysMagicFlag() FblBmChkMagicFlag(InitKeys) +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ + +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) || \ + defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +/* Define pattern for magic flags used if Bootloader should initialize the keys and generate/write CMAC */ +# define kFblBmInitCmacMagicByte0 0x49u /* 'I' */ +# define kFblBmInitCmacMagicByte1 0x6Eu /* 'n' */ +# define kFblBmInitCmacMagicByte2 0x69u /* 'i' */ +# define kFblBmInitCmacMagicByte3 0x74u /* 't' */ +# define kFblBmInitCmacMagicByte4 0x43u /* 'C' */ +# define kFblBmInitCmacMagicByte5 0x6Du /* 'm' */ +# define kFblBmInitCmacMagicByte6 0x61u /* 'a' */ +# define kFblBmInitCmacMagicByte7 0x63u /* 'c' */ +# define FblBmSetInitCmacMagicFlag() FblBmSetMagicFlag(InitCmac) +# define FblBmChkInitCmacMagicFlag() FblBmChkMagicFlag(InitCmac) +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY || FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ + +# if defined( FBLBM_MAIN_ENABLE_HARDWARE_SWAP ) +/* Define pattern for magic flags used if Bootloader should perform a secure boot update */ +# define kFblBmSBUpdateMagicByte0 0x53u /* 'S' */ +# define kFblBmSBUpdateMagicByte1 0x42u /* 'B' */ +# define kFblBmSBUpdateMagicByte2 0x55u /* 'U' */ +# define kFblBmSBUpdateMagicByte3 0x70u /* 'p' */ +# define kFblBmSBUpdateMagicByte4 0x64u /* 'd' */ +# define kFblBmSBUpdateMagicByte5 0x61u /* 'a' */ +# define kFblBmSBUpdateMagicByte6 0x74u /* 't' */ +# define kFblBmSBUpdateMagicByte7 0x65u /* 'e' */ +# define FblBmSetSBUpdateMagicFlag() FblBmSetMagicFlag(SBUpdate) +# define FblBmChkSBUpdateMagicFlag() FblBmChkMagicFlag(SBUpdate) +# endif /* FBLBM_MAIN_ENABLE_HARDWARE_SWAP */ +# endif /* FBLBM_ENABLE_SECURE_BOOT */ +#endif /* FBLBM_MAIN_ENABLE_MAGICFLAG */ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +#if defined( FBLBM_MAIN_ENABLE_MAGICFLAG ) +# define FBLBM_MAIN_MAGICFLAG_START_SEC_VAR_NOINIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 extern volatile V_MEMRAM1 vuint8 V_MEMRAM2 fblBmMagicFlag[kFblBmNoOfMagicBytes]; +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL ) +V_MEMRAM0 extern volatile V_MEMRAM1 vuint8 V_MEMRAM2 fblBmFblStartChannel; +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +V_MEMRAM0 extern volatile V_MEMRAM1 tFblBmFblStartParameter V_MEMRAM2 fblBmFblStartParameter; +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +V_MEMRAM0 extern volatile V_MEMRAM1 tFblBmApplStartParameter V_MEMRAM2 fblBmApplStartParameter; +# endif /* FBLBM_MAIN_ENABLE_APPLSTART_PARAM */ +# define FBLBM_MAIN_MAGICFLAG_STOP_SEC_VAR_NOINIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* FBLBM_MAIN_ENABLE_MAGICFLAG */ + +#endif /* BM_SHARED_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_SHARED.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBm/bm_types.h b/Source/bsw/FblBm/bm_types.h new file mode 100644 index 0000000..3df4ca4 --- /dev/null +++ b/Source/bsw/FblBm/bm_types.h @@ -0,0 +1,166 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 04.00.00 2019-10-10 vistmo FBL-390 No changes + * 04.00.01 2019-11-05 visrie ESCAN00104616 No changes + * ESCAN00104790 No changes + * 05.00.00 2019-12-04 visrie FBL-456 Added support for new FblLibSecBoot interface + * ESCAN00104644 No changes + * ESCAN00105176 No changes + * 05.01.00 2020-01-13 visrie ESCAN00104481 No changes + * FBL-953 Reworked handling of AP include files + * 05.02.00 2020-02-28 vistbe FBL-949 Split configuration files + * 06.00.00 2020-04-08 visrie FBL-1016 No changes + * 06.00.01 2020-04-08 visrie ESCAN00106837 No changes + * 06.00.02 2020-10-28 visrcn ESCAN00107189 No changes + * 06.01.00 2021-08-11 visrie FBL-3394 No changes + * 06.02.00 2022-02-04 visrie FBL-4602 No changes + * 06.02.01 2022-04-06 fmenke ESCAN00111029 No changes + * 06.03.00 2022-04-08 visrie FBL-4126 Improve usage for application + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 No changes + * 06.04.01 2022-04-28 fmenke ESCAN00111741 No changes + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.06.00 2022-07-13 fmenke FBL-5391 No changes + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 No changes + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 No changes + * 06.08.00 2022-11-30 visrie FBL-6065 No changes + * 06.08.01 2024-03-04 visrie ESCAN00116460 No changes + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 No changes + * 06.10.00 2024-11-15 erizk FBL-9652 Optimize startup times for secure boot + * 06.11.00 2025-05-23 dganesh FBL-9715 No changes + * 06.12.00 2025-09-23 pharring FBL-10124 No changes + **********************************************************************************************************************/ + +#ifndef BM_TYPES_H +#define BM_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +/* Required for FBL base types */ +#include "fbl_def.h" +#include "Fbl_Lbt.h" +#include "bm_hdr_types.h" +#include "FblBm_Lcfg.h" +#if defined( FBLBM_ENABLE_HARDWARE_CONFIGURATION ) +# include "bm_hw_cfg.h" +#endif +#if defined( FBLBM_ENABLE_OEM_CONFIGURATION ) +# include "bm_oem_cfg.h" +#endif +#if defined( FBLBM_ENABLE_GENERIC_CONFIGURATION ) +# include "bm_ap_cfg.h" +#endif + +#include "bm_shared.h" +#include "bm_types_header.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/** Values for BmHeader */ +#define FBLBM_HEADER_MAGIC_VALUE 0x05ECB007u /* Magic word */ +#define FBLBM_HEADER_MAJOR_VERSION 0x0001u /* Major version of BmHeader format */ +#define FBLBM_HEADER_MINOR_VERSION 0x0000u /* Minor Version of BmHeader format */ +#define FBLBM_HEADER_END_MAGIC_VALUE 0xCEC41160u /* Magic word to check for correct padding */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/** Mandatory blocks information */ +typedef struct +{ + tBlockDescriptor logicalBlock; /**< Pointer to logical block */ + tFblBmHdrHeader bmHeader; /**< pointer to bootmanager header structure */ +} tFblBmBlockInfo; + +/** Error codes */ +typedef enum +{ + FBLBM_ERROR_NO_ERROR = 0u, /* 0 */ + FBLBM_ERROR_HEADER_READ_FAILED, /* 1 */ + FBLBM_ERROR_HEADER_MAGIC_FAILED, /* 2 */ + FBLBM_ERROR_HEADER_VERSION_FAILED, /* 3 */ + FBLBM_ERROR_HEADER_LENGTH_FAILED, /* 4 */ + FBLBM_ERROR_VALIDITY_FAILED, /* 5 */ + FBLBM_ERROR_FBL_BMHEADER_INCORRECT, /* 6 */ + FBLBM_ERROR_FBL_BMHEADER_VERIFICATION_FAILED, /* 7 */ + FBLBM_ERROR_FBL_VERIFICATION_FAILED, /* 8 */ + FBLBM_ERROR_FBL_FBLHEADER_FAILED, /* 9 */ + FBLBM_ERROR_KEY_NOT_AVAILABLE, /* 10 */ + FBLBM_ERROR_UPDATER_SEARCH_INIT_FAILED, /* 11 */ + FBLBM_ERROR_UPDATER_SEARCH_NEXT_FINISHED, /* 12 */ + FBLBM_ERROR_UPDATER_HEADER_ADDRESS, /* 13 */ + FBLBM_ERROR_UPDATER_HEADER_READ_ERROR, /* 14 */ + FBLBM_ERROR_UPDATER_HEADER_CONSISTENCY, /* 15 */ + FBLBM_ERROR_UPDATER_HEADER_TYPE, /* 16 */ + FBLBM_ERROR_UPDATER_BLOCK_VALIDITY, /* 17 */ + FBLBM_ERROR_UPDATER_HEADER_CMAC_VERIFY, /* 18 */ + FBLBM_ERROR_UPDATER_VERIFY, /* 19 */ + FBLBM_ERROR_LBT_POINTER_NULL, /* 20 */ + FBLBM_ERROR_LBT_TOO_LARGE, /* 21 */ + FBLBM_ERROR_LBT_SIZE, /* 22 */ + FBLBM_ERROR_LBT_VERIFY, /* 23 */ + FBLBM_ERROR_REPROG_LBT_DESCR, /* 24 */ + FBLBM_ERROR_REPROG_LBT_INVALID, /* 25 */ + FBLBM_ERROR_REPROG_LBT_BMHEADER_INCORRECT, /* 26 */ + FBLBM_ERROR_REPROG_LBT_VERIFY_HEADER, /* 27 */ + FBLBM_ERROR_REPROG_LBT_VERIFY_SEGMENTS, /* 28 */ + FBLBM_ERROR_REPROG_LBT_MAGIC_FLAG, /* 29 */ + FBLBM_ERROR_REPROG_LBT_BLOCK_COUNT, /* 30 */ + FBLBM_ERROR_TARGET_LIST_INIT, /* 31 */ + FBLBM_ERROR_TARGET_INVALID, /* 32 */ + FBLBM_ERROR_TARGET_NO_VALID_HEADER, /* 33 */ + FBLBM_ERROR_TARGET_VERIFICATION_FAILED, /* 34 */ + FBLBM_ERROR_TARGET_INVALID_ADDRESS, /* 35 */ + FBLBM_ERROR_TARGET_DEP_MANDATORY_MISSING, /* 36 */ + FBLBM_ERROR_TARGET_DEP_NO_VALID_HEADER, /* 37 */ + FBLBM_ERROR_TARGET_DEP_VERIFY_FAILED, /* 38 */ + FBLBM_ERROR_END_OF_MAIN_REACHED, /* 39 */ + FBLBM_ERROR_AP_CHECK_MAC_READ_FAIL, /* 40 */ + FBLBM_ERROR_AP_CHECK_MAC_BUF_LENGTH, /* 41 */ + FBLBM_ERROR_AP_CHECK_MAC_READ_FAIL_LENGTH /* 42 */ +} tFblBmError; + +typedef enum +{ + FBLBM_KEY_IS_NOT_AVAILABLE, + FBLBM_KEY_IS_AVAILABLE +} tFblBmKeyEmptyResult; + +typedef enum +{ + FBLBM_MAC_IS_NOT_AVAILABLE, + FBLBM_MAC_IS_AVAILABLE +} tFblBmMacEmptyResult; + +#endif /* __BM_TYPES_H__ */ + +/*********************************************************************************************************************** + * END OF FILE: BM_TYPES.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBm/bm_types_header.h b/Source/bsw/FblBm/bm_types_header.h new file mode 100644 index 0000000..fd98415 --- /dev/null +++ b/Source/bsw/FblBm/bm_types_header.h @@ -0,0 +1,143 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Main module of BM + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 06.03.00 2022-04-08 visrie FBL-4126 Improve usage for application + * 06.04.00 2022-04-11 lhopfhauer FBL-4822 No changes + * 06.04.01 2022-04-28 fmenke ESCAN00111741 No changes + * 06.05.00 2022-05-06 lhopfhauer FBL-5148 No changes + * 06.06.00 2022-07-13 fmenke FBL-5391 No changes + * 06.06.01 2022-08-04 jschmitding ESCAN00112070 No changes + * 06.07.00 2022-11-07 lhopfhauer FBL-4932 No changes + * 06.08.00 2022-11-30 visrie FBL-6065 No changes + * 06.08.01 2024-03-04 visrie ESCAN00116460 No changes + * 06.09.00 2024-05-16 lhopfhauer FBL-8602 No changes + * 06.10.00 2024-11-15 erizk FBL-9652 No changes + * 06.11.00 2025-05-23 dganesh FBL-9715 No changes + * 06.12.00 2025-09-23 pharring FBL-10124 No changes + **********************************************************************************************************************/ + +#ifndef BM_TYPES_HEADER_H +#define BM_TYPES_HEADER_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if !defined( FBLBM_HEADER_ADDRESS ) +# error "Set the define FBLBM_HEADER_ADDRESS to the address of the BmHeader." +#endif +#if !defined( FBL_CALL_TYPE ) +# define FBL_CALL_TYPE +#endif + +#if defined( FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL ) +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_ONLY uint8 channel +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_FIRST uint8 channel, +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE channel +#else +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_ONLY void +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_FIRST /* Not used */ +# define FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE 0u +#endif /* FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL */ + +/*********************************************************************************************************************** + * BmHeader access + **********************************************************************************************************************/ + + +/* Define to access the FBL header structure */ +#if defined( V_MEMROM1_FAR ) +/* File is included in FBL context */ +# define FblBmHeaderTable ((V_MEMROM1_FAR tFblBmHeader V_MEMROM2_FAR V_MEMROM3 *)(FBLBM_HEADER_ADDRESS)) +# define FblBmHeaderLocal ((V_MEMROM1_FAR tFblBmHeader V_MEMROM2_FAR V_MEMROM3 *)(&FblBmHeader)) +#else +/* File is included in Application context */ +# define FblBmHeaderTable ((P2CONST(tFblBmHeader, AUTOMATIC, FBLBM_HEADER_CONST))(FBLBM_HEADER_ADDRESS)) +# define FblBmHeaderLocal ((P2CONST(tFblBmHeader, AUTOMATIC, FBLBM_HEADER_CONST))(&FblBmHeader)) +#endif + +/* PRQA S 3453 19 */ /* MD_MSR_FctLikeMacro */ +#if defined( FBL_ENABLE_FBL_START ) +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL ) +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +# define CallFblStart(channel, pParam, length) (FblBmHeaderTable->pFblStartFct)((channel), (pParam), (length)) +# else +# define CallFblStart(channel) (FblBmHeaderTable->pFblStartFct)(channel) +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# else +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +# define CallFblStart(pParam, length) (FblBmHeaderTable->pFblStartFct)((pParam), (length)) +# else +# define CallFblStart() (FblBmHeaderTable->pFblStartFct)() +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_PARAM */ +# endif /* FBLBM_MAIN_ENABLE_FBLSTART_CHANNEL */ +#endif /* FBL_ENABLE_FBL_START */ + +#if defined( FBL_ENABLE_STAY_IN_BOOT ) +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +# define CallApplStart(pParam, length) (FblBmHeaderTable->pApplStartFct)((pParam), (length)) +# else +# define CallApplStart() (FblBmHeaderTable->pApplStartFct)() +# endif +#endif /* FBL_ENABLE_STAY_IN_BOOT */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +# if defined( FBLBM_MAIN_ENABLE_FBLSTART_PARAM ) +/** Pointer to call FblStart() function */ +typedef FBL_CALL_TYPE void (*tFblStrtFct)(FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_FIRST void* pParam, uint8 length); +# else +/** Pointer to call FblStart() function */ +typedef FBL_CALL_TYPE void (*tFblStrtFct)(FBLBM_MAIN_FBLSTART_CHANNEL_HANDLE_TYPE_ONLY); +# endif /* FBL_MAIN_ENABLE_FBLSTART_PARAM */ + +# if defined( FBLBM_MAIN_ENABLE_APPLSTART_PARAM ) +/** Pointer to call FblStart() function */ +typedef FBL_CALL_TYPE void (*tApplStrtFct)(void* pParam, uint8 length); +# else +/** Pointer to call FblStart() function */ +typedef FBL_CALL_TYPE void (*tApplStrtFct)(void); +# endif /* FBL_MAIN_ENABLE_FBLSTART_PARAM */ + +/** BM header structure */ +typedef struct +{ + uint32 magic; /**< Magic Word */ + uint16 majorVersion; /**< Major version of BmHeader format */ + uint16 minorVersion; /**< Minor version of BmHeader format */ + uint32 fblHeaderAddress; /**< Pointer to Fbl Header */ + tFblStrtFct pFblStartFct; /**< Pointer to FblStart-function */ + tApplStrtFct pApplStartFct; /**< Pointer to ApplStart-function */ + uint32 checksum; /**< Checksum on BmHeader */ + uint32 end_magic; /**< End of structure in memory */ +} tFblBmHeader; + +#endif /* BM_TYPES_HEADER_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_TYPES_HEADER.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBmHdr/bm_hdr.c b/Source/bsw/FblBmHdr/bm_hdr.c new file mode 100644 index 0000000..f087b5e --- /dev/null +++ b/Source/bsw/FblBmHdr/bm_hdr.c @@ -0,0 +1,234 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief BM Header module + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-31-01 visrie - Initial release + * 01.01.00 2019-02-18 vismvi - No changes + * visrie ESCAN00102184 Maximum number of verification entries are not correctly evaluated + * 01.02.00 2019-07-22 visrie ESCAN00103790 Support invalid entry address configuration + * ESCAN00103791 Support of custom verification + * ESCAN00103803 No changes + * 02.00.00 2019-12-03 visrie FBL-456 Added support for new FblLibSecBoot interface + * 02.00.01 2020-01-15 visrie ESCAN00105368 Added missing encapsulation + * 02.01.00 2022-02-25 vistbe FBL-4128 Added/adapted MemMap sections + * 02.02.00 2024-08-29 viswmo FBL-9163 Add target-based BmHdrHeader search for updater + **********************************************************************************************************************/ + +#define BM_HDR_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "bm_main.h" +#include "fbl_lbt_access.h" + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# include "fbl_secboot.h" +#endif + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLBM_HDR_VERSION != 0x0202u ) || \ + ( FBLBM_HDR_RELEASE_VERSION != 0x00u ) +# error "Error in bm_hdr.c: Source and Header file are inconsistent!" +#endif + +#if ( FBLBM_HDR_VERSION != _FBLBM_HDR_VERSION ) || ( FBLBM_HDR_RELEASE_VERSION != _FBLBM_HDR_RELEASE_VERSION ) +# error "Error in bm_hdr.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ +#define FBLBMHDR_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * FblBmHdrGetBmHeader + **********************************************************************************************************************/ +/*! \brief Validate a specific bootmanager header of a logical block + * \param[in] targetHandle Target handle (e.g. Bootloader, Application) + * \param[in] bmHeaderAddress Location of the BmHeader structure. + * \param[out] bmHeader Buffer for the BmHeader + * \return Result of operation + * FBLBMHDR_CHKHDR_OK when operation succeeded + * FBLBMHDR_CHKHDR_READ_FAIL when reading the BmHeader failed + * FBLBMHDR_CHKHDR_HEADER_INCONSISTENT when the BmHeader is inconsistent + * FBLBMHDR_CHKHDR_WRONG_TARGET when the BmHeader is for another target + **********************************************************************************************************************/ +tFblBmHdrCheckBmHeaderResult FblBmHdrGetBmHeader(tFblBmHdrTargetHandle targetHandle, tFblAddress bmHeaderAddress, + V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader) +{ + tFblBmHdrCheckBmHeaderResult result; + + result = FBLBMHDR_CHKHDR_OK; + + if (FblReadProm(bmHeaderAddress, (vuint8 *)bmHeader, sizeof(tFblBmHdrHeader)) != sizeof(tFblBmHdrHeader)) + { + result = FBLBMHDR_CHKHDR_READ_FAIL; + } + + /* Check for correct target handle */ + if (result == FBLBMHDR_CHKHDR_OK) + { + if (bmHeader->bmTargetHandle != targetHandle) + { + result = FBLBMHDR_CHKHDR_WRONG_TARGET; + } + } + + /* Check for consistency errors */ + if (result == FBLBMHDR_CHKHDR_OK) + { + if (kFblOk != FblBmHdrCheckConsistency(bmHeader)) + { + result = FBLBMHDR_CHKHDR_HEADER_INCONSISTENT; + } + } + + return result; +} /* PRQA S 6010 */ /* MD_MSR_STPTH */ + +/*********************************************************************************************************************** + * FblBmHdrCheckConsistency + **********************************************************************************************************************/ +/*! \brief Checks the consistency of the BM header structure + * \param[in] bmHeader: Pointer to the BM Header structure + * \return Result of operation + **********************************************************************************************************************/ +tFblResult FblBmHdrCheckConsistency( const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * pBmHeader ) +{ + tFblResult result; +#if defined( FBLBMHDR_ENABLE_HEADER_VERIFICATION_LIST ) + vuintx i; +#endif /* FBLBMHDR_ENABLE_HEADER_VERIFICATION_LIST */ + + /* Initialize variables */ + result = kFblOk; + + /* Check magic value */ + if (pBmHeader->bmMagicFlag != FBLBMHDR_MAGIC_FLAG) + { + result = kFblFailed; + } + +#if defined( FBLBMHDR_ENABLE_HEADER_VERIFICATION_LIST ) + /* Check number of verification regions */ + if (result == kFblOk) + { + if (pBmHeader->bmVerificationListEntries > FBLBMHDR_NUM_OF_VERIFICATION_ENTRIES) + { + result = kFblFailed; + } + } + + /* Check if a verification region contains the entry address */ + if ( (result == kFblOk) + && (pBmHeader->bmEntryAddress != FBLBMHDR_ENTRY_ADDRESS_INVALID)) + { + /* Change result to failed, it will be set back to OK if a valid region was found */ + result = kFblFailed; + + for (i = 0u; i < pBmHeader->bmVerificationListEntries; i++) + { + if ( (pBmHeader->bmEntryAddress >= pBmHeader->bmVerificationList[i].address) + && (pBmHeader->bmEntryAddress < (pBmHeader->bmVerificationList[i].address + pBmHeader->bmVerificationList[i].length))) + { + /* Entry address is in a verification range */ + result = kFblOk; + break; + } + } + } +#endif /* FBLBMHDR_ENABLE_HEADER_VERIFICATION_LIST */ + + return result; +} + +#if defined( FBLBM_CALLOUT_IS_VALIDBLOCK ) +/*********************************************************************************************************************** + * FblBmHdrFindValidHeader + **********************************************************************************************************************/ +/*! \brief Find a valid bootmanager header structure for the given target + * \param[in] targetHandle Target handle (e.g. Bootloader, Application) + * \param[in,out] pBlockInfo Pointer to a structure which holds a pointer to the BM header and the corresponding + * logical block. + * \return Result of operation + * FBLBMHDR_CHKHDR_OK A valid BmHeader is found + * FBLBMHDR_CHKHDR_NOT_FOUND No BmHeader found + * FBLBMHDR_CHKHDR_BLOCK_INVALID Logical block is not valid + * see FblBmHdrCheckBmHeader for further return values. + * see FblBmHdrVerifyBmHeader for further return values. + **********************************************************************************************************************/ +tFblBmHdrCheckBmHeaderResult FblBmHdrFindValidHeader(tFblBmHdrTargetHandle targetHandle, + V_MEMRAM1 tFblBmBlockInfo V_MEMRAM2 V_MEMRAM3 * pBlockInfo) +{ + tFblBmHdrCheckBmHeaderResult result; + tFblLbtBlockFilter blockFilter; + + /* Initialize variables */ + result = FBLBMHDR_CHKHDR_NOT_FOUND; + + /* Iterate over all mandatory blocks */ + FblLbtBlockFilterInit(&blockFilter); + pBlockInfo->logicalBlock = FblLbtBlockFirst(&blockFilter); + while (FblLbtBlockDone() == FALSE) + { + + if (kFblOk == FBLBM_CALLOUT_IS_VALIDBLOCK(targetHandle, &pBlockInfo->logicalBlock)) + { + result = FblBmHdrGetBmHeader(targetHandle, pBlockInfo->logicalBlock.bmHeaderAddress, &pBlockInfo->bmHeader); + } + else + { + result = FBLBMHDR_CHKHDR_BLOCK_INVALID; + } + + if (result == FBLBMHDR_CHKHDR_OK) + { + /* Leave loop after first hit */ + break; + } + + /* Prepare next cycle */ + pBlockInfo->logicalBlock = FblLbtBlockNext(); + } + + return result; +} +#endif /* FBLBM_CALLOUT_IS_VALIDBLOCK */ + +#define FBLBMHDR_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * END OF FILE: BM_HDR.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBmHdr/bm_hdr.h b/Source/bsw/FblBmHdr/bm_hdr.h new file mode 100644 index 0000000..1217bb0 --- /dev/null +++ b/Source/bsw/FblBmHdr/bm_hdr.h @@ -0,0 +1,75 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief BM Header module + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-31-01 visrie - Initial release + * 01.01.00 2019-02-18 vismvi - No changes + * visrie ESCAN00102184 No changes + * 01.02.00 2019-07-22 visrie ESCAN00103790 No changes + * ESCAN00103791 No changes + * ESCAN00103803 No changes + * 02.00.00 2019-12-03 visrie FBL-456 Added support for new FblLibSecBoot interface + * 02.00.01 2020-01-15 visrie ESCAN00105368 Added missing encapsulation + * 02.01.00 2022-02-25 vistbe FBL-4128 Added/adapted MemMap sections + * 02.02.00 2024-08-29 viswmo FBL-9163 Add target-based BmHdrHeader search for updater + **********************************************************************************************************************/ + +#ifndef BM_HDR_H +#define BM_HDR_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblBm_Hdr CQComponent : Implementation */ +#define FBLBM_HDR_VERSION 0x0202u +#define FBLBM_HDR_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "FblBmHdr_Cfg.h" + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLBMHDR_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +tFblResult FblBmHdrCheckConsistency( const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * pBmHeader ); +tFblBmHdrCheckBmHeaderResult FblBmHdrGetBmHeader(tFblBmHdrTargetHandle targetHandle, tFblAddress bmHeaderAddress, + V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader); +#if defined( FBLBM_CALLOUT_IS_VALIDBLOCK ) +tFblBmHdrCheckBmHeaderResult FblBmHdrFindValidHeader(tFblBmHdrTargetHandle targetHandle, + V_MEMRAM1 tFblBmBlockInfo V_MEMRAM2 V_MEMRAM3 * pBlockInfo); +#endif /* FBLBM_CALLOUT_IS_VALIDBLOCK */ + +#define FBLBMHDR_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* BM_HDR_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_HDR.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblBmHdr/bm_hdr_types.h b/Source/bsw/FblBmHdr/bm_hdr_types.h new file mode 100644 index 0000000..52a3548 --- /dev/null +++ b/Source/bsw/FblBmHdr/bm_hdr_types.h @@ -0,0 +1,67 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief BM Header module + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-31-01 visrie - Initial release + * 01.01.00 2019-02-18 vismvi - No changes + * visrie ESCAN00102184 No changes + * 01.02.00 2019-07-22 visrie ESCAN00103790 Support invalid entry address configuration + * ESCAN00103791 No changes + * ESCAN00103803 No changes + * 02.00.00 2019-12-03 visrie FBL-456 No changes + * 02.00.01 2020-01-15 visrie ESCAN00105368 No changes + * 02.01.00 2022-02-25 vistbe FBL-4128 No changes + * 02.02.00 2024-08-29 viswmo FBL-9163 No changes + **********************************************************************************************************************/ + +#ifndef BM_HDR_TYPES_H +#define BM_HDR_TYPES_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "FblBmHdr_Cfg.h" + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef enum +{ + FBLBMHDR_CHKHDR_OK, + FBLBMHDR_CHKHDR_BLOCK_INVALID, + FBLBMHDR_CHKHDR_READ_FAIL, + FBLBMHDR_CHKHDR_HEADER_INCONSISTENT, + FBLBMHDR_CHKHDR_WRONG_TARGET, + FBLBMHDR_CHKHDR_GET_MAC_FAIL, + FBLBMHDR_CHKHDR_VERIFICATION_FAIL, + FBLBMHDR_CHKHDR_NOT_FOUND +}tFblBmHdrCheckBmHeaderResult; + +#endif /* BM_HDR_TYPES_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_HDR_TYPES.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblNvPattern/Make/FblNvPattern_cfg.mak b/Source/bsw/FblNvPattern/Make/FblNvPattern_cfg.mak new file mode 100644 index 0000000..0f18e05 --- /dev/null +++ b/Source/bsw/FblNvPattern/Make/FblNvPattern_cfg.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : FblNvPattern_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the FblNvPattern_rules.mak file. +############################################################################### \ No newline at end of file diff --git a/Source/bsw/FblNvPattern/Make/FblNvPattern_check.mak b/Source/bsw/FblNvPattern/Make/FblNvPattern_check.mak new file mode 100644 index 0000000..c6629b9 --- /dev/null +++ b/Source/bsw/FblNvPattern/Make/FblNvPattern_check.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : FblNvPattern_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the FblNvPattern_rules.mak file. +############################################################################### diff --git a/Source/bsw/FblNvPattern/Make/FblNvPattern_defs.mak b/Source/bsw/FblNvPattern/Make/FblNvPattern_defs.mak new file mode 100644 index 0000000..5cfe78d --- /dev/null +++ b/Source/bsw/FblNvPattern/Make/FblNvPattern_defs.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : FblNvPattern_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the FblNvPattern_rules.mak file. +############################################################################### diff --git a/Source/bsw/FblNvPattern/Make/FblNvPattern_rules.mak b/Source/bsw/FblNvPattern/Make/FblNvPattern_rules.mak new file mode 100644 index 0000000..84947ea --- /dev/null +++ b/Source/bsw/FblNvPattern/Make/FblNvPattern_rules.mak @@ -0,0 +1,24 @@ +############################################################################### +# File Name : FblNvPattern_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2025-04-25 virjjn Initial commit +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + +# Component Files +CC_FILES_TO_BUILD += FblNvPattern$(BSW_SRC_DIR)\fbl_nvpattern.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\..\Source\FblNvPattern_Callout_Stubs.c + +# Library Settings +LIBRARIES_TO_BUILD += FblNvPattern +FblNvPattern_FILES += FblNvPattern$(BSW_SRC_DIR)\fbl_nvpattern.c \ No newline at end of file diff --git a/Source/bsw/FblNvPattern/fbl_nvpattern.c b/Source/bsw/FblNvPattern/fbl_nvpattern.c new file mode 100644 index 0000000..8e5ed6e --- /dev/null +++ b/Source/bsw/FblNvPattern/fbl_nvpattern.c @@ -0,0 +1,1306 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of pattern/mask based non-volatile information storage + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 02.00.00 2025-03-11 virjjn FBL-9704 Initial version + * 02.01.00 2025-06-19 dganesh FBL-11034 Improvements in extended presence pattern + **********************************************************************************************************************/ + +#define FBL_NVPATTERN_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "fbl_nvpattern.h" + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLLIB_NVPATTERN_VERSION != 0x0201u ) || \ + ( FBLLIB_NVPATTERN_RELEASE_VERSION != 0x00u ) +# error "Error in fbl_nvpattern.c: Source and header file are inconsistent!" +#endif + +#if ( FBLLIB_NVPATTERN_VERSION != _FBLLIB_NVPATTERN_VERSION ) || \ + ( FBLLIB_NVPATTERN_RELEASE_VERSION != _FBLLIB_NVPATTERN_RELEASE_VERSION ) +# error "Error in fbl_nvpattern.c: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Definition of marker/mask values and their size */ +#if !defined( kFblNvMarkerValue ) +# define kFblNvMarkerValue {0x73u, 0x6Au, 0x29u, 0x3Eu} +#endif /* kFblNvMarkerValue */ +#if !defined( kFblNvMaskValue ) +# define kFblNvMaskValue {0x8Cu, 0x95u, 0xD6u, 0xC1u} +#endif /* kFblNvMaskValue */ +#if !defined( kFblNvPatternSize ) +# define kFblNvPatternSize 4u +#endif /* kFblNvPatternSize */ + +/* Macro to calculate the page aligned size to hold a value of size len */ +#define PAGE_ALIGN(len, align) (((len) + ((align) - 1u)) & ~((align) - 1u)) + +/* Macro to check if val is a power of two */ +#define IS_POWOFTWO(val) (((val) & ~((val) - 1u)) == (val)) + +/* Size of write buffer with enough space to hold one marker/mask value */ +#if ( FBL_MAX_SEGMENT_SIZE < kFblNvPatternSize ) +# define kFblNvPatternSegmentSize PAGE_ALIGN(kFblNvPatternSize, FBL_MAX_SEGMENT_SIZE) +#else +# define kFblNvPatternSegmentSize FBL_MAX_SEGMENT_SIZE +#endif + +/* Checks if tFblNvPatternId belongs to a block property or a pattern */ +#define IS_VALID_PATTERN_ID(id) (((id) > kFblNvPatternId_Invalid) && ((id) < kFblNvPatternId_Separator)) +#define IS_VALID_PROPERTY_ID(id) (((id) > kFblNvPatternId_Separator) && ((id) < kFblNvPatternId_Last)) + +/* Parameter value to skip comparison for function FblNvPatternGetPatternItemState */ +#define DONT_COMPARE (vuint8*)0u + +/* Enable the unexpected value check by default */ +#if !defined( FBL_NVPATTERN_DISABLE_CHECK_UNEXPECTEDVALUE ) +# define FBL_NVPATTERN_ENABLE_CHECK_UNEXPECTEDVALUE +#endif /* !FBL_NVPATTERN_DISABLE_CHECK_UNEXPECTEDVALUE && !FBL_NVPATTERN_ENABLE_CHECK_UNEXPECTEDVALUE */ + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/** Buffer with alignment to platform requirements */ +typedef struct +{ + vuint32 alignDummy; /**< Used to force 4Byte alignment */ + vuint8 data[kFblNvPatternSegmentSize]; +} tFblNvPatternAlignedBuffer; + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +#define FBLNVPATTERN_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +V_MEMRAM0 static V_MEMRAM1 tFblNvPatternAlignedBuffer V_MEMRAM2 pageBuffer; +#define FBLNVPATTERN_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLNVPATTERN_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +static tFblResult FblNvPatternWritePageAligned( const vuint8* pSrcBuffer, IO_PositionType address, IO_SizeType length ); +static tFblNvPatternItemState FblNvPatternGetPatternItemState( IO_PositionType patternAddress, IO_SizeType length, const vuint8* compareValue ); +static tFblResult FblNvPatternGetPatternBlockDescriptorByStartAddress( IO_PositionType patternStartAddress, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor ); +static IO_SizeType FblNvPatternGetPatternOffset( tFblNvPatternId patternId, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ); + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblNvPatternWritePageAligned + **********************************************************************************************************************/ +/*! \brief Writes data respecting the page size of the memory device + * \pre GetBaseAddr function has been called first + * \param[in] pSrcBuffer pointer to source data + * \param[in] address target address + * \param[in] length length of data + **********************************************************************************************************************/ +static tFblResult FblNvPatternWritePageAligned( const vuint8* pSrcBuffer, IO_PositionType address, IO_SizeType length ) +{ + tFblResult result; + IO_SizeType i; + IO_SizeType writeGranularity; + IO_SizeType actualWriteLength; + IO_SizeType localLength; + IO_PositionType offset; + + /* Initialize variables */ + result = kFblOk; + localLength = length; + offset = 0u; + + while (localLength > 0u) + { + (void)FblRealTimeSupport(); + + /* Determine page aligned write length, limit to buffer length */ + if (localLength > kFblNvPatternSegmentSize) + { + writeGranularity = kFblNvPatternSegmentSize; + actualWriteLength = kFblNvPatternSegmentSize; + } + else + { + writeGranularity = PAGE_ALIGN(localLength, (IO_SizeType)MemDriver_SegmentSize); + actualWriteLength = localLength; + } + + /* Fill buffer with payload data */ + for (i = 0u; i < actualWriteLength; i++) + { + pageBuffer.data[i] = pSrcBuffer[i + offset]; + } + /* Pad remaining buffer if necessary */ + if (actualWriteLength < kFblNvPatternSegmentSize) + { + for (i = actualWriteLength; i < writeGranularity; i++) + { + pageBuffer.data[i] = 0u; + } + } + + /* Call MIO to write data */ + if (MemDriver_RWriteSync(pageBuffer.data, writeGranularity, address + offset) != IO_E_OK) + { + result = kFblFailed; + break; + } + + /* Update variables */ + localLength -= actualWriteLength; + offset += actualWriteLength; + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetPatternItemState + **********************************************************************************************************************/ +/*! \brief Reads one marker/mask and returns the state of it + * \pre Global variable memSegment is set to the block where the pattern is stored + * \param[in] patternAddress address of pattern item + * \param[in] length the length of the pattern item to read + * \param[in] compareValue pointer to expected pattern value (return ExpectedValue), 0 if no comparison is needed + * \return The state of the pattern item + **********************************************************************************************************************/ +/* PRQA S 6010, 6030, 6080 1 */ /* MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static tFblNvPatternItemState FblNvPatternGetPatternItemState( IO_PositionType patternAddress, IO_SizeType length, const vuint8* compareValue) +{ + tFblNvPatternItemState itemState = FBL_NVPATTERN_STATE_READERROR; + vuint8 memErasedValue; + IO_SizeType currentReadLength; + IO_SizeType localLength = length; + IO_PositionType readOffset = 0u; + vuint32 i; + vuint32 countExpectedValue = 0u; + vuint32 countErasedValue = 0u; + + /* Determine memory erased value of used device */ +#if defined( FBL_ENABLE_MULTIPLE_MEM_DEVICES ) + memErasedValue = memDrvLst[FlashBlock[memSegment].device].erasedValue; +#else + memErasedValue = FBL_FLASH_DELETED; +#endif + + while (localLength > 0u) + { + /* Limit read length to buffer size */ + if (localLength > kFblNvPatternSegmentSize) + { + currentReadLength = kFblNvPatternSegmentSize; + } + else + { + currentReadLength = localLength; + } + + /* Read marker/mask */ + switch (MemDriver_RReadSync(pageBuffer.data, currentReadLength, patternAddress + readOffset)) + { + case IO_E_OK: + case IO_E_ERASED: + { + /* Read successful. Because some drivers don't return IO_E_ERASED, + * we have to assume that memory is erased if all bytes show the erased value + * and compare against the erased value later. */ + itemState = FBL_NVPATTERN_STATE_ERASED; + break; + } + default: + { + /* Read error */ + itemState = FBL_NVPATTERN_STATE_READERROR; + assertFbl(0u, kFblSysAssertParameterOutOfRange); /* PRQA S 2741, 4558 */ /* MD_FblNvPattern_Assertion */ + break; + } + } + + if (itemState == FBL_NVPATTERN_STATE_ERASED) + { + /* Check all bytes of marker/mask */ + for (i = 0u; i < currentReadLength; i++) + { + /* Compare one byte of pattern against the expected value/erased value */ + if ((compareValue != DONT_COMPARE) && (pageBuffer.data[i] == compareValue[readOffset + i])) + { + countExpectedValue++; + } + else if (pageBuffer.data[i] == memErasedValue) + { + countErasedValue++; + } + else /* (pageBuffer.data[i] != memErasedValue) */ + { + /* This might happen in case of unintended writes to pattern area */ + itemState = FBL_NVPATTERN_STATE_UNEXPECTEDVALUE; + } + + /* In case of an unexpected value break out of the for loop */ + if (itemState == FBL_NVPATTERN_STATE_UNEXPECTEDVALUE) + { + break; + } + } + + /* Check if there were expected and erased bytes included */ + if ( (countErasedValue != 0u) + && (countExpectedValue != 0u)) + { + itemState = FBL_NVPATTERN_STATE_UNEXPECTEDVALUE; + } + } + + /* Abort in case of error */ + if ((itemState == FBL_NVPATTERN_STATE_UNEXPECTEDVALUE) || (itemState == FBL_NVPATTERN_STATE_READERROR)) + { + break; + } + + /* Update variables */ + localLength -= currentReadLength; + readOffset += currentReadLength; + } + + /* Set itemState according to the counts */ + if (length == 0u) + { + itemState = FBL_NVPATTERN_STATE_NOMEMSEGMENT; + } + else if (countErasedValue == length) + { + itemState = FBL_NVPATTERN_STATE_ERASED; + } + else if (countExpectedValue == length) + { + itemState = FBL_NVPATTERN_STATE_EXPECTEDVALUE; + } + else + { + /* itemState already set correctly */ + } + + return itemState; +} + + +/*********************************************************************************************************************** + * FblNvPatternGetPatternBlockDescriptorByStartAddress + **********************************************************************************************************************/ +/*! \brief Prepares a dummy block descriptor spaning only the pattern region + * \param[in] patternStartAddress Start address of pattern region + * \param[out] blockDescriptor Pointer to RAM buffer in which the dummy block descriptor can be stored + * \return kFblOk: block descriptor created successfully , kFblFailed: Else + **********************************************************************************************************************/ +static tFblResult FblNvPatternGetPatternBlockDescriptorByStartAddress( IO_PositionType patternStartAddress, + V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor ) +{ + tFblResult result = kFblFailed; + IO_SizeType patternLength; + IO_SizeType patternRegionLength = 0u; + + /* Get memory segment index */ + memSegment = FblMemSegmentNrGet(patternStartAddress); + + /* Check if a valid memory segment in flash block table was found */ + if (memSegment >= 0) + { + /* Get offset for last pattern/property as this offset equals size of the complete pattern region */ + /* PRQA S 4342 1 */ /* MD_FblNvPattern_4342 */ + patternRegionLength = FblNvPatternGetPatternOffset((tFblNvPatternId)((vuintx)kFblNvPatternId_Last - 1u), &patternLength); + + blockDescriptor->blockStartAddress = patternStartAddress; + blockDescriptor->blockLength = patternRegionLength; + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetPatternOffset + **********************************************************************************************************************/ +/*! \brief Returns the offset for a certain pattern/property + * \details The returned offset is calculated from the end of the pattern region. Therefore a lower offset has + * the meaning that the respective pattern is located closer to the end of the pattern region. + * \pre Global variable memSegment is set to the block where the pattern region is stored + * \param[in] patternId ID of pattern/property for which the offset shall be calculated + * \param[out] patternOffset Pointer to RAM buffer to store the offset to the requested pattern + * \param[out] pPatternLength Pointer to RAM buffer to store the actual write address of the NvPattern or property + * \return Offset to the requested pattern + **********************************************************************************************************************/ +static IO_SizeType FblNvPatternGetPatternOffset( tFblNvPatternId patternId, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ) +{ + IO_SizeType patternOffset = 0u; + IO_SizeType localPatternLength = 0u; + vuintx i; + vuintx upperBound; + + /* Segment size must be a power of two */ + assertFbl(IS_POWOFTWO(MemDriver_SegmentSize), kFblSysAssertParameterOutOfRange); + + /* Adjust patternLength to write segment size of device */ + localPatternLength = PAGE_ALIGN(kFblNvPatternSize, (IO_SizeType)MemDriver_SegmentSize); + + /* Add size of NvPatterns to offset... + * Upper bound for loop is either the last NvPattern element if base address of block property has been requested + * or patternId in case the requested element is a NvPattern */ + upperBound = (patternId > kFblNvPatternId_Separator) ? ((vuintx)kFblNvPatternId_Separator - 1u) : (vuintx)patternId; + + for (i = 0u; i < upperBound; i++) + { +#if defined( FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION ) + patternOffset += (localPatternLength * ((IO_SizeType)fblNvPatternMultiplicity[i] * 2u)); +#else + patternOffset += (localPatternLength * 2u); +#endif /* FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION */ + } + + /* ... then add sizes of block property elements */ +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) + /* Skip this loop (set upperBound to 0) if the requested Id is not a block property, + * otherwise subtract kFblNvPatternId_Separator from pattern id to get the index into fblNvPatternElementLength */ + upperBound = (patternId > kFblNvPatternId_Separator) ? ((vuintx)patternId - (vuintx)kFblNvPatternId_Separator) : 0u; + + for (i = 0u; i < upperBound; i++) + { + patternOffset += PAGE_ALIGN(fblNvBlockProperties[i].length, (IO_SizeType)MemDriver_SegmentSize); + localPatternLength = PAGE_ALIGN(fblNvBlockProperties[i].length, (IO_SizeType)MemDriver_SegmentSize); + } +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + + /* Put results into arguments */ + *patternLength = localPatternLength; + + return patternOffset; +} +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * FblNvPatternGetPatternState + **********************************************************************************************************************/ +/*! \brief Determines the state of one or a set of marker/mask pairs. + * \details Iterates through all sub-patterns in case of multiple validation. + * Returns address and length of pattern which stores the currently relevant state. + * \param[in] pBlockDescriptor descriptor of the logical block which contains the NvPattern + * \param[in] patternId Id of pattern to read + * \param[out] pPatternAddress Pointer to RAM buffer which keeps the pattern base address + * \param[out] pPatternLength Pointer to RAM buffer which keeps the actual write length of the pattern + * \return The state of the (sub) pattern which holds the current state of the pattern + **********************************************************************************************************************/ +tFblNvPatternState FblNvPatternGetPatternState( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pBlockDescriptor, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * pPatternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pPatternLength ) +{ + vuint32 multiplicity; + tFblNvPatternState patternState; + IO_PositionType patternAddress; + vuint8 fblMarkerValue[] = kFblNvMarkerValue; /* PRQA S 3678 */ /* MD_FblNvPattern_3678_LocalVariable */ + vuint8 fblMaskValue[] = kFblNvMaskValue; /* PRQA S 3678 */ /* MD_FblNvPattern_3678_LocalVariable */ + + /* PRQA S 2742, 2880 2 */ /* MD_FblNvPattern_Assertion */ + assertFblUser(sizeof(fblMarkerValue) == kFblNvPatternSize, kFblSysAssertParameterOutOfRange); + assertFblUser(sizeof(fblMaskValue) == kFblNvPatternSize, kFblSysAssertParameterOutOfRange); + + /* Initialize variables */ + patternAddress = *pPatternAddress; + patternState.markerState = FBL_NVPATTERN_STATE_NOMEMSEGMENT; + patternState.maskState = FBL_NVPATTERN_STATE_NOMEMSEGMENT; + memSegment = -1; + + /* Get Base Address of pattern if id is valid */ + if (IS_VALID_PATTERN_ID(patternId)) + { + memSegment = FblNvPatternGetBaseAddrByBlockDescriptor(pBlockDescriptor, patternId, &patternAddress, pPatternLength); + } + + if (memSegment >= 0) + { + /* Determine number of sub-patterns */ +#if defined( FBL_NVPATTERN_ENABLE_MULTIPLE_VALIDATION ) + multiplicity = (vuint32)fblNvPatternMultiplicity[((vuintx)patternId - 1u)]; +#else + multiplicity = 1u; +#endif + } + else + { + /* No memory segment found, abort */ + multiplicity = 0u; + } + + /* Go through all configured sub-patterns until we have found the sub-pattern which holds the most recent state */ + while (multiplicity >= 1u) + { + /* Poll watchdog function */ + (void)FblRealTimeSupport(); + + /* Read marker and mask area */ + patternState.markerState = FblNvPatternGetPatternItemState(patternAddress, kFblNvPatternSize, fblMarkerValue); + patternState.maskState = FblNvPatternGetPatternItemState((patternAddress + *pPatternLength), kFblNvPatternSize, fblMaskValue); + + if ( ((patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED)) + || ((patternState.markerState == FBL_NVPATTERN_STATE_ERASED) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED))) + { + /* One pattern item is in erased state, this is the most recent state of the pattern */ + break; + } + + /* Get base address of next sub-pattern */ + patternAddress += (*pPatternLength * 2u); + + /* Decrement number of sub-patterns to process */ + multiplicity--; + } + + /* Write current address to passed argument pointer */ + *pPatternAddress = patternAddress; + + return patternState; +} + + +/*********************************************************************************************************************** + * FblNvPatternGetPatternStateByStartAddress + **********************************************************************************************************************/ +/*! \brief Determines the state of one or a set of marker/mask pairs. + * \details Iterates through all sub-patterns in case of multiple validation. + * Returns address and length of pattern which stores the currently relevant state. + * \param[in] patternStartAddress Start address of pattern region + * \param[in] patternId Id of pattern to read + * \param[out] pPatternAddress Pointer to RAM buffer which keeps the address of the pattern + * \param[out] pPatternLength Pointer to RAM buffer which keeps the actual write length of the pattern + * \return The state of the (sub) pattern which holds the current state of the pattern + **********************************************************************************************************************/ +tFblNvPatternState FblNvPatternGetPatternStateByStartAddress( IO_PositionType patternStartAddress, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * patternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblNvPatternState patternState = { 0u }; + + if(FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor) == kFblOk) + { + patternState = FblNvPatternGetPatternState(&dummyBlockDescriptor, patternId, patternAddress, patternLength); + } + + return patternState; +} + +/*********************************************************************************************************************** + * FblNvPatternGetBaseAddr + **********************************************************************************************************************/ +/*! \brief Calculates base address and actual (write) length of pattern and mask + * \pre LBT is present + * \param[in] blockNr Logical block number + * \param[in] patternId ID of the pattern which shall be checked + * \param[out] pPatternAddress Pointer to RAM buffer which keeps the pattern base address + * \param[out] pPatternLength Pointer to RAM buffer which keeps the actual write length of the pattern + * \return memSegment of the pattern location or -1 in case of an error + **********************************************************************************************************************/ +vsint16 FblNvPatternGetBaseAddr( vuint8 blockNr, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * pPatternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pPatternLength ) +{ + tBlockDescriptor blockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockNr, &blockDescriptor); + + if (result == kFblOk) + { + memSegment = FblNvPatternGetBaseAddrByBlockDescriptor(&blockDescriptor, patternId, pPatternAddress, pPatternLength); + } + else + { + /* Invalid block number passed, signal failure via return value */ + memSegment = -1; + } + + return memSegment; +} + +/*********************************************************************************************************************** + * FblNvPatternGetBaseAddrByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Calculates base address and actual (write) length of an NvPattern or block property element + * \param[in] blockDescriptor Logical block descriptor + * \param[in] patternId ID of the NvPattern or block property for which the base address is requested + * \param[out] pPatternAddress Pointer to RAM buffer to store the base address + * \param[out] pPatternLength Pointer to RAM buffer to store the actual write address of the NvPattern or property + * \return memSegment of the pattern location or -1 in case of an error + **********************************************************************************************************************/ +vsint16 FblNvPatternGetBaseAddrByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * patternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ) +{ + IO_PositionType lastBlockAddress; + + /* Get address of last byte in block */ + lastBlockAddress = blockDescriptor->blockStartAddress + (blockDescriptor->blockLength - 1u); + + /* Get corresponding memory segment index */ + memSegment = FblMemSegmentNrGet(lastBlockAddress); + + /* Check if a valid memory segment in flash block table was found */ + if (memSegment >= 0) + { + IO_SizeType offsetLength = FblNvPatternGetPatternOffset(patternId, patternLength); + + /* Calculate pattern address */ + *patternAddress = (lastBlockAddress - offsetLength) + 1u; + + /* Check for range overflow */ + assertFbl(*patternAddress >= blockDescriptor->blockStartAddress, kFblSysAssertParameterOutOfRange); + + /* All NvPattern data must be stored in the same memSegment */ + assertFbl(FblMemSegmentNrGet(*patternAddress) == memSegment, kFblSysAssertParameterOutOfRange); + } + else + { + /* No memory segment found, this is a configuration error. */ + assertFbl(0u, kFblSysAssertParameterOutOfRange); /* PRQA S 2741, 4558 */ /* MD_FblNvPattern_Assertion */ + } + + return memSegment; +} + +/*********************************************************************************************************************** + * FblNvPatternGetPatternRegionSizeByStartAddress + **********************************************************************************************************************/ +/*! \brief Calculates length of complete region containing NvPattern or block property elements + * \param[in] patternStartAddress Start address of pattern region + * \param[out] patternLength Pointer to RAM buffer to store the region size + * \return kFblOk: Pattern region size calculated successfully , kFblFailed: Else + **********************************************************************************************************************/ +tFblResult FblNvPatternGetPatternRegionSizeByStartAddress( IO_PositionType patternStartAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternRegionLength) +{ + tBlockDescriptor blockDescriptor; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &blockDescriptor); + + if (result == kFblOk) + { + *patternRegionLength = (IO_SizeType)blockDescriptor.blockLength; + } + + return result; +} +/*********************************************************************************************************************** + * FblNvPatternSet + **********************************************************************************************************************/ +/*! \brief Writes the pattern into the flash memory. + * \details The location of the pattern will be taken from the logical block table + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be set + * \return kFblOk: pattern successfully written, kFblFailed: Error writing pattern + **********************************************************************************************************************/ +tFblResult FblNvPatternSet( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ) +{ + tBlockDescriptor localBlockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockDescriptor->blockNr, &localBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternSetByBlockDescriptor(&localBlockDescriptor, patternId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternSetByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Writes the pattern into the flash memory. + * \details The location of the pattern will be taken from the logical block descriptor. + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be set + * \return kFblOk: pattern successfully written or already set, kFblFailed: Error writing pattern + **********************************************************************************************************************/ +tFblResult FblNvPatternSetByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ) +{ + IO_PositionType patternAddress; + IO_SizeType patternLength; + tFblResult result; + tFblNvPatternState patternState; + vuint8 fblMarkerValue[] = kFblNvMarkerValue; /* PRQA S 3678 */ /* MD_FblNvPattern_3678_LocalVariable */ + + /* PRQA S 2742, 2880 1 */ /* MD_FblNvPattern_Assertion */ + assertFblUser(sizeof(fblMarkerValue) == kFblNvPatternSize, kFblSysAssertParameterOutOfRange); + + /* Initialize variables */ + result = kFblFailed; + + /* Check state of pattern */ + patternState = FblNvPatternGetPatternState(blockDescriptor, patternId, &patternAddress, &patternLength); + + /* Proceed if marker is blank */ + if (patternState.markerState == FBL_NVPATTERN_STATE_ERASED) + { + /* Write pattern */ + if (kFblOk == FblNvPatternWritePageAligned(fblMarkerValue, patternAddress, kFblNvPatternSize)) + { + /* Verify that pattern is valid now */ + patternState = FblNvPatternGetPatternState(blockDescriptor, patternId, &patternAddress, &patternLength); + + if (patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) + { +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + result = FblNvPatternUpdateCmacByBlockDescriptor(blockDescriptor, patternId); +#else + result = kFblOk; +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + } + } + } + else if ((patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED)) + { + /* Pattern already has expected state */ + result = kFblOk; + } + else + { + /* For the sake of completeness */ + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternSetByStartAddress + **********************************************************************************************************************/ +/*! \brief Writes the pattern into the flash memory. + * \param[in] patternStartAddress Start address of pattern region + * \param[in] patternId ID of the pattern which shall be set + * \return kFblOk: pattern successfully written or already set, kFblFailed: Error writing pattern + **********************************************************************************************************************/ +tFblResult FblNvPatternSetByStartAddress( IO_PositionType patternStartAddress, + tFblNvPatternId patternId) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternSetByBlockDescriptor(&dummyBlockDescriptor, patternId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternClr + **********************************************************************************************************************/ +/*! \brief Writes the mask to invalidate the pattern + * \details The location of the pattern will be taken from the logical block table + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be set + * \return kFblOk: Mask for invalidation successfully written, kFblFailed: Error writing invalidation mask + **********************************************************************************************************************/ +tFblResult FblNvPatternClr( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ) +{ + tBlockDescriptor localBlockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockDescriptor->blockNr, &localBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternClrByBlockDescriptor(&localBlockDescriptor, patternId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternClrByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Writes the mask to invalidate the pattern + * \details The location of the pattern will be taken from the passed logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be set + * \return kFblOk: Mask for invalidation successfully written, kFblFailed: Error writing invalidation mask + **********************************************************************************************************************/ +tFblResult FblNvPatternClrByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ) +{ + tFblResult result; + IO_PositionType patternAddress; + IO_SizeType patternLength; + tFblNvPatternState patternState; + vuint8 fblMaskValue[] = kFblNvMaskValue; /* PRQA S 3678 */ /* MD_FblNvPattern_3678_LocalVariable */ + + /* PRQA S 2742, 2880 1 */ /* MD_FblNvPattern_Assertion */ + assertFblUser(sizeof(fblMaskValue) == kFblNvPatternSize, kFblSysAssertParameterOutOfRange); + + /* Check state of pattern */ + patternState = FblNvPatternGetPatternState(blockDescriptor, patternId, &patternAddress, &patternLength); + + /* Only set mask if pattern is set to valid */ + if ((patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED)) + { + /* Write mask value to flash */ + result = FblNvPatternWritePageAligned(fblMaskValue, (patternAddress + patternLength), kFblNvPatternSize); + } + else + { + /* Pattern is already in invalid state, do nothing. Illegal states are detected with assertions only. */ + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternClrByStartAddress + **********************************************************************************************************************/ +/*! \brief Writes the mask to invalidate the pattern + * \param[in] patternStartAddress Start address of pattern region + * \param[in] patternId ID of the pattern which shall be cleared + * \return kFblOk: Mask for invalidation successfully written, kFblFailed: Error writing invalidation mask + **********************************************************************************************************************/ +tFblResult FblNvPatternClrByStartAddress( IO_PositionType patternStartAddress, tFblNvPatternId patternId ) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternClrByBlockDescriptor(&dummyBlockDescriptor, patternId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGet + **********************************************************************************************************************/ +/*! \brief Checks if the pattern state is 'valid' (correct pattern value is set/mask is erased) + * \details The location of the pattern and mask is taken from the logical block table + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be checked + * \return kFblOk: Pattern is set and mask is erased, + * kFblFailed: Pattern is not set or mask not erased + **********************************************************************************************************************/ +tFblResult FblNvPatternGet( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ) +{ + tBlockDescriptor localBlockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockDescriptor->blockNr, &localBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternGetByBlockDescriptor(&localBlockDescriptor, patternId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Checks if the pattern state is 'valid' (correct pattern value is set/mask is erased) + * \details The location of the pattern and mask is taken from the passed logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId ID of the pattern which shall be checked + * \return kFblOk: Pattern is set and mask is erased, + * kFblFailed: Pattern is not set or mask not erased + **********************************************************************************************************************/ +tFblResult FblNvPatternGetByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ) +{ + IO_PositionType patternAddress; + IO_SizeType patternLength; + tFblNvPatternState patternState; + tFblResult result; + + /* Initialize result */ + result = kFblFailed; + + /* Check state of pattern */ + patternState = FblNvPatternGetPatternState(blockDescriptor, patternId, &patternAddress, &patternLength); + if ((patternState.markerState == FBL_NVPATTERN_STATE_EXPECTEDVALUE) && (patternState.maskState == FBL_NVPATTERN_STATE_ERASED)) + { +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) + result = FblNvPatternVerifyCmacByBlockDescriptor(blockDescriptor, patternId); +#else + result = kFblOk; +#endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetByStartAddress + **********************************************************************************************************************/ +/*! \brief Checks if the pattern state is 'valid' (correct pattern value is set/mask is erased) + * \param[in] patternStartAddress Start address of pattern region + * \param[in] patternId ID of the pattern which shall be checked + * \return kFblOk: Pattern is set and mask is erased, + * kFblFailed: Pattern is not set or mask not erased + **********************************************************************************************************************/ +tFblResult FblNvPatternGetByStartAddress( IO_PositionType patternStartAddress, tFblNvPatternId patternId ) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternGetByBlockDescriptor(&dummyBlockDescriptor, patternId); + } + + return result; +} + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +# if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +/*********************************************************************************************************************** + * FblNvPatternGetPropertyStateAndAddrByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Retrieve the property state and address + * \details The location of the property is taken from the passed logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] propertyId Id of the property to check the erase state + * \param[out] address Pointer to the property address + * \param[out] state Pointer to the property state + * \return kFblOk: Property state and address are read, + * kFblFailed: Property state and address are not read + **********************************************************************************************************************/ +tFblResult FblNvPatternGetPropertyStateAndAddrByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId propertyId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * address, + V_MEMRAM1 tFblNvPatternItemState V_MEMRAM2 V_MEMRAM3 * state) +{ + IO_PositionType propertyAddress = 0u; + IO_SizeType propertyLength; + IO_SizeType actualPropertyLength; + tFblResult result = kFblFailed; + + /* Init variables */ + *state = FBL_NVPATTERN_STATE_UNEXPECTEDVALUE; + *address = 0u; + + /* Check if requested Id is valid */ + if (IS_VALID_PROPERTY_ID(propertyId)) + { + /* Get address of element. Length is not used. */ + if (FblNvPatternGetBaseAddrByBlockDescriptor(blockDescriptor, propertyId, &propertyAddress, &propertyLength) >= 0) + { + /* Get the property length */ + actualPropertyLength = fblNvBlockProperties[(vuintx)propertyId - (vuintx)kFblNvPatternId_Separator - 1u].length; + *state = FblNvPatternGetPatternItemState(propertyAddress, actualPropertyLength, DONT_COMPARE); + *address = propertyAddress; + result = kFblOk; + } + } + + return result; +} +# endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ + +/*********************************************************************************************************************** + * FblNvPatternGetProperty + **********************************************************************************************************************/ +/*! \brief Reads value of a block property element + * \details Location of the property is taken from the logical block table + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] propertyId Id of property to read + * \param[in] bufferLength Length of destination buffer + * \param[out] pDestBuffer Pointer to RAM where read property value will be stored + * \return kFblOk: Property successfully read, kFblFailed: Error reading property + **********************************************************************************************************************/ +tFblResult FblNvPatternGetProperty( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8* pDestBuffer ) +{ + tBlockDescriptor localBlockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockDescriptor->blockNr, &localBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternGetPropertyByBlockDescriptor(&localBlockDescriptor, propertyId, bufferLength, pDestBuffer); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetPropertyByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Reads value of an block property element + * \details The location of the block property is taken from the passed logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] propertyId Id of the property to read + * \param[in] bufferLength Length of destination buffer + * \param[out] pDestBuffer Pointer to RAM where the read property value will be stored + * \return kFblOk: Property successfully read, kFblFailed: Error reading property + **********************************************************************************************************************/ +tFblResult FblNvPatternGetPropertyByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8* pDestBuffer ) +{ + IO_PositionType propertyAddress; + IO_SizeType propertyLength; + IO_SizeType sizeToRead = 0u; + tFblNvPatternId depPattern; + tFblResult result; + + result = kFblFailed; + propertyAddress = 0u; + + /* Check if requested Id is valid */ + if (IS_VALID_PROPERTY_ID(propertyId)) + { + sizeToRead = fblNvBlockProperties[(vuintx)propertyId - (vuintx)kFblNvPatternId_Separator - 1u].length; + depPattern = fblNvBlockProperties[(vuintx)propertyId - (vuintx)kFblNvPatternId_Separator - 1u].dependentPattern; + + /* Check if buffer length is sufficient for storing requested data */ + if (sizeToRead <= bufferLength) + { + /* If dependent pattern configured, check its validity */ + if (depPattern != kFblNvPatternId_Invalid) + { + result = FblNvPatternGetByBlockDescriptor(blockDescriptor, depPattern); + } + else + { + result = kFblOk; + } + } + } + + if (result == kFblOk) + { + /* Get address of property (length is not needed) */ + if (FblNvPatternGetBaseAddrByBlockDescriptor(blockDescriptor, propertyId, &propertyAddress, &propertyLength) >= 0) + { + if (MemDriver_RReadSync(pDestBuffer, sizeToRead, propertyAddress) == IO_E_OK) + { + result = kFblOk; + } + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternGetPropertyByStartAddress + **********************************************************************************************************************/ +/*! \brief Reads value of an block property element + * \param[in] patternStartAddress Start address of pattern region + * \param[in] propertyId Id of the property to read + * \param[in] bufferLength Length of destination buffer + * \param[out] pDestBuffer Pointer to RAM where the read property value will be stored + * \return kFblOk: Property successfully read, kFblFailed: Error reading property + **********************************************************************************************************************/ +tFblResult FblNvPatternGetPropertyByStartAddress( IO_PositionType patternStartAddress, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8 * destBuffer ) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternGetPropertyByBlockDescriptor(&dummyBlockDescriptor, propertyId, bufferLength, destBuffer); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternSetProperty + **********************************************************************************************************************/ +/*! \brief Writes value of a block property + * \details The location of the property is taken from the logical block table + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] pSrcBuffer Pointer to RAM with the data to write + * \param[in] propertyId Id of the block property to write + * \return kFblOk: Property successfully written, kFblFailed: Error writing property + **********************************************************************************************************************/ +tFblResult FblNvPatternSetProperty( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + const vuint8* pSrcBuffer, + tFblNvPatternId propertyId ) +{ + tBlockDescriptor localBlockDescriptor; + tFblResult result; + + result = FblLbtGetBlockDescriptorByNr(blockDescriptor->blockNr, &localBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternSetPropertyByBlockDescriptor(&localBlockDescriptor, pSrcBuffer, propertyId); + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternSetPropertyByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Writes value of a block property + * \details The location of the property is taken from the passed logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] pSrcBuffer Pointer to RAM with the data to write + * \param[in] propertyId Id of the property to write + * \return kFblOk: Property successfully written, kFblFailed: Error writing property + **********************************************************************************************************************/ +tFblResult FblNvPatternSetPropertyByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + const vuint8* pSrcBuffer, + tFblNvPatternId propertyId ) +{ + IO_PositionType propertyAddress; + IO_SizeType propertyLength; + IO_SizeType actualPropertyLength; + tFblResult result; + + /* Initialize variables */ + result = kFblFailed; + propertyAddress = 0u; + + /* Check if requested Id is valid */ + if (IS_VALID_PROPERTY_ID(propertyId)) + { + /* Get address and length of element */ + if (FblNvPatternGetBaseAddrByBlockDescriptor(blockDescriptor, propertyId, &propertyAddress, &propertyLength) >= 0) + { + /* Only write block property to memory if it has not been set before */ + actualPropertyLength = fblNvBlockProperties[(vuintx)propertyId - (vuintx)kFblNvPatternId_Separator - 1u].length; + if (FblNvPatternGetPatternItemState(propertyAddress, actualPropertyLength, DONT_COMPARE) == FBL_NVPATTERN_STATE_ERASED) + { + result = FblNvPatternWritePageAligned(pSrcBuffer, propertyAddress, actualPropertyLength); + } + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternSetPropertyByStartAddress + **********************************************************************************************************************/ +/*! \brief Writes value of a block property + * \param[in] patternStartAddress Start address of pattern region + * \param[in] pSrcBuffer Pointer to RAM with the data to write + * \param[in] propertyId Id of the property to write + * \return kFblOk: Property successfully written, kFblFailed: Error writing property + **********************************************************************************************************************/ +tFblResult FblNvPatternSetPropertyByStartAddress( IO_PositionType patternStartAddress, + const vuint8* srcBuffer, + tFblNvPatternId propertyId ) +{ + tBlockDescriptor dummyBlockDescriptor = { 0u }; + tFblResult result = FblNvPatternGetPatternBlockDescriptorByStartAddress(patternStartAddress, &dummyBlockDescriptor); + + if (result == kFblOk) + { + result = FblNvPatternSetPropertyByBlockDescriptor(&dummyBlockDescriptor, srcBuffer, propertyId); + } + + return result; +} + +# if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +/*********************************************************************************************************************** + * FblNvPatternSignedPresencePatternInit + **********************************************************************************************************************/ +/*! \brief Init the AES key and update the CMAC for all valid logical block during the first startup of ECU + **********************************************************************************************************************/ +void FblNvPatternSignedPresencePatternInit(void) +{ + ApplFblNvPatternSignedPresencePatternInit(); +} + +/*********************************************************************************************************************** + * FblNvPatternUpdateCmacByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Calculate the CMAC for the received patternId and update it in the respective property + * \details The address of the property will be fetched from the logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId Id of the pattern for which the CMAC needs to be calculated and written + * \return kFblOk: CMAC updated + * kFblFailed: CMAC not updated + **********************************************************************************************************************/ +tFblResult FblNvPatternUpdateCmacByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId) +{ + tFblResult result = kFblFailed; + IO_PositionType propertyAddress = 0u; + tFblNvPatternItemState propertyState; + vuint8 signatureBuffer[FBL_NVPATTERN_PP_CMAC_SIZE]; + + if (fblNvPatternProperties[patternId] != kFblNvPatternId_Invalid) + { + assertFblUser(fblNvBlockProperties[(vuintx)fblNvPatternProperties[patternId] - (vuintx)kFblNvPatternId_Separator - 1u].dependentPattern + == kFblNvPatternId_Invalid, kFblSysAssertParameterOutOfRange); + + if (FblNvPatternGetPropertyStateAndAddrByBlockDescriptor(blockDescriptor, fblNvPatternProperties[patternId], + &propertyAddress, &propertyState) == kFblOk) + { + if (propertyState == FBL_NVPATTERN_STATE_ERASED) + { + if (ApplFblNvPatternGenerateCMAC(fblNvPatternProperties[patternId], blockDescriptor, signatureBuffer) == kFblOk) + { + result = FblNvPatternSetPropertyByBlockDescriptor(blockDescriptor, signatureBuffer, fblNvPatternProperties[patternId]); + } + } + } + } + else + { + result = kFblOk; + } + + return result; +} + +/*********************************************************************************************************************** + * FblNvPatternVerifyCmacByBlockDescriptor + **********************************************************************************************************************/ +/*! \brief Verify the CMAC for the received patternId + * \details The address of the property will be fetched from the logical block descriptor + * \param[in] blockDescriptor Pointer to the logical block descriptor + * \param[in] patternId Id of the pattern for which the CMAC needs to be verified + * \return kFblOk: CMAC verified successfully + * kFblFailed: CMAC not verified or verification failed + **********************************************************************************************************************/ +tFblResult FblNvPatternVerifyCmacByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId) +{ + vuint8 signatureBuffer[FBL_NVPATTERN_PP_CMAC_SIZE]; + IO_PositionType propertyAddress = 0u; + IO_SizeType actualPropertyLength; + tFblNvPatternItemState propertyState; + tFblResult result = kFblFailed; + + if (fblNvPatternProperties[patternId] != kFblNvPatternId_Invalid) + { + assertFblUser(fblNvBlockProperties[(vuintx)fblNvPatternProperties[patternId] - (vuintx)kFblNvPatternId_Separator - 1u].dependentPattern + == kFblNvPatternId_Invalid, kFblSysAssertParameterOutOfRange); + + if (FblNvPatternGetPropertyStateAndAddrByBlockDescriptor(blockDescriptor, fblNvPatternProperties[patternId], + &propertyAddress, &propertyState) == kFblOk) + { + if (propertyState != FBL_NVPATTERN_STATE_ERASED) + { + actualPropertyLength = fblNvBlockProperties[(vuintx)fblNvPatternProperties[patternId] - + (vuintx)kFblNvPatternId_Separator - 1u].length; + + if (MemDriver_RReadSync(signatureBuffer, actualPropertyLength, propertyAddress) == IO_E_OK) + { + result = ApplFblNvPatternVerifyCMAC(fblNvPatternProperties[patternId], blockDescriptor, signatureBuffer); + } + } + } + } + else + { + result = kFblOk; + } + + return result; +} +# endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +#define FBLNVPATTERN_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * ERROR CHECKS + **********************************************************************************************************************/ + +#if (!IS_POWOFTWO(FBL_MAX_SEGMENT_SIZE)) +# error "FBL_MAX_SEGMENT_SIZE must be a power of two." +#endif + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblNvPattern_Assertion: + Reason: Assertion macros have to be disabled in production code and are used only for development. + Risk: Assertion code may be enabled in production code unintentionally. If a assertion condition is unexpectedly + false, the code is active. A problem may occur if the Macro is additionally changed from single statement + to multiple statement. + Prevention: Macro is not allowed to be changed without review. Development code is automatically disabled via + configuration of project state "Production". + + MD_FblNvPattern_3678_LocalVariable: + Reason: Local variable/array is not declared as const as some compiler/platforms have issues with that. + Risk: Content of the variable/array could be modified within the function. + Prevention: Code is checked for unintended write accesses by code inspection. + + MD_FblNvPattern_4342: + Reason: An expression of essential type has been cast to an enum type. + Risk: The essential type is not in range of enum type. + Prevention: Code must be reviewed to ensure cast is only applied on values in valid range + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_NVPATTERN.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblNvPattern/fbl_nvpattern.h b/Source/bsw/FblNvPattern/fbl_nvpattern.h new file mode 100644 index 0000000..f8c672c --- /dev/null +++ b/Source/bsw/FblNvPattern/fbl_nvpattern.h @@ -0,0 +1,167 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Implementation of pattern/mask based non-volatile information storage + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 02.00.00 2025-03-11 virjjn FBL-9704 Initial version + * 02.01.00 2025-06-19 dganesh FBL-11034 No changes + **********************************************************************************************************************/ + +#ifndef FBLLIB_NVPATTERN_H +#define FBLLIB_NVPATTERN_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_NvPattern CQComponent : Implementation */ +#define FBLLIB_NVPATTERN_VERSION 0x0201u +#define FBLLIB_NVPATTERN_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "FblNvPattern_Cfg.h" +#include "fbl_nvpattern_oem.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Set Id of separator item to last item if storing arbitrary values is not enabled */ +#if !defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +# define kFblNvPatternId_Separator kFblNvPatternId_Last +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ + +/*********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + **********************************************************************************************************************/ + +/** Representation of status of marker/mask */ +typedef enum +{ + FBL_NVPATTERN_STATE_NOMEMSEGMENT = 0u, /**< No matching memory segment has been found */ + FBL_NVPATTERN_STATE_READERROR, /**< Memory area could not be read */ + FBL_NVPATTERN_STATE_ERASED, /**< Marker/mask area is erased */ + FBL_NVPATTERN_STATE_UNEXPECTEDVALUE, /**< Unexpected marker/mask value */ + FBL_NVPATTERN_STATE_EXPECTEDVALUE /**< Expected marker/mask value is set */ +} tFblNvPatternItemState; + +/** Status of pattern */ +typedef struct +{ + tFblNvPatternItemState markerState; + tFblNvPatternItemState maskState; +} tFblNvPatternState; + +/*********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLNVPATTERN_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + + +tFblNvPatternState FblNvPatternGetPatternState( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pBlockDescriptor, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * pPatternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pPatternLength ); +tFblNvPatternState FblNvPatternGetPatternStateByStartAddress( IO_PositionType patternStartAddress, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * patternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ); +vsint16 FblNvPatternGetBaseAddr( vuint8 blockNr, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * pPatternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * pPatternLength ); +vsint16 FblNvPatternGetBaseAddrByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 * patternAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternLength ); +tFblResult FblNvPatternGetPatternRegionSizeByStartAddress( IO_PositionType patternStartAddress, + V_MEMRAM1 IO_SizeType V_MEMRAM2 V_MEMRAM3 * patternRegionLength ); +tFblResult FblNvPatternSet( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ); +tFblResult FblNvPatternSetByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ); +tFblResult FblNvPatternSetByStartAddress( IO_PositionType patternStartAddress, tFblNvPatternId patternId ); +tFblResult FblNvPatternClr( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ); +tFblResult FblNvPatternClrByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ); +tFblResult FblNvPatternClrByStartAddress( IO_PositionType patternStartAddress, tFblNvPatternId patternId ); +tFblResult FblNvPatternGet( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, tFblNvPatternId patternId ); +tFblResult FblNvPatternGetByBlockDescriptor( const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId patternId ); +tFblResult FblNvPatternGetByStartAddress( IO_PositionType patternStartAddress, tFblNvPatternId patternId ); + +#if defined( FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES ) +tFblResult FblNvPatternGetProperty(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8* pDestBuffer ); +tFblResult FblNvPatternGetPropertyByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8* pDestBuffer ); +tFblResult FblNvPatternGetPropertyByStartAddress( IO_PositionType patternStartAddress, + tFblNvPatternId propertyId, + IO_SizeType bufferLength, + vuint8 * destBuffer ); +tFblResult FblNvPatternSetProperty(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + const vuint8* pSrcBuffer, + tFblNvPatternId propertyId); +tFblResult FblNvPatternSetPropertyByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + const vuint8* pSrcBuffer, + tFblNvPatternId propertyId); +tFblResult FblNvPatternSetPropertyByStartAddress( IO_PositionType patternStartAddress, + const vuint8* srcBuffer, + tFblNvPatternId propertyId ); +# if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +tFblResult FblNvPatternGetPropertyStateAndAddrByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 *blockDescriptor, + tFblNvPatternId propertyId, + V_MEMRAM1 IO_PositionType V_MEMRAM2 V_MEMRAM3 *address, + V_MEMRAM1 tFblNvPatternItemState V_MEMRAM2 V_MEMRAM3 *state); + +tFblResult FblNvPatternUpdateCmacByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 *blockDescriptor, + tFblNvPatternId patternId); +tFblResult FblNvPatternVerifyCmacByBlockDescriptor(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 *blockDescriptor, + tFblNvPatternId patternId); +void FblNvPatternSignedPresencePatternInit(void); +void ApplFblNvPatternSignedPresencePatternInit(void); +tFblResult ApplFblNvPatternVerifyCMAC(tFblNvPatternId patternId, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * signatureBuffer); + +tFblResult ApplFblNvPatternGenerateCMAC(tFblNvPatternId patternId, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * signatureBuffer); +# endif /* FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN */ +#endif /* FBL_NVPATTERN_ENABLE_BLOCK_PROPERTIES */ +#define FBLNVPATTERN_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBLLIB_NVPATTERN_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_NVPATTERN.H + **********************************************************************************************************************/ diff --git a/Source/bsw/FblSecBoot/fbl_secboot.c b/Source/bsw/FblSecBoot/fbl_secboot.c new file mode 100644 index 0000000..31c6e8c --- /dev/null +++ b/Source/bsw/FblSecBoot/fbl_secboot.c @@ -0,0 +1,606 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief SecureBoot implementation + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2020-01-07 visrie FBL-524 Initial release + * 01.00.01 2020-04-27 visrie FBL-1773 No changes + * 02.00.00 2020-05-19 vistbe FBL-1016 Support EcuM_Init() mechanism + * 02.01.00 2021-01-19 visrie FBL-2648 Added support of new SecureBoot verify variant + * FBL-2641 Updated to new API version + * 02.02.00 2021-09-03 visjdn FBL-3352 No changes + * 02.03.00 2023-06-21 vistbe FBL-4814 Add support for OTA + * 02.03.01 2024-05-16 viswmo ESCAN00117059 Signature failure is not reported + * 02.04.00 2024-11-18 vismix FBL-9654 Optimize startup times for secure boot + * 02.05.00 2025-01-24 vikatya PIO-1340 SecureBoot for selected blocks + * 02.06.00 2025-02-19 visrie FBL-10209 Support total length for confirmation mode + **********************************************************************************************************************/ + +#define FBL_SECBOOT_SOURCE + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "fbl_inc.h" +#include "Std_Types.h" +#include "Csm.h" +#include "bm_types.h" +#include "bm_hdr.h" +#include "fbl_secboot.h" + +#if defined( FBLSB_ENABLE_COPY_FLASH_DRIVER ) +# include "FlashRom.h" +#endif /* FBLSB_ENABLE_COPY_FLASH_DRIVER */ + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( FBLLIB_SECBOOT_VHSM_VERSION != 0x0206u ) || \ + ( FBLLIB_SECBOOT_VHSM_RELEASE_VERSION != 0x00u ) +# error "Error in FBL_SECBOOT.C: Source and Header file are inconsistent!" +#endif + +#if ( FBLLIB_SECBOOT_VHSM_VERSION != _FBLLIB_SECBOOT_VHSM_VERSION ) || \ + ( FBLLIB_SECBOOT_VHSM_RELEASE_VERSION != _FBLLIB_SECBOOT_VHSM_RELEASE_VERSION ) +# error "Error in FBL_SECBOOT.C: Source and v_ver.h are inconsistent!" +#endif + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/** Watchdog triggered every n-th cycle (has to power of two) */ +#if !defined( FBLSB_WATCHDOG_CYCLE_COUNT ) +# define FBLSB_WATCHDOG_CYCLE_COUNT 0x20u +#endif +/** Trigger watchdog every n-th cycle */ +#define FBLSB_TRIGGER_WATCHDOG(cycle) \ +{ \ + if (((cycle) & (FBLSB_WATCHDOG_CYCLE_COUNT - 1u)) == 0x00u) \ + { \ + (void)FblLookForWatchdog(); \ + } \ +} + +#define FBLSB_VHSM_AUTHENTICATION_HEADER_HEADER 20u /* Magic Pattern (16) + Revision (4) */ +#define FBLSB_VHSM_AUTHENTICATION_HEADER_GROUPID 4u /* GroupId */ +#define FBLSB_VHSM_AUTHENTICATION_HEADER_NO_SEGMENTS 2u /* Nr of Segments */ +#define FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_BASE (FBLSB_VHSM_AUTHENTICATION_HEADER_GROUPID + FBLSB_VHSM_AUTHENTICATION_HEADER_NO_SEGMENTS) +#define FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_SEGMENT 42u /* Address (4) + Length (4) + Mode (2) + Hash (32) */ +#define FBLSB_VHSM_AUTHENTICATION_HEADER_SIGNATURE_LENGTH 4u /* Length field containing the actual length of the signature */ +#define FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_SEGMENTS(noOfSegments) \ + ((noOfSegments) * FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_SEGMENT) +#define FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH(noOfSegments) \ + (FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_BASE + FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH_SEGMENTS(noOfSegments)) + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * GLOBAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ +#define FBLSB_START_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +V_MEMRAM0 static V_MEMRAM1 tFblSbExtErrCode V_MEMRAM2 sbExtErrCode; + +#define FBLSB_STOP_SEC_VAR +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLSB_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBLSB_ENABLE_GENERATE_CMAC ) +static tFblLength FblSb_GetAuthenticationHeaderLength(const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * dataPtr); +static tFblResult FblSb_UpdateCommonMac(V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader, vuint32 macId); +#endif /* FBLSB_ENABLE_GENERATE_CMAC */ + +/*********************************************************************************************************************** + * EXTERNAL DATA + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +#if defined( FBLSB_ENABLE_GENERATE_CMAC ) +/*********************************************************************************************************************** + * FblSb_GetAuthenticationHeaderLength +**********************************************************************************************************************/ +/*! \brief Calculates the length of the vHsm authentication header + * \param[in] dataPtr Pointer to the groupId of the vHsm authentication header + * \return Length of the authentication header + **********************************************************************************************************************/ +static tFblLength FblSb_GetAuthenticationHeaderLength(const V_MEMRAM1 vuint8 V_MEMRAM2 V_MEMRAM3 * dataPtr) +{ + tFblLength authHeaderLength; + vuint32 noOfSegments; + + noOfSegments = FblMemGetInteger(FBLSB_VHSM_AUTHENTICATION_HEADER_NO_SEGMENTS, &dataPtr[FBLSB_VHSM_AUTHENTICATION_HEADER_GROUPID]); + authHeaderLength = FBLSB_VHSM_AUTHENTICATION_HEADER_LENGTH(noOfSegments); + + return authHeaderLength; +} + +/*********************************************************************************************************************** + * FblSb_UpdateCommonMac + **********************************************************************************************************************/ +/*! \brief Generate and write the common MACs + * \param[in] bmHeader Pointer to the bmHdrHeader structure + * \param[in] macId MAC operation identifier + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +/* PRQA S 3673, 6010, 6030, 6080 1 */ /* MD_MSR_Rule8.13, MD_MSR_STPTH, MD_MSR_STCYC, MD_MSR_STMIF */ +static tFblResult FblSb_UpdateCommonMac(V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader, vuint32 macId) +{ + tFblResult result = kFblOk; + Crypto_VerifyResultType verifyResult = CRYPTO_E_VER_NOT_OK; + uint32 jobId = 0u; + const uint8 * dataPtr; + uint32 dataLength = 0u; + uint32 signatureAddress = 0u; + uint32 signatureLength = 0u; + + /* Check if mac operation is configured. */ + if (macId != FBLBMHDR_MAC_OP_REF_NOT_USED) + { + /* Check if the SecureBootGroup can be updated */ + if (macId < FBLSB_NUM_OF_MAC_OPERATIONS) + { + /* Check if SecureBootUpdate is actually required */ + if ((FblSb_GetVerificationMethodOfMacOperation(macId) == FBLSB_VERIFICATIONMETHOD_INTERNAL) +# if defined( FBL_ENABLE_OTA ) + && (vOtaM_IsOpenedPartitionOfRoleActive() == E_OK) +# endif /* FBL_ENABLE_OTA */ + ) + { + jobId = FblSb_GetCsmJobIdOfMacUpdate(); + dataPtr = (const uint8 *)bmHeader->bmAuthenticationHeaderAddress; /* PRQA S 0306 */ /* MD_FblLibSecBoot_0306 */ + dataLength = FblSb_GetAuthenticationHeaderLength(dataPtr); + result = ApplFblSbGetSignatureInfo(bmHeader, macId, &signatureAddress, &signatureLength); + + assertFblGen((result == kFblOk), kFblSysAssertParameterOutOfRange); + + if (result == kFblOk) + { + /* PRQA S 0306 2 */ /* MD_FblLibSecBoot_0306 */ + if (E_OK == Csm_SignatureVerify(jobId, CRYPTO_OPERATIONMODE_SINGLECALL, dataPtr, dataLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))signatureAddress, signatureLength, &verifyResult)) + { + if (verifyResult != CRYPTO_E_VER_OK) + { + sbExtErrCode = FBLSB_EXT_ERR_CODE_SIGNATURE; + result = kFblFailed; + } + } + else + { + result = kFblFailed; + } + } + } + else if (FblSb_IsConfirmationModeOfMacOperation(macId)) + { + boolean inactivePartition = FALSE; + + jobId = FblSb_GetCsmJobIdOfMacConfirmationMode(); + dataPtr = (const uint8 *)bmHeader->bmAuthenticationHeaderAddress; /* PRQA S 0306 */ /* MD_FblLibSecBoot_0306 */ + dataLength = FBLSB_VHSM_AUTHENTICATION_HEADER_HEADER; + dataLength += FblSb_GetAuthenticationHeaderLength(&dataPtr[FBLSB_VHSM_AUTHENTICATION_HEADER_HEADER]); + signatureLength = FblMemGetInteger(FBLSB_VHSM_AUTHENTICATION_HEADER_SIGNATURE_LENGTH, &dataPtr[dataLength]); /* Extract actual signature length */ + dataLength += FBLSB_VHSM_AUTHENTICATION_HEADER_SIGNATURE_LENGTH; + dataLength += signatureLength; + +# if defined( FBL_ENABLE_OTA ) + if (vOtaM_IsOpenedPartitionOfRoleInactive() == E_OK) + { + inactivePartition = TRUE; + } +# endif /* FBL_ENABLE_OTA */ + + if (E_OK == Csm_SignatureVerify(jobId, CRYPTO_OPERATIONMODE_SINGLECALL, dataPtr, dataLength, + (P2CONST(uint8, AUTOMATIC, CSM_APPL_VAR))&inactivePartition, sizeof(inactivePartition), &verifyResult)) + { + if (verifyResult != CRYPTO_E_VER_OK) + { + sbExtErrCode = FBLSB_EXT_ERR_CODE_SIGNATURE; + result = kFblFailed; + } + } + else + { + result = kFblFailed; + } + } + else + { + result = kFblFailed; + } + } + else + { + /* This block has no SecureBootGroup and therefore can not be updated */ + result = kFblFailed; + } + + if ( (result != kFblOk) + && (sbExtErrCode == FBLSB_EXT_ERR_CODE_NONE) ) + { + sbExtErrCode = FBLSB_EXT_ERR_CODE_GENERAL; + } + } + + return result; +} +#endif /* FBLSB_ENABLE_GENERATE_CMAC */ + +/*********************************************************************************************************************** + * GLOBAL FUNCTIONS + **********************************************************************************************************************/ + +#if defined( FBLSB_ENABLE_COPY_FLASH_DRIVER ) +/*********************************************************************************************************************** + * FblUpdCopyFlashDriver + ***********************************************************************************************************************/ +/*! \brief Copies the flashdriver from the ROM table into flashCode buffer + ***********************************************************************************************************************/ +void FblSb_CopyFlashDriver( void ) +{ + vuint16 index; + + /* flashCode buffer location must match the flashdriver start address */ +# if defined( FLASH_DRIVER_RELOCATABLE ) +# else + if ( (flashCode == (IO_U8 *)FLASHDRV_BLOCK0_ADDRESS) ) +# endif /* FLASH_DRIVER_RELOCATABLE */ + { + /* Copy all flash driver code from ROM into the flashCode buffer */ + for (index = 0u; index < FLASHDRV_BLOCK0_LENGTH; index++) + { + FBLSB_TRIGGER_WATCHDOG(index); + flashCode[index] = FLASHDRV_DECRYPTDATA(flashDrvBlk0[index]); + } + } +} +#endif /* FBLSB_ENABLE_COPY_FLASH_DRIVER */ + +/*********************************************************************************************************************** + * FblSb_Init + ***********************************************************************************************************************/ +/*! \brief Initializes the SecureBoot module + * \details Initializes the complete crypto stack + ***********************************************************************************************************************/ +void FblSb_Init(void) +{ + /* Crypto stack is initialized via EcuM_Init */ + + sbExtErrCode = FBLSB_EXT_ERR_CODE_NONE; +} + +/*********************************************************************************************************************** + * FblSb_VerifyFblLbt + **********************************************************************************************************************/ +/*! \brief Verifies the BmHdrHeader and the LogicalBlockTable of the bootloader + * \param[in] fblHeader Pointer to the FBL Header + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise or when the feature is disabled + **********************************************************************************************************************/ +tFblResult FblSb_VerifyFblLbt(const V_MEMRAM1 tFblHeader V_MEMRAM2 V_MEMRAM3 * fblHeader) +{ + tFblResult result = kFblFailed; +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) + Crypto_VerifyResultType verifyResult = CRYPTO_E_VER_NOT_OK; + uint32 jobId = 0u; + uint32 groupId = 0u; +# endif /* FBLBM_ENABLE_FBLLBT_VERIFICATION */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)fblHeader; +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) + jobId = FblSb_GetCsmJobIdOfMacVerify(); + groupId = FblSb_GetGroupIdOfMacOperation(FBLSB_SECOND_AUTH_MAC_OPERATION_ID); + + /* Verify the FBL-Header and the LBT */ + if (Csm_MacVerify(jobId, CRYPTO_OPERATIONMODE_SINGLECALL, (uint8 *)&groupId, sizeof(groupId), NULL_PTR, 0u, &verifyResult) == E_OK) + { + result = kFblOk; + } + + if ((result == kFblOk) && (verifyResult != CRYPTO_E_VER_OK)) + { + result = kFblFailed; + } +# endif /* FBLBM_ENABLE_FBLLBT_VERIFICATION */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + + return result; +} + +/*********************************************************************************************************************** + * FblSb_VerifyHeader + **********************************************************************************************************************/ +/*! \brief Verifies the header + * \param[in] bmHdrHeader Pointer to the FblBmHdrHeader structure + * \return Result of operation + * kFblFailed always (unsupported feature) + **********************************************************************************************************************/ +tFblResult FblSb_VerifyHeader(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)bmHdrHeader; +#endif + + return kFblFailed; +} + +/*********************************************************************************************************************** + * FblSb_VerifyHeaderRom + **********************************************************************************************************************/ +/*! \brief Verifies the MAC of the BmHdrHeader structure at a specific address + * \param[in] bmHeaderAddress Address of the bmHdrHeader structure + * \param[in] bmHdrHeader Pointer to the FblBmHdrHeader structure + * \return kFblFailed always (unsupported feature) + **********************************************************************************************************************/ +tFblResult FblSb_VerifyHeaderRom(tFblAddress bmHeaderAddress, const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader) +{ +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)bmHeaderAddress; + (void)bmHdrHeader; +#endif + + return kFblFailed; +} + +/*********************************************************************************************************************** + * FblSb_UpdateInitialSegments + **********************************************************************************************************************/ +/*! \brief Updates the SecureBootSegments based on the initial values. + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblSb_UpdateInitialSegments(void) +{ + tFblResult result = kFblOk; + Crypto_VerifyResultType verifyResult; + uint32 jobId; + vuint32 macOperationIdx; + uint32 groupId; + + /* Iterrate over the configuration */ + for (macOperationIdx = 0u; ((macOperationIdx < FBLSB_NUM_OF_MAC_OPERATIONS) && (result == kFblOk)); macOperationIdx++) + { + jobId = FblSb_GetCsmJobIdOfMacVerifyForceSequential(); + + if (FblSb_IsVerifyForceSequentialOfMacOperation(macOperationIdx)) + { + result = kFblFailed; + verifyResult = CRYPTO_E_VER_NOT_OK; + groupId = FblSb_GetGroupIdOfMacOperation(macOperationIdx); + if (Csm_MacVerify(jobId, CRYPTO_OPERATIONMODE_SINGLECALL, (uint8 *)&groupId, sizeof(groupId), NULL_PTR, 0u, &verifyResult) == E_OK) + { + if (verifyResult == CRYPTO_E_VER_OK) + { + result = kFblOk; + } + } + } + } + + return result; +} + +/*********************************************************************************************************************** + * FblSb_VerifySegments + **********************************************************************************************************************/ +/*! \brief Verifies the segments + * \details Triggers a verification of the configured SecureBootGroup. + * \param[in] bmHdrHeader Pointer to the FblBmHdrHeader structure + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblSb_VerifySegments(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader) +{ + tFblResult result = kFblFailed; + Crypto_VerifyResultType verifyResult = CRYPTO_E_VER_NOT_OK; + uint32 macId = FblBmHdr_GetFblSbMacId(bmHdrHeader->bmTargetHandle); + uint32 jobId; + uint32 groupId; + + /* Check if mac operation is configured. */ + if (macId != FBLBMHDR_MAC_OP_REF_NOT_USED) + { + if (macId < FBLSB_NUM_OF_MAC_OPERATIONS) + { + jobId = FblSb_GetCsmJobIdOfMacVerify(); + groupId = FblSb_GetGroupIdOfMacOperation(macId); + if (E_OK == Csm_MacVerify(jobId, CRYPTO_OPERATIONMODE_SINGLECALL, (uint8 *)&groupId, sizeof(groupId), NULL_PTR, 0u, &verifyResult)) + { + result = kFblOk; + } + } + + if( (result == kFblOk) + && (verifyResult != CRYPTO_E_VER_OK)) + { + result = kFblFailed; + } + } + else + { + result = kFblOk; + } + + return result; +} + +#if defined( FBLSB_ENABLE_GENERATE_CMAC ) +/*********************************************************************************************************************** + * FblSb_UpdateFblMac + **********************************************************************************************************************/ +/*! \brief Generate and write the necessary MACs for the FBL + * \param[in] fblHeader Pointer to the FBL Header + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +tFblResult FblSb_UpdateFblMac(V_MEMROM1 tFblHeader V_MEMROM2 V_MEMROM3 * fblHeader) +{ + tFblResult result = kFblFailed; + tFblBmHdrHeader bmHeader = { 0u }; + vuint32 macId = 0u; + + /* Clear any previous errors */ + sbExtErrCode = FBLSB_EXT_ERR_CODE_NONE; + + /* Read BM Header */ + /* PRQA S 0306 1 */ /* MD_FblLibSecBoot_0306 */ + if (FblReadProm((tFblAddress)fblHeader->bmHeader, (vuint8 *)&bmHeader, sizeof(bmHeader)) == sizeof(bmHeader)) + { + result = FblBmHdrCheckConsistency(&bmHeader); + } + else + { + sbExtErrCode = FBLSB_EXT_ERR_CODE_MEMORY; + } + + if (result == kFblOk) + { + /* Update the MAC for the first validation structure, used for all FBL segments */ + macId = FblBmHdr_GetFblSbMacId(bmHeader.bmTargetHandle); + result = FblSb_UpdateCommonMac(&bmHeader, macId); + } + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_FBLLBT_VERIFICATION ) + if (result == kFblOk) + { + /* Now update the MAC of the second validation structure */ + bmHeader.bmAuthenticationHeaderAddress = FBLSB_SECOND_AUTH_HEADER_ADDRESS; + result = FblSb_UpdateCommonMac(&bmHeader, FBLSB_SECOND_AUTH_MAC_OPERATION_ID); + } +# endif /* FBLBM_ENABLE_FBLLBT_VERIFICATION */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + + return result; +} + +/*********************************************************************************************************************** + * FblSb_UpdateBlockMac + **********************************************************************************************************************/ +/*! \brief Generate and write the necessary MACs for a logical block + * \param[in] blockDescriptor Pointer to the logical block + * \param[in] segmentList Pointer to the segments + * \return Result of operation + * kFblOk when operation succeeded + * kFblFailed otherwise + **********************************************************************************************************************/ +/* PRQA S 3673 2 */ /* MD_MSR_Rule8.13 */ +tFblResult FblSb_UpdateBlockMac(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + V_MEMRAM1 FL_SegmentListType V_MEMRAM2 V_MEMRAM3 * segmentList) +{ + tFblResult result = kFblFailed; + tFblBmHdrHeader bmHeader = { 0u }; + vuint32 macId = 0u; + +#if defined( V_ENABLE_USE_DUMMY_STATEMENT ) + /* Parameters not used: avoid compiler warning */ /* PRQA S 3112 2 */ /* MD_MSR_DummyStmt */ + (void)segmentList; +#endif + + /* Clear any previous errors */ + sbExtErrCode = FBLSB_EXT_ERR_CODE_NONE; + + /* Read BM Header */ + if (FblReadProm(blockDescriptor->bmHeaderAddress, (vuint8 *)&bmHeader, sizeof(bmHeader)) == sizeof(bmHeader)) + { + result = FblBmHdrCheckConsistency(&bmHeader); + } + else + { + sbExtErrCode = FBLSB_EXT_ERR_CODE_MEMORY; + } + + if (result == kFblOk) + { + macId = FblBmHdr_GetFblSbMacId(bmHeader.bmTargetHandle); + result = FblSb_UpdateCommonMac(&bmHeader, macId); + } + + return result; +} +#endif /* FBLSB_ENABLE_GENERATE_CMAC */ + +/*********************************************************************************************************************** + * FblSb_GetExtendedErrorCode + **********************************************************************************************************************/ +/*! \brief Returns an extended error information from previous call to FblSb_UpdateBlockMac/FblSb_UpdateFblMac + * \return Extended error code + **********************************************************************************************************************/ +tFblSbExtErrCode FblSb_GetExtendedErrorCode(void) +{ + return sbExtErrCode; +} + +#define FBLSB_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_FblLibSecBoot_0306: + Reason: Address conversion between integer values and pointers is required to allow for hardware independent + configuration and address range checks. + Risk: The size of integer required to hold the result of a pointer cast is implementation-defined. + Prevention: The size of the respective integer data type which holds the address value is adapted on a hardware + specific basis. The correctness of the respective implementation is verified by runtime tests. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: FBL_SECBOOT.C + **********************************************************************************************************************/ diff --git a/Source/bsw/FblSecBoot/fbl_secboot.h b/Source/bsw/FblSecBoot/fbl_secboot.h new file mode 100644 index 0000000..d123e97 --- /dev/null +++ b/Source/bsw/FblSecBoot/fbl_secboot.h @@ -0,0 +1,121 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief SecureBoot implementation + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2020-01-07 visrie FBL-524 Initial release + * 01.00.01 2020-04-27 visrie FBL-1773 Added API reference version define + * 02.00.00 2020-05-19 vistbe FBL-1016 No changes + * 02.01.00 2021-01-19 visrie FBL-2648 No changes + * FBL-2641 Updated to new API version + * 02.02.00 2021-09-08 visjdn FBL-3352 No changes + * 02.03.00 2023-06-21 vistbe FBL-4814 Add support for OTA + * 02.03.01 2024-05-16 viswmo ESCAN00117059 No changes + * 02.04.00 2024-11-18 vismix FBL-9654 No changes + * 02.05.00 2025-01-24 vikatya PIO-1340 No changes + * 02.06.00 2025-02-19 visrie FBL-10209 No changes + **********************************************************************************************************************/ + +#ifndef FBL_SECBOOT_H +#define FBL_SECBOOT_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblLib_SecBoot_vHsm CQComponent : Implementation */ +#define FBLLIB_SECBOOT_VHSM_VERSION 0x0206u +#define FBLLIB_SECBOOT_VHSM_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "FblSb_Cfg.h" +#include "FblBm_Cfg.h" +#include "fbl_secboot_ap.h" +#include "fbl_main_types.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/* Reference interface version */ +/** Major interface version identifies incompatible changes */ +#define FBLSB_API_REFERENCE_VERSION_MAJOR 0x02u +/** Minor interface version identifies backward compatible changes */ +#define FBLSB_API_REFERENCE_VERSION_MINOR 0x03u +/** Release interface version identifies cosmetic changes */ +#define FBLSB_API_REFERENCE_VERSION_RELEASE 0x00u + +#if defined( FBL_ENABLE_OTA ) +# define FblSb_UpdateBlockMacSwap(blockDescriptor, segmentList) FblSb_UpdateBlockMac(blockDescriptor, segmentList) +#endif + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +typedef enum +{ + FBLSB_EXT_ERR_CODE_NONE = 0u, + FBLSB_EXT_ERR_CODE_GENERAL, + FBLSB_EXT_ERR_CODE_CRC, + FBLSB_EXT_ERR_CODE_SIGNATURE, + FBLSB_EXT_ERR_CODE_MEMORY +} tFblSbExtErrCode; + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLSB_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( FBLSB_ENABLE_COPY_FLASH_DRIVER ) +void FblSb_CopyFlashDriver( void ); +#endif /* FBLSB_ENABLE_COPY_FLASH_DRIVER */ + +void FblSb_Init(void); +tFblResult FblSb_VerifyFblLbt(const V_MEMRAM1 tFblHeader V_MEMRAM2 V_MEMRAM3 * fblHeader); +tFblResult FblSb_VerifyHeader(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader); +tFblResult FblSb_VerifyHeaderRom(tFblAddress bmHeaderAddress, const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader); +tFblResult FblSb_VerifySegments(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 *bmHdrHeader); + +tFblResult FblSb_UpdateInitialSegments(void); + +#if defined( FBLSB_ENABLE_GENERATE_CMAC ) +tFblResult FblSb_UpdateFblMac(V_MEMROM1 tFblHeader V_MEMROM2 V_MEMROM3 * fblHeader); +tFblResult FblSb_UpdateBlockMac(const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * blockDescriptor, + V_MEMRAM1 FL_SegmentListType V_MEMRAM2 V_MEMRAM3 * segmentList); +#endif /* FBLSB_ENABLE_GENERATE_CMAC */ + +tFblSbExtErrCode FblSb_GetExtendedErrorCode(void); + +#define FBLSB_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBL_SECBOOT_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_SECBOOT.H + **********************************************************************************************************************/ diff --git a/Source/bsw/VStdLib/Make/VStdLib_cfg.mak b/Source/bsw/VStdLib/Make/VStdLib_cfg.mak new file mode 100644 index 0000000..2160b93 --- /dev/null +++ b/Source/bsw/VStdLib/Make/VStdLib_cfg.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : VStdLib_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the VStdLib_rules.mak file. +############################################################################### + +############################################################## +# CAN_CONFIG_PATH: (not used for Vector) +# The Variable CAN_CONFIG_PATH is optional. It allows the +# configuration of the directory, where you can also find the +# generated source files. Generally they should be in the +# directory $(PROJECT_ROOT)\source\networks. +# But if the application should run on several hardware +# targets, then different CAN configurations of different +# directories will be necessary. Therefor the variable +# CAN_CONFIG_PATH should be used. +# +# For example: +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\st10 +# CAN_CONFIG_PATH = $(PROJECT_ROOT)\source\network\v850 +# + +#VSTDLIB_CONFIG_PATH = + + +############################################################## +# CAN_DRIVER_MODE: (not used for Vector) +# This Variable contains the name of the can driver module. At +# the moment the Standard Software Core Supports the two driver +# can_drv.c (single CAN) and can_drvm.c (multi CAN). Other +# values are not allowed. +# +# For example: +# CAN_DRIVER_MODE = singlechannel/multichannel +# + + +############################################################### +# REQUIRED +# +# No Other resources are required to write a Configuration +# Makefile. +# +############################################################### + + +############################################################### +# PROVIDE +# +# A Configuration Makefile does not provide resources for other +# basic software bundles or the base_make package +# +############################################################### + + +############################################################### +# REGISTRY +# +# Like the Provide-Section this block is empty. +# +############################################################### + + +############################################################### +# SPECIFIC +# +# All variables in the _cfg makefile are "Specific" variables, +# because they should only be used in the *_check.mak, +# *_defs.mak and *_rules.mak Makefiles of the same basic +# software bundle. +############################################################### diff --git a/Source/bsw/VStdLib/Make/VStdLib_check.mak b/Source/bsw/VStdLib/Make/VStdLib_check.mak new file mode 100644 index 0000000..5ebb4e4 --- /dev/null +++ b/Source/bsw/VStdLib/Make/VStdLib_check.mak @@ -0,0 +1,79 @@ +############################################################################### +# File Name : VStdLib_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the VStdLib_rules.mak file. +############################################################################### + +############################################################### +# REGISTRY +# + +#e.g.: PREPARE_CONFIGURATION_INTERFACE += CAN_MODULES +PREPARE_CONFIGURATION_INTERFACE += + +CHECK_VARS_WHICH_ARE_REQUIRED += + +CHECK_VARS_WHICH_ARE_OPTIONAL += + +CHECK_VARS_WHICH_ARE_OBSOLETE += + +CHECK_VARS_WITH_ONE_CC_FILE += +CHECK_VARS_WITH_MORE_CC_FILES += + +CHECK_VARS_WITH_ONE_CPP_FILE += +CHECK_VARS_WITH_MORE_CPP_FILES += + +CHECK_VARS_WITH_ONE_ASM_FILE += +CHECK_VARS_WITH_MORE_ASM_FILES += + +CHECK_VARS_WITH_ONE_LIB_FILE += +CHECK_VARS_WITH_MORE_LIB_FILES += + +CHECK_VARS_WITH_ONE_OBJ_FILE += +CHECK_VARS_WITH_MORE_OBJ_FILES += + +#e.g: CHECK_VARS_WITH_ONE_DIRECTORY += $(DIRECTORIES_TO_CREATE) +# $(DIRECTORIES_TO_CREATE) = C:\demo\drv (this var is defined in _rules.mak) +CHECK_VARS_WITH_ONE_DIRECTORY += +CHECK_VARS_WITH_MORE_DIRECTORIES += + +CHECK_VARS_WITH_ONE_FILE += +CHECK_VARS_WITH_MORE_FILES += + +CHECK_VARS_WITH_MAX_LENGTH_ONE += + +############################################################### +# SPECIFIC +# +#ifneq ($(CAN_DRIVER_MODE),singlechannel) +#ifneq ($(CAN_DRIVER_MODE),multichannel) +#$(error The value of the variable CAN_DRIVER_MODE is not valid. \ +# Please use singlechannel or multichannel) +#endif +#endif + + +############################################################### +# REQUIRED +# +# No other resources are required for a Configuration Check +# Makefile +# +############################################################### + + +############################################################### +# PROVIDE +# +# A configuration Makefile does not provide resources for other +# basic software bundles or the base-make package. +# +############################################################### + diff --git a/Source/bsw/VStdLib/Make/VStdLib_defs.mak b/Source/bsw/VStdLib/Make/VStdLib_defs.mak new file mode 100644 index 0000000..209074a --- /dev/null +++ b/Source/bsw/VStdLib/Make/VStdLib_defs.mak @@ -0,0 +1,85 @@ +############################################################################### +# File Name : VStdLib_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the VStdLib_rules.mak file. +############################################################################### + +############################################################### +# INTERNAL REQUIRED CONFIGURATION (in can_cfg.mak) +# +# CAN_MODULES (required) (not necessary for Vector) +# CAN_DRIVER_MODE (required) (not necessary for Vector) +# CAN_PROJECT_PATH (optional) +# CAN_BUILD_LIBRARY (required) + + +############################################################### +# REQUIRED (defined in base_make) +# +# PROJECT_ROOT +# SSC_ROOT +############################################################### + + +############################################################### +# SPECIFIC +# Specific variables which were defined here are only for local use in this Makefile +# if for example additional includes are necessary, these vars can be defined and used in the REGISTRY-Part. +# e.g.: $(CAN_CORE_PATH) = $(SSC_ROOT)\Can could be used for CPP_INCLUDE_PATH += $(CAN_CORE_PATH)\CPP_FILES\... + +VSTDLIB_CORE_PATH = + +# e.g.: CAN_OUTPUT_PATH = $(GENDATA_DIR) +VSTDLIB_OUTPUT_PATH = + + + +#CAN_TOOL_PATH = $(PROJECT_ROOT)\core\com\can\gentool + +# it is also possible to generate own configurations with some checks like the following example +# ifneq ( $(CAN_CONFIG_PATH),) +# CAN_PROJECT_PATH = $(CAN_CONFIG_PATH) +# else +# CAN_PROJECT_PATH = $(PROJECT_ROOT)\source\network\can +# endif + + +############################################################### +# REGISTRY +# +# $(SSC_PLUGINS) is a list of the components. Here can is added (not necessary for Vector, whole component-list also exists in Global.makefile.target.make...) +# e.g.: SSC_PLUGINS += can +SSC_PLUGINS += +#e.g.: CAN_DEPENDENT_PLUGINS = +VSTDLIB_DEPENDENT_PLUGINS = + +#----------------------------------------------------------------------------------------- +# MakeSupport usually includes all header-files which were in the same +# directory as the source-files automatically, but to ensure that the +# Asr-Makefiles will also work with other Basic-Make-Packages, +# it is necessary to define all include directories for this Module +# e.g.: CC_INCLUDE_PATH += $(CAN_CORE_PATH) +#------------------------------------------------------------------------------------------ +CC_INCLUDE_PATH += VStdLib$(BSW_SRC_DIR) +CPP_INCLUDE_PATH += +ASM_INCLUDE_PATH += + +#PREPROCESSOR_DEFINES+= drivermode + +#drivermode_KEY = CAN_MODE +#drivermode_VALUE = $(CAN_DRIVER_MODE) + + +############################################################### +# PROVIDE +# +# A Public Makefile does not provide resources for other basic +# software bundles or the base_make package. +############################################################### diff --git a/Source/bsw/VStdLib/Make/VStdLib_rules.mak b/Source/bsw/VStdLib/Make/VStdLib_rules.mak new file mode 100644 index 0000000..e72c2b7 --- /dev/null +++ b/Source/bsw/VStdLib/Make/VStdLib_rules.mak @@ -0,0 +1,100 @@ +############################################################################### +# File Name : VStdLib_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2019 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2018-10-23 vistkr Initial Version for VStdLib_GenericAsr +# 1.01.00 2019-02-06 vircbl Added support of component-based SIP structure +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + + +############################################################### +# REGISTRY +# + +#e.g.: LIBRARIES_TO_BUILD += +#e.g.: _FILES = \.c +LIBRARIES_TO_BUILD += + +# e.g.: CC_FILES_TO_BUILD += \.c \_Irq.c +CC_FILES_TO_BUILD += VStdLib$(BSW_SRC_DIR)\vstdlib.c +CPP_FILES_TO_BUILD += +ASM_FILES_TO_BUILD += + +#LIBRARIES_LINK_ONLY += (not yet supported) +#OBJECTS_LINK_ONLY += (not yet supported) + +#------------------------------------------------------------------------------------------------- +#only define new dirs, OBJ, LIB, LOG were created automaticly +#------------------------------------------------------------------------------------------------- +DIRECTORIES_TO_CREATE += + +#DEPEND_GCC_OPTS += (not yet supported) + +# e.g.: GENERATED_SOURCE_FILES += $(GENDATA_DIR)\drv_par.c +GENERATED_SOURCE_FILES += + +#e.g.: COMMON_SOURCE_FILES += $(GENDATA_DIR)\v_par.c +COMMON_SOURCE_FILES += + +#------------------------------------------------------------------------------------------------- +# .dep & .lnk & .bin and..... +# all in err\ & obj\ & lst\ & lib\ & log\ will be deleted by clean-rule automaticly +# so in this clean-rule it is only necessary to define additional files which +# were not delete automaticly. +# e.g.: $()\can_test.c +#------------------------------------------------------------------------------------------------- +MAKE_CLEAN_RULES += +#MAKE_GENERATE_RULES += +#MAKE_COMPILER_RULES += +#MAKE_DEBUG_RULES += +#MAKE_CONFIG_RULES += +#MAKE_ADD_RULES += + + +############################################################### +# REQUIRED (defined in BaseMake (global.Makefile.target.make...)) +# +# SSC_ROOT (required) +# PROJECT_ROOT (required) +# +# LIB_OUTPUT_PATH (optional) +# OBJ_OUTPUT_PATH (optional) +# +# OBJ_FILE_SUFFIX +# LIB_FILE_SUFFIX +# +############################################################### + + +############################################################### +# PROVIDE this Section can be used to define own additional rules +# +# In vendorx_can_cfg.mak: +# Please configure the project file: +#CAN_CONFIG_FILE = $(PROJECT_ROOT)\source\network\can\my_can_config.cfg + +#In vendorx_can_config : +#generate_can_config: +#$(SSC_ROOT)\core\com\can\tools\canconfiggen.exe -o $(CAN_CONFIG_FILE) + + +############################################################### +# SPECIFIC +# +# There are no rules defined for the Specific part of the +# Rules-Makefile. Each author is free to create temporary +# variables or to use other resources of GNU-MAKE +# +############################################################### + + diff --git a/Source/bsw/VStdLib/_VStdLib_Cfg.h b/Source/bsw/VStdLib/_VStdLib_Cfg.h new file mode 100644 index 0000000..581a769 --- /dev/null +++ b/Source/bsw/VStdLib/_VStdLib_Cfg.h @@ -0,0 +1,1006 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file VStdLib_Cfg.h + * \brief Configuration of the generic Vector Standard Library (VStdLib_GenericAsr) + * \details Template file that can be adapted by the user. + * This file contains the project specific configuration of the VStdLib. It also provides the possibility + * of overwriting the public APIs with project specific optimized implementations. + * + *********************************************************************************************************************/ + +#if !defined (VSTDLIB_CFG_H) +# define VSTDLIB_CFG_H + +/** + * Additional include files + * + * If necessary include additional files below (e.g. if VSTDLIB_USE_LIBRARY_FUNCTIONS is defined to STD_ON). + */ +/* # include ... */ + +/********************************************************************************************************************** + * General configuration + *********************************************************************************************************************/ + +/** + * VSTDLIB_USE_LIBRARY_FUNCTIONS + * + * If set to STD_ON the memory initialization, memory copy and memory comparison APIs are mapped to external functions + * (e.g. compiler libraries or other implementations that are optimized for the target platform). + * As the generic VStdLib implementation provides optimized routines only for 32bit platforms, this is recommended when + * using MCUs with other architectures. + * + * Values: + * STD_ON - Use external memory functions - requires additional configuration, see below. + * STD_OFF - Use generic memory functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION + * + * If set to STD_ON the memory copy with endianness swap API is mapped to an external function + * (e.g. compiler libraries or other implementations that are optimized for the target platform). + * As the generic VStdLib implementation provides optimized routines only for 32bit platforms, this is recommended when + * using MCUs with other architectures. + * + * Values: + * STD_ON - Use external memory copy with endianness swap function - requires additional configuration, see below. + * STD_OFF - Use generic memory copy with endianness swap function provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION STD_OFF + +/** + * VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION + * + * If set to STD_ON, the memory check API is mapped to an external function (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * As the generic VStdLib implementation provides optimized routines only for 32bit platforms, this is recommended when + * using MCUs with other architectures. + * + * Values: + * STD_ON - Use external memory check function - requires additional configuration, see below. + * STD_OFF - Use generic memory check function provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION STD_OFF + +/** + * VSTDLIB_RUNTIME_OPTIMIZATION + * + * If set to STD_ON optimized routines are used to increase the performance of the memory initialization, memory copy + * and memory comparison APIs. + * The setting of this define is only relevant if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_OFF or + * VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_OFF. + * + * Values: + * STD_ON - Use optimized routines for memory operations (runtime efficient, but increases code size) + * STD_OFF - Use simple routines for memory operations (code efficient, but significantly increases runtime) + * + * Default: + * STD_ON + */ +# define VSTDLIB_RUNTIME_OPTIMIZATION STD_ON + +/** + * VSTDLIB_USE_JUMPTABLES + * + * If set to STD_ON jump tables are used to increase the performance of the memory initialization and memory copy APIs. + * The setting of this define is only relevant if VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON and + * VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_OFF or + * VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_OFF. + * + * Values: + * STD_ON - Use jump tables for memory operations (runtime efficient in general, but may depend on compiler) + * STD_OFF - Use loops for memory operations (code efficient, also use this if the compiler generates no efficient + * code for the jump tables) + * + * Default: + * STD_ON + */ +# define VSTDLIB_USE_JUMPTABLES STD_ON + +/** + * VSTDLIB_DEV_ERROR_DETECT + * + * If set to STD_ON the development error detection is enabled. In this case the pointer arguments of all global + * module functions are checked. If any NULL_PTR is passed, these functions return without performing any action. + * Please note that this setting has no influence on MICROSAR SafeBSW. + * + * Values: + * STD_ON - Check function arguments + * STD_OFF - Disable development error detection + * + * Default: + * STD_OFF + */ +# define VSTDLIB_DEV_ERROR_DETECT STD_OFF + +/** + * VSTDLIB_DEV_ERROR_REPORT + * + * If set to STD_ON the development error reporting is enabled. In this case Det_ReportError() is called if any + * development error is detected. + * + * Values: + * STD_ON - Enable calls of Det_ReportError() - requires VSTDLIB_DEV_ERROR_DETECT also to be defined to STD_ON + * STD_OFF - Disable development error reporting + * + * Default: + * STD_OFF + */ +# define VSTDLIB_DEV_ERROR_REPORT STD_OFF + +/** + * VSTDLIB_VERSION_INFO_API + * + * If set to STD_ON the API VStdLib_GetVersionInfo() is provided. + * + * Values: + * STD_ON - Provide the version info API + * STD_OFF - Do not provide the version info API + * + * Default: + * STD_OFF + */ +# define VSTDLIB_VERSION_INFO_API STD_OFF + +/** + * VSTDLIB_DUMMY_STATEMENT + * + * Expression that is used for dummy statements to avoid compile warnings about unused identifiers. + * + * Example values: + * (void)(v) + * (v)=(v) + * or leave the definition empty to disable the usage of dummy statements + * + * Default: + * (void)(v) + */ +# define VSTDLIB_DUMMY_STATEMENT(v) (void)(v) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ + +/** + * VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 8-bit bit search APIs are mapped to external functions (e.g. compiler libraries or + * other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external bit search functions - requires additional configuration, see below. + * STD_OFF - Use generic 8-bit bit search functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 16-bit bit search APIs are mapped to external functions (e.g. compiler libraries or + * other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external bit search functions - requires additional configuration, see below. + * STD_OFF - Use generic 16-bit bit search functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 32-bit bit search APIs are mapped to external functions (e.g. compiler libraries or + * other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external bit search functions - requires additional configuration, see below. + * STD_OFF - Use generic 32-bit bit search functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 64-bit bit search APIs are mapped to external functions (e.g. compiler libraries or + * other implementations that are optimized for the target platform). + * The setting of this define is only allowed if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * + * Values: + * STD_ON - Use external bit search functions - requires additional configuration, see below. + * STD_OFF - Use generic 64-bit bit search functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 16-bit deserialization and serialization APIs are mapped to external functions + * (e.g. compiler libraries or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external (de-)serialization functions - requires additional configuration, see below. + * STD_OFF - Use generic 16-bit (de-)serialization functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 32-bit deserialization and serialization APIs are mapped to external functions + * (e.g. compiler libraries or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external (de-)serialization functions - requires additional configuration, see below. + * STD_OFF - Use generic 32-bit (de-)serialization functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 64-bit deserialization and serialization APIs are mapped to external functions + * (e.g. compiler libraries or other implementations that are optimized for the target platform). + * The setting of this define is only allowed if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * + * Values: + * STD_ON - Use external (de-)serialization functions - requires additional configuration, see below. + * STD_OFF - Use generic 64-bit (de-)serialization functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 16-bit endianness swap APIs are mapped to external functions (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external endianness swap functions - requires additional configuration, see below. + * STD_OFF - Use generic 16-bit endianness swap functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 32-bit endianness swap APIs are mapped to external functions (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external endianness swap functions - requires additional configuration, see below. + * STD_OFF - Use generic 32-bit endianness swap functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS + * + * If set to STD_ON all 64-bit endianness swap APIs are mapped to external functions (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * The setting of this define is only allowed if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * + * Values: + * STD_ON - Use external endianness swap functions - requires additional configuration, see below. + * STD_OFF - Use generic 64-bit endianness swap functions provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS + * + * If set to STD_ON all bit copy sawtooth APIs are mapped to external functions (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external bit copy functions with sawtooth bit numbering + * STD_OFF - Use generic bit copy functions with sawtooth bit numbering provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS STD_OFF + +/** + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS + * + * If set to STD_ON all bit copy monotone APIs are mapped to external functions (e.g. compiler libraries + * or other implementations that are optimized for the target platform). + * + * Values: + * STD_ON - Use external bit copy functions with monotone bit numbering + * STD_OFF - Use generic bit copy functions with monotone bit numbering provided by VStdLib + * + * Default: + * STD_OFF + */ +# define VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS STD_OFF + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON) +/** + * Memory library functions. + * + * If VSTDLIB_USE_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the memory initialization, memory + * copy and memory comparison APIs by overwriting the definitions below. The error directive has to be removed. + * + * NOTE: + * - If the external functionality is not able to handle more than 65535 bytes it is necessary to define + * VSTDLIB_SUPPORT_LARGE_DATA to STD_OFF. + * - The specified functions must behave synchronously. + * - It has to be ensured that the specified memory initialization and memory copy functions are able to copy from + * and to all memory locations independently of the pointer length. + */ +# error "Verify the setting for VSTDLIB_SUPPORT_LARGE_DATA and fill the macros in this section with correct values!" + +# define VSTDLIB_SUPPORT_LARGE_DATA STD_ON + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Set nCnt bytes to zero at pDst (any alignment) */ +# define VStdLib_MemClr(pDst, nCnt) memset((pDst), 0, (nCnt)) + +/* Set nCnt bytes to the character nPattern at pDst (any alignment) */ +# define VStdLib_MemSet(pDst, nPattern, nCnt) memset((pDst), (nPattern), (nCnt)) + +/* Copy nCnt bytes from pSrc to pDst (any alignment) */ +# define VStdLib_MemCpy(pDst, pSrc, nCnt) memcpy((pDst), (pSrc), (nCnt)) + +/* Copy nCnt 16bit blocks from pSrc to pDst (both pointers 16-bit aligned) */ +# define VStdLib_MemCpy16(pDst, pSrc, nCnt) memcpy((pDst), (pSrc), ((nCnt)<<1)) + +/* Copy nCnt 32bit blocks from pSrc to pDst (both pointers 32-bit aligned) */ +# define VStdLib_MemCpy32(pDst, pSrc, nCnt) memcpy((pDst), (pSrc), ((nCnt)<<2)) + +/* + * Compares the two buffers for the specified number of bytes and returns whether they are equal or not. + * + * The memory comparison API has to return the datatype sint8 with the following values + * < 0, if buffer1 contains a smaller value than buffer2. + * = 0, if buffer1 and buffer2 are equal for the number of compared bytes. + * > 0, if buffer1 contains a greater value than buffer2. + * + * Attention: The shown example is only possible, if memcmp() returns values which are in the range of datatype sint8! + * +*/ +# define VStdLib_MemCmp(pBuf1, pBuf2, nCnt) ((sint8)memcmp((pBuf1), (pBuf2), (nCnt))) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_ON) +/** + * Memory copy with endianness swap API library function. + * + * If VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION is set to STD_ON it is necessary to specify the + * memory copy with endianness swap API by overwriting the definition below. The error directive has to be removed. + * + * NOTE: + * - If the external functionality is not able to handle more than 65535 bytes it is necessary to define + * VSTDLIB_SUPPORT_LARGE_DATA to STD_OFF. + * - The specified function must behave synchronously. + * - It has to be ensured that the specified function is able to copy from and to all memory locations independently + * of the pointer length. + */ +# error "Verify the setting for VSTDLIB_SUPPORT_LARGE_DATA and fill the macro in this section with the correct value!" + +# if !defined (VSTDLIB_SUPPORT_LARGE_DATA) +# define VSTDLIB_SUPPORT_LARGE_DATA STD_ON +# endif + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* + * Copies nCnt bytes from pSrc (any alignment) to pDst (integer type alignment) with swapped endianness according to + * the integer type intType. + * + * Possible values for parameter inType are: + * - 1 for integer type uint8/sint8 + * - 2 for integer type uint16/sint16 + * - 4 for integer type uint32/sint32 + * - 8 for integer type uint64/sint64 + */ +# define VStdLib_MemCpySwapEndian(pDst, pSrc, nCnt, intType) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION == STD_ON) +/** + * Memory check library function. + * + * If VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION is set to STD_ON it is necessary to define the memory check function by overwriting the definition below. + * The error directive has to be removed. + * + * NOTE: + * - If the external functionality is not able to handle more than 65535 bytes it is necessary to define + * VSTDLIB_SUPPORT_LARGE_DATA to STD_OFF. + * - The specified function must behave synchronously. + */ +# error "Verify the setting for VSTDLIB_SUPPORT_LARGE_DATA and fill the macro in this section with the correct value!" + +# if !defined (VSTDLIB_SUPPORT_LARGE_DATA) +# define VSTDLIB_SUPPORT_LARGE_DATA STD_ON +# endif + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Compares nCnt bytes of memory starting at pBuf to the specified 8-bit nPattern. If the content at pBuf is equal to the nPattern, E_OK is returned. + Otherwise, the errorCode passed as argument is returned. */ +# define VStdLib_MemCheck(pBuf, nPattern, nCnt, errorCode) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +/** + * Bit search library functions. + * + * If VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify 8-bit bit search APIs by + * overwriting the definitions below. The error directive has to be removed. + * + * The 8-bit search APIs to get the highest/lowest bit position of a set/unset bit have to use the return value + * VSTDLIB_BITPOS_NA, if the value contains no set/unset bit. + * + * The 8-bit search APIs to get the bit count of leading/trailing ones/zeros have to use the return value + * VSTDLIB_BITCNT_NA, if the value contains no unset/set bit. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Returns the highest bit position of a set bit in the specified 8-bit value */ +# define VStdLib_GetHighestBitPosOne8(value) + +/* Returns the highest bit position of an unset bit in the specified 8-bit value */ +# define VStdLib_GetHighestBitPosZero8(value) + +/* Returns the lowest bit position of a set bit in the specified 8-bit value */ +# define VStdLib_GetLowestBitPosOne8(value) + +/* Returns the lowest bit position of an unset bit in the specified 8-bit value */ +# define VStdLib_GetLowestBitPosZero8(value) + +/* Returns the count of set bits preceding the highest unset bit in the specified 8-bit value */ +# define VStdLib_GetCountLeadingOnes8(value) + +/* Returns the count of unset bits preceding the highest set bit in the specified 8-bit value */ +# define VStdLib_GetCountLeadingZeros8(value) + +/* Returns the count of set bits following the lowest unset bit in the specified 8-bit value */ +# define VStdLib_GetCountTrailingOnes8(value) + +/* Returns the count of unset bits following the lowest set bit in the specified 8-bit value */ +# define VStdLib_GetCountTrailingZeros8(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +/** + * Bit search library functions. + * + * If VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify 16-bit bit search APIs by + * overwriting the definitions below. The error directive has to be removed. + * + * The 16-bit search APIs to get the highest/lowest bit position of a set/unset bit have to use the return value + * VSTDLIB_BITPOS_NA, if the value contains no set/unset bit. + * + * The 16-bit search APIs to get the bit count of leading/trailing ones/zeros have to use the return value + * VSTDLIB_BITCNT_NA, if the value contains no unset/set bit. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Returns the highest bit position of a set bit in the specified 16-bit value */ +# define VStdLib_GetHighestBitPosOne16(value) + +/* Returns the highest bit position of an unset bit in the specified 16-bit value */ +# define VStdLib_GetHighestBitPosZero16(value) + +/* Returns the lowest bit position of a set bit in the specified 16-bit value */ +# define VStdLib_GetLowestBitPosOne16(value) + +/* Returns the lowest bit position of an unset bit in the specified 16-bit value */ +# define VStdLib_GetLowestBitPosZero16(value) + +/* Returns the count of set bits preceding the highest unset bit in the specified 16-bit value */ +# define VStdLib_GetCountLeadingOnes16(value) + +/* Returns the count of unset bits preceding the highest set bit in the specified 16-bit value */ +# define VStdLib_GetCountLeadingZeros16(value) + +/* Returns the count of set bits following the lowest unset bit in the specified 16-bit value */ +# define VStdLib_GetCountTrailingOnes16(value) + +/* Returns the count of unset bits following the lowest set bit in the specified 16-bit value */ +# define VStdLib_GetCountTrailingZeros16(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +/** + * Bit search library functions. + * + * If VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify 32-bit bit search APIs by + * overwriting the definitions below. The error directive has to be removed. + * + * The 32-bit search APIs to get the highest/lowest bit position of a set/unset bit have to use the return value + * VSTDLIB_BITPOS_NA, if the value contains no set/unset bit. + * + * The 32-bit search APIs to get the bit count of leading/trailing ones/zeros have to use the return value + * VSTDLIB_BITCNT_NA, if the value contains no unset/set bit. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Returns the highest bit position of a set bit in the specified 32-bit value */ +# define VStdLib_GetHighestBitPosOne32(value) + +/* Returns the highest bit position of an unset bit in the specified 32-bit value */ +# define VStdLib_GetHighestBitPosZero32(value) + +/* Returns the lowest bit position of a set bit in the specified 32-bit value */ +# define VStdLib_GetLowestBitPosOne32(value) + +/* Returns the lowest bit position of an unset bit in the specified 32-bit value */ +# define VStdLib_GetLowestBitPosZero32(value) + +/* Returns the count of set bits preceding the highest unset bit in the specified 32-bit value */ +# define VStdLib_GetCountLeadingOnes32(value) + +/* Returns the count of unset bits preceding the highest set bit in the specified 32-bit value */ +# define VStdLib_GetCountLeadingZeros32(value) + +/* Returns the count of set bits following the lowest unset bit in the specified 32-bit value */ +# define VStdLib_GetCountTrailingOnes32(value) + +/* Returns the count of unset bits following the lowest set bit in the specified 32-bit value */ +# define VStdLib_GetCountTrailingZeros32(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON)) +/** + * Bit search library functions. + * + * If VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify 64-bit bit search APIs by + * overwriting the definitions below. The error directive has to be removed. + * + * The 64-bit search APIs to get the highest/lowest bit position of a set/unset bit have to use the return value + * VSTDLIB_BITPOS_NA, if the value contains no set/unset bit. + * + * The 64-bit search APIs to get the bit count of leading/trailing ones/zeros have to use the return value + * VSTDLIB_BITCNT_NA, if the value contains no unset/set bit. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Returns the highest bit position of a set bit in the specified 64-bit value */ +# define VStdLib_GetHighestBitPosOne64(value) + +/* Returns the highest bit position of an unset bit in the specified 64-bit value */ +# define VStdLib_GetHighestBitPosZero64(value) + +/* Returns the lowest bit position of a set bit in the specified 64-bit value */ +# define VStdLib_GetLowestBitPosOne64(value) + +/* Returns the lowest bit position of an unset bit in the specified 64-bit value */ +# define VStdLib_GetLowestBitPosZero64(value) + +/* Returns the count of set bits preceding the highest unset bit in the specified 64-bit value */ +# define VStdLib_GetCountLeadingOnes64(value) + +/* Returns the count of unset bits preceding the highest set bit in the specified 64-bit value */ +# define VStdLib_GetCountLeadingZeros64(value) + +/* Returns the count of set bits following the lowest unset bit in the specified 64-bit value */ +# define VStdLib_GetCountTrailingOnes64(value) + +/* Returns the count of unset bits following the lowest set bit in the specified 64-bit value */ +# define VStdLib_GetCountTrailingZeros64(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) +/** + * (De-)serialization library functions. + * + * If VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 16-bit + * deserialization and serialization APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Converts the specified unsigned 16-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertUint16ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified unsigned 16-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertUint16ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified signed 16-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertSint16ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified signed 16-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertSint16ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 16-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToUint16BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 16-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToUint16LittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 16-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToSint16BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 16-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToSint16LittleEndian(src, dst) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) +/** + * (De-)serialization library functions. + * + * If VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 32-bit + * deserialization and serialization APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Converts the specified unsigned 32-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertUint32ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified unsigned 32-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertUint32ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified signed 32-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertSint32ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified signed 32-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertSint32ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 32-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToUint32BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 32-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToUint32LittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 32-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToSint32BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 32-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToSint32LittleEndian(src, dst) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON)) +/** + * (De-)serialization library functions. + * + * If VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 64-bit + * deserialization and serialization APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Converts the specified unsigned 64-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertUint64ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified unsigned 64-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertUint64ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified signed 64-bit value to an unsigned 8-bit array according to big endian */ +# define VStdLib_ConvertSint64ToUint8ArrayBigEndian(src, dst) + +/* Converts the specified signed 64-bit value to an unsigned 8-bit array according to little endian */ +# define VStdLib_ConvertSint64ToUint8ArrayLittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 64-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToUint64BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an unsigned 64-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToUint64LittleEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 64-bit value according to big endian */ +# define VStdLib_ConvertUint8ArrayToSint64BigEndian(src, dst) + +/* Converts the specified unsigned 8-bit array to an signed 64-bit value according to little endian */ +# define VStdLib_ConvertUint8ArrayToSint64LittleEndian(src, dst) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) +/** + * Endianness swap library functions. + * + * If VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 16-bit + * endianness swap APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Swaps the endianness of the specified unsigned 16-bit value */ +# define VStdLib_SwapEndianUint16(value) + +/* Swaps the endianness of the specified signed 16-bit value */ +# define VStdLib_SwapEndianSint16(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) +/** + * Endianness swap library functions. + * + * If VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 32-bit + * endianness swap APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Swaps the endianness of the specified unsigned 32-bit value */ +# define VStdLib_SwapEndianUint32(value) + +/* Swaps the endianness of the specified signed 32-bit value */ +# define VStdLib_SwapEndianSint32(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON)) +/** + * Endianness swap library functions. + * + * If VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the 64-bit + * endianness swap APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Swaps the endianness of the specified unsigned 64-bit value */ +# define VStdLib_SwapEndianUint64(value) + +/* Swaps the endianness of the specified signed 64-bit value */ +# define VStdLib_SwapEndianSint64(value) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON) +/** + * Bitcopy sawtooth library functions. + * + * If VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the Bitcopy + * sawtooth APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Copy nCnt bits from pSrc to pDst (any offset) with big data endianness + * Bit numbering of source and destination is sawtooth */ +# define VStdLib_BitCpySawBigToBigEndian(pDst, nDstBitOffsetSaw, pSrc, nSrcBitOffsetSaw, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with swapped data endianness (big to little) + * Bit numbering of source and destination is sawtooth */ +# define VStdLib_BitCpySawBigToLittleEndian(pDst, nDstBitOffsetSaw, pSrc, nSrcBitOffsetSaw, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with swapped data endianness (little to big) + * Bit numbering of source and destination is sawtooth */ +# define VStdLib_BitCpySawLittleToBigEndian(pDst, nDstBitOffsetSaw, pSrc, nSrcBitOffsetSaw, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with little data endianness + * Bit numbering of source and destination is sawtooth */ +# define VStdLib_BitCpySawLittleToLittleEndian(pDst, nDstBitOffsetSaw, pSrc, nSrcBitOffsetSaw, nCnt) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON) */ + +/********************************************************************************************************************** + * Additional configuration if VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON + *********************************************************************************************************************/ + +# if (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON) +/** + * Bitcopy sawtooth library functions. + * + * If VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS is set to STD_ON it is necessary to specify the Bitcopy + * sawtooth APIs by overwriting the definitions below. The error directive has to be removed. + * + */ +# error "Fill the macros in this section with correct values!" + +/* PRQA S 3453 FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +/* Copy nCnt bits from pSrc to pDst (any offset) with big data endianness + * Bit numbering of source and destination is monotone */ +# define VStdLib_BitCpyMonBigToBigEndian(pDst, nDstBitOffsetMon, pSrc, nSrcBitOffsetMon, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with swapped data endianness (big to little) + * Bit numbering of source and destination is monotone */ +# define VStdLib_BitCpyMonBigToLittleEndian(pDst, nDstBitOffsetMon, pSrc, nSrcBitOffsetMon, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with swapped data endianness (little to big) + * Bit numbering of source and destination is monotone */ +# define VStdLib_BitCpyMonLittleToBigEndian(pDst, nDstBitOffsetMon, pSrc, nSrcBitOffsetMon, nCnt) + +/* Copy nCnt bits from pSrc to pDst (any offset) with little data endianness + * Bit numbering of source and destination is monotone */ +# define VStdLib_BitCpyMonLittleToLittleEndian(pDst, nDstBitOffsetMon, pSrc, nSrcBitOffsetMon, nCnt) + +/* PRQA L:FUNCTION_LIKE_MACRO */ + +# endif /* (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON) */ + +/********************************************************************************************************************** + * Compatibility for legacy Vector modules + *********************************************************************************************************************/ + +# if defined(VSTD_ENABLE_INTCTRL_HANDLING) || defined(VSTD_ENABLE_DEFAULT_INTCTRL) || \ + defined(VSTD_ENABLE_OSEK_INTCTRL) || defined(VSTD_ENABLE_APPL_INTCTRL) +/** + * Compatibility for legacy Vector modules. + * + * Legacy Vector modules that are used in a MICROSAR stack might rely on interrupt handling functionalities that are + * no longer supported by VStdLib. Map relevant calls to functionalities that are provided by the MICROSAR stack or + * application and remove the error directive. VStdSuspendAllInterrupts() and VStdResumeAllInterrupts() can be mapped + * to OS services or an exclusive area that is provided by the BSW scheduler for example. + */ +# error "VStdLib_GenericAsr does not support interrupt control handling, provide a mapping in this section!" + +# endif + +/********************************************************************************************************************** + * Do not modify anything below + *********************************************************************************************************************/ + +# define VSTDLIB_CFG_MAJOR_VERSION (3u) +# define VSTDLIB_CFG_MINOR_VERSION (4u) + +#endif /* VSTDLIB_CFG_H */ + +/********************************************************************************************************************** + * END OF FILE: VStdLib_Cfg.h + *********************************************************************************************************************/ diff --git a/Source/bsw/VStdLib/vstdlib.c b/Source/bsw/VStdLib/vstdlib.c new file mode 100644 index 0000000..80ce911 --- /dev/null +++ b/Source/bsw/VStdLib/vstdlib.c @@ -0,0 +1,7811 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file vstdlib.c + * \brief Implementation of the generic Vector Standard Library (VStdLib_GenericAsr) + * \details This is the source file of the VStdLib. It contains the hardware independent implementation of the + * public APIs. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the header file. + * + * FILE VERSION + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the VERSION CHECK below. + *********************************************************************************************************************/ + +#define VSTDLIB_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "vstdlib.h" + +/********************************************************************************************************************** + * VERSION CHECK + *********************************************************************************************************************/ + +/* Checks the version of the interface header file */ +#if ( (VSTDLIB_SW_MAJOR_VERSION != (3u)) \ + || (VSTDLIB_SW_MINOR_VERSION != (9u)) \ + || (VSTDLIB_SW_PATCH_VERSION != (0u)) ) +# error "Version numbers of vstdlib.c and vstdlib.h are inconsistent!" +#endif + +/* Checks the version of the configuration header file */ +#if ( (VSTDLIB_CFG_MAJOR_VERSION != (3u)) \ + || (VSTDLIB_CFG_MINOR_VERSION != (4u)) ) +# error "Version numbers of vstdlib.c and VStdLib_Cfg.h are inconsistent!" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +#if !defined (VSTDLIB_USE_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION) +# error "VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION) +# error "VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_RUNTIME_OPTIMIZATION) +# error "VSTDLIB_RUNTIME_OPTIMIZATION has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_JUMPTABLES) +# error "VSTDLIB_USE_JUMPTABLES has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_DEV_ERROR_DETECT) +# error "VSTDLIB_DEV_ERROR_DETECT has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_DEV_ERROR_REPORT) +# error "VSTDLIB_DEV_ERROR_REPORT has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_VERSION_INFO_API) +# error "VSTDLIB_VERSION_INFO_API has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_DUMMY_STATEMENT) +# error "VSTDLIB_DUMMY_STATEMENT has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if !defined (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS) +# error "VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS has to be defined.. check VStdLib_Cfg.h!" +#endif + +#if (!defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON)) +# error "The 64-bit bit search functions can only be overwritten, if PLATFORM_SUPPORT_SINT64_UINT64 is defined!" +#endif + +#if (!defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON)) +# error "The 64-bit (De-)serialization functions can only be overwritten, if PLATFORM_SUPPORT_SINT64_UINT64 is defined!" +#endif + +#if (!defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON)) +# error "The 64-bit endianness conversion functions can only be overwritten, if PLATFORM_SUPPORT_SINT64_UINT64 is defined!" +#endif + +#if ((VSTDLIB_DEV_ERROR_REPORT == STD_ON) && (VSTDLIB_DEV_ERROR_DETECT != STD_ON)) +# error "VSTDLIB_DEV_ERROR_REPORT defined to STD_ON requires VSTDLIB_DEV_ERROR_DETECT also to be defined to STD_ON!" +#endif + +#if (VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_MemClr) || !defined (VStdLib_MemSet) || !defined (VStdLib_MemCpy) || \ + !defined (VStdLib_MemCpy16) || !defined (VStdLib_MemCpy32) || !defined (VStdLib_MemCmp)) +# error "Memory function API mapping has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_ON) +# if (!defined (VStdLib_MemCpySwapEndian)) +# error "Memory copy with endianness swap API mapping has to be defined" +# endif +#endif + +#if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION == STD_ON) +# if (!defined (VStdLib_MemCheck)) +# error "Memory check API mapping has to be defined" +# endif +#endif + +#if (((VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON)) && \ + (VSTDLIB_SUPPORT_LARGE_DATA != STD_ON) && (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON)) +# error "VSTDLIB_RUNTIME_OPTIMIZATION must not be enabled if large data support is not given!" +#endif + +#if (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_GetHighestBitPosOne8) || !defined (VStdLib_GetHighestBitPosZero8) || \ + !defined (VStdLib_GetLowestBitPosOne8) || !defined (VStdLib_GetLowestBitPosZero8) || \ + !defined (VStdLib_GetCountLeadingOnes8) || !defined (VStdLib_GetCountLeadingZeros8) || \ + !defined (VStdLib_GetCountTrailingOnes8) || !defined (VStdLib_GetCountTrailingZeros8)) +# error "Bit search API mapping for 8-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_GetHighestBitPosOne16) || !defined (VStdLib_GetHighestBitPosZero16) || \ + !defined (VStdLib_GetLowestBitPosOne16) || !defined (VStdLib_GetLowestBitPosZero16) || \ + !defined (VStdLib_GetCountLeadingOnes16) || !defined (VStdLib_GetCountLeadingZeros16) || \ + !defined (VStdLib_GetCountTrailingOnes16) || !defined (VStdLib_GetCountTrailingZeros16)) +# error "Bit search API mapping for 16-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_GetHighestBitPosOne32) || !defined (VStdLib_GetHighestBitPosZero32) || \ + !defined (VStdLib_GetLowestBitPosOne32) || !defined (VStdLib_GetLowestBitPosZero32) || \ + !defined (VStdLib_GetCountLeadingOnes32) || !defined (VStdLib_GetCountLeadingZeros32) || \ + !defined (VStdLib_GetCountTrailingOnes32) || !defined (VStdLib_GetCountTrailingZeros32)) +# error "Bit search API mapping for 32-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_GetHighestBitPosOne64) || !defined (VStdLib_GetHighestBitPosZero64) || \ + !defined (VStdLib_GetLowestBitPosOne64) || !defined (VStdLib_GetLowestBitPosZero64) || \ + !defined (VStdLib_GetCountLeadingOnes64) || !defined (VStdLib_GetCountLeadingZeros64) || \ + !defined (VStdLib_GetCountTrailingOnes64) || !defined (VStdLib_GetCountTrailingZeros64)) +# error "Bit search API mapping for 64-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_ConvertUint16ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertUint16ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertSint16ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertSint16ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToUint16BigEndian) || !defined (VStdLib_ConvertUint8ArrayToUint16LittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToSint16BigEndian) || !defined (VStdLib_ConvertUint8ArrayToSint16LittleEndian)) +# error "(De-)serialization API mapping for 16-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_ConvertUint32ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertUint32ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertSint32ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertSint32ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToUint32BigEndian) || !defined (VStdLib_ConvertUint8ArrayToUint32LittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToSint32BigEndian) || !defined (VStdLib_ConvertUint8ArrayToSint32LittleEndian)) +# error "(De-)serialization API mapping for 32-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_ConvertUint64ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertUint64ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertSint64ToUint8ArrayBigEndian) || !defined (VStdLib_ConvertSint64ToUint8ArrayLittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToUint64BigEndian) || !defined (VStdLib_ConvertUint8ArrayToUint64LittleEndian) || \ + !defined (VStdLib_ConvertUint8ArrayToSint64BigEndian) || !defined (VStdLib_ConvertUint8ArrayToSint64LittleEndian)) +# error "(De-)serialization API mapping for 64-bit values has to be defined!" +# endif +#endif + +#if (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_SwapEndianUint16) || !defined (VStdLib_SwapEndianSint16)) +# error "Endianness swap API mapping for 16-bit values has to be defined" +# endif +#endif + +#if (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_SwapEndianUint32) || !defined (VStdLib_SwapEndianSint32)) +# error "Endianness swap API mapping for 32-bit values has to be defined" +# endif +#endif + +#if (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON) +# if (!defined (VStdLib_SwapEndianUint64) || !defined (VStdLib_SwapEndianSint64)) +# error "Endianness swap API mapping for 64-bit values has to be defined" +# endif +#endif + +/********************************************************************************************************************** + * LOCAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Masks internal parameters to ensure an upper limit of 3, respectively 31 */ +#define VSTDLIB_MASK_3 (0x03u) +#define VSTDLIB_MASK_31 (0x1Fu) + +/* Bitmask for lower three bits */ +#define VSTDLIB_MASK_7 (0x07u) + +/* Bitmasks for search and endianness swap algorithms */ +#define VSTDLIB_MASK_UPPER_NIBBLE (0xF0u) +#define VSTDLIB_MASK_LOWER_NIBBLE (0x0Fu) +#define VSTDLIB_MASK_UPPER_BYTE (0xFF00u) +#define VSTDLIB_MASK_LOWER_BYTE (0x00FFu) +#define VSTDLIB_MASK_UPPER_TWO_BYTES (0xFFFF0000u) +#define VSTDLIB_MASK_LOWER_TWO_BYTES (0x0000FFFFu) +#define VSTDLIB_MASK_UPPER_FOUR_BYTES (0xFFFFFFFF00000000uLL) +#define VSTDLIB_MASK_LOWER_FOUR_BYTES (0x00000000FFFFFFFFuLL) +#define VSTDLIB_MASK_ALLBITS_IN_ONE_BYTE (0xFFu) +#define VSTDLIB_MASK_ALLBITS_IN_TWO_BYTES (0xFFFFu) +#define VSTDLIB_MASK_ALLBITS_IN_FOUR_BYTES (0xFFFFFFFFu) +#define VSTDLIB_MASK_ALLBITS_IN_EIGHT_BYTES (0xFFFFFFFFFFFFFFFFuLL) + +/* Return values for VStdLib_Loc_GetMemCmpNeqResult(), VStdLib_MemCmp(), VStdLib_Loc_MemCmp_8(), + VStdLib_Loc_MemCmp_32_Aligned(), VStdLib_Loc_MemCmp_32_Unaligned() */ +#define VSTDLIB_MEM_CMP_RES_EQ (0) +#define VSTDLIB_MEM_CMP_RES_G (1) +#define VSTDLIB_MEM_CMP_RES_L (-1) + +/* Not each Platform_Types.h defines CPU_TYPE_64 */ +#if !defined (CPU_TYPE_64) +# define CPU_TYPE_64 (64u) +#endif + +/********************************************************************************************************************** + * LOCAL FUNCTION MACROS + *********************************************************************************************************************/ + +/* Returns the number of bytes (0 - 3) that are missing to the next 32-bit boundary + Note: VSTDLIB_MASK_7 required to mask lower three bits, which ensures that macro returns 0 for 32-bit aligned pointer. +*/ +#if (CPU_TYPE == CPU_TYPE_64) +/* ESCAN00108975: Compiler warning: 'type cast': pointer truncation from 'uint8 *' to 'uint32_least' + ESCAN00109680: Compiler warning: Conversion from 'uint8 *' to 'uint64' is sign-extended +*/ +# define VSTDLIB_ALIGN_OFFSET(ptr) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ \ + (uint8_least)((4u - ((uint64)(ptr) & VSTDLIB_MASK_7)) & VSTDLIB_MASK_3) +#else +# define VSTDLIB_ALIGN_OFFSET(ptr) /* PRQA S 3453 */ /* MD_MSR_FctLikeMacro */ \ + (uint8_least)((4u - ((uint32_least)(ptr) & VSTDLIB_MASK_7)) & VSTDLIB_MASK_3) +#endif + +#if ((VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +/* Returns the bit position of a set bit in the specified nibble by using a lookup table */ +# define VStdLib_Loc_GetHighestBitPosOneInNibble(value) VStdLib_HighestBitPosOneInNibble[(value)] +# define VStdLib_Loc_GetLowestBitPosOneInNibble(value) VStdLib_LowestBitPosOneInNibble[(value)] + +#endif /* (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +/* Converts a byte array (src) to the integer type value (dst) in the swapped endianness. + The endianness swap is implemented by using the opposite service function to the current platform endianness. +*/ +#if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON) +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# define VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint16LittleEndian((src), (dst)) +# define VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint32LittleEndian((src), (dst)) +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) +# define VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint64LittleEndian((src), (dst)) +# endif +# else /* (CPU_BYTE_ORDER == LOW_BYTE_FIRST */ +# define VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint16BigEndian((src), (dst)) +# define VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint32BigEndian((src), (dst)) +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) +# define VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(src, dst) VStdLib_ConvertUint8ArrayToUint64BigEndian((src), (dst)) +# endif +# endif /* CPU_BYTE_ORDER */ +#endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON */ + +/********************************************************************************************************************** + * LOCAL TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* Module specific definition of LOCAL */ +#if !defined (VSTDLIB_LOCAL) +# define VSTDLIB_LOCAL static +#endif + +#if ((VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON)) + +/* Struct for iterations in source and destination for bit copy algorithm */ +typedef struct +{ + VStdLib_CntType startByte; + VStdLib_CntType lastByte; + uint8 bitOffsetStartByte; + uint8 bitOffsetEndByte; +} VStdLib_BitCpyIterType; + +#endif /* (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON) */ + +/********************************************************************************************************************** + * LOCAL DATA PROTOTYPES + *********************************************************************************************************************/ +#if ((VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +# define VSTDLIB_START_SEC_CONST_8BIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/* Lookup table of nibble to bit position of highest set bit in nibble */ +VSTDLIB_LOCAL CONST(uint8, VSTDLIB_CONST) VStdLib_HighestBitPosOneInNibble[16u] = /* PRQA S 3218 */ /* MD_VStdLib_FileScope */ +{ + /* Bit position / Nibble value */ + VSTDLIB_BITPOS_NA, /* 0000 */ /* not possible, is catched directly via API */ + 0u, /* 0001 */ + 1u, /* 0010 */ + 1u, /* 0011 */ + 2u, /* 0100 */ + 2u, /* 0101 */ + 2u, /* 0110 */ + 2u, /* 0111 */ + 3u, /* 1000 */ + 3u, /* 1001 */ + 3u, /* 1010 */ + 3u, /* 1011 */ + 3u, /* 1100 */ + 3u, /* 1101 */ + 3u, /* 1110 */ + 3u /* 1111 */ +}; + +/* Lookup table of nibble to bit position of lowest set bit in nibble */ +VSTDLIB_LOCAL CONST(uint8, VSTDLIB_CONST) VStdLib_LowestBitPosOneInNibble[16u] = /* PRQA S 3218 */ /* MD_VStdLib_FileScope */ +{ + /* Bit position / Nibble value */ + VSTDLIB_BITPOS_NA, /* 0000 */ /* not possible, is catched directly via API */ + 0u, /* 0001 */ + 1u, /* 0010 */ + 0u, /* 0011 */ + 2u, /* 0100 */ + 0u, /* 0101 */ + 1u, /* 0110 */ + 0u, /* 0111 */ + 3u, /* 1000 */ + 0u, /* 1001 */ + 1u, /* 1010 */ + 0u, /* 1011 */ + 2u, /* 1100 */ + 0u, /* 1101 */ + 1u, /* 1110 */ + 0u /* 1111 */ +}; + +# define VSTDLIB_STOP_SEC_CONST_8BIT +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /*(VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#define VSTDLIB_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_GetMemCmpNeqResult() + *********************************************************************************************************************/ +/*! \brief Returns whether the specified buffer1 value is greater or smaller than the specified buffer2 value. + * \details - + * \param[in] buf1Value Buffer1 value for comparison. + * \param[in] buf2Value Buffer2 value for comparison. + * \return < 0 Buffer1 value is greater than buffer2 value. + * \return > 0 Buffer1 value is smaller than buffer2 value. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'buf1Value' and 'buf2Value' have to contain unequal values. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_GetMemCmpNeqResult(uint32 buf1Value, uint32 buf2Value); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_8() + *********************************************************************************************************************/ +/*! \brief Compares two buffers byte-wise for the specified number of bytes and returns whether they are equal + * or not (any alignment). + * \details - + * \param[in] pBuf1_8 8-bit pointer to first buffer for comparison. + * \param[in] pBuf2_8 8-bit pointer to second buffer for comparison. + * \param[in] nCnt Number of bytes to compare, pBuf1_8 and pBuf2_8 must be valid for this amount. + * \return < 0 The first buffer contains a smaller value than the second buffer. + * \return 0 The two buffers are equal for the number of compared bytes. + * \return > 0 The first buffer contains a greater value than the second buffer. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'pBuf1_8' and 'pBuf2_8' have to point to valid memory areas. Each memory area has to + * be valid for at least the byte count defined in parameter 'nCnt'. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_8( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_8, + uint32_least nCnt); + +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_8_3() + *********************************************************************************************************************/ +/*! \brief Initializes up to 3 bytes at pDst to the character nPattern (any alignment). + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to be initialized. + * \param[in] nPattern The character to be used to initialize the memory. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_8_3( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8 nPattern, + uint8_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_8_31() + *********************************************************************************************************************/ +/*! \brief Initializes up to 31 bytes at pDst to the character nPattern (any alignment). + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to be initialized. + * \param[in] nPattern The character to be used to initialize the memory. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_8_31( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8 nPattern, + uint8_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Initializes memory at pDst to the character nPattern (32-bit aligned). + * \details With a for loop, the tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst32 32-bit pointer to the memory location to be initialized. + * \param[in] nPattern The character to be used to initialize the memory. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + uint8 nPattern, + uint32_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_3() + *********************************************************************************************************************/ +/*! \brief Copies up to 3 bytes from pSrc to pDst (any alignment). + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_3( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_31() + *********************************************************************************************************************/ +/*! \brief Copies up to 31 bytes from pSrc to pDst (any alignment). + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_31( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Copies 32-bit aligned data from pSrc to pDst. + * \details With a for loop, the tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_PartialWord() + *********************************************************************************************************************/ +/*! \brief Copies a partial word of 1 to 3 bytes from pSrc to pDst to reach a 32-bit boundary (any alignment). + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to copy to. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in,out] pPrev Word to copy from (is modified and used by caller afterwards). + * \param[in,out] pDPos Index for pDst8 to copy to (is modified and used by caller afterwards). + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_PartialWord( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8_least nCnt, + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pPrev, + P2VAR(uint32_least, AUTOMATIC, VSTDLIB_VAR_FAR) pDPos); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_32_Unaligned() + *********************************************************************************************************************/ +/*! \brief Copies data from 32-bit aligned pSrc to unaligned pDst. + * \details With a for loop using 32-bit accesses, the head and tail depending on VSTDLIB_USE_JUMPTABLES either + with a jumptable or a for loop. + * \param[out] pDst8 8-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] nDstOffset pDst offset to the next 32-bit boundary. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst8' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_32_Unaligned( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt, + uint8_least nDstOffset); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Compares two 32-bit aligned buffers for the specified number of bytes and returns whether they are + * equal or not. + * \details The buffer values are compared 4-bytes-wise until the number of not compared bytes is smaller than 4. + * The remaining bytes are compared byte-wise using VStdLib_Loc_MemCmp_8(). + * \param[in] pBuf1_32 32-bit pointer to first buffer for comparison. + * \param[in] pBuf2_32 32-bit pointer to second buffer for comparison. + * \param[in] nCnt Number of bytes to compare, pBuf1_32 and pBuf2_32 must be valid for this amount. + * \return < 0 The first buffer contains a smaller value than the second buffer. + * \return 0 The two buffers are equal for the number of compared bytes. + * \return > 0 The first buffer contains a greater value than the second buffer. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pBuf1_32' and 'pBuf2_32' have to point to valid memory areas. Each memory area has + * to be valid for at least the byte count defined in parameter 'nCnt'. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_32_Aligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_32, + uint32_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_32_Unaligned() + *********************************************************************************************************************/ +/*! \brief Compares a 32-bit aligned buffer with an unaligned buffer for the specified number of bytes and + * returns whether they are equal or not. + * \details The buffer values are compared 4-bytes-wise by correcting the byte displacement until the number of + * not compared bytes is smaller than 4. The remaining bytes are compared byte-wise using + * VStdLib_Loc_MemCmp_8(). + * \param[in] pBuf1_32 32-bit pointer to first buffer for comparison. + * \param[in] pBuf2_8 8-bit pointer to second buffer for comparison. + * \param[in] nCnt Number of bytes to compare, pBuf1_32 and pBuf2_8 must be valid for this amount. + * \param[in] nBuf2Offset pBuf2_8 offset to the next 32-bit boundary. + * \return < 0 The first buffer contains a smaller value than the second buffer. + * \return 0 The two buffers are equal for the number of compared bytes. + * \return > 0 The first buffer contains a greater value than the second buffer. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pBuf1_32' and 'pBuf2_8' have to point to valid memory areas. Each memory area has + * to be valid for at least the byte count defined in parameter 'nCnt'. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_32_Unaligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_32, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_8, + uint32_least nCnt, + uint8_least nBuf2Offset); + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ +#endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +#if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON) +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_IntType_32() + *********************************************************************************************************************/ +/*! \brief Copies and swaps up to 32 bytes from pSrc8 (any alignment) to pDst (intType alignment) according to + * the integer type intType. + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst Pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[16, 32, 64]). + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_IntType_32( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt, + uint8 intType); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int16_32() + *********************************************************************************************************************/ +/*! \brief Copies and swaps up to 32 bytes from pSrc8 (any alignment) to pDst16 (16-bit alignment) according to + * the integer type VSTDLIB_INTTYPE_16. + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst16 16-bit pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst16' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_16 size. + * The parameter 'pDst16' is 16-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int16_32( + P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pDst16, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int32_32() + *********************************************************************************************************************/ +/*! \brief Copies and swaps up to 32 bytes from pSrc8 (any alignment) to pDst32 (32-bit alignment) according to + * the integer type VSTDLIB_INTTYPE_32. + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_32 size. + * The parameter 'pDst32' is 32-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int32_32( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt); + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int64_32() + *********************************************************************************************************************/ +/*! \brief Copies and swaps up to 32 bytes from pSrc8 (any alignment) to pDst64 (64-bit alignment) according to + * the integer type VSTDLIB_INTTYPE_64. + * \details Depending on VSTDLIB_USE_JUMPTABLES either with a jumptable or a for loop. + * \param[out] pDst64 64-bit pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * && defined PLATFORM_SUPPORT_SINT64_UINT64 + * \pre The parameters 'pDst64' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_64 size. + * The parameter 'pDst64' is 64-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int64_32( + P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR) pDst64, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt); + +# endif /* defined PLATFORM_SUPPORT_SINT64_UINT64 */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Copies and swaps 32-bit aligned data from pSrc32 to pDst32 according to the integer type intType. + * \details With a for loop. The tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable (32-bit access) + * or a for loop (integer type dependent access). + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[16, 32, 64]). + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst32' is 32-bit aligned and aligned according to the integer type 'intType'. + * The parameter 'pSrc32' is 32-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt, + uint8 intType); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Copies and swaps 32-bit aligned data from pSrc32 to pDst32 according to the integer type + * VSTDLIB_INTTYPE_16. + * \details With a for loop. The tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable (32-bit access) + * or a for loop (16-bit access). + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_16 size. + * The parameter 'pDst32' is 16-bit and 32-bit aligned. + * The parameter 'pSrc32' is 32-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_SwapEndianInt16_32() + *********************************************************************************************************************/ +/*! \brief Returns two 16-bit values with a swapped endianness in a 32-bit value. + * \details - + * \param[in] src32 32-bit value containing two 16-bit values. + * \return 32-bit value containing the two 16-bit values with a swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint32, VSTDLIB_CODE) VStdLib_Loc_SwapEndianInt16_32(uint32 src32); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Copies and swaps 32-bit aligned data from pSrc32 to pDst32 according to the integer type + * VSTDLIB_INTTYPE_32. + * \details With a for loop. The tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable (32-bit access) + * or a for loop (32-bit access). + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pDst32' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_32 size. + * The parameter 'pDst32' is 32-bit aligned. + * The parameter 'pSrc32' is 32-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt); + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Copies and swaps 32-bit aligned data from pSrc32 to pDst32 according to the integer type + * VSTDLIB_INTTYPE_64. + * \details With a for loop. The tail depending on VSTDLIB_USE_JUMPTABLES either with a jumptable (32-bit access) + * or a for loop (64-bit access). + * \param[out] pDst32 32-bit pointer to the memory location to copy to. + * \param[in] pSrc32 32-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * && defined PLATFORM_SUPPORT_SINT64_UINT64 + * \pre The parameters 'pDst32' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type VSTDLIB_INTTYPE_64 size. + * The parameter 'pDst32' is 32-bit and 64-bit aligned. + * The parameter 'pSrc32' is 32-bit aligned. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt); + +# endif /* defined PLATFORM_SUPPORT_SINT64_UINT64 */ +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian() + *********************************************************************************************************************/ +/*! \brief Copies and swaps nCnt bytes from pSrc8 (any alignment) to pDst (intType alignment) according to + * the integer type intType. + * \details - + * \param[out] pDst Pointer to the memory location to copy to. + * \param[in] pSrc8 8-bit pointer to the memory location to copy from. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[16, 32, 64]). + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint32_least nCnt, + uint8 intType); + +#endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyConvertBitCounting() + *********************************************************************************************************************/ +/*! \brief Converts sawtooth to monotone bit position numbering and vice versa. + * \details Is used by _s BitCpy and normal BitCpy APIs. The conversion from sawtooth to monotone bit position + * numbering in case of big endian data simplifies the calculation of the last byte to copy to or + * from and the calculation of its bit offset. Same applies for the conversion of monotone to sawtooth + * bit position numbering in case of little endian data. + * \param[in] bitPos Bit position numbered as sawtooth or monotone. + * \return Bit position with converted bit position numbering. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(VStdLib_CntType, VSTDLIB_CODE) VStdLib_Loc_BitCpyConvertBitCounting(VStdLib_CntType bitPos); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyGetLastIterByte() + *********************************************************************************************************************/ +/*! \brief Returns last iteration byte. + * \details Is used by _s BitCpy and normal BitCpy APIs to get the last iteration byte. + * \param[in] lengthInBits Sum of bits to be copied plus the offset. + * \return Last iteration byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(VStdLib_CntType, VSTDLIB_CODE) VStdLib_Loc_BitCpyGetLastIterByte( + VStdLib_CntType lengthInBits); + +#if ((VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyIter() + *********************************************************************************************************************/ +/*! \brief Sets all relevant interation parameters to iterate over a memory location. + * \details - + * \param[in] pIter Pointer to the iteration structure of a memory location. + * \param[in] nBitOffset Bit offset numbered as sawtooth or monotone. + * \param[in] nCnt Number of bits to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyIter( + P2VAR(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pIter, + VStdLib_CntType nBitOffset, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyGetOffsetInBitsEndByte() + *********************************************************************************************************************/ +/*! \brief Returns bit offset in the last byte. + * \details Converts bit numbering from sawtooth to monotone and vice versa. It is used to shift the bit mask + * for the last destination byte and to determine the source byte shift if the memory locations have + * different data endianness. + * \param[in] lengthInBits Sum of bits to be copied plus the bit offset. + * \return 0-7 Bit offset in last byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyGetOffsetInBitsEndByte( + VStdLib_CntType lengthInBits); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigEndianSrc_7() + *********************************************************************************************************************/ +/*! \brief Copies big endian data from one memory location into another memory location. + * \details Uses VStdLib_Loc_BitCpyBigEndianSrc() and a bit mask to copy 1 to 7 bits starting at pSrc8 + * to another memory location starting at pDst8. + * \param[out] pDst8 Pointer to the memory location to copy to, must not be NULL. + * \param[in] dstByteIdx Index to iterate over all bytes in the memory location to copy to. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[in] srcByteIdx Index to iterate over all bytes in the memory location to copy from. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable to indicate if right/left or no shift is needed for the relevant source byte. + * \param[in] dstBitMask Mask to be able to copy number of bits < 8. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigEndianSrc_7( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + VStdLib_CntType dstByteIdx, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift, + uint8 dstBitMask); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleEndianSrc_7() + *********************************************************************************************************************/ +/*! \brief Copies little endian data from one memory location into another memory location. + * \details Uses VStdLib_Loc_BitCpyLittleEndianSrc() and a bit mask to copy 1 to 7 bits starting at pSrc8 + * to another memory location starting at pDst8. + * \param[out] pDst8 Pointer to the memory location to copy to. + * \param[in] dstByteIdx Index to iterate over all dstBytes. + * \param[in] pSrc8 Pointer to the memory location to copy from. + * \param[in] srcByteIdx Index to iterate over all bytes in the memory location to copy from. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable to indicate if right/left or no shift is needed for the relevant source byte. + * \param[in] dstBitMask Mask to be able to copy number of bits < 8. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleEndianSrc_7( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + VStdLib_CntType dstByteIdx, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift, + uint8 dstBitMask); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigEndianSrc() + *********************************************************************************************************************/ +/*! \brief Returns byte (big endian data) with relevant bits to copy to a memory location. + * \details Uses VStdLib_Loc_BitCpyShiftRight_BigEndianSrc() or VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc() to + * get source byte with relevant bits. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable to indicate if right/left or no shift is needed for the relevant source byte. + * \return Source byte to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleEndianSrc() + *********************************************************************************************************************/ +/*! \brief Returns byte (little endian data) with relevant bits to copy to a memory location. + * \details Uses VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc() or VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc() + * to get source byte with relevant bits. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable to indicate if right/left or no shift is needed for the relevant source byte. + * \return Source byte to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftRight_BigEndianSrc() + *********************************************************************************************************************/ +/*! \brief Prepares byte (big endian data) with relevant bits to copy to a memory location. + * \details To align the offsets of the memory locations the relevant byte in the source is shifted + * and merged with the missing bits of the previous relevant source byte. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[out] pSrcByte Pointer to byte to be modified. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable that indicates that right shift is needed for the relevant source byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftRight_BigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc() + *********************************************************************************************************************/ +/*! \brief Prepares byte (big endian data) with relevant bits to copy to a memory location. + * \details To align the offsets of the memory locations the relevant byte in the source is shifted + * and merged with the missing bits of the next relevant source byte. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[out] pSrcByte Pointer to byte to be modified. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable that indicates that left shift is needed for the relevant source byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc() + *********************************************************************************************************************/ +/*! \brief Prepares byte (big endian data) with relevant bits to copy to a memory location. + * \details To align the offsets of the memory locations the relevant byte in the source is shifted + * and merged with the missing bits of the next relevant source byte. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[out] pSrcByte Pointer to byte to be modified. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable that indicates that right shift is needed for the relevant source byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc() + *********************************************************************************************************************/ +/*! \brief Prepares byte (big endian data) with relevant bits to copy to a memory location. + * \details To align the offsets of the memory locations the relevant byte in the source is shifted + * and merged with the missing bits of the previous relevant source byte. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[out] pSrcByte Pointer to byte to be modified. + * \param[in] srcByteIdx Index to indicate which source byte to use. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \param[in] srcShift Variable that indicates that left shift is needed for the relevant source byte. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpySwapEndian() + *********************************************************************************************************************/ +/*! \brief Copies and swaps nCnt bits from one memory location into another memory location. + * \details Copies bits byte-wise starting at pSrc8 to another memory location starting at pDst8. + * \param[out] pDst8 Pointer to the memory location to copy to, must not be NULL. + * \param[in] pDstIter Pointer to the iteration structure of the memory location to copy to. + * \param[in] pSrc8 Pointer to the memory location to copy from, must not be NULL. + * \param[in] pSrcIter Pointer to the iteration structure of the memory location to copy from. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpySwapEndian( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pDstIter, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies big endian data from one memory location to another memory location with big endian data. + * \details Copies nCnt bits starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to the + * destination-byte-pointer. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to the + * source-byte-pointer. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies big endian data from one memory location to another memory location with little endian data. + * \details Copies nCnt bits starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to the + * destination-byte-pointer. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to the + * source-byte-pointer. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies little endian data from one memory location to another memory location with big endian data. + * \details Copies nCnt bits starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to the + * destination-byte-pointer. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to the + * source-byte-pointer. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies little endian data from one memory location to another memory location with little endian data. + * \details Copies nCnt bits starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to the + * destination-byte-pointer. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to the + * source-byte-pointer. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area. + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +#endif /* (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON) */ + +#if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_GetMemCheckResult() + *********************************************************************************************************************/ +/*! \brief Checks if a buffer value is equal to a pattern. + * \details Assigns a passed errorCode to the retVal in case of mismatch. + * \param[in] nBufValue Value to be checked. + * \param[in] nPattern The character to be checked against. + * \param[in] pRetVal Pointer to the result. + * \param[in] errorCode Value to be assigned as the result, if bufValue is not equal to pattern. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON + * \pre errorCode != E_OK + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_GetMemCheckResult( + uint32 nBufValue, + uint32 nPattern, + P2VAR(Std_ReturnType, AUTOMATIC, VSTDLIB_VAR_FAR) pRetVal, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_Loc_MemCheck_8() + *********************************************************************************************************************/ +/*! \brief Checks byte-wise if the data at pBuf8 matches the nPattern (any alignment). + * \details - + * \param[out] pBuf8 8-bit pointer to the memory location to be checked. + * \param[in] nPattern The character to be checked for in the memory. + * \param[in] nCnt Number of bytes to check, pBuf8 must be valid for this amount. + * \param[in] errorCode Value to be returned, if content of pBuf8 is not equal to pattern. + * \return E_OK pBuf8 consists only of the pattern. + * \return errorCode pBuf8 contains atleast one value that is not equal to pattern. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pBuf8' and 'nCnt' have to define a valid memory area and (errorCode != E_OK). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_Loc_MemCheck_8( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf8, + uint8 nPattern, + uint32_least nCnt, + Std_ReturnType errorCode); + +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCheck_32_Aligned() + *********************************************************************************************************************/ +/*! \brief Checks data at pBuf(32-bit aligned) for the nPattern. + * \details The buffer data is checked 4-bytes-wise until less than 4 bytes are left to be checked. + * The remaining bytes are compared byte-wise using VStdLib_Loc_MemCheck_8() + * \param[out] pBuf32 32-bit pointer to the memory location to be checked. + * \param[in] nPattern The character to checked for in the memory. + * \param[in] nCnt Number of bytes to check, pBuf must be valid for this amount. + * \param[in] errorCode Value to be returned, if content of pBuf is not equal to pattern. + * \return E_OK pBuf consists only of the pattern. + * \return errorCode pBuf contains atleast one value that is not equal to pattern. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON && VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON + * \pre The parameters 'pBuf32' and 'nCnt' have to define a valid memory area and (errorCode != E_OK). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_Loc_MemCheck_32_Aligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf32, + uint8 nPattern, + uint32_least nCnt, + Std_ReturnType errorCode); + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ +#endif /* VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON */ + +#if ((VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && \ + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInByte() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified byte value. + * \details - + * \param[in] value The byte value in which the highest set bit shall be found. + * \return 0-7 Bit position of the highest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be greater than zero (contains at least one set bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInByte(uint8 value); + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInByte() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified byte value. + * \details - + * \param[in] value The byte value in which the lowest set bit shall be found. + * \return 0-7 Bit position of the lowest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be smaller than its maximum value (contains at least one unset bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInByte(uint8 value); + +#endif /* (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && \ + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInTwoBytes() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified two byte value. + * \details - + * \param[in] value The two byte value in which the highest set bit shall be found. + * \return 0-15 Bit position of the highest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be greater than zero (contains at least one set bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInTwoBytes(uint16 value); + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInTwoBytes() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified two byte value. + * \details - + * \param[in] value The two byte value in which the lowest set bit shall be found. + * \return 0-15 Bit position of the lowest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be smaller than its maximum value (contains at least one unset bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInTwoBytes(uint16 value); + +#endif /* (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && \ + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInFourBytes() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified four byte value. + * \details - + * \param[in] value The four byte value in which the highest set bit shall be found. + * \return 0-31 Bit position of the highest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be greater than zero (contains at least one set bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInFourBytes(uint32 value); + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInFourBytes() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified four byte value. + * \details - + * \param[in] value The four byte value in which the lowest set bit shall be found. + * \return 0-31 Bit position of the lowest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON || + * (defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + * \pre The parameters 'value' has to be smaller than its maximum value (contains at least one unset bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInFourBytes(uint32 value); + +#endif /* (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInEightBytes() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified eight byte value. + * \details - + * \param[in] value The eight byte value in which the highest set bit shall be found. + * \return 0-63 Bit position of the highest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'value' has to be greater than zero (contains at least one set bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInEightBytes(uint64 value); + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInEightBytes() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified eight byte value. + * \details - + * \param[in] value The eight byte value in which the lowest set bit shall be found. + * \return 0-63 Bit position of the lowest set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config defined PLATFORM_SUPPORT_SINT64_UINT64 && VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON + * \pre The parameters 'value' has to be smaller than its maximum value (contains at least one unset bit). + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInEightBytes(uint64 value); + +#endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +/********************************************************************************************************************** + * LOCAL FUNCTIONS + *********************************************************************************************************************/ + +#if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_GetMemCmpNeqResult() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_GetMemCmpNeqResult(uint32 buf1Value, uint32 buf2Value) +{ + /* ----- Local Variables ---------------------------------------------- */ + sint8 result; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Set result depending, if buffer1 value is greater or smaller than buffer2 value */ + if (buf1Value > buf2Value) + { + result = VSTDLIB_MEM_CMP_RES_G; + } + else /* (buf1Value < buf2Value) */ + { + result = VSTDLIB_MEM_CMP_RES_L; + } + + return result; +} + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_8( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_8, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least pos; + sint8 result = VSTDLIB_MEM_CMP_RES_EQ; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Linearly compare buffers byte-wise in a loop */ + for (pos = 0u; pos < nCnt; pos++) /* FETA_VSTDLIB_LOC_MEMCMP_X_X */ + { + /* #110 If current buffer values are unequal */ + if (pBuf1_8[pos] != pBuf2_8[pos]) + { + /* #120 Set corresponding result value and break the comparison */ + result = VStdLib_Loc_GetMemCmpNeqResult((uint32)pBuf1_8[pos], (uint32)pBuf2_8[pos]); + break; + } + } + + return result; +} + +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_8_3() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_8_3( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8 nPattern, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Initialize up to 3 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 3: + pDst8[2] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 2: + pDst8[1] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 1: + pDst8[0] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #20 Linearly initialize the bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMSET_X_X */ + { + pDst8[idx] = nPattern; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemSet_8_3() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_8_31() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030 1 */ /* MD_VStdLib_Metrics */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_8_31( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8 nPattern, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Initialize up to 31 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 31: + pDst8[30] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 30: + pDst8[29] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 29: + pDst8[28] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 28: + pDst8[27] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 27: + pDst8[26] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 26: + pDst8[25] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 25: + pDst8[24] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 24: + pDst8[23] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 23: + pDst8[22] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 22: + pDst8[21] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 21: + pDst8[20] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 20: + pDst8[19] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 19: + pDst8[18] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 18: + pDst8[17] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 17: + pDst8[16] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 16: + pDst8[15] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 15: + pDst8[14] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 14: + pDst8[13] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 13: + pDst8[12] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 12: + pDst8[11] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 11: + pDst8[10] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 10: + pDst8[9] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 9: + pDst8[8] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 8: + pDst8[7] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 7: + pDst8[6] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 6: + pDst8[5] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 5: + pDst8[4] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 4: + pDst8[3] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 3: + pDst8[2] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 2: + pDst8[1] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 1: + pDst8[0] = nPattern; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #20 Linearly initialize the bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMSET_X_X */ + { + pDst8[idx] = nPattern; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemSet_8_31() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemSet_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemSet_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + uint8 nPattern, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; + uint32_least remaining; + uint32 nPattern32 = + (uint32)(((uint32)nPattern << 24u) | ((uint32)nPattern << 16u) | ((uint32)nPattern << 8u) | nPattern); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly initialize 16-byte blocks using 32-bit accesses in a loop */ + for (remaining = nCnt; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMSET_X_X */ + { + pDst32[dPos] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + } + +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #20 Initialize the remaining block using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (remaining) + { + /* #30 Use 32-bit access for remaining four byte tuples */ + case 15: + case 14: + case 13: + case 12: + pDst32[dPos] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 11: + case 10: + case 9: + case 8: + pDst32[dPos] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 7: + case 6: + case 5: + case 4: + pDst32[dPos] = nPattern32; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 3: + case 2: + case 1: + /* #40 Use 8-bit access for remaining three bytes */ + VStdLib_Loc_MemSet_8_3( /* SBSW_VSTDLIB_CALL_REMAINING_JUMPTABLE */ /* FETA_VSTDLIB_CALL_LOC_MEMSET_8_X_REMAINING */ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], + nPattern, + (uint8_least) (remaining & VSTDLIB_MASK_3)); + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + /* #50 Initialize the remaining block using a byte-wise algorithm */ + VStdLib_Loc_MemSet_8_31( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMSET_8_X_REMAINING */ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], + nPattern, + (uint8_least) remaining); + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemSet_32_Aligned() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_3() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_3( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy up to 3 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 3: + pDst8[2] = pSrc8[2]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 2: + pDst8[1] = pSrc8[1]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 1: + pDst8[0] = pSrc8[0]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #20 Linearly copy the bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMCPY_X_X */ + { + pDst8[idx] = pSrc8[idx]; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpy_8_3() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_31() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030 1 */ /* MD_VStdLib_Metrics */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_31( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy up to 31 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 31: + pDst8[30] = pSrc8[30]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 30: + pDst8[29] = pSrc8[29]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 29: + pDst8[28] = pSrc8[28]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 28: + pDst8[27] = pSrc8[27]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 27: + pDst8[26] = pSrc8[26]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 26: + pDst8[25] = pSrc8[25]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 25: + pDst8[24] = pSrc8[24]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 24: + pDst8[23] = pSrc8[23]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 23: + pDst8[22] = pSrc8[22]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 22: + pDst8[21] = pSrc8[21]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 21: + pDst8[20] = pSrc8[20]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 20: + pDst8[19] = pSrc8[19]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 19: + pDst8[18] = pSrc8[18]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 18: + pDst8[17] = pSrc8[17]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 17: + pDst8[16] = pSrc8[16]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 16: + pDst8[15] = pSrc8[15]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 15: + pDst8[14] = pSrc8[14]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 14: + pDst8[13] = pSrc8[13]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 13: + pDst8[12] = pSrc8[12]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 12: + pDst8[11] = pSrc8[11]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 11: + pDst8[10] = pSrc8[10]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 10: + pDst8[9] = pSrc8[9]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 9: + pDst8[8] = pSrc8[8]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 8: + pDst8[7] = pSrc8[7]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 7: + pDst8[6] = pSrc8[6]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 6: + pDst8[5] = pSrc8[5]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 5: + pDst8[4] = pSrc8[4]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 4: + pDst8[3] = pSrc8[3]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 3: + pDst8[2] = pSrc8[2]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 2: + pDst8[1] = pSrc8[1]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + case 1: + pDst8[0] = pSrc8[0]; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #20 Linearly copy the bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMCPY_X_X */ + { + pDst8[idx] = pSrc8[idx]; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpy_8_31() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; /* == sPos */ + uint32_least remaining; + uint32 x0, x1, x2, x3; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly copy 16-byte blocks using 32-bit accesses in a loop */ + for (remaining = nCnt; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPY_X_X */ + { + x0 = pSrc32[dPos]; + x1 = pSrc32[dPos + 1u]; + x2 = pSrc32[dPos + 2u]; + x3 = pSrc32[dPos + 3u]; + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + } + +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #20 Copy the remaining block using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (remaining) + { + /* #30 Use 32-bit access for remaining four byte tuples */ + case 15: + case 14: + case 13: + case 12: + pDst32[dPos] = pSrc32[dPos]; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 11: + case 10: + case 9: + case 8: + pDst32[dPos] = pSrc32[dPos]; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 7: + case 6: + case 5: + case 4: + pDst32[dPos] = pSrc32[dPos]; /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 3: + case 2: + case 1: + /* #40 Use 8-bit access for remaining three bytes */ + VStdLib_Loc_MemCpy_8_3( /* SBSW_VSTDLIB_CALL_REMAINING_JUMPTABLE */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_X_REMAINING */ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) (remaining & VSTDLIB_MASK_3)); + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + /* #50 Copy the remaining block using a byte-wise algorithm */ + VStdLib_Loc_MemCpy_8_31( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_X_REMAINING */ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) remaining); + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpy_32_Aligned() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_8_PartialWord() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_8_PartialWord( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + uint8_least nCnt, + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pPrev, + P2VAR(uint32_least, AUTOMATIC, VSTDLIB_VAR_FAR) pDPos) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy 1 to 3 bytes using a jump table and adapt '*pDPos' and '*pPrev' for little endian byte order */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 3: + pDst8[*pDPos] = (uint8) *pPrev; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) >>= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + /* intentionally no break */ + case 2: + pDst8[*pDPos] = (uint8) *pPrev; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) >>= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + /* intentionally no break */ + default: /* case 1 - nCnt is always in range [1..3] */ + pDst8[*pDPos] = (uint8) *pPrev; /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) >>= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #20 Linearly copy the bytes using a loop and adapt '*pDPos' and '*pPrev' for little endian byte order */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMCPY_X_X */ + { + pDst8[*pDPos] = (uint8) (uint8) *pPrev; /* SBSW_VSTDLIB_ACCESS_LOOP */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) >>= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #30 Copy 1 to 3 bytes using a jump table and adapt '*pDPos' and '*pPrev' for big endian byte order */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 3: + pDst8[*pDPos] = (uint8) ((*pPrev) >> 24u); /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) <<= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + /* intentionally no break */ + case 2: + pDst8[*pDPos] = (uint8) ((*pPrev) >> 24u); /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) <<= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + /* intentionally no break */ + default: /* case 1 - nCnt is always in range [1..3] */ + pDst8[*pDPos] = (uint8) ((*pPrev) >> 24u); /* SBSW_VSTDLIB_ACCESS_8_JUMPTABLE */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) <<= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idx; + + /* #40 Linearly copy the bytes using a loop and adapt '*pDPos' and '*pPrev' for big endian byte order */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_LOC_MEMCPY_X_X */ + { + pDst8[*pDPos] = (uint8) ((*pPrev) >> 24u); /* SBSW_VSTDLIB_ACCESS_LOOP */ + (*pDPos)++; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + (*pPrev) <<= 8u; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +# endif /* CPU_BYTE_ORDER */ +} /* VStdLib_Loc_MemCpy_8_PartialWord() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpy_32_Unaligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpy_32_Unaligned( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt, + uint8_least nDstOffset) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; + uint32_least sPos = 0u; + uint32_least remaining = nCnt; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 If more than 32 bytes have to be copied */ + if (remaining >= 32u) + { + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32; + uint32 prev; + + /* #20 Copy the first partial word to reach the 32-bit boundary and adjust the destination pointer */ + prev = pSrc32[sPos]; + remaining -= 4u; + VStdLib_Loc_MemCpy_8_PartialWord( /* SBSW_VSTDLIB_CALL_MODIFIED_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_PARTIALWORD */ + pDst8, + nDstOffset, + &prev, + &dPos); + + /* At this point 'pDst8[dPos]' is aligned to a 32-bit boundary */ + pDst32 = (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst8[dPos]; /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + dPos = 0u; + sPos++; + + /* #30 Linearly copy 16-byte blocks using 32-bit accesses by correcting the byte displacement of dst and src */ + if (nDstOffset == 3u) /* 24-bit displacement */ + { + for (; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPY_32_UNALIGNED */ + { + uint32 x0, x1, x2, x3, x4; + x1 = pSrc32[sPos]; + x2 = pSrc32[sPos + 1u]; + x3 = pSrc32[sPos + 2u]; + x4 = pSrc32[sPos + 3u]; +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + x0 = prev | (x1 << 8u); + x1 = (x1 >> 24u) | (x2 << 8u); + x2 = (x2 >> 24u) | (x3 << 8u); + x3 = (x3 >> 24u) | (x4 << 8u); + prev = x4 >> 24u; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + x0 = prev | (x1 >> 8u); + x1 = (x1 << 24u) | (x2 >> 8u); + x2 = (x2 << 24u) | (x3 >> 8u); + x3 = (x3 << 24u) | (x4 >> 8u); + prev = x4 << 24; +# endif /* CPU_BYTE_ORDER */ + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + sPos += 4u; + } + } + else if (nDstOffset == 2u) /* 16-bit displacement */ + { + for (; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPY_32_UNALIGNED */ + { + uint32 x0, x1, x2, x3, x4; + x1 = pSrc32[sPos]; + x2 = pSrc32[sPos + 1u]; + x3 = pSrc32[sPos + 2u]; + x4 = pSrc32[sPos + 3u]; +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + x0 = prev | (x1 << 16u); + x1 = (x1 >> 16u) | (x2 << 16u); + x2 = (x2 >> 16u) | (x3 << 16u); + x3 = (x3 >> 16u) | (x4 << 16u); + prev = x4 >> 16u; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + x0 = prev | (x1 >> 16); + x1 = (x1 << 16u) | (x2 >> 16u); + x2 = (x2 << 16u) | (x3 >> 16u); + x3 = (x3 << 16u) | (x4 >> 16u); + prev = x4 << 16; +# endif /* CPU_BYTE_ORDER */ + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + sPos += 4u; + } + + } + else /* nDstOffset == 1 - 8-bit displacement */ + { + for (; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPY_32_UNALIGNED */ + { + uint32 x0, x1, x2, x3, x4; + x1 = pSrc32[sPos]; + x2 = pSrc32[sPos + 1u]; + x3 = pSrc32[sPos + 2u]; + x4 = pSrc32[sPos + 3u]; +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + x0 = prev | (x1 << 24u); + x1 = (x1 >> 8u) | (x2 << 24u); + x2 = (x2 >> 8u) | (x3 << 24u); + x3 = (x3 >> 8u) | (x4 << 24u); + prev = x4 >> 8u; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + x0 = prev | (x1 >> 24u); + x1 = (x1 << 8u) | (x2 >> 24u); + x2 = (x2 << 8u) | (x3 >> 24u); + x3 = (x3 << 8u) | (x4 >> 24u); + prev = x4 << 8u; +# endif /* CPU_BYTE_ORDER */ + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + sPos += 4u; + } + } + + /* #40 Linearly copy the remaining words using a loop */ + { + uint8_least prevShift = (uint8_least) ((nDstOffset << 3u) & VSTDLIB_MASK_31); + uint8_least xShift = 32u - prevShift; + /* At this point remaining is < 16 byte */ + for (; remaining >= 4u; remaining -= 4u) /* FETA_VSTDLIB_LOC_MEMCPY_32_UNALIGNED */ + { + uint32 x0, x1; + x1 = pSrc32[sPos]; +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + x0 = prev | (x1 << xShift); + prev = x1 >> prevShift; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + x0 = prev | (x1 >> xShift); + prev = x1 << prevShift; +# endif /* CPU_BYTE_ORDER */ + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP_REMAINING */ + dPos++; + sPos++; + } + } + + /* #50 Copy the remaining partial word using a byte-wise algorithm */ + pDst8 = (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos]; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + dPos = 0u; + VStdLib_Loc_MemCpy_8_PartialWord( /* SBSW_VSTDLIB_CALL_REMAINING_PARTIAL */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_PARTIALWORD_CALC */ + pDst8, + (4u - nDstOffset), + &prev, + &dPos); + } + + /* #60 Copy the remaining bytes using a byte-wise algorithm */ + VStdLib_Loc_MemCpy_8_31( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_31_REMAINING */ + &pDst8[dPos], + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[sPos], + (uint8_least) remaining); +} /* VStdLib_Loc_MemCpy_32_Unaligned() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_32_Aligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_32, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least pos = 0u; + uint32_least remaining = nCnt; + sint8 result = VSTDLIB_MEM_CMP_RES_EQ; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Linearly compare buffers 4-bytes-wise using 32-bit accesses in a loop */ + for (; remaining >= 4u; remaining -= 4u) /* FETA_VSTDLIB_LOC_MEMCMP_X_X */ + { + /* #110 If current buffer values are unequal */ + if (pBuf1_32[pos] != pBuf2_32[pos]) + { + /* #120 Set corresponding result value and break the comparison */ + result = VStdLib_Loc_GetMemCmpNeqResult(pBuf1_32[pos], pBuf2_32[pos]); + break; + } + pos++; + } + + /* #130 If the buffers are still equal */ + if (result == VSTDLIB_MEM_CMP_RES_EQ) + { + /* #140 Compare the remaining bytes using byte-wise memcmp */ + result = VStdLib_Loc_MemCmp_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_8_ALIGNED_REMAINING */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pBuf1_32[pos], + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pBuf2_32[pos], + remaining); + } + + return result; +} + +/********************************************************************************************************************** + * VStdLib_Loc_MemCmp_32_Unaligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(sint8, VSTDLIB_CODE) VStdLib_Loc_MemCmp_32_Unaligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_32, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_8, + uint32_least nCnt, + uint8_least nBuf2Offset) +{ + /* ----- Local Variables ---------------------------------------------- */ + sint8 result; + + /* ----- Implementation ----------------------------------------------- */ + + /* #100 Compare the first bytes to reach the 32-bit boundary for buffer2 */ + result = VStdLib_Loc_MemCmp_8((P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR))&pBuf1_32[0u], /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_8_NBUF2OFFSET */ + pBuf2_8, nBuf2Offset); + + /* #110 If buffers are still equal */ + if (result == VSTDLIB_MEM_CMP_RES_EQ) + { + /* #120 Adjust pointer for buffer2 */ + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_32 = \ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR))&pBuf2_8[nBuf2Offset]; /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + uint32_least buf1Pos = 1u; /* 32-bit value at position 0 was already used in comparison above */ + uint32_least buf2Pos = 0u; /* First 32-bit value in 32 bit aligned buffer2 */ + uint32_least remaining = nCnt - 4u; /* 4 bytes were already used in comparison above (not compared bytes will be stored in 'prev') */ + + /* #130 Determine byte displacement properties for the 4-byte-wise comparison */ + + /* Calculate byte displacement dependent shift values */ + uint8_least prevShift = (uint8_least) ((nBuf2Offset << 3u) & VSTDLIB_MASK_31); + uint8_least xShift = 32u - prevShift; + + /* Save the not compared bytes, because of byte displacement */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + uint32 prev = pBuf1_32[0u] >> prevShift; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + uint32 prev = pBuf1_32[0u] << prevShift; +# endif + + /* #140 Linearly compare buffers 4-byte-wise using 32-bit accesses in a loop by correcting the byte displacement of buffer1 and buffer2 */ + for (; remaining >= 4u; remaining -= 4u) /* FETA_VSTDLIB_LOC_MEMCMP_32_UNALIGNED */ + { + uint32 x0, x1; + x1 = pBuf1_32[buf1Pos]; /* Save current 32-bit value */ + + /* Compare value: not compared bytes from previous comparison 'prev' plus bytes from current 32-bit value */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + x0 = prev | (x1 << xShift); +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + x0 = prev | (x1 >> xShift); +# endif + + /* #150 If current buffer values are unequal */ + if (x0 != pBuf2_32[buf2Pos]) + { + /* #160 Set corresponding result value and break the comparison */ + result = VStdLib_Loc_GetMemCmpNeqResult(x0, pBuf2_32[buf2Pos]); + break; + } + else + { + buf1Pos++; + buf2Pos++; + + /* Save the not compared bytes, because of byte displacement */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + prev = x1 >> prevShift; +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + prev = x1 << prevShift; +# endif + } + } + + /* #170 If the buffers are still equal */ + if (result == VSTDLIB_MEM_CMP_RES_EQ) + { + /* #180 Compare the remaining bytes from the byte displacement correction using byte-wise memcmp */ + /* At this point (4 - nBuf2Offset) bytes of buffer2 are not compared, which are contained in 'prev' from buffer1 */ + pBuf2_8 = (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR))&pBuf2_32[buf2Pos]; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + result = VStdLib_Loc_MemCmp_8((P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR))&prev, /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_8_CALC */ + pBuf2_8, (4u - (uint32_least)nBuf2Offset)); + } + + /* #190 If the buffers are still equal */ + /* After the last 32-bit alignment of buffer1, there may be 0 to 3 bytes that were not compared by the 4-byte-wise comparison */ + if (result == VSTDLIB_MEM_CMP_RES_EQ) + { + /* #200 Compare the remaining bytes using byte-wise memcmp */ + result = VStdLib_Loc_MemCmp_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_8_UNALIGNED_REMAINING */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pBuf1_32[buf1Pos], /* First byte after last 32-bit alignment */ + &pBuf2_8[(4u - nBuf2Offset)], /* First byte after 'prev' comparison */ + remaining); + } + } + + return result; +} + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ +#endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + + +#if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON) +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_IntType_32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_IntType_32( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt, + uint8 intType) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Execute integer type dependent copying and swapping */ + switch (intType) + { + case VSTDLIB_INTTYPE_16: + VStdLib_Loc_MemCpySwapEndian_Int16_32( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + (P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR))pDst, /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + pSrc8, + nCnt); + break; + + case VSTDLIB_INTTYPE_32: + VStdLib_Loc_MemCpySwapEndian_Int32_32( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR))pDst, /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + pSrc8, + nCnt); + break; + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + case VSTDLIB_INTTYPE_64: + VStdLib_Loc_MemCpySwapEndian_Int64_32( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + (P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR))pDst, /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + pSrc8, + nCnt); + break; +# endif + + default: + /* #20 Do not copy and swap for any unsupported intType */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + errorId = VSTDLIB_E_PARAM_INTTYPE; +# endif + break; + } + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_Loc_MemCpySwapEndian_8_32() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int16_32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +/* PRQA S 6030 1 */ /* MD_VStdLib_Metrics */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int16_32( + P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pDst16, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy and swap up to 32 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 32: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[30], &pDst16[15]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 30: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[28], &pDst16[14]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 28: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[26], &pDst16[13]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 26: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[24], &pDst16[12]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 24: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[22], &pDst16[11]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 22: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[20], &pDst16[10]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 20: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[18], &pDst16[9]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 18: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[16], &pDst16[8]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 16: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[14], &pDst16[7]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 14: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[12], &pDst16[6]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 12: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[10], &pDst16[5]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 10: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[8], &pDst16[4]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 8: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[6], &pDst16[3]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 6: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[4], &pDst16[2]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 4: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[2], &pDst16[1]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 2: + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[0], &pDst16[0]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idxSrc, idxDst = 0u; + + /* #20 Linearly copy and swap the bytes using a loop */ + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 2u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian(&pSrc8[idxSrc], &pDst16[idxDst]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + idxDst++; + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpySwapEndian_Int16_32() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int32_32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int32_32( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy and swap up to 32 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 32: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[28], &pDst32[7]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 28: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[24], &pDst32[6]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 24: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[20], &pDst32[5]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 20: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[16], &pDst32[4]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 16: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[12], &pDst32[3]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 12: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[8], &pDst32[2]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 8: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[4], &pDst32[1]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 4: + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[0], &pDst32[0]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idxSrc, idxDst = 0u; + + /* #20 Linearly copy and swap the bytes using a loop */ + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 4u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian(&pSrc8[idxSrc], &pDst32[idxDst]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + idxDst++; + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpySwapEndian_Int32_32() */ + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_Int64_32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_Int64_32( + P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR) pDst64, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint8_least nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #10 Copy and swap up to 32 bytes using a jump table */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (nCnt) + { + case 32: + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(&pSrc8[24], &pDst64[3]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 24: + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(&pSrc8[16], &pDst64[2]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 16: + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(&pSrc8[8], &pDst64[1]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + case 8: + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(&pSrc8[0], &pDst64[0]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + uint8_least idxSrc, idxDst = 0u; + + /* #20 Linearly copy and swap the bytes using a loop */ + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 8u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian(&pSrc8[idxSrc], &pDst64[idxDst]); /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + idxDst++; + } + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpySwapEndianInt64_8_32() */ + +# endif /* defined PLATFORM_SUPPORT_SINT64_UINT64 */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt, + uint8 intType) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Execute integer type dependent copying and swapping */ + switch (intType) + { + case VSTDLIB_INTTYPE_16: + VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned(pDst32, pSrc32, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + break; + + case VSTDLIB_INTTYPE_32: + VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned(pDst32, pSrc32, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + break; + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + case VSTDLIB_INTTYPE_64: + VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned(pDst32, pSrc32, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X */ + break; +# endif + + default: + /* #20 Do not copy and swap for any unsupported intType */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + errorId = VSTDLIB_E_PARAM_INTTYPE; +# endif + break; + } + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_Loc_MemCpySwapEndian_32_Aligned() */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; /* == sPos */ + uint32_least remaining; + uint32 x0, x1, x2, x3; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly copy and swap 16-byte blocks using 32-bit accesses in a loop */ + for (remaining = nCnt; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + x0 = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos]); + x1 = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos + 1u]); + x2 = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos + 2u]); + x3 = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos + 3u]); + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + } + +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #20 Copy and swap the remaining block using a jump table */ + /* Only a multiple of VSTDLIB_INTTYPE_16 is possible (precondition) - remaining count can be only 14, 12, 10, 8, 6, 4, 2 or 0 here */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (remaining) + { + case 12: + pDst32[dPos] = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 8: + pDst32[dPos] = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 4: + pDst32[dPos] = VStdLib_Loc_SwapEndianInt16_32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + break; + default: /* case 14, 10, 6, 2, 0 - 32-bit access too complex due to the next two 16-bit values are shared over two different 32-bit source values */ + /* Destination is also expected to be 16-bit aligned as described in precondition */ + VStdLib_Loc_MemCpySwapEndian_Int16_32( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT16_32_REMAINING */ + (P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], /* PRQA S 0310 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) remaining); + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + /* #30 Copy and swap the remaining block using a 16-bit-wise algorithm */ + /* Destination is also expected to be 16-bit aligned as described in precondition */ + VStdLib_Loc_MemCpySwapEndian_Int16_32( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT16_32_REMAINING */ + (P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], /* PRQA S 0310 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) remaining); + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned */ + +/********************************************************************************************************************** + * VStdLib_Loc_SwapEndianInt16_32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint32, VSTDLIB_CODE) VStdLib_Loc_SwapEndianInt16_32(uint32 src32) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32 dst; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Swap endianness of two 16-bit values in a 32-bit value */ + dst = VStdLib_SwapEndianUint16((uint16)((src32 & VSTDLIB_MASK_UPPER_TWO_BYTES) >> 16u)); + dst = ((uint32)dst << 16u) | (uint32)VStdLib_SwapEndianUint16((uint16)(src32 & VSTDLIB_MASK_LOWER_TWO_BYTES)); + + return dst; +} /* VStdLib_Loc_SwapEndianInt16_32 */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; /* == sPos */ + uint32_least remaining; + uint32 x0, x1, x2, x3; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly copy and swap 16-byte blocks using 32-bit accesses in a loop */ + for (remaining = nCnt; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + x0 = VStdLib_SwapEndianUint32(pSrc32[dPos]); + x1 = VStdLib_SwapEndianUint32(pSrc32[dPos + 1u]); + x2 = VStdLib_SwapEndianUint32(pSrc32[dPos + 2u]); + x3 = VStdLib_SwapEndianUint32(pSrc32[dPos + 3u]); + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + } + +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #20 Copy and swap the remaining block using a jump table */ + /* Only a multiple of VSTDLIB_INTTYPE_32 is possible (precondition) - remaining count can be only 12, 8, 4 or 0 here */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (remaining) + { + case 12: + pDst32[dPos] = VStdLib_SwapEndianUint32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 8: + pDst32[dPos] = VStdLib_SwapEndianUint32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + dPos++; + /* intentionally no break */ + case 4: + pDst32[dPos] = VStdLib_SwapEndianUint32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + /* #30 Copy and swap the remaining block using a 32-bit-wise algorithm */ + VStdLib_Loc_MemCpySwapEndian_Int32_32( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT32_32_REMAINING */ + &pDst32[dPos], + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) remaining); + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned( + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc32, + uint32_least nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least dPos = 0u; /* == sPos */ + uint32_least remaining; + uint32 x0, x1, x2, x3; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly copy and swap 16-byte blocks using 32-bit accesses in a loop */ + for (remaining = nCnt; remaining >= 16u; remaining -= 16u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + /* 64-bit value is shared over two 32-bit values - swap each 32-bit value and then the order of both values */ + /* 64-bit value */ + x1 = VStdLib_SwapEndianUint32(pSrc32[dPos]); + x0 = VStdLib_SwapEndianUint32(pSrc32[dPos + 1u]); + + /* 64-bit value */ + x3 = VStdLib_SwapEndianUint32(pSrc32[dPos + 2u]); + x2 = VStdLib_SwapEndianUint32(pSrc32[dPos + 3u]); + + pDst32[dPos] = x0; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 1u] = x1; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 2u] = x2; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + pDst32[dPos + 3u] = x3; /* SBSW_VSTDLIB_ACCESS_32_LOOP */ + dPos += 4u; + } + +# if (VSTDLIB_USE_JUMPTABLES == STD_ON) + + /* #20 Copy and swap the remaining block using a jump table */ + /* Only a multiple of VSTDLIB_INTTYPE_64 is possible (precondition) - remaining count can be only 8 or 0 here */ + /* PRQA S 2003 VSTDLIB_NO_CASE_BREAK */ /* MD_VStdLib_NoCaseBreak */ + switch (remaining) + { + case 8: + pDst32[dPos + 1u] = VStdLib_SwapEndianUint32(pSrc32[dPos]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + pDst32[dPos] = VStdLib_SwapEndianUint32(pSrc32[dPos + 1u]); /* SBSW_VSTDLIB_ACCESS_32_JUMPTABLE */ + /* intentionally no break */ + default: + /* nothing to do */ + break; + } + /* PRQA L:VSTDLIB_NO_CASE_BREAK */ + +# else /* VSTDLIB_USE_JUMPTABLES == STD_OFF */ + + /* #30 Copy and swap the remaining block using a 64-bit-wise algorithm */ + /* Destination is also expected to be 64-bit aligned as described in precondition */ + VStdLib_Loc_MemCpySwapEndian_Int64_32( /* SBSW_VSTDLIB_CALL_REMAINING */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT64_32_REMAINING */ + (P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR)) &pDst32[dPos], /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pSrc32[dPos], + (uint8_least) remaining); + +# endif /* VSTDLIB_USE_JUMPTABLES */ +} /* VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned */ + +# endif /* defined PLATFORM_SUPPORT_SINT64_UINT64 */ +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ + +/********************************************************************************************************************** + * VStdLib_Loc_MemCpySwapEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_MemCpySwapEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + uint32_least nCnt, + uint8 intType) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint32_least idxSrc, idxDst = 0u; + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly copy and swap nCnt bytes using a loop */ + switch (intType) + { + case VSTDLIB_INTTYPE_16: + { + P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pDst16 = \ + (P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 2u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint16SwapEndian( /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + &pSrc8[idxSrc], + &pDst16[idxDst]); + + idxDst++; + } + } + break; + + case VSTDLIB_INTTYPE_32: + { + P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst32 = \ + (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 4u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint32SwapEndian( /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + &pSrc8[idxSrc], + &pDst32[idxDst]); + + idxDst++; + } + } + break; + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) + case VSTDLIB_INTTYPE_64: + { + P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR) pDst64 = \ + (P2VAR(uint64, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + + for (idxSrc = 0u; idxSrc < nCnt; idxSrc += 8u) /* FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X */ + { + VStdLib_Loc_ConvertUint8ArrayToUint64SwapEndian( /* SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT */ + &pSrc8[idxSrc], + &pDst64[idxDst]); + + idxDst++; + } + } + break; +# endif /* defined PLATFORM_SUPPORT_SINT64_UINT64 */ + + default: + /* #20 Do not copy and swap for any unsupported intType */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + errorId = VSTDLIB_E_PARAM_INTTYPE; +# endif + break; + } + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_Loc_MemCpySwapEndian() */ + +#endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyConvertBitCounting() + **********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(VStdLib_CntType, VSTDLIB_CODE) VStdLib_Loc_BitCpyConvertBitCounting(VStdLib_CntType bitPos) +{ + VStdLib_CntType bitPosConverted = (VStdLib_CntType) ((7u - (bitPos & 7u)) + (8u * (bitPos >> 3u))); + + return bitPosConverted; +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyGetLastIterByte() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(VStdLib_CntType, VSTDLIB_CODE) VStdLib_Loc_BitCpyGetLastIterByte( + VStdLib_CntType lengthInBits) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #100 Calculate the last iteration byte from the length in bits */ + VStdLib_CntType lastIterByte = lengthInBits / 8u; + + /* #110 If the length in bits is not divisible by 8, increment the last iteration byte by 1 */ + if ((lengthInBits % 8u) != 0u) + { + lastIterByte++; + } + + return lastIterByte; +} + +#if ((VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyIter() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyIter( + P2VAR(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pIter, + VStdLib_CntType nBitOffset, + VStdLib_CntType nCnt) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #10 Initialize all iteration parameters */ + pIter->startByte = (VStdLib_CntType) (nBitOffset / 8u); /* SBSW_VSTDLIB_ACCESS_STRUCT_LOCAL */ + pIter->lastByte = VStdLib_Loc_BitCpyGetLastIterByte(nBitOffset + nCnt); /* SBSW_VSTDLIB_ACCESS_STRUCT_LOCAL */ + pIter->bitOffsetStartByte = (uint8) (nBitOffset % 8u); /* SBSW_VSTDLIB_ACCESS_STRUCT_LOCAL */ + /* converts monotone to sawtooth bit position and vice versa */ + pIter->bitOffsetEndByte = VStdLib_Loc_BitCpyGetOffsetInBitsEndByte(pIter->bitOffsetStartByte + nCnt); /* SBSW_VSTDLIB_ACCESS_STRUCT_LOCAL */ +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyGetOffsetInBitsEndByte() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyGetOffsetInBitsEndByte(VStdLib_CntType lengthInBits) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 lengthMod = (uint8) (lengthInBits % 8u); + uint8 offset = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 If the bit length is a multiple of 8 */ + if (lengthMod != 0u) + { + /* #110 Calculate the offset in last byte to copy to or from */ + offset = 8u - lengthMod; + } + + return offset; +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigEndianSrc_7() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigEndianSrc_7( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + VStdLib_CntType dstByteIdx, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift, + uint8 dstBitMask) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #10 Read source byte */ + uint8 srcByte = VStdLib_Loc_BitCpyBigEndianSrc( + pSrc8, + srcByteIdx, + pSrcIter, + srcShift); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + + /* #20 Read destination byte */ + uint8 tmpByte = pDst8[dstByteIdx]; + + /* #30 Get relevant bits to copy */ + srcByte &= dstBitMask; + tmpByte &= (~dstBitMask); + tmpByte |= srcByte; + + /* #40 Copy the bits */ + pDst8[dstByteIdx] = tmpByte; /* SBSW_VSTDLIB_ACCESS_8 */ +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleEndianSrc_7() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleEndianSrc_7( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + VStdLib_CntType dstByteIdx, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift, + uint8 dstBitMask) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #10 Read source byte */ + uint8 srcByte = VStdLib_Loc_BitCpyLittleEndianSrc( + pSrc8, + srcByteIdx, + pSrcIter, + srcShift); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + + /* #20 Read destination byte */ + uint8 tmpByte = pDst8[dstByteIdx]; + + /* #30 Get relevant bits to copy */ + srcByte &= dstBitMask; + tmpByte &= (~dstBitMask); + tmpByte |= srcByte; + + /* #40 Copy the bits */ + pDst8[dstByteIdx] = tmpByte; /* SBSW_VSTDLIB_ACCESS_8 */ +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 srcByte = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'srcByteIdx' against the index of the last iteration source byte */ + if (srcByteIdx < pSrcIter->lastByte) + { + srcByte = pSrc8[srcByteIdx]; + } + /* #20 If the source shift is not 0 */ + if (srcShift != 0) + { + /* #30 If the source shift is bigger than 0, use VStdLib_Loc_BitCpyShiftRight_BigEndianSrc() + * to shift the source byte to the right and merge with missing bits from the previous relevant source byte */ + if (srcShift > 0) + { + VStdLib_Loc_BitCpyShiftRight_BigEndianSrc(pSrc8, &srcByte, srcByteIdx, pSrcIter, srcShift); /* SBSW_VSTDLIB_CALL_MODIFIABLE_SRCBYTE */ + } + /* #40 Else, use VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc() to shift the source byte to the left + * and merge with missing bits from the next relevant source byte */ + else + { + VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc(pSrc8, &srcByte, srcByteIdx, pSrcIter, srcShift); /* SBSW_VSTDLIB_CALL_MODIFIABLE_SRCBYTE */ + } + } + + return srcByte; +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 srcByte = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'srcByteIdx' against the index of the last iteration source byte */ + if (srcByteIdx < pSrcIter->lastByte) + { + srcByte = pSrc8[srcByteIdx]; + } + /* #20 If the source shift is not 0 */ + if (srcShift != 0) + { + /* #30 If the source shift is bigger than 0, use VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc() + * to shift the source byte to the right and merge with missing bits from the next relevant source byte */ + if (srcShift > 0) + { + VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc(pSrc8, &srcByte, srcByteIdx, pSrcIter, srcShift); /* SBSW_VSTDLIB_CALL_MODIFIABLE_SRCBYTE */ + } + /* #40 Else, use VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc() to shift the source byte to the left + * and merge with missing bits from the previous relevant source byte */ + else + { + VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc(pSrc8, &srcByte, srcByteIdx, pSrcIter, srcShift); /* SBSW_VSTDLIB_CALL_MODIFIABLE_SRCBYTE */ + } + } + + return srcByte; +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftRight_BigEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftRight_BigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 unsignedSrcShift = (uint8) srcShift; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Shift the source byte to the right */ + *(pSrcByte) >>= unsignedSrcShift; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + + /* #20 If bits are missing to fill destination byte get missing bits from previous relevant source byte + * and merge them with current source byte */ + if (srcByteIdx > pSrcIter->startByte) + { + uint8 missingBits = (uint8) (pSrc8[srcByteIdx - 1u] << (8u - unsignedSrcShift)); + *(pSrcByte) |= missingBits; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftLeft_BigEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 unsignedSrcShift = (uint8) (-srcShift); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Shift the source byte to the left */ + *(pSrcByte) <<= unsignedSrcShift; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + + /* #20 If bits are missing to fill destination byte get missing bits from next relevant source byte + * and merge them with current source byte */ + if ((srcByteIdx + 1u) < pSrcIter->lastByte) + { + uint8 missingBits = (pSrc8[srcByteIdx + 1u] >> (8u - unsignedSrcShift)); + *(pSrcByte) |= missingBits; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftRight_LittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 unsignedSrcShift = (uint8) srcShift; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Shift the source byte to the right */ + *(pSrcByte) >>= unsignedSrcShift; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + + /* #20 If bits are missing to fill destination byte get missing bits from next relevant source byte + * and merge them with current source byte */ + if ((srcByteIdx + 1u) < pSrcIter->lastByte) + { + uint8 missingBits = (uint8) (pSrc8[srcByteIdx + 1u] << (8u - unsignedSrcShift)); + *(pSrcByte) |= missingBits; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyShiftLeft_LittleEndianSrc( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcByte, + VStdLib_CntType srcByteIdx, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter, + sint8 srcShift) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 unsignedSrcShift = (uint8) (-srcShift); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Shift the source byte to the left */ + *(pSrcByte) <<= unsignedSrcShift; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + + /* #20 If bits are missing to fill destination byte get missing bits from previous relevant source byte + * and merge them with current source byte */ + if (srcByteIdx > pSrcIter->startByte) + { + uint8 missingBits = (pSrc8[srcByteIdx - 1u] >> (8u - unsignedSrcShift)); + *(pSrcByte) |= missingBits; /* SBSW_VSTDLIB_ACCESS_LOCAL */ + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpySwapEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpySwapEndian( + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pDstIter, + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8, + P2CONST(VStdLib_BitCpyIterType, AUTOMATIC, VSTDLIB_VAR_FAR) pSrcIter) +{ + VStdLib_CntType idx; /* Explicitly not initialized. Used as for-loop counter (first usage in for-initialization statement) */ + VStdLib_CntType srcIdx = (VStdLib_CntType) (pSrcIter->lastByte - 1u); + + for (idx = pDstIter->startByte; idx < pDstIter->lastByte; idx++) /* FETA_VSTDLIB_LOC_BITCPYSWAPENDIAN */ + { + pDst8[idx] = pSrc8[srcIdx]; /* SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX */ + srcIdx--; + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* #10 If parameters 'nDstBitOffsetMon' and 'nSrcBitOffsetMon' are both 0 and parameter 'nCnt' is a multiple of 8 */ + if ((nDstBitOffsetMon == 0u) && (nSrcBitOffsetMon == 0u) && ((nCnt % 8u) == 0u)) + { + VStdLib_CntType nCntInBytes = nCnt / 8u; + + /* #20 Use VStdLib_MemCpy algorithm to copy data */ + VStdLib_MemCpy(pDst, pSrc, nCntInBytes); /* SBSW_VSTDLIB_CALL_CONVERTED_BITCNT */ /* FETA_VSTDLIB_CALL_MEMCPY_IN_LOC_BITCPY */ + } + /* #30 Else */ + else + { + VStdLib_BitCpyIterType srcIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_BitCpyIterType dstIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_CntType dstByteIdx; /* Explicitly not initialized. Is initialized after call of VStdLib_Loc_BitCpyIter() */ + VStdLib_CntType srcByteIdx; /* Explicitly not initialized. Is initialized after call of VStdLib_Loc_BitCpyIter() */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + sint8 srcShift = 0; + uint8 bitMaskStart = 0xFFu; + uint8 bitMaskEnd = 0xFFu; + + /* #40 Use VStdLib_Loc_BitCpyIter to set the iteration parameters */ + VStdLib_Loc_BitCpyIter( + &srcIter, + nSrcBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + VStdLib_Loc_BitCpyIter( + &dstIter, + nDstBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + dstByteIdx = dstIter.startByte; + srcByteIdx = srcIter.startByte; + + /* #50 Set the source shift if the bit offset of the leftmost destination and source byte are not equal */ + if (dstIter.bitOffsetStartByte != srcIter.bitOffsetStartByte) + { + srcShift = (sint8) dstIter.bitOffsetStartByte - (sint8) srcIter.bitOffsetStartByte; + } + + /* Set the bit masks for the first and last destination byte */ + bitMaskStart >>= dstIter.bitOffsetStartByte; + bitMaskEnd <<= dstIter.bitOffsetEndByte; + + /* #60 If the first destination byte to copy to is equal to the last byte to copy to, copy relevant bits to only this + * destination byte */ + if (dstIter.startByte == (dstIter.lastByte - 1u)) + { + /* Adjust start bit mask */ + bitMaskStart &= bitMaskEnd; + + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + /* #70 Else */ + else + { + /* #80 Use VStdLib_Loc_BitCpyBigEndianSrc_7() to copy the first bits separately */ + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + + srcByteIdx++; + dstByteIdx++; + + /* #90 Use VStdLib_Loc_BitCpyBigEndianSrc() to copy the bits inbetween the first and last source byte byte-wise */ + for (; dstByteIdx < (dstIter.lastByte - 1u); dstByteIdx++) /* FETA_VSTDLIB_LOC_BITCPY */ + { + pDst8[dstByteIdx] = VStdLib_Loc_BitCpyBigEndianSrc( + pSrc8, + srcByteIdx, + &srcIter, + srcShift); /* SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX */ /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ + + srcByteIdx++; + } + + /* #100 Use VStdLib_Loc_BitCpyBigEndianSrc_7() to copy the last bits separately */ + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskEnd); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + } +} /* VStdLib_Loc_BitCpyBigToBigEndian() */ + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyBigToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + VStdLib_BitCpyIterType srcIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_BitCpyIterType dstIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + + /* #10 Use VStdLib_Loc_BitCpyIter to set the iteration parameters */ + VStdLib_Loc_BitCpyIter( + &srcIter, + nSrcBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + VStdLib_Loc_BitCpyIter( + &dstIter, + nDstBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + /* #20 If parameter 'nDstBitOffsetSaw' and 'nSrcBitOffsetMon' are both 0 and parameter 'nCnt' is a multiple of 8 */ + if ((nDstBitOffsetSaw == 0u) && (nSrcBitOffsetMon == 0u) && ((nCnt % 8u) == 0u)) + { + /* #30 Use VStdLib_Loc_BitCpySwapEndian algorithm to copy data in reverse order */ + VStdLib_Loc_BitCpySwapEndian(pDst8, &dstIter, pSrc8, &srcIter); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ /* FETA_VSTDLIB_CALL_LOC_BITCPYSWAPENDIAN */ + } + /* #40 Else */ + else + { + sint8 srcShift = 0; + VStdLib_CntType dstByteIdx = dstIter.startByte; + VStdLib_CntType srcByteIdx = (VStdLib_CntType) (srcIter.lastByte - 1u); + uint8 bitMaskStart = 0xFFu; + uint8 bitMaskEnd = 0xFFu; + + /* #50 Set the source shift if the bit offset of the leftmost destination byte and the bit offset of + * the rightmost source byte are not equal */ + if (dstIter.bitOffsetStartByte != srcIter.bitOffsetEndByte) + { + srcShift = (sint8) srcIter.bitOffsetEndByte - (sint8) dstIter.bitOffsetStartByte; + } + + /* Set the bit masks for the first and last destination byte */ + bitMaskStart <<= dstIter.bitOffsetStartByte; + bitMaskEnd >>= dstIter.bitOffsetEndByte; + + /* #60 If the first destination byte to copy to is equal to the last byte to copy to, copy relevant bits to only this + * destination byte */ + if (dstIter.startByte == (dstIter.lastByte - 1u)) + { + /* Adjust start bit mask */ + bitMaskStart &= bitMaskEnd; + + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + /* #70 Else */ + else + { + /* #80 Use VStdLib_Loc_BitCpyBigEndianSrc_7() to copy the first bits separately */ + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + + srcByteIdx--; + dstByteIdx++; + + /* #90 Use VStdLib_Loc_BitCpyBigEndianSrc() to copy the bits inbetween the first and last source byte byte-wise */ + for (; dstByteIdx < (dstIter.lastByte - 1u); dstByteIdx++) /* FETA_VSTDLIB_LOC_BITCPY */ + { + pDst8[dstByteIdx] = VStdLib_Loc_BitCpyBigEndianSrc( + pSrc8, + srcByteIdx, + &srcIter, + srcShift); /* SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX */ /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ + + srcByteIdx--; + } + + /* #100 Use VStdLib_Loc_BitCpyBigEndianSrc_7() to copy the last bits separately */ + VStdLib_Loc_BitCpyBigEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskEnd); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + } +} /* VStdLib_Loc_BitCpyBigToLittleEndian() */ + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + VStdLib_BitCpyIterType srcIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_BitCpyIterType dstIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + + /* #10 Use VStdLib_Loc_BitCpyIter to set the iteration parameters */ + VStdLib_Loc_BitCpyIter( + &srcIter, + nSrcBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + VStdLib_Loc_BitCpyIter( + &dstIter, + nDstBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + /* #20 If parameter 'nDstBitOffsetSaw' and 'nSrcBitOffsetMon' are both 0 and parameter 'nCnt' is a multiple of 8 */ + if ((nDstBitOffsetMon == 0u) && (nSrcBitOffsetSaw == 0u) && ((nCnt % 8u) == 0u)) + { + /* #30 Use VStdLib_Loc_BitCpySwapEndian algorithm to copy data in reverse order */ + VStdLib_Loc_BitCpySwapEndian(pDst8, &dstIter, pSrc8, &srcIter); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ /* FETA_VSTDLIB_CALL_LOC_BITCPYSWAPENDIAN */ + } + /* #40 Else */ + else + { + sint8 srcShift = 0; + VStdLib_CntType dstByteIdx = dstIter.startByte; + VStdLib_CntType srcByteIdx = (VStdLib_CntType) (srcIter.lastByte - 1u); + uint8 bitMaskStart = 0xFFu; + uint8 bitMaskEnd = 0xFFu; + + /* #50 Set the source shift if the bit offset of the leftmost destination byte and the bit offset of + * the rightmost source byte are not equal */ + if (dstIter.bitOffsetStartByte != srcIter.bitOffsetEndByte) + { + srcShift = (sint8) dstIter.bitOffsetStartByte - (sint8) srcIter.bitOffsetEndByte; + } + + /* Set the bit masks for the first and last destination byte */ + bitMaskStart >>= dstIter.bitOffsetStartByte; + bitMaskEnd <<= dstIter.bitOffsetEndByte; + + /* #60 If the first destination byte to copy to is equal to the last byte to copy to, copy relevant bits to only this + * destination byte */ + if (dstIter.startByte == (dstIter.lastByte - 1u)) + { + /* Adjust start bit mask */ + bitMaskStart &= bitMaskEnd; + + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + /* #70 Else */ + else + { + /* #80 Use VStdLib_Loc_BitCpyLittleEndianSrc_7() to copy the first bits separately */ + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + + srcByteIdx--; + dstByteIdx++; + + /* #90 Use VStdLib_Loc_BitCpyLittleEndianSrc() to copy the bits inbetween the first and last source byte byte-wise */ + for (; dstByteIdx < (dstIter.lastByte - 1u); dstByteIdx++) /* FETA_VSTDLIB_LOC_BITCPY */ + { + pDst8[dstByteIdx] = VStdLib_Loc_BitCpyLittleEndianSrc( + pSrc8, + srcByteIdx, + &srcIter, + srcShift); /* SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX */ /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ + + srcByteIdx--; + } + + /* #100 Use VStdLib_Loc_BitCpyLittleEndianSrc_7() to copy the last bits separately */ + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskEnd); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + } +} /* VStdLib_Loc_BitCpyLittleToBigEndian() */ + +/********************************************************************************************************************** + * VStdLib_Loc_BitCpyLittleToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_BitCpyLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* #10 If parameters 'nDstBitOffsetSaw' and 'nSrcBitOffsetSaw' are both 0 and parameter 'nCnt' is a multiple of 8 */ + if ((nDstBitOffsetSaw == 0u) && (nSrcBitOffsetSaw == 0u) && ((nCnt % 8u) == 0u)) + { + VStdLib_CntType nCntInBytes = nCnt / 8u; + + /* #20 Use VStdLib_MemCpy algorithm to copy data */ + VStdLib_MemCpy(pDst, pSrc, nCntInBytes); /* SBSW_VSTDLIB_CALL_CONVERTED_BITCNT */ /* FETA_VSTDLIB_CALL_MEMCPY_IN_LOC_BITCPY */ + } + /* #30 Else */ + else + { + VStdLib_BitCpyIterType srcIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_BitCpyIterType dstIter; /* Struct is explicitly not initialized. Is initialized with call of VStdLib_Loc_BitCpyIter() by passing address of struct */ + VStdLib_CntType dstByteIdx; /* Explicitly not initialized. Is initialized after call of VStdLib_Loc_BitCpyIter() */ + VStdLib_CntType srcByteIdx; /* Explicitly not initialized. Is initialized after call of VStdLib_Loc_BitCpyIter() */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + sint8 srcShift = 0; + uint8 bitMaskStart = 0xFFu; + uint8 bitMaskEnd = 0xFFu; + + /* #40 Use VStdLib_Loc_BitCpyIter to set the iteration parameters */ + VStdLib_Loc_BitCpyIter( + &srcIter, + nSrcBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + VStdLib_Loc_BitCpyIter( + &dstIter, + nDstBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_MODIFIABLE_ITER */ + + dstByteIdx = dstIter.startByte; + srcByteIdx = srcIter.startByte; + + + /* #50 Set the source shift if the bit offset of the leftmost destination and source byte are not equal */ + if (dstIter.bitOffsetStartByte != srcIter.bitOffsetStartByte) + { + srcShift = (sint8) srcIter.bitOffsetStartByte - (sint8) dstIter.bitOffsetStartByte; + } + + /* Set the bit masks for the first and last destination byte */ + bitMaskStart <<= dstIter.bitOffsetStartByte; + bitMaskEnd >>= dstIter.bitOffsetEndByte; + + /* #60 If the first destination byte to copy to is equal to the last byte to copy to, copy relevant bits to only this + * destination byte */ + if (dstIter.startByte == (dstIter.lastByte - 1u)) + { + /* Adjust start bit mask */ + bitMaskStart &= bitMaskEnd; + + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + /* #70 Else */ + else + { + /* #80 Use VStdLib_Loc_BitCpyLittleEndianSrc_7() to copy the first bits separately */ + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskStart); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + + srcByteIdx++; + dstByteIdx++; + + /* #90 Use VStdLib_Loc_BitCpyLittleEndianSrc() to copy the bits inbetween the first and last source byte byte-wise */ + for (; dstByteIdx < (dstIter.lastByte - 1u); dstByteIdx++) /* FETA_VSTDLIB_LOC_BITCPY */ + { + pDst8[dstByteIdx] = VStdLib_Loc_BitCpyLittleEndianSrc( + pSrc8, + srcByteIdx, + &srcIter, + srcShift); /* SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX */ /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ + + srcByteIdx++; + } + + /* #100 Use VStdLib_Loc_BitCpyLittleEndianSrc_7() to copy the last bits separately */ + VStdLib_Loc_BitCpyLittleEndianSrc_7( + pDst8, + dstByteIdx, + pSrc8, + srcByteIdx, + &srcIter, + srcShift, + bitMaskEnd); /* SBSW_VSTDLIB_CALL_MODIFIED_IDX */ + } + } +} /* VStdLib_Loc_BitCpyLittleToLittleEndian() */ + +#endif /* (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON) */ + +#if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** +* VStdLib_Loc_GetMemCheckResult() +*********************************************************************************************************************/ +/*! +* Internal comment removed. + * + * +*/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_Loc_GetMemCheckResult( + uint32 nBufValue, + uint32 nPattern, + P2VAR(Std_ReturnType, AUTOMATIC, VSTDLIB_VAR_FAR) pRetVal, + Std_ReturnType errorCode) +{ + /* ----- Implementation ----------------------------------------------- */ + /* #10 If the buffer value and pattern are not equal, store errorCode at pRetVal */ + if (nBufValue != nPattern) + { + *(pRetVal) = errorCode; /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + } +} + +/********************************************************************************************************************** + * VStdLib_Loc_MemCheck_8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_Loc_MemCheck_8( + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf8, + uint8 nPattern, + uint32_least nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint32_least idx = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly check the bytes using a loop */ + for (; ((idx < nCnt) && (retVal == E_OK)); idx++) /* FETA_VSTDLIB_LOC_MEMCHECK_X_NCNT, FETA_VSTDLIB_LOC_MEMCHECK_X_RETVAL */ + { + VStdLib_Loc_GetMemCheckResult( /* SBSW_VSTDLIB_CALL_MODIFIABLE_RETVAL */ + pBuf8[idx], + nPattern, + &retVal, + errorCode); + } + + return retVal; +} /* VStdLib_Loc_MemCheck_8() */ + +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + +/********************************************************************************************************************** + * VStdLib_Loc_MemCheck_32_Aligned() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_Loc_MemCheck_32_Aligned( + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf32, + uint8 nPattern, + uint32_least nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint32_least dPos = 0u; + uint32_least remaining = nCnt; + uint32 nPattern32 = + (uint32)(((uint32)nPattern << 24u) | ((uint32)nPattern << 16u) | ((uint32)nPattern << 8u) | nPattern); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Linearly check 4-byte-wise using 32-bit accesses in a loop */ + for (; ((remaining >= 4u) && (retVal == E_OK)); remaining -= 4u) /* FETA_VSTDLIB_LOC_MEMCHECK_X_NCNT, FETA_VSTDLIB_LOC_MEMCHECK_X_RETVAL */ + { + VStdLib_Loc_GetMemCheckResult( /* SBSW_VSTDLIB_CALL_MODIFIABLE_RETVAL */ + pBuf32[dPos], + nPattern32, + &retVal, + errorCode); + dPos++; + } + + /* #20 If no mismatch was found, check the remaining bytes using a byte-wise algorithm */ + if (retVal == E_OK) + { + retVal = VStdLib_Loc_MemCheck_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCHECK_8_REMAINING */ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) &pBuf32[dPos], + nPattern, + remaining, + errorCode); + } + + return retVal; +} /* VStdLib_Loc_MemCheck_32_Aligned() */ + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON */ +#endif /* VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTIONS != STD_ON */ + +#if ((VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && \ + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInByte() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInByte(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the upper nibble contain a set bit? */ + if ((value & VSTDLIB_MASK_UPPER_NIBBLE) != 0u) + { + /* #110 Shift upper nibble in lower nibble and adapt postion */ + value >>= 4u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 4u; + } + + /* #200 Determine bit position in lower nibble */ + pos += VStdLib_Loc_GetHighestBitPosOneInNibble(value); + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInByte() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInByte(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the lower nibble contain a set bit? */ + if ((value & VSTDLIB_MASK_LOWER_NIBBLE) != 0u) + { + /* #110 Mask lower nibble */ + value &= VSTDLIB_MASK_LOWER_NIBBLE; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + } + else + { + /* #120 Shift upper nibble in lower nibble and adapt postion */ + value >>= 4u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 4u; + } + + /* #200 Determine bit position in lower nibble */ + pos += VStdLib_Loc_GetLowestBitPosOneInNibble(value); + + return pos; +} + +#endif /* (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || \ + ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInTwoBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInTwoBytes(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the upper byte contain a set bit? */ + if ((value & VSTDLIB_MASK_UPPER_BYTE) != 0u) + { + /* #110 Shift upper byte in lower byte and adapt postion */ + value >>= 8u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 8u; + } + + /* #200 Determine bit position in lower byte */ + pos += VStdLib_Loc_GetHighestBitPosOneInByte((uint8)(value)); + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInTwoBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInTwoBytes(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the lower byte contain a set bit? */ + if ((value & VSTDLIB_MASK_LOWER_BYTE) != 0u) + { + /* #110 Mask lower byte */ + value &= VSTDLIB_MASK_LOWER_BYTE; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + } + else + { + /* #120 Shift upper byte in lower byte and adapt postion */ + value >>= 8u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 8u; + } + + /* #200 Determine bit position in lower byte */ + pos += VStdLib_Loc_GetLowestBitPosOneInByte((uint8)(value)); + + return pos; +} + +#endif /* (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || + ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && \ + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON))) + + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInFourBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInFourBytes(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the upper two bytes contain a set bit? */ + if ((value & VSTDLIB_MASK_UPPER_TWO_BYTES) != 0u) + { + /* #110 Shift upper two bytes in lower two bytes and adapt postion */ + value >>= 16u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 16u; + } + + /* #200 Determine bit position in lower two bytes */ + pos += VStdLib_Loc_GetHighestBitPosOneInTwoBytes((uint16)(value)); + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInFourBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInFourBytes(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the lower two bytes contain a set bit? */ + if ((value & VSTDLIB_MASK_LOWER_TWO_BYTES) != 0u) + { + /* #110 Mask lower two bytes */ + value &= VSTDLIB_MASK_LOWER_TWO_BYTES; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + } + else + { + /* #120 Shift upper two bytes in lower two bytes and adapt postion */ + value >>= 16u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 16u; + } + + /* #200 Determine bit position in lower two bytes */ + pos += VStdLib_Loc_GetLowestBitPosOneInTwoBytes((uint16)(value)); + + return pos; +} + +#endif /* (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) || ((defined PLATFORM_SUPPORT_SINT64_UINT64) && + (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) */ + +#if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_Loc_GetHighestBitPosOneInEightBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetHighestBitPosOneInEightBytes(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the upper four bytes contain a set bit? */ + if ((value & VSTDLIB_MASK_UPPER_FOUR_BYTES) != 0u) + { + /* #110 Shift upper four bytes in lower four bytes and adapt postion */ + value >>= 32u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 32u; + } + + /* #200 Determine bit position in lower four bytes */ + pos += VStdLib_Loc_GetHighestBitPosOneInFourBytes((uint32)(value)); + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_Loc_GetLowestBitPosOneInEightBytes() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint8, VSTDLIB_CODE) VStdLib_Loc_GetLowestBitPosOneInEightBytes(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = 0u; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Does the lower four bytes contain a set bit? */ + if ((value & VSTDLIB_MASK_LOWER_FOUR_BYTES) != 0u) + { + /* #110 Mask lower four bytes */ + value &= VSTDLIB_MASK_LOWER_FOUR_BYTES; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + } + else + { + /* #120 Shift upper four bytes in lower four bytes and adapt postion */ + value >>= 32u; /* PRQA S 1338 */ /* MD_VStdLib_ParamValueMod */ + pos = 32u; + } + + /* #200 Determine bit position in lower four bytes */ + pos += VStdLib_Loc_GetLowestBitPosOneInFourBytes((uint32)(value)); + + return pos; +} + +#endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64 ) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +#if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemSet() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemSet(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + uint8 nPattern, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'pDst' */ + if (pDst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + + /* #20 If less than 32 bytes have to be initialized */ + if (nCnt < 32u) + { + /* #30 Use a byte-wise algorithm */ + VStdLib_Loc_MemSet_8_31( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMSET_X_X */ + pDst8, + nPattern, + (uint8_least) nCnt); + } + /* #40 Else */ + else + { + /* #50 Get the destination pointer offset to the next 32-bit boundary */ + uint8_least nDstOffset = VSTDLIB_ALIGN_OFFSET(pDst8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + + /* #60 If the destination is not aligned */ + if (nDstOffset != 0u) + { + /* #70 Initialize the amount of bytes to reach the alignment boundary and adjust the pointer */ + VStdLib_Loc_MemSet_8_3( /* SBSW_VSTDLIB_CALL_MODIFIED_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMSET_8_3 */ + pDst8, + nPattern, + nDstOffset); + + pDst8 = &pDst8[nDstOffset]; + nCnt -= nDstOffset; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + } + + /* #80 The pointer is aligned, use the 32-bit aligned memset */ + VStdLib_Loc_MemSet_32_Aligned( /* SBSW_VSTDLIB_CALL_MODIFIED_PTR_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMSET_X_X */ + (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + nPattern, + nCnt); + } + +# else /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_OFF */ + + VStdLib_CntType idx; + + /* #90 Linearly initialize nCnt bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_MEMSET */ + { + pDst8[idx] = nPattern; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION */ + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_SET, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_MemSet() */ + +/********************************************************************************************************************** + * VStdLib_MemCpy() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2VAR(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + + /* #20 If less than 32 bytes have to be copied */ + if (nCnt < 32u) + { + /* #30 Use a byte-wise algorithm */ + VStdLib_Loc_MemCpy_8_31( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X */ + pDst8, + pSrc8, + (uint8_least) nCnt); + } + /* #40 Else */ + else + { + /* #50 Get the source pointer offset to the next 32-bit boundary */ + uint8_least nSrcOffset = VSTDLIB_ALIGN_OFFSET(pSrc8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + uint8_least nDstOffset; + + /* #60 If the source is not aligned */ + if (nSrcOffset != 0u) + { + /* #70 Copy the amount of bytes to reach the alignment boundary and adjust the pointers */ + VStdLib_Loc_MemCpy_8_3( /* SBSW_VSTDLIB_CALL_MODIFIED_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_8_3 */ + pDst8, + pSrc8, + nSrcOffset); + + pSrc8 = &pSrc8[nSrcOffset]; + pDst8 = &pDst8[nSrcOffset]; + nCnt -= nSrcOffset; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + } + + /* #80 Get the destination pointer offset to the next 32-bit boundary */ + nDstOffset = VSTDLIB_ALIGN_OFFSET(pDst8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + + /* #90 If destination is aligned */ + if (nDstOffset == 0u) + { + /* #100 Both pointers are aligned, use the 32-bit aligned memcpy */ + VStdLib_Loc_MemCpy_32_Aligned( /* SBSW_VSTDLIB_CALL_MODIFIED_PTR_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X */ + (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + nCnt); + } + /* #110 Else */ + else + { + /* #120 Use the 32-bit unaligned memcpy */ + VStdLib_Loc_MemCpy_32_Unaligned( /* SBSW_VSTDLIB_CALL_MODIFIED_PTR_CNT */ /* FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X, FETA_VSTDLIB_CALL_LOC_MEMCPY_32_UNALIGNED_NDSTOFFSET */ + pDst8, + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + nCnt, + nDstOffset); + } + } + +# else /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_OFF */ + + VStdLib_CntType idx; + + /* #130 Linearly copy nCnt bytes using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_MEMCPY */ + { + pDst8[idx] = pSrc8[idx]; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION */ + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_MemCpy() */ + +/********************************************************************************************************************** + * VStdLib_MemCpy16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy16(P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + VStdLib_CntType idx; + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #20 Linearly copy nCnt 16-bit blocks using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_MEMCPY */ + { + pDst[idx] = pSrc[idx]; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_16, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_MemCpy16() */ + +/********************************************************************************************************************** + * VStdLib_MemCpy32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy32(P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + VStdLib_CntType idx; + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #20 Linearly copy nCnt 32-bit blocks using a loop */ + for (idx = 0u; idx < nCnt; idx++) /* FETA_VSTDLIB_MEMCPY */ + { + pDst[idx] = pSrc[idx]; /* SBSW_VSTDLIB_ACCESS_LOOP */ + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_32, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_MemCpy32() */ + +#endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_MemCpy_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy_s(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (nCnt > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + } + else + { + /* #20 Call VStdLib_MemCpy() */ + VStdLib_MemCpy(pDst, pSrc, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_MEMCPY */ + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif +} /* VStdLib_MemCpy_s() */ + +/********************************************************************************************************************** + * VStdLib_MemCpy_Return_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpy_Return_s(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + Std_ReturnType retVal = E_OK; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (nCnt > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_MemCpy() */ + VStdLib_MemCpy(pDst, pSrc, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_MEMCPY */ + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} /* VStdLib_MemCpy_Return_s() */ + +#if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCmp() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(sint8, VSTDLIB_CODE) VStdLib_MemCmp( + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1_8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR))pBuf1; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2_8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR))pBuf2; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + sint8 result = VSTDLIB_MEM_CMP_RES_EQ; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'pBuf1' */ + if (pBuf1 == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + result = VSTDLIB_MEM_CMP_RES_L; + } + /* #20 Check parameter 'pBuf2' */ + else if (pBuf2 == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + result = VSTDLIB_MEM_CMP_RES_G; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 If buffer1 and buffer2 can be unequal */ + if (pBuf1 != pBuf2) + { +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + /* #110 If less than 32 bytes have to be compared */ + if (nCnt < 32u) + { + /* #120 Use byte-wise memcmp */ + result = VStdLib_Loc_MemCmp_8(pBuf1_8, pBuf2_8, nCnt); /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X */ + } + /* #130 Else */ + else + { + /* #140 Get the pointer offset from buffer1 to the next 32-bit boundary */ + uint8_least nBuf1Offset = VSTDLIB_ALIGN_OFFSET(pBuf1_8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + + /* #150 If buffer1 is not aligned */ + if (nBuf1Offset != 0u) + { + /* #160 Compare the amount of bytes to reach the alignment boundary of buffer1 */ + result = VStdLib_Loc_MemCmp_8(pBuf1_8, pBuf2_8, nBuf1Offset); /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_8_NBUF1OFFSET */ + } + + /* #170 If buffers are still equal */ + if (result == VSTDLIB_MEM_CMP_RES_EQ) + { + uint8_least nBuf2Offset; + + /* #180 Adjust the pointers for buffer1 and buffer2 */ + pBuf1_8 = &pBuf1_8[nBuf1Offset]; + pBuf2_8 = &pBuf2_8[nBuf1Offset]; + nCnt -= nBuf1Offset; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + + /* #190 Get the pointer offset from buffer2 to the next 32-bit boundary */ + nBuf2Offset = VSTDLIB_ALIGN_OFFSET(pBuf2_8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + + /* #200 If buffer2 is aligned */ + if (nBuf2Offset == 0u) + { + /* #210 Both pointers are aligned, use the 32-bit aligned memcmp */ + result = VStdLib_Loc_MemCmp_32_Aligned( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pBuf1_8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pBuf2_8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + nCnt); + } + /* #220 Else buffer2 is not aligned and buffer 1 is aligned */ + else + { + /* #230 Use the 32-bit unaligned memcmp */ + result = VStdLib_Loc_MemCmp_32_Unaligned( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X, FETA_VSTDLIB_CALL_LOC_MEMCMP_32_UNALIGNED_NBUF2OFFSET */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pBuf1_8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + pBuf2_8, + nCnt, + nBuf2Offset); + } + } + } +# else /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_OFF */ + + /* #240 Use byte-wise memcmp */ + result = VStdLib_Loc_MemCmp_8(pBuf1_8, pBuf2_8, nCnt); /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X */ + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION */ + } + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_CMP, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif + + return result; +} + +#endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +#if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ +/* PRQA S 6080 1 */ /* MD_MSR_STMIF */ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpySwapEndian(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType) +{ + /* ----- Local Variables ---------------------------------------------- */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ +# if ((VSTDLIB_DEV_ERROR_DETECT == STD_ON) || (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON)) + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pDst8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ +# endif + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Check parameter 'pDst' is aligned according to the integer type */ +# if (CPU_TYPE == CPU_TYPE_64) + else if (((uint64)pDst8 % (uint64)intType) != 0u) /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ +# else + else if (((uint32_least)pDst8 % (uint32_least)intType) != 0u) /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ +# endif + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #30 Check parameter 'nCnt' is a multiple of integer type size */ + else if ((nCnt % (VStdLib_CntType)intType) != 0u) + { + errorId = VSTDLIB_E_PARAM_SIZE; + } + /* Parameter intType is checked in the local functions. No copy and swap is executed for any unsupported intType + and VSTDLIB_E_PARAM_INTTYPE is reported if VSTDLIB_DEV_ERROR_REPORT is enabled */ + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 If integer type is VSTDLIB_INTTYPE_8, call VStdLib_MemCpy() */ + if (intType == VSTDLIB_INTTYPE_8) + { + VStdLib_MemCpy(pDst, pSrc, nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_MEMCPY */ + } + else + { +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + /* #110 If less than 33 bytes have to be copied and swapped */ + if (nCnt < 33u) + { + /* #120 Use a integer-type-wise algorithm (for dst) */ + VStdLib_Loc_MemCpySwapEndian_IntType_32( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_X_X */ + pDst, + pSrc8, + (uint8_least) nCnt, + intType); + } + /* #130 If destination and source are 32-bit aligned */ + else if ((VSTDLIB_ALIGN_OFFSET(pDst8) == 0u) && (VSTDLIB_ALIGN_OFFSET(pSrc8) == 0u)) /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + { + /* #140 Use a 32-bit-wise algorithm (for dst and src) */ + VStdLib_Loc_MemCpySwapEndian_32_Aligned( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_X_X */ + (P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pDst, /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pSrc, /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + nCnt, + intType); + } + /* #150 Else destination or source is not aligned */ + else + { + /* #160 Linearly copy and swap nCnt bytes using a loop (integer type access to dst) */ + VStdLib_Loc_MemCpySwapEndian(pDst, pSrc8, nCnt, intType); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_X_X */ + } +# else /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_OFF */ + /* #170 Linearly copy and swap nCnt bytes using a loop (integer type access to dst) */ + VStdLib_Loc_MemCpySwapEndian(pDst, pSrc8, nCnt, intType); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION */ + } + } + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_MemCpySwapEndian() */ + +#endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpySwapEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + Std_ReturnType retval = E_OK; + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (nCnt > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retval = errorCode; + } + else + { + /* #20 Call VStdLib_MemCpySwapEndian() */ + VStdLib_MemCpySwapEndian(pDst, pSrc, nCnt, intType); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ /* FETA_VSTDLIB_CALL_MEMCPYSWAPENDIAN */ + /* retval is already set to E_OK */ + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retval; +} /* VStdLib_MemCpySwapEndian_s() */ + +#if (VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* For big endian data use monotone bit counting */ + VStdLib_CntType nDstBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetSaw); + VStdLib_CntType nSrcBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nSrcBitOffsetSaw); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyBigToBigEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyBigToBigEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyBigToBigEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetSawToMon, + pSrc, + nSrcBitOffsetSawToMon, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* For big endian data use monotone bit counting */ + VStdLib_CntType nSrcBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nSrcBitOffsetSaw); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyBigToLittleEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyBigToLittleEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyBigToLittleEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSawToMon, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* For big endian data use monotone bit counting */ + VStdLib_CntType nDstBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetSaw); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyLittleToBigEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyLittleToBigEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyLittleToBigEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetSawToMon, + pSrc, + nSrcBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyLittleToLittleEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyLittleToLittleEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyLittleToLittleEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSaw, + nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +#endif /* VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToBigEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawBigToBigEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + /* For big endian destination data use monotone bit counting */ + VStdLib_CntType nDstBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetSaw); + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetSawToMon); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpySawBigToBigEndian() */ + VStdLib_BitCpySawBigToBigEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSaw, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToLittleEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawBigToLittleEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetSaw); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpySawBigToLittleEndian() */ + VStdLib_BitCpySawBigToLittleEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSaw, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToBigEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawLittleToBigEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + /* For big endian destination data use monotone bit counting */ + VStdLib_CntType nDstBitOffsetSawToMon = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetSaw); + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetSawToMon); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpySawLittleToBigEndian() */ + VStdLib_BitCpySawLittleToBigEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSaw, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToLittleEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawLittleToLittleEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetSaw); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpySawLittleToLittleEndian() */ + VStdLib_BitCpySawLittleToLittleEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetSaw, + pSrc, + nSrcBitOffsetSaw, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_SAW_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +#if (VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyBigToBigEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyBigToBigEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyBigToBigEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* For little endian data use sawtooth bit counting */ + VStdLib_CntType nDstBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetMon); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyBigToLittleEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyBigToLittleEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyBigToLittleEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetMonToSaw, + pSrc, + nSrcBitOffsetMon, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* For little endian data use sawtooth bit counting */ + VStdLib_CntType nSrcBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nSrcBitOffsetMon); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyLittleToBigEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyLittleToBigEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyLittleToBigEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMonToSaw, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + /* For little endian data use sawtooth bit counting */ + VStdLib_CntType nDstBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetMon); + VStdLib_CntType nSrcBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nSrcBitOffsetMon); + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'pDst' and 'pSrc' */ + if ((pDst == NULL_PTR) || (pSrc == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + /* #20 Use VStdLib_Loc_BitCpyLittleToLittleEndian() to copy data if parameter 'nCnt' is bigger than 0 */ + else +# endif + { + /* Catch the case, if there is nothing to copy. If it is not catched here, it needs to be catch in + VStdLib_Loc_BitCpyLittleToLittleEndian() */ + if (nCnt > 0u) + { + VStdLib_Loc_BitCpyLittleToLittleEndian( /* FETA_VSTDLIB_CALL_LOC_BITCPY */ + pDst, + nDstBitOffsetMonToSaw, + pSrc, + nSrcBitOffsetMonToSaw, + nCnt); /* SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET */ + } + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} + +#endif /* VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToBigEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonBigToBigEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + Std_ReturnType retVal = E_OK; + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetMon); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpyMonBigToBigEndian() */ + VStdLib_BitCpyMonBigToBigEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMon, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToLittleEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonBigToLittleEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + /* For little endian destination data use sawtooth bit counting */ + VStdLib_CntType nDstBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetMon); + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetMonToSaw); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpyMonBigToLittleEndian() */ + VStdLib_BitCpyMonBigToLittleEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMon, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToBigEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToBigEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetMon); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpyMonLittleToBigEndian() */ + VStdLib_BitCpyMonLittleToBigEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMon, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToLittleEndian_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToLittleEndian_s( /* PRQA S 6060 */ /* MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) + +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + uint8 errorId = VSTDLIB_E_NO_ERROR; + /* For little endian destination data use sawtooth bit counting */ + VStdLib_CntType nDstBitOffsetMonToSaw = VStdLib_Loc_BitCpyConvertBitCounting(nDstBitOffsetMon); + VStdLib_CntType dstEndByte = VStdLib_Loc_BitCpyGetLastIterByte(nCnt + nDstBitOffsetMonToSaw); + + /* ----- Implementation ----------------------------------------------- */ + /* #10 Check parameter 'nDstSize' (independently of development error detection) */ + if (dstEndByte > nDstSize) + { + errorId = VSTDLIB_E_PARAM_SIZE; + retVal = errorCode; + } + else + { + /* #20 Call VStdLib_BitCpyMonLittleToLittleEndian() */ + VStdLib_BitCpyMonLittleToLittleEndian( /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + pDst, + nDstBitOffsetMon, + pSrc, + nSrcBitOffsetMon, + nCnt); + } + + /* ----- Development Error Report ------------------------------------- */ +#if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_BIT_COPY_MON_S, errorId); + } +#else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +#endif + + return retVal; +} + +#if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCheck() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + * + * + * + * + * + * + * + */ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCheck( + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf, + uint8 nPattern, + VStdLib_CntType nCnt, + Std_ReturnType errorCode) +{ + /* ----- Local Variables ---------------------------------------------- */ + Std_ReturnType retVal = E_OK; + + P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf8 = \ + (P2CONST(uint8, AUTOMATIC, VSTDLIB_VAR_FAR)) pBuf; /* PRQA S 0316 */ /* MD_VStdLib_PtrCast */ + + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check the parameter 'pBuf' */ + if (pBuf == NULL_PTR) + { + retVal = errorCode; + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ +# if (VSTDLIB_RUNTIME_OPTIMIZATION == STD_ON) + /* #20 If less than 32 bytes of memory have to be checked for nPattern */ + if (nCnt < 32u) + { + /* #30 Use a byte-wise memcheck */ + retVal = VStdLib_Loc_MemCheck_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCHECK_X */ + pBuf8, + nPattern, + nCnt, + errorCode); + } + /* #40 Else */ + else + { + /* #50 Get the pointer offset to the next 32-bit boundary */ + uint8_least nBufOffset = VSTDLIB_ALIGN_OFFSET(pBuf8); /* PRQA S 0306 */ /* MD_VStdLib_PtrCastToInt */ + + /* #60 If the pointer is not aligned */ + if (nBufOffset != 0u) + { + /* #70 Check the amount of bytes to reach the alignment boundary and adjust the pointer */ + retVal = VStdLib_Loc_MemCheck_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCHECK_8_NBUFOFFSET */ + pBuf8, + nPattern, + nBufOffset, + errorCode); + + pBuf8 = &pBuf8[nBufOffset]; + nCnt -= nBufOffset; /* PRQA S 1338 */ /* MD_VStdLib_ParamMod */ + } + + if (retVal == E_OK) + { + /* #80 The pointer is aligned, use the 32-bit aligned memcheck */ + retVal = VStdLib_Loc_MemCheck_32_Aligned( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCHECK_X */ + (P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR)) pBuf8, /* PRQA S 0310, 3305 */ /* MD_VStdLib_PtrCast */ + nPattern, + nCnt, + errorCode); + } + } + +# else /* VSTDLIB_RUNTIME_OPTIMIZATION == STD_OFF */ + + /* #90 Use byte-wise memcheck */ + retVal = VStdLib_Loc_MemCheck_8( /* SBSW_VSTDLIB_CALL_NO_PTR_WRITE */ /* FETA_VSTDLIB_CALL_LOC_MEMCHECK_X */ + pBuf8, + nPattern, + nCnt, + errorCode); + +# endif /* VSTDLIB_RUNTIME_OPTIMIZATION */ + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_MEM_CHECK, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif + + return retVal; +} /* VStdLib_MemCheck() */ + +#endif /* VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON */ + +#if (VSTDLIB_VERSION_INFO_API == STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetVersionInfo() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(void, VSTDLIB_CODE) VStdLib_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, VSTDLIB_APPL_VAR) versioninfo) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'versioninfo' */ + if (versioninfo == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #20 Write component data to 'versioninfo' */ + versioninfo->vendorID = VSTDLIB_VENDOR_ID; /* SBSW_VSTDLIB_ACCESS_VERSIONINFO */ + versioninfo->moduleID = VSTDLIB_MODULE_ID; /* SBSW_VSTDLIB_ACCESS_VERSIONINFO */ + versioninfo->sw_major_version = VSTDLIB_SW_MAJOR_VERSION; /* SBSW_VSTDLIB_ACCESS_VERSIONINFO */ + versioninfo->sw_minor_version = VSTDLIB_SW_MINOR_VERSION; /* SBSW_VSTDLIB_ACCESS_VERSIONINFO */ + versioninfo->sw_patch_version = VSTDLIB_SW_PATCH_VERSION; /* SBSW_VSTDLIB_ACCESS_VERSIONINFO */ + } + + /* ----- Development Error Report ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if (errorId != VSTDLIB_E_NO_ERROR) + { + (void) Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_GET_VERSION_INFO, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ +# endif +} /* VStdLib_GetVersionInfo() */ + +#endif /* VSTDLIB_VERSION_INFO_API == STD_ON */ + +#if (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the highest set bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInByte(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_ONE_BYTE) + { + /* #110 Get the bit position of the highest unset bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInByte((uint8)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the lowest set bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInByte(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_ONE_BYTE) + { + /* #110 Get the bit position of the lowest unset bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInByte((uint8)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_ONE_BYTE) + { + /* #110 Get count of leading ones */ + cnt = (uint8) (7u - VStdLib_Loc_GetHighestBitPosOneInByte((uint8)(~value))); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of leading zeros */ + cnt = (uint8) (7u - VStdLib_Loc_GetHighestBitPosOneInByte(value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_ONE_BYTE) + { + /* #110 Get count of trailing ones */ + cnt = VStdLib_Loc_GetLowestBitPosOneInByte((uint8)(~value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros8() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros8(uint8 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of trailing zeros */ + cnt = VStdLib_Loc_GetLowestBitPosOneInByte(value); + } + + return cnt; +} + +#endif /* VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +#if (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the highest set bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInTwoBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_TWO_BYTES) + { + /* #110 Get the bit position of the highest unset bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInTwoBytes((uint16)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the lowest set bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInTwoBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_TWO_BYTES) + { + /* #110 Get the bit position of the lowest unset bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInTwoBytes((uint16)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_TWO_BYTES) + { + /* #110 Get count of leading ones */ + cnt = (uint8) (15u - VStdLib_Loc_GetHighestBitPosOneInTwoBytes((uint16)(~value))); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of leading zeros */ + cnt = (uint8) (15u - VStdLib_Loc_GetHighestBitPosOneInTwoBytes(value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_TWO_BYTES) + { + /* #110 Get count of trailing ones */ + cnt = VStdLib_Loc_GetLowestBitPosOneInTwoBytes((uint16)(~value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros16(uint16 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of trailing zeros */ + cnt = VStdLib_Loc_GetLowestBitPosOneInTwoBytes(value); + } + + return cnt; +} + +#endif /* VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +#if (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the highest set bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInFourBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_FOUR_BYTES) + { + /* #110 Get the bit position of the highest unset bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInFourBytes((uint32)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the lowest set bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInFourBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_FOUR_BYTES) + { + /* #110 Get the bit position of the lowest unset bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInFourBytes((uint32)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_FOUR_BYTES) + { + /* #110 Get count of leading ones */ + cnt = (uint8) (31u - VStdLib_Loc_GetHighestBitPosOneInFourBytes((uint32)(~value))); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of leading zeros */ + cnt = (uint8) (31u - VStdLib_Loc_GetHighestBitPosOneInFourBytes(value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_FOUR_BYTES) + { + /* #110 Get count of trailing ones */ + cnt = VStdLib_Loc_GetLowestBitPosOneInFourBytes((uint32)(~value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros32(uint32 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of trailing zeros */ + cnt = VStdLib_Loc_GetLowestBitPosOneInFourBytes(value); + } + + return cnt; +} + +#endif /* VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +#if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the highest set bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInEightBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_EIGHT_BYTES) + { + /* #110 Get the bit position of the highest unset bit */ + pos = VStdLib_Loc_GetHighestBitPosOneInEightBytes((uint64)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get the bit position of the lowest set bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInEightBytes(value); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 pos = VSTDLIB_BITPOS_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_EIGHT_BYTES) + { + /* #110 Get the bit position of the lowest unset bit */ + pos = VStdLib_Loc_GetLowestBitPosOneInEightBytes((uint64)(~value)); + } + + return pos; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_EIGHT_BYTES) + { + /* #110 Get count of leading ones */ + cnt = (uint8) (63u - VStdLib_Loc_GetHighestBitPosOneInEightBytes((uint64)(~value))); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of leading zeros */ + cnt = (uint8) (63u - VStdLib_Loc_GetHighestBitPosOneInEightBytes(value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one unset bit */ + if (value != VSTDLIB_MASK_ALLBITS_IN_EIGHT_BYTES) + { + /* #110 Get count of trailing ones */ + cnt = VStdLib_Loc_GetLowestBitPosOneInEightBytes((uint64)(~value)); + } + + return cnt; +} + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros64(uint64 value) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 cnt = VSTDLIB_BITCNT_NA; + + /* ----- Implementation ----------------------------------------------- */ + /* #100 Verify that the passed value contains at least one set bit */ + if (value != 0u) + { + /* #110 Get count of trailing zeros */ + cnt = VStdLib_Loc_GetLowestBitPosOneInEightBytes(value); + } + + return cnt; +} + +#endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +#define VSTDLIB_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA JUSTIFICATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_VStdLib_NoCaseBreak: + Reason: Break statements are omitted due to performance reasons when using jump tables. + Risk: Resulting code is misleading. + Prevention: Code comments, code inspection and test of the different variants in the component test. + + MD_VStdLib_ParamMod: + Reason: Pointers and counts given as function parameters are modified during different algorithm stages. + Risk: Wrong pointer access is performed. + Prevention: Silent analysis, code inspection and test of the different variants in the component test. + + MD_VStdLib_ParamValueMod: + Reason: The direct modification of the function parameter leads to code which is easier to read and maintain. + Risk: Incorrect expectation of the value of the modified function parameter. + Prevention: Code inspection and test of the different variants in the component test. + + MD_VStdLib_PtrCast: + Reason: Pointer is casted as different memory access sizes are utilized due to performance reasons. + Risk: Wrong pointer access is performed. + Prevention: Code inspection and test of the different variants in the component test. + + MD_VStdLib_PtrCastToInt: + Reason: Pointer is casted to an integral type in order to get the target alignment. + Risk: None, as only LSBs are evaluated. + Prevention: None. + + MD_VStdLib_Para2ConstPtr + Reason: The address of a parameter is stored in a constant pointer in order to use the VStdLib_MemCpy(). + Risk: None. + Prevention: None. + + MD_VStdLib_NotUsedInUnit: + Reason: Static inline function is not used within this translation unit, because it is intended to be used as + a inline function by other modules. + Risk: None. + Prevention: None. + + MD_VStdLib_FileScope: + Reason: Constant tables are kept at a central location for a better overview and maintenance. + Risk: None. + Prevention: None. + + MD_VStdLib_Metrics: + Reason: No separation of functionality due to performance reasons when using jump tables. + Risk: None, as the complexity arises from one single switch statement. + Prevention: None. + +*/ + +/*********************************************************************************************************************** + * SILENTBSW JUSTIFICATIONS + **********************************************************************************************************************/ + +/* SBSW_JUSTIFICATION_BEGIN + + \ID SBSW_VSTDLIB_CALL_UNMODIFIED + \DESCRIPTION A function is called with unmodified 'pDst' and 'nCnt' parameters. + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' and 'nCnt' are valid. These parameters are passed + to the callee without modifications. If the parameters are casted there are no side effects. + + \ID SBSW_VSTDLIB_CALL_MODIFIED_CNT + \DESCRIPTION A static function is called with unmodified 'pDst' parameter and a modified 'nCnt' parameter. + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' and 'nCnt' are valid. The offset value is + always smaller than 4 due to VSTDLIB_ALIGN_OFFSET() and 'nCnt' is 32 or higher at this point. + Therefore 'pDst' and 'nCnt' for the callee are valid. + + \ID SBSW_VSTDLIB_CALL_MODIFIED_IDX + \DESCRIPTION A static function is called with unmodified 'pDst' parameter starting at a specific offset and a modified + 'nCnt' parameter. + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' starting at offset and 'nCnt' are valid. The index + is always smaller equal to 'nCnt' bits starting at offset. Therefore 'pDst' starting at a + specific offset and 'nCnt' are valid for the callee. + + \ID SBSW_VSTDLIB_CALL_CONVERTED_BITCNT + \DESCRIPTION A static function is called with unmodified 'pDst' parameter starting at a specific offset and a modified + 'nCnt' parameter. + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' and 'nCnt' are valid. 'nCntInBytes' is 'nCnt' + devided by 8. The devision by 8 converts the bit count in a valid byte count where the byte count + defines the same range as the bit count in a different format. Therefore 'pDst' starting at a + specific offset and 'nCnt' are valid for the callee. + + \ID SBSW_VSTDLIB_CALL_CONVERTED_BITOFFSET + \DESCRIPTION A static function is called with unmodified 'pDst' starting at a specific offset and 'nCnt' parameters + but converted offset parameter(s). + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' starting at offset is valid for 'nCnt' bits. + The conversion changes offset numbering from sawtooth to monotone or from monotone to sawtooth. + The change of the value of the offset from one numbering method to the other is 7 at most. The + offset is therfore still within the same byte. Thus the start byte and the end byte don't change + when converting bit counting numbering. Therefore 'pDst' starting at a specific offset and 'nCnt' + are valid for the callee. + + \ID SBSW_VSTDLIB_CALL_MODIFIED_PTR_CNT + \DESCRIPTION A static function can be called with unmodified or modified 'pDst' and 'nCnt' parameters. + \COUNTERMEASURE \N The caller of the function ensures that 'pDst' and 'nCnt' are valid. In case the function is + called with modified parameters (pointer alignment was performed), 'pDst' is incremented by + the value of 'nDstOffset' and 'nCnt' is decremented by the same value. Therefore 'pDst' + and 'nCnt' for the callee are valid. + + \ID SBSW_VSTDLIB_ACCESS_LOOP + \DESCRIPTION Linear memory access using a for loop. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. The for loop ensures that + the loop index is always smaller than nCnt. Therefore only valid memory is accessed. + + \ID SBSW_VSTDLIB_ACCESS_LOOP_ENDIDX + \DESCRIPTION Linear memory access using a for loop. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' starting at a specific offset and 'nCnt' bits are + valid. The for loop ensures that the loop index is always smaller than the length of the first and + last byte to copy to (number of iterations) which is determined with 'nCnt' bits starting a specific + destination offset. Therefore only valid memory is accessed. + + \ID SBSW_VSTDLIB_ACCESS_8_JUMPTABLE + \DESCRIPTION Linear 8-bit-access using a switch statement. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. The constant indices are + always smaller than the value of 'nCnt'. Therefore only valid memory is accessed. + + \ID SBSW_VSTDLIB_ACCESS_8 + \DESCRIPTION Linear 8-bit-access. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' starting at a specific offset and 'dstByteIdx' are + valid. Therefore only valid memory is accessed. + + \ID SBSW_VSTDLIB_ACCESS_32_LOOP + \DESCRIPTION Linear 32-bit-access using a for loop. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. The access index 'dPos' + is initialized with 0. The loop control variable 'remaining' is decremented by 16 per iteration. + The exit condition ensures that at least 16 bytes are valid per iteration. The access index + 'dPos' plus constant offset ensures that exactly 16 valid bytes are accessed. 'dPos' is + incremented by 4 (that equals 16 bytes) after the access. + + \ID SBSW_VSTDLIB_ACCESS_32_LOOP_REMAINING + \DESCRIPTION Linear 32-bit-access using a for loop. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. After the for loop above + 'remaining' bytes of valid memory start at the address that is indicated by 'dPos'. The loop + control variable 'remaining' is decremented by 4 per iteration. The exit condition ensures that + at least 4 bytes are valid per iteration. The access index 'dPos' ensures that exactly 4 valid + bytes are accessed. 'dPos' is incremented by 1 (that equals 4 bytes) after the access. + + \ID SBSW_VSTDLIB_ACCESS_32_JUMPTABLE + \DESCRIPTION Linear 32-bit-access using a switch statement. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. After the for loop above + 'remaining' bytes of valid memory start at the address that is indicated by 'dPos'. The switch + statement ensures that an access is only made if at least 4 byte are valid. 'dPos' is + incremented by 4 after the access. + + \ID SBSW_VSTDLIB_CALL_REMAINING_JUMPTABLE + \DESCRIPTION A static function is called to access the remaining bytes at the end of processing a 32-bit jump table. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. At this point 0-3 + bytes of valid memory (indicated by the LSBs of 'remaining') start at the address that is + indicated by 'dPos'. Due to the usage of VSTDLIB_MASK_3 'pDst' and 'nCnt' for the callee are + valid. + + \ID SBSW_VSTDLIB_CALL_REMAINING + \DESCRIPTION A static function is called to access the remaining bytes after 32-bit operations. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. After the for loop above + 'remaining' bytes of valid memory start at the address that is indicated by 'dPos'. Therefore + 'pDst' and 'nCnt' for the callee are valid. + + \ID SBSW_VSTDLIB_CALL_REMAINING_PARTIAL + \DESCRIPTION A static function is called to access the remaining partial word after 32-bit displacement operations. + \COUNTERMEASURE \N The caller of this function ensures that 'pDst' and 'nCnt' are valid. At this point at least + (4 - 'nDstOffset') bytes of valid memory start at the address that is indicated by 'dPos'. + Therefore 'pDst' and 'nCnt' for the callee are valid. + + \ID SBSW_VSTDLIB_ACCESS_LOCAL + \DESCRIPTION Access to a pointer referencing a local variable. + \COUNTERMEASURE \N The function is only called with valid pointers to local variables. + + \ID SBSW_VSTDLIB_ACCESS_STRUCT_LOCAL + \DESCRIPTION Access to a pointer referencing a local structure. + \COUNTERMEASURE \N The function is only called with valid pointers to local structures. The structure elements + are modified. + + \ID SBSW_VSTDLIB_CALL_NO_PTR_WRITE + \DESCRIPTION The static function is called with pointer parameters. The pointers are only accessed for reading. + \COUNTERMEASURE \N None. + + \ID SBSW_VSTDLIB_CALL_MODIFIABLE_RETVAL + \DESCRIPTION A static function is called with a pointer parameter 'pRetval' which can be possibly modified. + \COUNTERMEASURE \N The caller of the function ensures that 'pRetVal' is valid. + + \ID SBSW_VSTDLIB_CALL_MODIFIABLE_SRCBYTE + \DESCRIPTION A static function is called with a pointer parameter 'pSrcByte' which is modified. + \COUNTERMEASURE \N The caller of the function ensures that 'pSrcByte' is valid. + + \ID SBSW_VSTDLIB_CALL_MODIFIABLE_ITER + \DESCRIPTION A static function is called with a pointer parameter to a structure 'pSrcIter' or 'pDstIter' where + the structure elements are modified. + \COUNTERMEASURE \N The caller of the function ensures that 'pSrcIter' or 'pDstIter' is valid. + + \ID SBSW_VSTDLIB_ACCESS_VERSIONINFO + \DESCRIPTION The function VStdLib_GetVersionInfo() writes to the object referenced by parameter 'versioninfo'. + \COUNTERMEASURE \N The caller ensures that the pointer passed to the parameter 'versioninfo' is valid and references + an object of type Std_VersionInfoType. + + \ID SBSW_VSTDLIB_ACCESS_PASSED_ARRAY + \DESCRIPTION Write access to an element of an array. + The array is referenced by a pointer parameter. The element is accessed by a static index. + \COUNTERMEASURE \N [CM_VSTDLIB_ARRAY] + + \ID SBSW_VSTDLIB_ACCESS_PASSED_INT + \DESCRIPTION Write access to the integer variable which is referenced by a pointer parameter. + \COUNTERMEASURE \N The caller ensures that the pointer references a valid variable. + + \ID SBSW_VSTDLIB_CALL_MEM_CPY + \DESCRIPTION The function VStdLib_MemCpy is called with the pointer parameter to an array from the caller + and a static size for the number of bytes to copy. + \COUNTERMEASURE \N [CM_VSTDLIB_ARRAY] + + \ID SBSW_VSTDLIB_CALL_CNV_ARRAY_TO_UINT + \DESCRIPTION The function VStdLib_ConvertUint8ArrayToUint[16,32,64][Big,Little]Endian is called with the pointer + parameter to an array from the caller. + \COUNTERMEASURE \N [CM_VSTDLIB_ARRAY] + +SBSW_JUSTIFICATION_END */ + +/* +\CM CM_VSTDLIB_ARRAY The caller ensures that the referenced array is valid for the required size. +*/ + +/********************************************************************************************************************** + * FETA JUSTIFICATIONS + *********************************************************************************************************************/ + +/* FETA_JUSTIFICATION_BEGIN + +\ID FETA_VSTDLIB_LOC_MEMSET_X_X +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to initialize the destination with a + pattern value. +\COUNTERMEASURE \N [CM_VSTDLIB_PARA_NCNT] + +\ID FETA_VSTDLIB_CALL_LOC_MEMSET_8_X_REMAINING +\DESCRIPTION Function parameter [nCnt] from the callee (VStdLib_Loc_MemSet_8_3 or VStdLib_Loc_MemSet_8_31) specifies + the number of iteration to use to initialize the destination with a pattern value. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMSET_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemSet_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMSET_8_3 +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemSet_8_3() specifies the number of iterations to use + to initialize the destination with a pattern value. + The value for [nCnt] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemSet + +\ID FETA_VSTDLIB_CALL_LOC_MEMSET_X_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemSet_8_31 or VStdLib_Loc_MemSet_32_Aligned) specifies + the number of iterations to use to initialize the destination with a pattern value. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemSet) has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_MEMSET +\DESCRIPTION Function parameter [nCnt] specifies the number of iteration to use to initialize the destination with a + pattern value. + The user of the service function VStdLib_MemSet has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_MEMSET_MACRO +\DESCRIPTION Function parameter [nCnt] specifies the number of iteration to use to initialize the destination with a + pattern value. + The user of the macro has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + + +\ID FETA_VSTDLIB_LOC_MEMCPY_X_X +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to copy data from source to destination. +\COUNTERMEASURE \N [CM_VSTDLIB_PARA_NCNT] + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_8_X_REMAINING +\DESCRIPTION Function parameter [nCnt] from the callee (VStdLib_Loc_MemCpy_8_3 or VStdLib_Loc_MemCpy_8_31) specifies + the number of iteration to use to copy data from source to destination. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpy_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_8_31_REMAINING +\DESCRIPTION Function parameter [nCnt] from calee VStdLib_Loc_MemCpy_8_31 specifies the number of iteration to use to + copy data from source to destination. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpy_32_Unaligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_8_3 +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpy_8_3() specifies the number of iterations to use + to copy data from source to destination. + The value for [nCnt] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemCpy + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemCpy_8_31 or VStdLib_Loc_MemCpy_32_Aligned or + VStdLib_Loc_MemCpy_32_Unaligned) specifies the number of iterations to use to copy data from source to + destination. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCpy) has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_8_PARTIALWORD +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpy_8_PartialWord specifies the number of iteration + to use to copy data from source to destination. + The value for [nCnt] is set by the caller to the value of its function parameter [nDstOffset]. +\COUNTERMEASURE \N CM_VSTDLIB_PARA_NCNT + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_8_PARTIALWORD_CALC +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpy_8_PartialWord specifies the number of iteration + to use to copy data from source to destination. + The value for [nCnt] is determined (4u - nDstOffset) within this caller. The correctness of the function + parameter [nDstOffset] from the caller used for the determination is ensured by + FETA_VSTDLIB_CALL_LOC_MEMCPY_32_UNALIGNED_NDSTOFFSET. +\COUNTERMEASURE \D VStdLib_Loc_MemCpy_32_Unaligned + +\ID FETA_VSTDLIB_LOC_MEMCPY_32_UNALIGNED +\DESCRIPTION Local variable [remaining] specifies the number of iteration to use to copy data from source to destination. + The value of [remaining] is determined within this caller. The correctness of the function + parameter [nCnt] from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPY_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpy_32_Unaligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPY_32_UNALIGNED_NDSTOFFSET +\DESCRIPTION Function parameter [nDstOffset] from VStdLib_Loc_MemCpy_32_Unaligned specifies the number of iteration to + use to copy data from source to destination. + The value (0, 1, 2 or 3) for [nDstOffset] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemCpy + +\ID FETA_VSTDLIB_MEMCPY +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to copy data from source to destination. + The user of the service function VStdLib_MemCpy or VStdLib_MemCpy16 or VStdLib_MemCpy32 has to ensure the + correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_CALL_MEMCPY +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_MemCpy specifies the number of iterations to use to copy + data from source to destination. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCpy_s, VStdLib_MemCpy_Return_s or VStdLib_MemCpySwapEndian) has to ensure the + correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_MEMCPY_MACRO +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to copy data from source to destination. + The user of the macro has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_CALL_MEMCPY_MACRO +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_MemCpyMacro specifies the number of iterations to use to + copy data from source to destination. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (macro VStdLib_MemCpyMacro_s) has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + + +\ID FETA_VSTDLIB_LOC_MEMCMP_X_X +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to compare data from buffer1 with + buffer2. +\COUNTERMEASURE \N CM_VSTDLIB_PARA_NCNT + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_8_ALIGNED_REMAINING +\DESCRIPTION Function parameter [nCnt] from the callee VStdLib_Loc_MemCmp_32_Aligned specifies the number of iteration + to use to compare data from buffer1 with buffer2. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCmp_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemCmp_8 or VStdLib_MemCmp_32_Aligned or + VStdLib_MemCmp_32_Unaligned) specifies the number of iterations to use to compare data from buffer1 with + buffer2. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCmp) has to ensure the correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_8_NBUF2OFFSET +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCmp_8 specifies the number of iteration to use to + compare data from buffer1 with buffer2. + The value for [nCnt] is set by the caller to the value of its function parameter [nBuf2Offset]. +\COUNTERMEASURE \N CM_VSTDLIB_PARA_NCNT + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_8_CALC +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCmp_8 specifies the number of iteration to use to + compare data from buffer1 with buffer2. + The value for [nCnt] is determined (4u - nBuf2Offset) within this caller. The correctness of the function + parameter [nBuf2Offset] from the caller used for the determination is ensured by + FETA_VSTDLIB_CALL_LOC_MEMCMP_32_UNALIGNED_NBUF2OFFSET. +\COUNTERMEASURE \D VStdLib_Loc_MemCmp_32_Unaligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_8_UNALIGNED_REMAINING +\DESCRIPTION Function parameter [nCnt] from the callee VStdLib_Loc_MemCmp_32_Unaligned specifies the number of iteration + to use to compare data from buffer1 with buffer2. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCmp_32_Unaligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_8_NBUF1OFFSET +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCmp_8 specifies the number of iteration to use to + compare data from buffer1 with buffer2. + The value (0, 1, 2 or 3) for [nCnt] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemCmp + +\ID FETA_VSTDLIB_LOC_MEMCMP_32_UNALIGNED +\DESCRIPTION Local variable [remaining] specifies the number of iteration to use to compare data from buffer1 with + buffer2. + The value of [remaining] is determined within this caller. The correctness of the function + parameter [nCnt] from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCMP_X_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpy_32_Unaligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCMP_32_UNALIGNED_NBUF2OFFSET +\DESCRIPTION Function parameter [nBuf2Offset] from VStdLib_Loc_MemCmp_32_Unaligned specifies the number of iteration to + compare data from buffer1 with buffer2. + The value (0, 1, 2 or 3) for [nBuf2Offset] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemCmp + + +\ID FETA_VSTDLIB_LOC_MEMCPYSWAPENDIAN_X_X +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to copy and swap data from source to + destination. +\COUNTERMEASURE \N [CM_VSTDLIB_PARA_NCNT] + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemCpySwapEndian_Int16_32 or + VStdLib_Loc_MemCpySwapEndian_Int32_32 or VStdLib_Loc_MemCpySwapEndian_Int64_32 or + VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned or VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned or + VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned) specifies the number of iterations to use to copy and swap + data from source to destination. + The value for [nCnt] is set by the caller to the value of its function parameter [nCnt]. +\COUNTERMEASURE \N [CM_VSTDLIB_PARA_NCNT] + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT16_32_REMAINING +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpySwapEndian_Int16_32 specifies the number of + iterations to use to copy and swap data from source to destination. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpySwapEndianInt16_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT32_32_REMAINING +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpySwapEndian_Int32_32 specifies the number of + iterations to use to copy and swap data from source to destination. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpySwapEndianInt32_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INT64_32_REMAINING +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCpySwapEndian_Int64_32 specifies the number of + iterations to use to copy and swap data from source to destination. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_INTX_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCpySwapEndianInt64_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCPYSWAPENDIAN_X_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemCpySwapEndian_IntType_32 or + VStdLib_Loc_MemCpySwapEndian_32_Aligned or VStdLib_Loc_MemCpySwapEndian) specifies the number of + iterations to use to compare data from buffer1 with buffer2. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCpySwapEndian) has to ensure the correctness of value + for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + +\ID FETA_VSTDLIB_CALL_MEMCPYSWAPENDIAN +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_MemCpySwapEndian specifies the number of iterations to use + to copy and swap data from source to destination. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCpySwapEndian_s) has to ensure the + correctness of value for [nCnt]. +\COUNTERMEASURE \S SMI-494148 + + +\ID FETA_VSTDLIB_LOC_MEMCHECK_X_NCNT +\DESCRIPTION Function parameter [nCnt] specifies the number of iterations to use to check data from buffer against a + pattern. +\COUNTERMEASURE \N CM_VSTDLIB_PARA_NCNT + +\ID FETA_VSTDLIB_LOC_MEMCHECK_X_RETVAL +\DESCRIPTION Local variable [retVal] is used to break the loop before [nCnt] iterations when the check detects a + mismatch. + The value for [retVal] is determined for each iteration by the called function + VStdLib_Loc_GetMemCheckResult. +\COUNTERMEASURE \D DSGN-VStdLib-MemCheck + +\ID FETA_VSTDLIB_CALL_LOC_MEMCHECK_8_REMAINING +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCheck_8 specifies the number of iterations to use to + check data from buffer against a pattern. + The value for [nCnt] is determined within this caller. The correctness of the function parameter [nCnt] + from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_MEMCHECK_X. +\COUNTERMEASURE \D VStdLib_Loc_MemCheck_32_Aligned + +\ID FETA_VSTDLIB_CALL_LOC_MEMCHECK_8_NBUFOFFSET +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_Loc_MemCheck_8 specifies the number of iterations to use to + check data from buffer against a pattern. + The value (0, 1, 2 or 3) for [nCnt] is determined within this caller. +\COUNTERMEASURE \D VStdLib_MemCheck + +\ID FETA_VSTDLIB_CALL_LOC_MEMCHECK_X +\DESCRIPTION Function parameter [nCnt] from callee (VStdLib_Loc_MemCheck_8 or VStdLib_Loc_MemCheck_32_Aligned) + specifies the number of iterations to use to check data from buffer against a pattern. + The value for [nCnt] is the value of the caller's function parameter [nCnt]. + The user of the caller (service function VStdLib_MemCheck) has to ensure the correctness of value for + [nCnt]. +\COUNTERMEASURE \S SMI-494148 + + +\ID FETA_VSTDLIB_LOC_BITCPYSWAPENDIAN +\DESCRIPTION The function parameter [pDstIter] is a pointer to a local struct. The struct holds the integer element + [lastByte]. [lastByte] specifies the number of iterations to use to copy data from source to destination. +\COUNTERMEASURE \N Caller ensures correctness of value [lastByte] from function parameter [pDstIter] + +\ID FETA_VSTDLIB_CALL_LOC_BITCPYSWAPENDIAN +\DESCRIPTION The function parameter [pDstIter] from the callee VStdLib_Loc_BitCpySwapEndian is a pointer to a local struct. + The struct holds the integer element [lastByte]. [lastByte] specifies the number of iterations to use to copy + data from source to destination. The value for [lastByte] is determined within this caller by the local + function VStdLib_Loc_BitCpyIter. The correctness of the function parameters [nCnt] and + [nDstBitOffsetSaw/nDstBitOffsetMon] from the caller used for the determination is ensured by + FETA_VSTDLIB_CALL_LOC_BITCPY. +\COUNTERMEASURE \D VStdLib_Loc_BitCpyBigToLittleEndian or VStdLib_Loc_BitCpyLittleToBigEndian + +\ID FETA_VSTDLIB_CALL_MEMCPY_IN_LOC_BITCPY +\DESCRIPTION Function parameter [nCnt] from callee VStdLib_MemCpy specifies the number of iterations to use to copy data + from source to destination. The value for [nCnt] is determined within this caller. The correctness of the + function parameter [nCnt] from the caller used for the determination is ensured by FETA_VSTDLIB_CALL_LOC_BITCPY. +\COUNTERMEASURE \D VStdLib_Loc_BitCpyBigToBigEndian or VStdLib_Loc_BitCpyLittleToLittleEndian + +\ID FETA_VSTDLIB_LOC_BITCPY +\DESCRIPTION Function parameters [nCnt] and [nDstBitOffsetSaw/nDstBitOffsetMon] are used by the local function VStdLib_Loc_BitCpyIter + to determine number of iterations to use to copy data from source to destination. The correctness of the function + parameters [nCnt] and [nDstBitOffsetSaw/nDstBitOffsetMon] from the caller used for the determination is ensured by + FETA_VSTDLIB_CALL_LOC_BITCPY. +\COUNTERMEASURE \D DSGN-VStdLib-BitCpy + +\ID FETA_VSTDLIB_CALL_LOC_BITCPY +\DESCRIPTION Function parameters [nCnt] and [nDstBitOffsetSaw/nDstBitOffsetMon] from the callee are used to determine the number + of iterations to use to copy data from source to destination. The value for [nCnt] is the value of the caller's function + parameter [nCnt]. The user of the caller (service functions for BitCpy) has to ensure the correctness of + value for [nCnt] and [nDstBitOffsetSaw/nDstBitOffsetMon]. +\COUNTERMEASURE \S SMI-494148 + +FETA_JUSTIFICATION_END */ + +/* +\CM CM_VSTDLIB_PARA_NCNT Caller ensures correctness of value for function parameter [nCnt]. +*/ + +/********************************************************************************************************************** + * END OF FILE: vstdlib.c + *********************************************************************************************************************/ diff --git a/Source/bsw/VStdLib/vstdlib.h b/Source/bsw/VStdLib/vstdlib.h new file mode 100644 index 0000000..c3eebba --- /dev/null +++ b/Source/bsw/VStdLib/vstdlib.h @@ -0,0 +1,4362 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/*! \file vstdlib.h + * \brief Interface of the generic Vector Standard Library (VStdLib_GenericAsr) + * \details This is the header file of the VStdLib. It contains the public (inline) APIs and global data of + * the VStdLib. + * It has to be included by other modules to access the APIs of the VStdLib. + * + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2012-05-08 vistvi Creation + * 01.00.01 2013-09-04 vistvi ESCAN00064708: Inconsistent file names + * 01.01.00 2013-12-10 vistvi ESCAN00073131: MISRA Improvements + * 02.00.00 2015-01-12 vistkr ESCAN00080277: FEAT-427: SafeBSW Step I + * ESCAN00081720: Extended version check is not available for MSR4 + * 2015-05-04 vistkr ESCAN00081765: FEAT-1275: SafeBSW Step 2 + * ESCAN00082267: FEAT-1379: Optimized copy operation for large data + * 02.00.01 2015-12-02 vistkr ESCAN00086942: Compiler error: Last line of file ends without a newline + * 02.00.02 2016-04-14 vistkr ESCAN00089506: Remove trace links for memory manipulation services + * 03.00.00 2018-10-23 vistkr STORYC-6844: MISRA-C:2012: VStdLib + * 03.01.00 2021-01-18 visgaz CAN-1574: [VStdLib] Support bit search functions + * 03.02.00 2021-03-15 visgaz CAN-1579: [VStdLib] Support memory comparison functions + * CAN-1577: [VStdLib] Support serialization functions + * 03.03.00 2021-04-12 visgaz CAN-2834: [VStdLib] Optimize memory comparison functions + * CAN-2831: [VStdLib] Optimize serialization functions + * CAN-1576: [VStdLib] Support endianess conversion functions + * ESCAN00108975: Compiler warning: 'type cast': pointer truncation from 'uint8 *' to 'uint32_least' + * 03.04.00 2021-06-07 visgaz CANCORE-325: [VStdLib] Convert CReqSpec, CAD and TestSpec to the new textbased format + * ESCAN00109680: Compiler warning: Conversion from 'uint8 *' to 'uint64' is sign-extended + * 03.05.00 2022-03-29 visgaz CANCORE-455: [VStdLib] Support MemCpy with endianness conversion functions + * ESCAN00110377: Compiler warning: Constant out of range + * ESCAN00110415: Compiler warning: Narrowing or signed-to-unsigned type conversion found + * - Refactored description for endianness conversion and (de-)serialization feature + * 2022-07-07 visnaj CANHAL-1215: [VStdLib] Support VStdLib_MemCheck() + * 03.06.00 2023-01-10 visgaz CANCORE-1197: [VStdLib] Finite Execution Time Analysis + * 2023-01-25 CANCORE-1379: [VStdLib] Safety analysis + * 03.07.00 2023-02-14 vismte CANCORE-1647: [VStdLib] Implementation of sawtooth functions for BitCopy + * CANCORE-1699: [VStdLib] Implementation of monotone functions for BitCopy + * 2023-03-23 vismte ESCAN00114258: Incomplete description for FETA-ID FETA_VSTDLIB_CALL_LOC_MEMCHECK_8_REMAINING + * 03.08.00 2023-04-13 vismte CANCORE-1904: [VStdLib] Review findings + * CANCORE-1203: [VStdLib] Support MemCpy_s with return value + * CANCORE-1201: [VStdLib] Extend Embedded Compiler tests and fix compiler warnings + * 03.08.01 2023-07-26 vismte ESCAN00115111: Compiler error during VCA analysis in _VStdLib.vcaspecs.c + * 03.09.00 2024-09-24 hjenhani CANCORE-2865: [VStdLib] Make VStdLib VCA (Silent Analysis) compatible + *********************************************************************************************************************/ + +#ifndef VSTDLIB_H +# define VSTDLIB_H + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +# include "Std_Types.h" + +# include "VStdLib_Cfg.h" + +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +# endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/* Vendor and module identification */ +# define VSTDLIB_VENDOR_ID (30u) +# if !defined (VSTDLIB_MODULE_ID) +# define VSTDLIB_MODULE_ID (255u) +# endif + +/* Component version information (decimal version of ALM implementation package) */ +# define VSTDLIB_SW_MAJOR_VERSION (3u) +# define VSTDLIB_SW_MINOR_VERSION (9u) +# define VSTDLIB_SW_PATCH_VERSION (0u) + +# if !defined (VSTDLIB_INSTANCE_ID_DET) +# define VSTDLIB_INSTANCE_ID_DET (0u) +# endif + +/* API service IDs */ +# define VSTDLIB_SID_MEM_SET (0x00u) /*!< Service ID: VStdLib_MemClr(), VStdLib_MemSet() */ +# define VSTDLIB_SID_MEM_COPY (0x01u) /*!< Service ID: VStdLib_MemCpy(), VStdLib_MemCpyEndianPlatformToBig(), VStdLib_MemCpyEndianPlatformToLittle(), + VStdLib_MemCpyEndianBigToPlatform(), VStdLib_MemCpyEndianLittleToPlatform() */ +# define VSTDLIB_SID_MEM_COPY_16 (0x02u) /*!< Service ID: VStdLib_MemCpy16() */ +# define VSTDLIB_SID_MEM_COPY_32 (0x03u) /*!< Service ID: VStdLib_MemCpy32() */ +# define VSTDLIB_SID_MEM_COPY_S (0x04u) /*!< Service ID: VStdLib_MemCpy_s(), VStdLib_MemCpy_Return_s(), VStdLib_MemCpyEndianPlatformToBig_s(), + VStdLib_MemCpyEndianPlatformToLittle_s(), VStdLib_MemCpyEndianBigToPlatform_s(), + VStdLib_MemCpyEndianLittleToPlatform_s() */ +# define VSTDLIB_SID_GET_VERSION_INFO (0x05u) /*!< Service ID: VStdLib_GetVersionInfo() */ +# define VSTDLIB_SID_MEM_CMP (0x06u) /*!< Service ID: VStdLib_MemCmp() */ +# define VSTDLIB_SID_CNV_UINT16_TO_ARRAY_BE (0x07u) /*!< Service ID: VStdLib_ConvertUint16ToUint8ArrayBigEndian(), VStdLib_ConvertSint16ToUint8ArrayBigEndian() */ +# define VSTDLIB_SID_CNV_UINT16_TO_ARRAY_LE (0x08u) /*!< Service ID: VStdLib_ConvertUint16ToUint8ArrayLittleEndian(), VStdLib_ConvertSint16ToUint8ArrayLittleEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT16_BE (0x09u) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint16BigEndian(), VStdLib_ConvertUint8ArrayToSint16BigEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT16_LE (0x0Au) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint16LittleEndian(), VStdLib_ConvertUint8ArrayToSint16LittleEndian() */ +# define VSTDLIB_SID_CNV_UINT32_TO_ARRAY_BE (0x0Bu) /*!< Service ID: VStdLib_ConvertUint32ToUint8ArrayBigEndian(), VStdLib_ConvertSint32ToUint8ArrayBigEndian() */ +# define VSTDLIB_SID_CNV_UINT32_TO_ARRAY_LE (0x0Cu) /*!< Service ID: VStdLib_ConvertUint32ToUint8ArrayLittleEndian(), VStdLib_ConvertSint32ToUint8ArrayLittleEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT32_BE (0x0Du) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint32BigEndian(), VStdLib_ConvertUint8ArrayToSint32BigEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT32_LE (0x0Eu) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint32LittleEndian(), VStdLib_ConvertUint8ArrayToSint32LittleEndian() */ +# define VSTDLIB_SID_CNV_UINT64_TO_ARRAY_BE (0x0Fu) /*!< Service ID: VStdLib_ConvertUint64ToUint8ArrayBigEndian(), VStdLib_ConvertSint64ToUint8ArrayBigEndian() */ +# define VSTDLIB_SID_CNV_UINT64_TO_ARRAY_LE (0x10u) /*!< Service ID: VStdLib_ConvertUint64ToUint8ArrayLittleEndian(), VStdLib_ConvertSint64ToUint8ArrayLittleEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT64_BE (0x11u) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint64BigEndian(), VStdLib_ConvertUint8ArrayToSint64BigEndian() */ +# define VSTDLIB_SID_CNV_ARRAY_TO_UINT64_LE (0x12u) /*!< Service ID: VStdLib_ConvertUint8ArrayToUint64LittleEndian(), VStdLib_ConvertUint8ArrayToSint64LittleEndian() */ +# define VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN (0x13u) /*!< Service ID: VStdLib_MemCpySwapEndian(), VStdLib_MemCpyEndianPlatformToBig(), + VStdLib_MemCpyEndianPlatformToLittle(), VStdLib_MemCpyEndianBigToPlatform(), + VStdLib_MemCpyEndianLittleToPlatform() */ +# define VSTDLIB_SID_MEM_COPY_SWAP_ENDIAN_S (0x14u) /*!< Service ID: VStdLib_MemCpySwapEndian_s(), VStdLib_MemCpyEndianPlatformToBig_s(), + VStdLib_MemCpyEndianPlatformToLittle_s(), VStdLib_MemCpyEndianBigToPlatform_s(), + VStdLib_MemCpyEndianLittleToPlatform_s() */ +# define VSTDLIB_SID_MEM_CHECK (0x15u) /*!< Service ID: VStdLib_MemCheck() */ + +# define VSTDLIB_SID_BIT_COPY_SAW (0x16u) /*!< Service ID: VStdLib_BitCpySawBigToBigEndian(), VStdLib_BitCpySawBigToLittleEndian(), + VStdLib_BitCpySawLittleToBigEndian(), VStdLib_BitCpySawLittleToLittleEndian() */ +# define VSTDLIB_SID_BIT_COPY_MON (0x17u) /*!< Service ID: VStdLib_BitCpyMonBigToBigEndian(), VStdLib_BitCpyMonBigToLittleEndian(), + VStdLib_BitCpyMonLittleToBigEndian(), VStdLib_BitCpyMonLittleToLittleEndian() */ +# define VSTDLIB_SID_BIT_COPY_SAW_S (0x18u) /*!< Service ID: VStdLib_BitCpySawBigToBigEndian_s(), VStdLib_BitCpySawBigToLittleEndian_s(), + VStdLib_BitCpySawLittleToBigEndian_s(), VStdLib_BitCpySawLittleToLittleEndian_s() */ +# define VSTDLIB_SID_BIT_COPY_MON_S (0x19u) /*!< Service ID: VStdLib_BitCpyMonBigToBigEndian_s(), VStdLib_BitCpyMonBigToLittleEndian_s(), + VStdLib_BitCpyMonLittleToBigEndian_s(), VStdLib_BitCpyMonLittleToLittleEndian_s() */ + +/* Error codes */ +# define VSTDLIB_E_NO_ERROR (0x00u) /*!< Used to check if no error occurred */ +# define VSTDLIB_E_PARAM_POINTER (0x01u) /*!< Error code: API used with invalid pointer parameter (e.g. NULL) */ +# define VSTDLIB_E_PARAM_SIZE (0x02u) /*!< Error code: API used with invalid destination buffer size */ +# define VSTDLIB_E_PARAM_INTTYPE (0x03u) /*!< Error code: API used with invalid integer type parameter */ + +/* Large data support */ +# if !defined (VSTDLIB_SUPPORT_LARGE_DATA) +# define VSTDLIB_SUPPORT_LARGE_DATA STD_ON +# endif + +/* Return value from bit search APIs, if bit position or bit count is not available */ +# define VSTDLIB_BITPOS_NA (0x80u) +# define VSTDLIB_BITCNT_NA VSTDLIB_BITPOS_NA + +/*! Possible values for the integer type parameter of the memory copy with endianness conversion APIs */ +# define VSTDLIB_INTTYPE_8 (1u) +# define VSTDLIB_INTTYPE_16 (2u) +# define VSTDLIB_INTTYPE_32 (4u) +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) +# define VSTDLIB_INTTYPE_64 (8u) +# endif + +/********************************************************************************************************************** + * GLOBAL DATA TYPES AND STRUCTURES + *********************************************************************************************************************/ + +/* Module specific definition of LOCAL_INLINE */ +# if !defined (VSTDLIB_LOCAL_INLINE) +# define VSTDLIB_LOCAL_INLINE LOCAL_INLINE +# endif + +/*! Data type for nCnt API parameters */ +# if (VSTDLIB_SUPPORT_LARGE_DATA == STD_ON) +typedef uint32_least VStdLib_CntType; +# else +typedef uint16_least VStdLib_CntType; +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTION MACROS (MACRO API) + *********************************************************************************************************************/ + +/* PRQA S 3453 VSTDLIB_FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +# if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemClr() + *********************************************************************************************************************/ +/*! \brief Initializes memory to zero. + * \details Sets nCnt bytes starting at pDst to zero. + * \param[out] pDst Pointer to the memory location to be initialized, must not be NULL. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON, + * else it is realized by a call to VStdLib_MemSet() with 'nPattern' == 0. + * The compatible definition VStdLib_MemClrLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_MemClr(pDst, nCnt) VStdLib_MemSet((pDst), 0, (nCnt)) + +# endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_SUPPORT_LARGE_DATA == STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemClrLarge() + *********************************************************************************************************************/ +/*! \brief Initializes memory to zero. + * \details Sets nCnt bytes starting at pDst to zero. + * \param[out] pDst Pointer to the memory location to be initialized, must not be NULL. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_MemClrLarge(pDst, nCnt) VStdLib_MemClr((pDst), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemSetLarge() + *********************************************************************************************************************/ +/*! \brief Initializes memory to a specified pattern. + * \details Sets nCnt bytes starting at pDst to the character nPattern. + * \param[out] pDst Pointer to the memory location to be initialized, must not be NULL. + * \param[in] nPattern The character to be used to initialize the memory. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_MemSetLarge(pDst, nPattern, nCnt) VStdLib_MemSet((pDst), (nPattern), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpyLarge() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt bytes starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyLarge(pDst, pSrc, nCnt) VStdLib_MemCpy((pDst), (pSrc), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpy16Large() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt 16-bit blocks starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, 16-bit aligned and not NULL. + * \param[in] pSrc Pointer to the memory location to copy from, 16-bit aligned and not NULL. + * \param[in] nCnt Number of 16-bit blocks to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpy16Large(pDst, pSrc, nCnt) VStdLib_MemCpy16((pDst), (pSrc), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpy32Large() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt 32-bit blocks starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, 32-bit aligned and not NULL. + * \param[in] pSrc Pointer to the memory location to copy from, 32-bit aligned and not NULL. + * \param[in] nCnt Number of 32-bit blocks to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpy32Large(pDst, pSrc, nCnt) VStdLib_MemCpy32((pDst), (pSrc), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpyLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another. + * \details Uses VStdLib_MemCpy() to copy nCnt bytes starting at pSrc to another memory location starting + * at pDst, if nDstSize is greater than or equal to nCnt. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyLarge_s(pDst, nDstSize, pSrc, nCnt) VStdLib_MemCpy_s((pDst), (nDstSize), (pSrc), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpyLarge_Return_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyLarge_Return_s(pDst, nDstSize, pSrc, nCnt, errorCode) \ + VStdLib_MemCpy_Return_s((pDst), (nDstSize), (pSrc), (nCnt), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCmpLarge() + *********************************************************************************************************************/ +/*! \brief Compares two buffers for the specified number of bytes and returns whether they are equal or not. + * \details - + * \param[in] pBuf1 Pointer to first buffer for comparison, must not be NULL. + * \param[in] pBuf2 Pointer to second buffer for comparison, must not be NULL. + * \param[in] nCnt Number of bytes to compare, pBuf1 and pBuf2 must be valid for this amount. + * \return < 0 The first buffer contains a smaller value than the second buffer. + * \return 0 The two buffers are equal for the number of compared bytes. + * \return > 0 The first buffer contains a greater value than the second buffer. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pBuf1' and 'pBuf2' have to point to valid memory areas. Each memory area has to be + * valid for at least the byte count defined in parameter 'nCnt'. + * The memory areas defined by parameters 'pBuf1', 'pBuf2' and 'nCnt' must not be changed by another + * context whilethe comparison is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCmpLarge(pBuf1, pBuf2, nCnt) VStdLib_MemCmp((pBuf1), (pBuf2), (nCnt)) + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndianLarge() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc to another memory location starting at pDst in the swapped + * endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpySwapEndianLarge(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpySwapEndian((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndianLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another in the swapped + * endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpySwapEndian() to copy and swap nCnt + * bytes starting at pSrc to another memory location starting at pDst. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpySwapEndianLarge_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpySwapEndian_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)); + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToBigLarge() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (platform endianness) to another memory location starting at pDst + * in big endian according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianPlatformToBigLarge(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianPlatformToBig((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToBigLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (platform endianness) to + * another in big endian according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in big endian. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianPlatformToBigLarge_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianPlatformToBig_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToLittleLarge() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (platform endianness) to another memory location starting at pDst + * in little endian according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianPlatformToLittleLarge(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianPlatformToLittle((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToLittleLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (platform endianness) to + * another in little endian according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in little endian. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') that is writable from the + * calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianPlatformToLittleLarge_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianPlatformToLittle_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianBigToPlatformLarge() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (big endian) to another memory location starting at pDst in the + * platform endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianBigToPlatformLarge(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianBigToPlatform((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianBigToPlatformLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (big endian) to another in the + * platform endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in the platform + * endianness Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianBigToPlatformLarge_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianBigToPlatform_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianLittleToPlatformLarge() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (little endian) to another memory location starting at pDst in the + * platform endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianLittleToPlatformLarge(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianLittleToPlatform((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianLittleToPlatformLarge_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (little endian) to another in + * the platform endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in the platform + * endianness. Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianLittleToPlatformLarge_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianLittleToPlatform_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCheckLarge() + *********************************************************************************************************************/ +/*! \brief Compares the content of a memory area to a specified pattern. + * \details Compares nCnt bytes of memory starting at pBuf to the character nPattern. + * \param[in] pBuf Pointer to the memory location to be checked, must not be NULL. + * \param[in] nPattern The character to be checked for in the memory. + * \param[in] nCnt Number of bytes to be checked, pBuf must be valid for this amount. + * \param[in] errorCode Value to be returned, if content of pBuf is not equal to pattern. + * Should not be equal to E_OK. + * \return E_OK Content of pBuf is equal to pattern. + * \return errorCode Content of pBuf is not equal to pattern. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_SUPPORT_LARGE_DATA == STD_ON + * \pre The parameters 'pBuf' and 'nCnt' have to define a valid memory area. + * The memory area defined by parameters 'pBuf' and 'nCnt' must not be changed by another context while + * the comparison is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCheckLarge(pBuf, nPattern, nCnt, errorCode) VStdLib_MemCheck((pBuf), (nPattern), (nCnt), (errorCode)) + +# endif /* VSTDLIB_SUPPORT_LARGE_DATA == STD_ON */ + +# if (VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertSint16ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The signed 16-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least two elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint16ToUint8ArrayBigEndian(src, dst) VStdLib_ConvertUint16ToUint8ArrayBigEndian(((uint16)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertSint16ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The signed 16-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least two elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint16ToUint8ArrayLittleEndian(src, dst) VStdLib_ConvertUint16ToUint8ArrayLittleEndian(((uint16)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint16BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 16-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 16-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to a signed 16-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint16BigEndian(src, dst) VStdLib_ConvertUint8ArrayToUint16BigEndian((src), ((uint16*)(dst))) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint16LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 16-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 16-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to a signed 16-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint16LittleEndian(src, dst) VStdLib_ConvertUint8ArrayToUint16LittleEndian((src), ((uint16*)(dst))) + +# endif /* VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertSint32ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The signed 32-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least four elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint32ToUint8ArrayBigEndian(src, dst) VStdLib_ConvertUint32ToUint8ArrayBigEndian(((uint32)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertSint32ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The signed 32-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least four elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint32ToUint8ArrayLittleEndian(src, dst) VStdLib_ConvertUint32ToUint8ArrayLittleEndian(((uint32)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint32BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 32-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 32-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to a signed 32-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint32BigEndian(src, dst) VStdLib_ConvertUint8ArrayToUint32BigEndian(src, ((uint32*)(dst))) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint32LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 32-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 32-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to a signed 32-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint32LittleEndian(src, dst) VStdLib_ConvertUint8ArrayToUint32LittleEndian((src), ((uint32*)(dst))) + +# endif /* VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_ConvertSint64ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The signed 64-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least eight elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint64ToUint8ArrayBigEndian(src, dst) VStdLib_ConvertUint64ToUint8ArrayBigEndian(((uint64)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertSint64ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The signed 64-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least eight elements that is writable + * from the calling context. + *********************************************************************************************************************/ +# define VStdLib_ConvertSint64ToUint8ArrayLittleEndian(src, dst) VStdLib_ConvertUint64ToUint8ArrayLittleEndian(((uint64)(src)), (dst)) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint64BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 64-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 64-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least eight elements. + * The parameter 'dst' has to point to a signed 64-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint64BigEndian(src, dst) VStdLib_ConvertUint8ArrayToUint64BigEndian((src), ((uint64*)(dst))) + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToSint64LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to a signed 64-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to a signed 64-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least eight elements. + * The parameter 'dst' has to point to a signed 64-bit variable that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_ConvertUint8ArrayToSint64LittleEndian(src, dst) VStdLib_ConvertUint8ArrayToUint64LittleEndian((src), ((uint64*)(dst))) + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) */ + +# if (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianSint16() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified signed 16-bit value. + * \details - + * \param[in] value Signed 16-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_SwapEndianSint16(value) ((sint16)VStdLib_SwapEndianUint16(((uint16)(value)))) + +# endif /* VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigUint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Unsigned 16-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToBigUint16(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToBigUint16(value) VStdLib_SwapEndianUint16((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigSint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Signed 16-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToBigSint16(value) ((sint16)VStdLib_ConvertEndianPlatformToBigUint16(((uint16)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleUint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Unsigned 16-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToLittleUint16(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToLittleUint16(value) VStdLib_SwapEndianUint16((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleSint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Signed 16-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToLittleSint16(value) ((sint16)VStdLib_ConvertEndianPlatformToLittleUint16(((uint16)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformUint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Unsigned 16-bit value according to big endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformUint16(value) VStdLib_ConvertEndianPlatformToBigUint16((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformSint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Signed 16-bit value according to big endian, which shall be converted to the platform. + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformSint16(value) VStdLib_ConvertEndianPlatformToBigSint16((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformUint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Unsigned 16-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformUint16(value) VStdLib_ConvertEndianPlatformToLittleUint16((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformSint16() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 16-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Signed 16-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformSint16(value) VStdLib_ConvertEndianPlatformToLittleSint16((value)) + +# if (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianSint32() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified signed 32-bit value. + * \details - + * \param[in] value Signed 32-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_SwapEndianSint32(value) ((sint32)VStdLib_SwapEndianUint32(((uint32)(value)))) + +# endif /* VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigUint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Unsigned 32-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToBigUint32(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToBigUint32(value) VStdLib_SwapEndianUint32((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigSint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Signed 32-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToBigSint32(value) ((sint32)VStdLib_ConvertEndianPlatformToBigUint32(((uint32)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleUint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Unsigned 32-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToLittleUint32(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToLittleUint32(value) VStdLib_SwapEndianUint32((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleSint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Signed 32-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToLittleSint32(value) ((sint32)VStdLib_ConvertEndianPlatformToLittleUint32(((uint32)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformUint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Unsigned 32-bit value according to big endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformUint32(value) VStdLib_ConvertEndianPlatformToBigUint32((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformSint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Signed 32-bit value according to big endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformSint32(value) VStdLib_ConvertEndianPlatformToBigSint32((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformUint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Unsigned 32-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformUint32(value) VStdLib_ConvertEndianPlatformToLittleUint32((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformSint32() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 32-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Signed 32-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config - + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformSint32(value) VStdLib_ConvertEndianPlatformToLittleSint32((value)) + +# if defined (PLATFORM_SUPPORT_SINT64_UINT64) +# if (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianSint64() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified signed 64-bit value. + * \details - + * \param[in] value Signed 64-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_SwapEndianSint64(value) ((sint64)VStdLib_SwapEndianUint64(((uint64)(value)))) + +# endif /* VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigUint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Unsigned 64-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToBigUint64(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToBigUint64(value) VStdLib_SwapEndianUint64((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToBigSint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value from the platform endianness to big endian. + * \details - + * \param[in] value Signed 64-bit value according to the platform endianness, which shall be converted to big + * endian. + * \return Value in big endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToBigSint64(value) ((sint64)VStdLib_ConvertEndianPlatformToBigUint64(((uint64)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleUint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Unsigned 64-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# define VStdLib_ConvertEndianPlatformToLittleUint64(value) (value) +# else +# define VStdLib_ConvertEndianPlatformToLittleUint64(value) VStdLib_SwapEndianUint64((value)) +# endif + +/********************************************************************************************************************** + * VStdLib_ConvertEndianPlatformToLittleSint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value from the platform endianness to little endian. + * \details - + * \param[in] value Signed 64-bit value according to the platform endianness, which shall be converted to little + * endian. + * \return Value in little endian. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianPlatformToLittleSint64(value) ((sint64)VStdLib_ConvertEndianPlatformToLittleUint64(((uint64)(value)))) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformUint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Unsigned 64-bit value according to big endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformUint64(value) VStdLib_ConvertEndianPlatformToBigUint64((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianBigToPlatformSint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value from big endian to the platform endianness. + * \details - + * \param[in] value Signed 64-bit value according to big endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianBigToPlatformSint64(value) VStdLib_ConvertEndianPlatformToBigSint64((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformUint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Unsigned 64-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformUint64(value) VStdLib_ConvertEndianPlatformToLittleUint64((value)) + +/********************************************************************************************************************** + * VStdLib_ConvertEndianLittleToPlatformSint64() + *********************************************************************************************************************/ +/*! \brief Converts the specified signed 64-bit value from little endian to the platform endianness. + * \details - + * \param[in] value Signed 64-bit value according to little endian, which shall be converted to the platform + * endianness. + * \return Value in the platform endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \pre - + *********************************************************************************************************************/ +# define VStdLib_ConvertEndianLittleToPlatformSint64(value) VStdLib_ConvertEndianPlatformToLittleSint64((value)) + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) */ + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToBig() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (platform endianness) to another memory location starting at pDst + * in big endian according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianPlatformToBigLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) +# define VStdLib_MemCpyEndianPlatformToBig(pDst, pSrc, nCnt, intType) VStdLib_MemCpy((pDst), (pSrc), (nCnt)) +# else +# define VStdLib_MemCpyEndianPlatformToBig(pDst, pSrc, nCnt, intType) VStdLib_MemCpySwapEndian((pDst), (pSrc), (nCnt), (intType)) +# endif + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToLittle() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (platform endianness) to another memory location starting at pDst + * in little endian according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianPlatformToLittleLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) +# define VStdLib_MemCpyEndianPlatformToLittle(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpy((pDst), (pSrc), (nCnt)) +# else +# define VStdLib_MemCpyEndianPlatformToLittle(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpySwapEndian((pDst), (pSrc), (nCnt), (intType)) +# endif + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianBigToPlatform() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (big endian) to another memory location starting at pDst in the + * platform endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianBigToPlatformLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianBigToPlatform(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianPlatformToBig((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianBigToPlatform_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (big endian) to another in the + * platform endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in the platform + * endianness. Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianBigToPlatformLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianBigToPlatform_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianPlatformToBig_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianLittleToPlatform() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc (little endian) to another memory location starting at pDst in the + * platform endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianLittleToPlatformLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianLittleToPlatform(pDst, pSrc, nCnt, intType) \ + VStdLib_MemCpyEndianPlatformToLittle((pDst), (pSrc), (nCnt), (intType)) + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianLittleToPlatform_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (little endian) to another in + * the platform endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in the platform + * endianness. Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianLittleToPlatformLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +# define VStdLib_MemCpyEndianLittleToPlatform_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode) \ + VStdLib_MemCpyEndianPlatformToLittle_s((pDst), (nDstSize), (pSrc), (nCnt), (intType), (errorCode)) + +/* PRQA L:VSTDLIB_FUNCTION_LIKE_MACRO */ + +# if !defined (VStdLib_MemClrMacro) + +/********************************************************************************************************************** + * VStdLib_MemClrMacro() + *********************************************************************************************************************/ +/*! \brief Initializes memory to zero (macro implementation). + * \details Sets nCnt blocks starting at pDst to zero (block-size is given by the type of pDst). + * \param[out] pDst Any typed pointer to the memory location to be initialized, must be aligned + * corresponding to its type and not be NULL. + * \param[in] nCnt Number of blocks to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_MemClrMacro(pDst, nCnt) \ + { VStdLib_CntType __i; for ( __i = 0u; __i < (nCnt); ++__i) { (pDst)[__i] = 0; } } /* FETA_VSTDLIB_MEMSET_MACRO */ + +# endif + +# if !defined (VStdLib_MemSetMacro) + +/********************************************************************************************************************** + * VStdLib_MemSetMacro() + *********************************************************************************************************************/ +/*! \brief Initializes memory to a specified pattern (macro implementation). + * \details Sets nCnt blocks starting at pDst to nPattern (block-size is given by the type of pDst). + * \param[out] pDst Any typed pointer to the memory location to be initialized, must be aligned + * corresponding to its type and not be NULL. + * \param[in] nPattern The pattern to be used to initialize the memory (consider the correlation between its + * type and the type of pDst). + * \param[in] nCnt Number of blocks to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +# define VStdLib_MemSetMacro(pDst, nPattern, nCnt) \ + { VStdLib_CntType __i; for ( __i = 0u; __i < (nCnt); ++__i) { (pDst)[__i] = (nPattern); } } /* FETA_VSTDLIB_MEMSET_MACRO */ + +# endif + +# if !defined (VStdLib_MemCpyMacro) + +/********************************************************************************************************************** + * VStdLib_MemCpyMacro() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another (macro implementation). + * \details Copies nCnt blocks starting at pSrc to another memory location starting at pDst (block-size is given + * by the type of pDst). + * \param[out] pDst Any typed pointer to the memory location to copy to, must be aligned corresponding + * to its type and not be NULL. + * \param[in] pSrc Any typed pointer to the memory location to copy from, must be aligned corresponding + * to its type and not be NULL. + * \param[in] nCnt Number of blocks to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyMacro(pDst, pSrc, nCnt) \ + { VStdLib_CntType __i; for ( __i = 0u; __i < (nCnt); ++__i) { (pDst)[__i] = (pSrc)[__i]; } } /* FETA_VSTDLIB_MEMCPY_MACRO */ + +# endif + +# if !defined (VStdLib_MemCpyMacro_s) + +/********************************************************************************************************************** + * VStdLib_MemCpyMacro_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another (macro + * implementation). + * \details Uses VStdLib_MemCpyMacro() to copy nCnt blocks starting at pSrc to another memory location starting + * at pDst (block-size is given by the type of pDst), if nDstSize is greater than or equal to nCnt. + * \param[out] pDst Any typed pointer to the memory location to copy to, must be aligned corresponding + * to its type and not be NULL. + * \param[in] nDstSize Maximum number of blocks available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Any typed pointer to the memory location to copy from, must be aligned corresponding + * to its type and not be NULL. + * \param[in] nCnt Number of blocks to copy. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +# define VStdLib_MemCpyMacro_s(pDst, nDstSize, pSrc, nCnt) \ + { if ((nDstSize) >= (nCnt)) { VStdLib_MemCpyMacro((pDst), (pSrc), (nCnt)); } } /* FETA_VSTDLIB_CALL_MEMCPY_MACRO */ + +# endif + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES (FUNCTION API) + *********************************************************************************************************************/ + +# define VSTDLIB_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemSet() + *********************************************************************************************************************/ +/*! \brief Initializes memory to a specified pattern. + * \details Sets nCnt bytes starting at pDst to the character nPattern. + * \param[out] pDst Pointer to the memory location to be initialized, must not be NULL. + * \param[in] nPattern The character to be used to initialize the memory. + * \param[in] nCnt Number of bytes to initialize, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON. + * The compatible definition VStdLib_MemSetLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemSet(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + uint8 nPattern, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_MemCpy() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt bytes starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON. + * The compatible definition VStdLib_MemCpyLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_MemCpy16() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt 16-bit blocks starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, 16-bit aligned and not NULL. + * \param[in] pSrc Pointer to the memory location to copy from, 16-bit aligned and not NULL. + * \param[in] nCnt Number of 16-bit blocks to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON. + * The compatible definition VStdLib_MemCpy16Large() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy16(P2VAR(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint16, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_MemCpy32() + *********************************************************************************************************************/ +/*! \brief Copies data from one memory location to another. + * \details Copies nCnt 32-bit blocks starting at pSrc to another memory location starting at pDst. + * \param[out] pDst Pointer to the memory location to copy to, 32-bit aligned and not NULL. + * \param[in] pSrc Pointer to the memory location to copy from, 32-bit aligned and not NULL. + * \param[in] nCnt Number of 32-bit blocks to copy, pDst must be valid for this amount. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON. + * The compatible definition VStdLib_MemCpy32Large() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a valid memory area that is writable from the calling + * context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy32(P2VAR(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(uint32, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt); + +# endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_MemCpy_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another. + * \details Uses VStdLib_MemCpy() to copy nCnt bytes starting at pSrc to another memory location starting + * at pDst, if nDstSize is greater than or equal to nCnt. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpy_s(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_MemCpy_Return_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyLarge_Return_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpy_Return_s(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location to another in the swapped + * endianness according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpySwapEndian() to copy and swap nCnt + * bytes starting at pSrc to another memory location starting at pDst. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpySwapEndianLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpySwapEndian_s(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToBig_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (platform endianness) to + * another in big endian according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in big endian. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianPlatformToBigLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + * \vcaattr EscalateFindings((The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the calling context)) + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpyEndianPlatformToBig_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToLittle_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies data from one memory location (platform endianness) to + * another in little endian according to the integer type intType. + * \details If nDstSize is greater than or equal to nCnt, it uses VStdLib_MemCpy()/VStdLib_MemCpySwapEndian() to + * copy nCnt bytes starting at pSrc to another memory location starting at pDst in little endian. + * Otherwise no copying is performed and the passed errorCode is returned. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \param[in] errorCode Value to be returned, if nCnt exceeds nDstSize. + * Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode nCnt exceeds nDstSize. No copying was performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nDstSize' + * \synchronous TRUE + * \config The compatible definition VStdLib_MemCpyEndianPlatformToLittleLarge_s() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the + * calling context. + * The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType'). + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + * \vcaattr EscalateFindings((The parameters 'pDst' and 'nDstSize' have to define a valid memory area that is writable from the calling context)) + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpyEndianPlatformToLittle_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode); + +# if (VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCmp() + *********************************************************************************************************************/ +/*! \brief Compares two buffers for the specified number of bytes and returns whether they are equal or not. + * \details - + * \param[in] pBuf1 Pointer to first buffer for comparison, must not be NULL. + * \param[in] pBuf2 Pointer to second buffer for comparison, must not be NULL. + * \param[in] nCnt Number of bytes to compare, pBuf1 and pBuf2 must be valid for this amount. + * \return < 0 The first buffer contains a smaller value than the second buffer. + * \return 0 The two buffers are equal for the number of compared bytes. + * \return > 0 The first buffer contains a greater value than the second buffer. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_LIBRARY_FUNCTIONS == STD_ON. + * The compatible definition VStdLib_MemCmpLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pBuf1' and 'pBuf2' have to point to valid memory areas. Each memory area has to be + * valid for at least the byte count defined in parameter 'nCnt'. + * The memory areas defined by parameters 'pBuf1', 'pBuf2' and 'nCnt' must not be changed by another + * context while the comparison is being executed. + *********************************************************************************************************************/ +FUNC(sint8, VSTDLIB_CODE) VStdLib_MemCmp(P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf1, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf2, + VStdLib_CntType nCnt); + +# endif /* VSTDLIB_USE_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCpySwapEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bytes starting at pSrc to another memory location starting at pDst in the swapped + * endianness according to the integer type intType. + * \details Depending on the configuration (VSTDLIB_RUNTIME_OPTIMIZATION) and the passed arguments for parameter + * intType and nCnt different memory access sizes are used (see TechRef). + * intType value VSTDLIB_INTTYPE_64 is only supported if PLATFORM_SUPPORT_SINT64_UINT64 is defined. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nCnt Number of bytes to copy, pDst must be valid for this amount. + * \param[in] intType Integer type with which the memory locations are interpreted + * (VSTDLIB_INTTYPE_[8, 16, 32, 64]). + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst' and 'nCnt' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION == STD_ON. + * The compatible definition VStdLib_MemCpySwapEndianLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pDst' and 'nCnt' have to define a memory area that is valid for a multiple of the + * integer type size (parameter 'intType') and writable from the calling context. + * The parameter 'pDst' is aligned according to the integer type 'intType'. + * The source memory area defined by parameters 'pSrc' and 'nCnt' must not be changed by another context + * while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_MemCpySwapEndian(P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType); + +# endif /* VSTDLIB_USE_MEM_CPY_ENDIAN_CONVERSION_LIBRARY_FUNCTION != STD_ON */ + +# if(VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of big endian data from one memory location to another memory location with big + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of big endian data from one memory location to another memory location with little + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of little endian data from one memory location to another memory location with big + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of little endian data from one memory location to another memory location with + * little endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpySawLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt); + +# endif /* VSTDLIB_USE_BITCPYSAWTOOTH_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToBigEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of big endian data from one memory location to + * another memory location with big endian data. + * \details Uses VStdLib_BitCpySawBigToBigEndian() to copy data, if nDstSize is greater than or equal to the last + * byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetSaw'' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawBigToBigEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpySawBigToLittleEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of big endian data from one memory location to + * another memory location with little endian data. + * \details Uses VStdLib_BitCpySawBigToLittleEndian() to copy data, if nDstSize is greater than or equal to the + * last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawBigToLittleEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToBigEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of little endian data from one memory location to + * another memory location with big endian data. + * \details Uses VStdLib_BitCpySawLittleToBigEndian() to copy data, if nDstSize is greater than or equal to the + * last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawLittleToBigEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpySawLittleToLittleEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of little endian data from one memory location to + * another memory location with little endian data. + * \details Uses VStdLib_BitCpySawLittleToLittleEndian() to copy data, if nDstSize is greater than or equal to + * the last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetSaw Bit offset (it can even be greater than 7) in sawtooth numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetSaw'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetSaw' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffetSaw' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetSaw' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetSaw' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpySawLittleToLittleEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetSaw, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetSaw, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +# if(VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of big endian data from one memory location to another memory location with big + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonBigToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of big endian data from one memory location to another memory location with little + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonBigToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToBigEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of little endian data from one memory location to another memory location with big + * endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToBigEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToLittleEndian() + *********************************************************************************************************************/ +/*! \brief Copies nCnt bits of little endian data from one memory location to another memory location with + * little endian data. + * \details - + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToLittleEndian( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt); + +# endif /* VSTDLIB_USE_BITCPYMONOTONE_LIBRARY_FUNCTIONS != STD_ON */ + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToBigEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of big endian data from one memory location to + * another memory location with big endian data. + * \details Uses VStdLib_BitCpyMonBigToBigEndian() to copy data, if nDstSize is greater than or equal to the last + * byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonBigToBigEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonBigToLittleEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of big endian data from one memory location to + * another memory location with little endian data. + * \details Uses VStdLib_BitCpyMonBigToLittleEndian() to copy data, if nDstSize is greater than or equal to the + * last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonBigToLittleEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToBigEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of little endian data from one memory location to + * another memory location with big endian data + * \details Uses VStdLib_BitCpyMonLittleToBigEndian() to copy data, if nDstSize is greater than or equal to the + * last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToBigEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +/********************************************************************************************************************** + * VStdLib_BitCpyMonLittleToLittleEndian_s() + *********************************************************************************************************************/ +/*! \brief Verifies the destination size and copies nCnt bits of little endian data from one memory location to + * another memory location with little endian data. + * \details Uses VStdLib_BitCpyMonLittleToLittleEndian() to copy data, if nDstSize is greater than or equal to + * the last byte to copy to. + * \param[out] pDst Pointer to the memory location to copy to, must not be NULL. + * \param[in] nDstSize Maximum number of bytes available in the destination (typically the size of the + * destination object). + * \param[in] nDstBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pDst'. Bits are copied to exactly this bit position. + * \param[in] pSrc Pointer to the memory location to copy from, must not be NULL. + * \param[in] nSrcBitOffsetMon Bit offset (it can even be greater than 7) in monotone numbering is added to + * 'pSrc'. Bits are copied from exactly this bit position. + * \param[in] nCnt Number of bits to copy starting at 'nDstBitOffsetMon'. + * \param[in] errorCode Value to be returned, if 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds + * 'nDstSize'. Should not be equal to E_OK. + * \return E_OK Copying was performed. + * \return errorCode 'nCnt' bits starting at 'nDstBitOffsetMon' exceeds 'nDstSize'. No copying was + * performed. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt'. + * \synchronous TRUE + * \config - + * \pre The parameters 'pDst', 'nDstBitOffsetMon' and 'nCnt' have to define a valid memory area that is + * writable from the calling context. + * The source memory area defined by parameters 'pSrc', 'nSrcBitOffsetMon' and 'nCnt' must not + * be changed by another context while the copying is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_BitCpyMonLittleToLittleEndian_s( + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + VStdLib_CntType nDstBitOffsetMon, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nSrcBitOffsetMon, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +# if (VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON) + +/********************************************************************************************************************** + * VStdLib_MemCheck() + *********************************************************************************************************************/ +/*! \brief Compares the content of a memory area to a specified pattern. + * \details Compares nCnt bytes of memory starting at pBuf to the character nPattern. + * \param[in] pBuf Pointer to the memory location to be checked, must not be NULL. + * \param[in] nPattern The character to be checked for in the memory. + * \param[in] nCnt Number of bytes to be checked, pBuf must be valid for this amount. + * \param[in] errorCode Value to be returned, if content of pBuf is not equal to pattern. + * Should not be equal to E_OK. + * \return E_OK Content of pBuf is equal to pattern. + * \return errorCode Content of pBuf is not equal to pattern. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_MEMCHECK_FUNCTION == STD_ON. + * The compatible definition VStdLib_MemCheckLarge() exists additionally (and solely) + * if VSTDLIB_SUPPORT_LARGE_DATA == STD_ON. + * \pre The parameters 'pBuf' and 'nCnt' have to define a valid memory area. + * The memory area defined by parameters 'pBuf' and 'nCnt' must not be changed by another context while + * the comparison is being executed. + * The parameter 'errorCode' must not be E_OK. + *********************************************************************************************************************/ +FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCheck(P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pBuf, + uint8 nPattern, + VStdLib_CntType nCnt, + Std_ReturnType errorCode); + +# endif /* VSTDLIB_USE_MEM_CHECK_LIBRARY_FUNCTION != STD_ON */ + +# if (VSTDLIB_VERSION_INFO_API == STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetVersionInfo() + *********************************************************************************************************************/ +/*! \brief Returns the version information of this module. + * \details Returns version information, vendor ID and AUTOSAR module ID of the component. + * \param[out] versioninfo Pointer to where to store the version information, must not be NULL. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config VSTDLIB_VERSION_INFO_API == STD_ON + * \pre The parameter 'versioninfo' has to be valid and reference an object of type Std_VersionInfoType. + * \trace CREQ-VStdLib-VersionInformation + *********************************************************************************************************************/ +FUNC(void, VSTDLIB_CODE) VStdLib_GetVersionInfo(P2VAR(Std_VersionInfoType, AUTOMATIC, VSTDLIB_APPL_VAR) versioninfo); + +# endif /* VSTDLIB_VERSION_INFO_API == STD_ON */ + +# if (VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne8() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the highest set bit shall be found. + * \return 0-7 Bit position of the highest set bit. + * \return VSTDLIB_BITPOS_NA 8-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero8() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of an unset bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the highest unset bit shall be found. + * \return 0-7 Bit position of the highest unset bit. + * \return VSTDLIB_BITPOS_NA 8-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne8() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the lowest set bit shall be found. + * \return 0-7 Bit position of the lowest set bit. + * \return VSTDLIB_BITPOS_NA 8-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero8() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of an unset bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the lowest unset bit shall be found. + * \return 0-7 Bit position of the lowest unset bit. + * \return VSTDLIB_BITPOS_NA 8-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes8() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits preceding the highest unset bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the count of leading ones shall be determined. + * \return 0-7 Count of leading ones. + * \return VSTDLIB_BITCNT_NA 8-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros8() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits preceding the highest set bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the count of leading zeros shall be determined. + * \return 0-7 Count of leading zeros. + * \return VSTDLIB_BITCNT_NA 8-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes8() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits following the lowest unset bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the count of trailing ones shall be determined. + * \return 0-7 Count of trailing ones. + * \return VSTDLIB_BITCNT_NA 8-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes8(uint8 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros8() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits following the lowest set bit in the specified 8-bit value. + * \details - + * \param[in] value The 8-bit value in which the count of trailing zeros shall be determined. + * \return 0-7 Count of trailing zeros. + * \return VSTDLIB_BITCNT_NA 8-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros8(uint8 value); + +# endif /* VSTDLIB_USE_8BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne16() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the highest set bit shall be found. + * \return 0-15 Bit position of the highest set bit. + * \return VSTDLIB_BITPOS_NA 16-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero16() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of an unset bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the highest unset bit shall be found. + * \return 0-15 Bit position of the highest unset bit. + * \return VSTDLIB_BITPOS_NA 16-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne16() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the lowest set bit shall be found. + * \return 0-15 Bit position of the lowest set bit. + * \return VSTDLIB_BITPOS_NA 16-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero16() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of an unset bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the lowest unset bit shall be found. + * \return 0-15 Bit position of the lowest unset bit. + * \return VSTDLIB_BITPOS_NA 16-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes16() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits preceding the highest unset bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the count of leading ones shall be determined. + * \return 0-15 Count of leading ones. + * \return VSTDLIB_BITCNT_NA 16-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros16() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits preceding the highest set bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the count of leading zeros shall be determined. + * \return 0-15 Count of leading zeros. + * \return VSTDLIB_BITCNT_NA 16-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes16() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits following the lowest unset bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the count of trailing ones shall be determined. + * \return 0-15 Count of trailing ones. + * \return VSTDLIB_BITCNT_NA 16-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes16(uint16 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros16() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits following the lowest set bit in the specified 16-bit value. + * \details - + * \param[in] value The 16-bit value in which the count of trailing zeros shall be determined. + * \return 0-15 Count of trailing zeros. + * \return VSTDLIB_BITCNT_NA 16-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros16(uint16 value); + +# endif /* VSTDLIB_USE_16BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne32() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the highest set bit shall be found. + * \return 0-31 Bit position of the highest set bit. + * \return VSTDLIB_BITPOS_NA 32-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero32() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of an unset bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the highest unset bit shall be found. + * \return 0-31 Bit position of the highest unset bit. + * \return VSTDLIB_BITPOS_NA 32-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne32() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the lowest set bit shall be found. + * \return 0-31 Bit position of the lowest set bit. + * \return VSTDLIB_BITPOS_NA 32-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero32() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of an unset bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the lowest unset bit shall be found. + * \return 0-31 Bit position of the lowest unset bit. + * \return VSTDLIB_BITPOS_NA 32-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes32() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits preceding the highest unset bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the count of leading ones shall be determined. + * \return 0-31 Count of leading ones. + * \return VSTDLIB_BITCNT_NA 32-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros32() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits preceding the highest set bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the count of leading zeros shall be determined. + * \return 0-31 Count of leading zeros. + * \return VSTDLIB_BITCNT_NA 32-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes32() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits following the lowest unset bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the count of trailing ones shall be determined. + * \return 0-31 Count of trailing ones. + * \return VSTDLIB_BITCNT_NA 32-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes32(uint32 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros32() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits following the lowest set bit in the specified 32-bit value. + * \details - + * \param[in] value The 32-bit value in which the count of trailing zeros shall be determined. + * \return 0-31 Count of trailing zeros. + * \return VSTDLIB_BITCNT_NA 32-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros32(uint32 value); + +# endif /* VSTDLIB_USE_32BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON */ + +# if ((defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosOne64() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of a set bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the highest set bit shall be found. + * \return 0-63 Bit position of the highest set bit. + * \return VSTDLIB_BITPOS_NA 64-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosOne64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetHighestBitPosZero64() + *********************************************************************************************************************/ +/*! \brief Returns the highest bit position of an unset bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the highest unset bit shall be found. + * \return 0-63 Bit position of the highest unset bit. + * \return VSTDLIB_BITPOS_NA 64-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetHighestBitPosZero64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosOne64() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of a set bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the lowest set bit shall be found. + * \return 0-63 Bit position of the lowest set bit. + * \return VSTDLIB_BITPOS_NA 64-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosOne64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetLowestBitPosZero64() + *********************************************************************************************************************/ +/*! \brief Returns the lowest bit position of an unset bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the lowest unset bit shall be found. + * \return 0-63 Bit position of the lowest unset bit. + * \return VSTDLIB_BITPOS_NA 64-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetLowestBitPosZero64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingOnes64() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits preceding the highest unset bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the count of leading ones shall be determined. + * \return 0-63 Count of leading ones. + * \return VSTDLIB_BITCNT_NA 64-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingOnes64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetCountLeadingZeros64() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits preceding the highest set bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the count of leading zeros shall be determined. + * \return 0-63 Count of leading zeros. + * \return VSTDLIB_BITCNT_NA 64-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountLeadingZeros64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingOnes64() + *********************************************************************************************************************/ +/*! \brief Returns the count of set bits following the lowest unset bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the count of trailing ones shall be determined. + * \return 0-63 Count of trailing ones. + * \return VSTDLIB_BITCNT_NA 64-bit value contains no unset bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingOnes64(uint64 value); + +/********************************************************************************************************************** + * VStdLib_GetCountTrailingZeros64() + *********************************************************************************************************************/ +/*! \brief Returns the count of unset bits following the lowest set bit in the specified 64-bit value. + * \details - + * \param[in] value The 64-bit value in which the count of trailing zeros shall be determined. + * \return 0-63 Count of trailing zeros. + * \return VSTDLIB_BITCNT_NA 64-bit value contains no set bit. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +FUNC(uint8, VSTDLIB_CODE) VStdLib_GetCountTrailingZeros64(uint64 value); + +# endif /* (defined PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_SEARCH_LIBRARY_FUNCTIONS != STD_ON) */ + +# if (VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertUint16ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The unsigned 16-bit value which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least two elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 2; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint16ToUint8ArrayBigEndian( + uint16 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint16ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 16-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The unsigned 16-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least two elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 2; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint16ToUint8ArrayLittleEndian( + uint16 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint16BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 16-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 16-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to an unsigned 16-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 2; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint16BigEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint16, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint16LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 16-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 16-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least two elements. + * The parameter 'dst' has to point to an unsigned 16-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 2; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint16LittleEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint16, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +# endif /* VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertUint32ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The unsigned 32-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least four elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 4; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint32ToUint8ArrayBigEndian( + uint32 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint32ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 32-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The unsigned 32-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least four elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 4; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint32ToUint8ArrayLittleEndian( + uint32 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint32BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 32-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 32-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least four elements. + * The parameter 'dst' has to point to an unsigned 32-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 4; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint32BigEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint32, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint32LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 32-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 32-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least four elements. + * The parameter 'dst' has to point to an unsigned 32-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 4; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint32LittleEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint32, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +# endif /* VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_ConvertUint64ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value to an unsigned 8-bit array according to big endian. + * \details - + * \param[in] src The unsigned 64-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least eight elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 8; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint64ToUint8ArrayBigEndian( + uint64 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint64ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 64-bit value to an unsigned 8-bit array according to little endian. + * \details - + * \param[in] src The unsigned 64-bit value, which shall be converted. + * \param[out] dst Pointer to an unsigned 8-bit array, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'dst' has to point to an unsigned 8-bit array of at least eight elements that is writable + * from the calling context. + * \spec + * requires $lengthOf(dst) >= 8; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint64ToUint8ArrayLittleEndian( + uint64 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint64BigEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 64-bit value according to big endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 64-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least eight elements. + * The parameter 'dst' has to point to an unsigned 64-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 8; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint64BigEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint64, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint64LittleEndian() + *********************************************************************************************************************/ +/*! \brief Converts the specified unsigned 8-bit array to an unsigned 64-bit value according to little endian. + * \details - + * \param[in] src Pointer to an unsigned 8-bit array, which shall be converted. + * \param[out] dst Pointer to an unsigned 64-bit variable, where the conversion result will be stored. + * \context ANY + * \reentrant TRUE for different memory areas defined by parameter 'dst' + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined. This service is implemented + * externally if VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS == STD_ON. + * \pre The parameter 'src' has to point to an unsigned 8-bit array of at least eight elements. + * The parameter 'dst' has to point to an unsigned 64-bit variable that is writable from the calling + * context. + * \spec + * requires $lengthOf(src) >= 8; + * requires $lengthOf(dst) >= 1; + * \endspec + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint64LittleEndian( + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint64, AUTOMATIC, VSTDLIB_APPL_VAR) dst); + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) */ + +# if (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint16() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified unsigned 16-bit value. + * \details - + * \param[in] value Unsigned 16-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint16, VSTDLIB_CODE) VStdLib_SwapEndianUint16(uint16 value); + +# endif /* VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint32() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified unsigned 32-bit value. + * \details - + * \param[in] value Unsigned 32-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is implemented externally if VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint32, VSTDLIB_CODE) VStdLib_SwapEndianUint32(uint32 value); + +# endif /* VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint64() + *********************************************************************************************************************/ +/*! \brief Swaps the endianness of the specified unsigned 64-bit value. + * \details - + * \param[in] value Unsigned 64-bit value, whose endianness shall be swapped. + * \return Value in the swapped endianness. + * \context ANY + * \reentrant TRUE + * \synchronous TRUE + * \config This service is only available if PLATFORM_SUPPORT_SINT64_UINT64 is defined.This service is implemented + * externally if VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS == STD_ON. + * \pre - + *********************************************************************************************************************/ +VSTDLIB_LOCAL_INLINE FUNC(uint64, VSTDLIB_CODE) VStdLib_SwapEndianUint64(uint64 value); + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) */ + +# define VSTDLIB_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ +# define VSTDLIB_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +# if( VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertUint16ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint16ToUint8ArrayBigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint16 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 16-bit value to big endian byte array */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 2u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)((src & 0xFF00u) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)( src & 0x00FFu); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT16_TO_ARRAY_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint16ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint16ToUint8ArrayLittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint16 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 16-bit value to lillte endian byte array */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 2u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)( src & 0x00FFu); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)((src & 0xFF00u) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT16_TO_ARRAY_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint16BigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint16BigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint16, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert big endian byte array to unsigned 16-bit value */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint16)((((uint16)src[0u]) << 8u) |/* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + ((uint16)src[1u])); +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT16_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint16LittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint16LittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint16, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'src' and 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert lillte endian byte array to unsigned 16-bit value */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 2u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint16)(((uint16)src[0u]) | /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + (((uint16)src[1u]) << 8u)); +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT16_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +# endif /* VSTDLIB_USE_16BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_ConvertUint32ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint32ToUint8ArrayBigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint32 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 32-bit value to big endian byte array */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 4u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)((src & 0xFF000000u) >> 24u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)((src & 0x00FF0000u) >> 16u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[2u] = (uint8)((src & 0x0000FF00u) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[3u] = (uint8)( src & 0x000000FFu); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT32_TO_ARRAY_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint32ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint32ToUint8ArrayLittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint32 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 32-bit value to lillte endian byte array */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 4u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)( src & 0x000000FFu); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)((src & 0x0000FF00u) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[2u] = (uint8)((src & 0x00FF0000u) >> 16u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[3u] = (uint8)((src & 0xFF000000u) >> 24u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT32_TO_ARRAY_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint32BigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint32BigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint32, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'src' and 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert big endian byte array to unsigned 32-bit value */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 4u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint32)((((uint32)src[0u]) << 24u) | /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + (((uint32)src[1u]) << 16u) | + (((uint32)src[2u]) << 8u) | + ((uint32)src[3u]) + ); +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT32_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint32LittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint32LittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint32, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'src' and 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert lillte endian byte array to unsigned 32-bit value */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 4u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint32)( ((uint32)src[0u]) | /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + (((uint32)src[1u]) << 8u) | + (((uint32)src[2u]) << 16u) | + (((uint32)src[3u]) << 24u) + ); +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT32_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +# endif /* VSTDLIB_USE_32BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_ConvertUint64ToUint8ArrayBigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint64ToUint8ArrayBigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint64 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 64-bit value to big endian byte array */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 8u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)((src & 0xFF00000000000000uLL) >> 56u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)((src & 0x00FF000000000000uLL) >> 48u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[2u] = (uint8)((src & 0x0000FF0000000000uLL) >> 40u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[3u] = (uint8)((src & 0x000000FF00000000uLL) >> 32u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[4u] = (uint8)((src & 0x00000000FF000000uLL) >> 24u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[5u] = (uint8)((src & 0x0000000000FF0000uLL) >> 16u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[6u] = (uint8)((src & 0x000000000000FF00uLL) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[7u] = (uint8)( src & 0x00000000000000FFuLL); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT64_TO_ARRAY_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint64ToUint8ArrayLittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint64ToUint8ArrayLittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + uint64 src, + P2VAR(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameter 'dst' */ + if(dst == NULL_PTR) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert unsigned 64-bit value to lillte endian byte array */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, &src, 8u); /* PRQA S 0315, 1340 */ /* MD_MSR_VStdLibCopy, MD_VStdLib_Para2ConstPtr */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + dst[0u] = (uint8)( src & 0x00000000000000FFuLL); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[1u] = (uint8)((src & 0x000000000000FF00uLL) >> 8u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[2u] = (uint8)((src & 0x0000000000FF0000uLL) >> 16u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[3u] = (uint8)((src & 0x00000000FF000000uLL) >> 24u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[4u] = (uint8)((src & 0x000000FF00000000uLL) >> 32u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[5u] = (uint8)((src & 0x0000FF0000000000uLL) >> 40u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[6u] = (uint8)((src & 0x00FF000000000000uLL) >> 48u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ + dst[7u] = (uint8)((src & 0xFF00000000000000uLL) >> 56u); /* SBSW_VSTDLIB_ACCESS_PASSED_ARRAY */ +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_UINT64_TO_ARRAY_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint64BigEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint64BigEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint64, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'src' and 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert big endian byte array to unsigned 64-bit value */ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 8u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint64)((((uint64)src[0u]) << 56u) | /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + (((uint64)src[1u]) << 48u) | + (((uint64)src[2u]) << 40u) | + (((uint64)src[3u]) << 32u) | + (((uint64)src[4u]) << 24u) | + (((uint64)src[5u]) << 16u) | + (((uint64)src[6u]) << 8u) | + ((uint64)src[7u]) + ); +# endif /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT64_BE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +/********************************************************************************************************************** + * VStdLib_ConvertUint8ArrayToUint64LittleEndian() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(void, VSTDLIB_CODE) VStdLib_ConvertUint8ArrayToUint64LittleEndian( /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ + P2CONST(uint8, AUTOMATIC, VSTDLIB_APPL_VAR) src, + P2VAR(uint64, AUTOMATIC, VSTDLIB_APPL_VAR) dst) +{ + /* ----- Local Variables ---------------------------------------------- */ + uint8 errorId = VSTDLIB_E_NO_ERROR; + + /* ----- Development Error Checks ------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_DETECT == STD_ON) + /* #10 Check parameters 'src' and 'dst' */ + if((src == NULL_PTR) || (dst == NULL_PTR)) + { + errorId = VSTDLIB_E_PARAM_POINTER; + } + else +# endif + { + /* ----- Implementation ----------------------------------------------- */ + /* #100 Convert lillte endian byte array to unsigned 64-bit value */ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* Optimization possible, if target platform optimized VStdLib_MemCpy() is used */ + VStdLib_MemCpy(dst, src, 8u); /* PRQA S 0315 */ /* MD_MSR_VStdLibCopy */ /* SBSW_VSTDLIB_CALL_MEM_CPY */ +# else + (*dst) = (uint64)( ((uint64)src[0u]) | /* SBSW_VSTDLIB_ACCESS_PASSED_INT */ + (((uint64)src[1u]) << 8u) | + (((uint64)src[2u]) << 16u) | + (((uint64)src[3u]) << 24u) | + (((uint64)src[4u]) << 32u) | + (((uint64)src[5u]) << 40u) | + (((uint64)src[6u]) << 48u) | + (((uint64)src[7u]) << 56u) + ); +# endif /* CPU_BYTE_ORDER == LOW_BYTE_FIRST */ + } + + /* ----- Development Error Report --------------------------------------- */ +# if (VSTDLIB_DEV_ERROR_REPORT == STD_ON) + if(errorId != VSTDLIB_E_NO_ERROR) + { + (void)Det_ReportError(VSTDLIB_MODULE_ID, VSTDLIB_INSTANCE_ID_DET, VSTDLIB_SID_CNV_ARRAY_TO_UINT64_LE, errorId); + } +# else + VSTDLIB_DUMMY_STATEMENT(errorId); /* PRQA S 1338, 2983, 3122 */ /* MD_MSR_DummyStmt */ +# endif +} + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_DE_SERIALIZATION_LIBRARY_FUNCTIONS != STD_ON) */ + +# if (VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint16() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint16, VSTDLIB_CODE) VStdLib_SwapEndianUint16(uint16 value) /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ +{ + /* ----- Implementation ----------------------------------------------- */ + + /* #100 Swap endianness */ + return (uint16)(((value & 0xFF00u) >> 8u) | ((value & 0x00FFu) << 8u)); +} + +# endif /* VSTDLIB_USE_16BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint32() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint32, VSTDLIB_CODE) VStdLib_SwapEndianUint32(uint32 value) /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ +{ + /* ----- Implementation ----------------------------------------------- */ + + /* #100 Swap endianness */ + return (uint32)(((value & 0xFF000000u) >> 24u) | /* 3 to 0 */ + ((value & 0x00FF0000u) >> 8u) | /* 2 to 1 */ + ((value & 0x0000FF00u) << 8u) | /* 1 to 2 */ + ((value & 0x000000FFu) << 24u) /* 0 to 3 */ + ); +} + +# endif /* VSTDLIB_USE_32BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON */ + +# if (defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON)) + +/********************************************************************************************************************** + * VStdLib_SwapEndianUint64() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(uint64, VSTDLIB_CODE) VStdLib_SwapEndianUint64(uint64 value) /* PRQA S 3219 */ /* MD_VStdLib_NotUsedInUnit */ +{ + /* ----- Implementation ----------------------------------------------- */ + + /* #100 Swap endianness */ + return (uint64)(((value & 0xFF00000000000000uLL) >> 56u) | /* 7 to 0 */ + ((value & 0x00FF000000000000uLL) >> 40u) | /* 6 to 1 */ + ((value & 0x0000FF0000000000uLL) >> 24u) | /* 5 to 2 */ + ((value & 0x000000FF00000000uLL) >> 8u) | /* 4 to 3 */ + ((value & 0x00000000FF000000uLL) << 8u) | /* 3 to 4 */ + ((value & 0x0000000000FF0000uLL) << 24u) | /* 2 to 5 */ + ((value & 0x000000000000FF00uLL) << 40u) | /* 1 to 6 */ + ((value & 0x00000000000000FFuLL) << 56u) /* 0 to 7 */ + ); +} + +# endif /* defined (PLATFORM_SUPPORT_SINT64_UINT64) && (VSTDLIB_USE_64BIT_ENDIAN_CONVERSION_LIBRARY_FUNCTIONS != STD_ON) */ + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToBig_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpyEndianPlatformToBig_s( /* PRQA S 3219, 6060 */ /* MD_VStdLib_NotUsedInUnit, MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode) +{ +# if (CPU_BYTE_ORDER == HIGH_BYTE_FIRST) + /* #10 Call VStdLib_MemCpy_Return_s() */ + VSTDLIB_DUMMY_STATEMENT(intType); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ + return VStdLib_MemCpy_Return_s(pDst, nDstSize, pSrc, nCnt, errorCode); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + +# else /* CPU_BYTE_ORDER == LOW_BYTE_FIRST) */ + /* #20 Call VStdLib_MemCpySwapEndian_s() */ + return VStdLib_MemCpySwapEndian_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ +# endif /* CPU_BYTE_ORDER */ +} + +/********************************************************************************************************************** + * VStdLib_MemCpyEndianPlatformToLittle_s() + *********************************************************************************************************************/ +/*! + * Internal comment removed. + * + * + * + * + * + */ +VSTDLIB_LOCAL_INLINE FUNC(Std_ReturnType, VSTDLIB_CODE) VStdLib_MemCpyEndianPlatformToLittle_s( /* PRQA S 3219, 6060 */ /* MD_VStdLib_NotUsedInUnit, MD_MSR_STPAR */ + P2VAR(void, AUTOMATIC, VSTDLIB_VAR_FAR) pDst, + VStdLib_CntType nDstSize, + P2CONST(void, AUTOMATIC, VSTDLIB_VAR_FAR) pSrc, + VStdLib_CntType nCnt, + uint8 intType, + Std_ReturnType errorCode) +{ +# if (CPU_BYTE_ORDER == LOW_BYTE_FIRST) + /* #10 Call VStdLib_MemCpy_Return_s() */ + VSTDLIB_DUMMY_STATEMENT(intType); /* PRQA S 2983, 3112 */ /* MD_MSR_DummyStmt */ + return VStdLib_MemCpy_Return_s(pDst, nDstSize, pSrc, nCnt, errorCode); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ + +# else /* CPU_BYTE_ORDER == HIGH_BYTE_FIRST) */ + /* #20 Call VStdLib_MemCpySwapEndian_s() */ + return VStdLib_MemCpySwapEndian_s(pDst, nDstSize, pSrc, nCnt, intType, errorCode); /* SBSW_VSTDLIB_CALL_UNMODIFIED */ +# endif /* CPU_BYTE_ORDER */ +} + +# define VSTDLIB_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/********************************************************************************************************************** + * COMPATIBILITY MACROS + *********************************************************************************************************************/ + +# define VSTDLIB__COREHLL_VERSION (0x0308u) /* last core version this component was based on */ +# define VSTDLIB__COREHLL_RELEASE_VERSION (0x00u) +# define VSTDLIB_GENERICASR_VERSION ((VSTDLIB_SW_MAJOR_VERSION << 8u) | VSTDLIB_SW_MINOR_VERSION) +# define VSTDLIB_GENERICASR_RELEASE_VERSION VSTDLIB_SW_PATCH_VERSION +# define kVStdMainVersion VSTDLIB_SW_MAJOR_VERSION +# define kVStdSubVersion VSTDLIB_SW_MINOR_VERSION +# define kVStdReleaseVersion VSTDLIB_SW_PATCH_VERSION + +# define kVStdErrorIntDisableTooOften (0x01u) +# define kVStdErrorIntRestoreTooOften (0x02u) +# define kVStdErrorMemClrInvalidParameter (0x03u) +# define kVStdErrorMemCpyInvalidParameter (0x04u) +# define kVStdErrorFunctionNotSupportedByHw (0x05u) +# define kVStdErrorMemSetInvalidParameter (0x06u) +# define kVStdErrorUnexpectedLockState (0x07u) + +# define VSTD_HL_DISABLE_SUPPORT_MEM_FCT +# define VSTD_HL_DISABLE_MEM_FCT_MAPPING +# define VSTD_HL_USE_VSTD_MEMCLR +# define VSTD_HL_USE_VSTD_MEMSET +# define VSTD_HL_USE_VSTD_RAMMEMCPY +# define VSTD_HL_USE_VSTD_ROMMEMCPY +# define VSTD_HL_USE_VSTD_WORD_MEMCPY +# define VSTD_HL_USE_VSTD_DWORD_MEMCPY + +# define VStdInitPowerOn() + +/* PRQA S 3453 VSTDLIB_FUNCTION_LIKE_MACRO */ /* MD_MSR_FctLikeMacro */ + +# if !defined (VStdLib_MemCpyRom) +# define VStdLib_MemCpyRom(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# endif + +# define VStdMemClr(d, c) VStdLib_MemClr((d), (c)) +# define VStdMemNearClr(d, c) VStdLib_MemClr((d), (c)) +# define VStdMemFarClr(d, c) VStdLib_MemClr((d), (c)) +# define VStdMemSet(d, p, c) VStdLib_MemSet((d), (p), (c)) +# define VStdMemNearSet(d, p, c) VStdLib_MemSet((d), (p), (c)) +# define VStdMemFarSet(d, p, c) VStdLib_MemSet((d), (p), (c)) + +# define VStdMemCpy(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyRom(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) +# define VStdMemCpyRamToRam(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyRomToRam(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) +# define VStdMemCpyRamToNearRam(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyRomToNearRam(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) +# define VStdMemCpyRamToFarRam(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyRomToFarRam(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) +# define VStdMemCpyFarRamToRam(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyFarRamToFarRam(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdMemCpyFarRomToFarRam(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) +# define VStdRamMemCpy(d, s, c) VStdLib_MemCpy((d), (s), (c)) +# define VStdRomMemCpy(d, s, c) VStdLib_MemCpyRom((d), (s), (c)) + +# define VStdMemCpy16(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdMemCpy16RamToRam(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdMemCpy16RamToNearRam(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdMemCpy16NearRamToRam(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdMemCpy16RamToFarRam(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdMemCpy16FarRamToRam(d, s, c) VStdLib_MemCpy16((d), (s), (c)) +# define VStdRamMemCpy16(d, s, c) VStdLib_MemCpy16((d), (s), (c)) + +# define VStdMemCpy32(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdMemCpy32RamToRam(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdMemCpy32RamToNearRam(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdMemCpy32NearRamToRam(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdMemCpy32RamToFarRam(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdMemCpy32FarRamToRam(d, s, c) VStdLib_MemCpy32((d), (s), (c)) +# define VStdRamMemCpy32(d, s, c) VStdLib_MemCpy32((d), (s), (c)) + +# if !defined (VStdLib_MemCpyRomMacro) +# define VStdLib_MemCpyRomMacro(d, s, c) VStdLib_MemCpyMacro((d), (s), (c)) +# endif + +# define VStdMemClr_Macro(d, c) VStdLib_MemClrMacro((d), (c)) +# define VStdMemSet_Macro(d, p, c) VStdLib_MemSetMacro((d), (p), (c)) +# define VStdMemCpy_Macro(d, s, c) VStdLib_MemCpyMacro((d), (s), (c)) +# define VStdMemCpyRom_Macro(d, s, c) VStdLib_MemCpyRomMacro((d), (s), (c)) + +/* PRQA L:VSTDLIB_FUNCTION_LIKE_MACRO */ + +#endif /* VSTDLIB_H */ + +/********************************************************************************************************************** + * END OF FILE: vstdlib.h + *********************************************************************************************************************/ diff --git a/Source/bsw/WrapNv/Make/WrapNv_cfg.mak b/Source/bsw/WrapNv/Make/WrapNv_cfg.mak new file mode 100644 index 0000000..20e4358 --- /dev/null +++ b/Source/bsw/WrapNv/Make/WrapNv_cfg.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : WrapNv_cfg.mak +# Description: Configuration makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2021 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the WrapNv_rules.mak file. +############################################################################### \ No newline at end of file diff --git a/Source/bsw/WrapNv/Make/WrapNv_check.mak b/Source/bsw/WrapNv/Make/WrapNv_check.mak new file mode 100644 index 0000000..28c0c4e --- /dev/null +++ b/Source/bsw/WrapNv/Make/WrapNv_check.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : WrapNv_check.mak +# Description: Configuration check makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2021 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the WrapNv_rules.mak file. +############################################################################### diff --git a/Source/bsw/WrapNv/Make/WrapNv_defs.mak b/Source/bsw/WrapNv/Make/WrapNv_defs.mak new file mode 100644 index 0000000..b7d82ec --- /dev/null +++ b/Source/bsw/WrapNv/Make/WrapNv_defs.mak @@ -0,0 +1,12 @@ +############################################################################### +# File Name : WrapNv_defs.mak +# Description: Public makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2021 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Refer to the WrapNv_rules.mak file. +############################################################################### diff --git a/Source/bsw/WrapNv/Make/WrapNv_rules.mak b/Source/bsw/WrapNv/Make/WrapNv_rules.mak new file mode 100644 index 0000000..792abfe --- /dev/null +++ b/Source/bsw/WrapNv/Make/WrapNv_rules.mak @@ -0,0 +1,25 @@ +############################################################################### +# File Name : WrapNv_rules.mak +# Description: Rules makefile +#------------------------------------------------------------------------------ +# COPYRIGHT +#------------------------------------------------------------------------------ +# Copyright (c) 2021 by Vector Informatik GmbH. All rights reserved. +#------------------------------------------------------------------------------ +# REVISION HISTORY +#------------------------------------------------------------------------------ +# Version Date Author Description +#------------------------------------------------------------------------------ +# 1.00.00 2021-04-01 visrcn Initial commit +#------------------------------------------------------------------------------ +# TemplateVersion = 1.02 +############################################################################### + +# Component Files +CC_FILES_TO_BUILD += WrapNv$(BSW_SRC_DIR)\WrapNv.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\WrapNv_Cfg.c +GENERATED_SOURCE_FILES += $(GENDATA_DIR)\..\Source\WrapNv_Callout_Stubs.c + +# Library Settings +LIBRARIES_TO_BUILD += WrapNv +WrapNv_FILES += WrapNv$(BSW_SRC_DIR)\WrapNv.c \ No newline at end of file diff --git a/Source/bsw/WrapNv/WrapNv.c b/Source/bsw/WrapNv/WrapNv.c new file mode 100644 index 0000000..a191b66 --- /dev/null +++ b/Source/bsw/WrapNv/WrapNv.c @@ -0,0 +1,1880 @@ +/********************************************************************************************************************** + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file WrapNv.c + * \brief Wrapper for NV-memory access + * ------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/*********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#define WRAPNV_SOURCE + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +#include "WrapNv.h" + +#if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +/* Critical sections handled by SchM */ +# include "SchM_WrapNv.h" + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) +# include "Det.h" +# endif /* WRAPNV_DEV_ERROR_REPORT */ +#endif /* WRAPNV_USECASE_ */ + +#if defined( WRAPNV_USECASE_DRVEEP ) +# include "EepInc.h" +#endif +#if defined( WRAPNV_USECASE_EEPM ) +# include "EepMgr_Inc.h" +#endif + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +#if ( SYSSERVICE_WRAPPERNV_VERSION != 0x0402u ) || \ + ( SYSSERVICE_WRAPPERNV_RELEASE_VERSION != 0x00u ) +# error "Error in WrapNv.c: Source and header file are inconsistent!" +#endif + +/********************************************************************************************************************** + * DEFINES + *********************************************************************************************************************/ + +#if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +/** Default value, in case block/data is not available and explicit default value not given */ +# if !defined( WRAPNV_DEFAULT_VALUE ) +# define WRAPNV_DEFAULT_VALUE 0xFFu +# endif /* WRAPNV_DEFAULT_VALUE */ + +# if !defined( STATIC ) +# define STATIC static +# endif + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) +/* PRQA S 3453 1 */ /* MD_MSR_19.7 */ +# define WrapNv_Det_ReportError(ApiId, ErrorCode) (void)Det_ReportError(WRAPNV_MODULE_ID, WRAPNV_INSTANCE_ID, (ApiId), (ErrorCode)) +# endif + +# define WrapNv_EnterCritical() SchM_Enter_WrapNv_WRAPNV_EXCLUSIVE_AREA_0() +# define WrapNv_LeaveCritical() SchM_Exit_WrapNv_WRAPNV_EXCLUSIVE_AREA_0() + +/*********************************************************************************************************************** + * TYPEDEFS + **********************************************************************************************************************/ + +/** Specifies the current state of the operation */ +typedef enum +{ + WRAPNV_STATE_IDLE = 0u, /** No operation in progress */ + WRAPNV_STATE_READ_INIT, /** Initialize read operation */ + WRAPNV_STATE_READ_PENDING, /** Wait until read operation has finished */ + WRAPNV_STATE_READ_MODIFY_INIT, /** Initialize read operation for read-modify-write operation */ + WRAPNV_STATE_READ_MODIFY_PENDING, /** Wait until read operation has finished */ + WRAPNV_STATE_MODIFY_DATA, /** Modify data for write operation */ + WRAPNV_STATE_WRITE_INIT, /** Initialize write operation */ + WRAPNV_STATE_WRITE_PENDING, /** Wait until write operation has finished */ + WRAPNV_STATE_DELETE_INIT, /** Initialize delete operation */ + WRAPNV_STATE_DELETE_PENDING, /** Wait until delete operation has finished */ + WRAPNV_STATE_CANCEL /** Process cancel operation */ +} tWrapNvState; + +/** Defines the current operation which is processed by the WrapNv */ +typedef enum +{ + WRAPNV_OPERATION_IDLE = 0u, /** No operation in progress */ + WRAPNV_OPERATION_READ, /** Read operation in progress */ + WRAPNV_OPERATION_READPARTIAL, /** ReadPartial operation in progress */ + WRAPNV_OPERATION_WRITE, /** Write operation in progress */ + WRAPNV_OPERATION_DELETE /** Delete operation in progress */ +} tWrapNvOperation; + +/*********************************************************************************************************************** + * LOCAL DATA + **********************************************************************************************************************/ + +# define WRAPNV_START_SEC_VAR_NOINIT_UNSPECIFIED +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +/* NV block specific */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvRecordNumber; /**< Record ID */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvBlockNumber; /**< Number of block */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvBlockDataset; /**< Dataset of block */ +STATIC VAR(uint8, WRAPNV_VAR_NOINIT) gWrapNvBlockBuffer[WRAPNV_MAX_BLOCK_LENGTH]; /**< Data buffer for whole NV block */ /* PRQA S 3218 */ /* MD_WrapNv_3218 */ +STATIC P2CONST(uint8, AUTOMATIC, WRAPNV_CONST) gWrapNvBlockDefaultValue; /**< Default value of a NV block, if invalid/not present */ +# if defined( WRAPNV_USECASE_NVM ) +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvBlockMaxDataset; /**< Maximum number of datasets of the block */ +# endif /* WRAPNV_USECASE_NVM */ + +/* Data specific */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvReadDataOffset; /**< Offset in NV block to the data */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvReadDataLength; /**< Length of data inside the NV block */ +STATIC VAR(tWrapNvRamData, WRAPNV_VAR_NOINIT) gWrapNvReadDataBuffer; /**< Input buffer from upper layer */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvWriteDataOffset; /**< Offset in NV block to the data */ +STATIC VAR(uint16, WRAPNV_VAR_NOINIT) gWrapNvWriteDataLength; /**< Length of data inside the NV block */ +STATIC VAR(tWrapNvConstData, WRAPNV_VAR_NOINIT) gWrapNvWriteDataBuffer; /**< Write buffer from upper layer */ +STATIC VAR(tWrapNvRamData, WRAPNV_VAR_NOINIT) gWrapNvBlockAccessBuffer; /**< Buffer used to read and/or write data from/to the NV block */ + +STATIC VAR(tWrapNvState, WRAPNV_VAR_NOINIT) gWrapNvCurrentState; /**< Current state of NV access (read/modify/write) */ +STATIC VAR(tWrapNvOperation, WRAPNV_VAR_NOINIT) gWrapNvCurrentOperation; /**< Current operation */ + +# define WRAPNV_STOP_SEC_VAR_NOINIT_UNSPECIFIED +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ +#endif /* WRAPNV_USECASE_* */ + +/*********************************************************************************************************************** + * LOCAL FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define WRAPNV_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +STATIC FUNC(MemIf_StatusType, WRAPNV_CODE) WrapNv_GetStatus( void ); +STATIC FUNC(MemIf_JobResultType, WRAPNV_CODE) WrapNv_GetJobResult( void ); +# if defined( WRAPNV_USECASE_NVM ) +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_SetDataIndex( void ); +# endif /* WRAPNV_USECASE_NVM */ +STATIC FUNC(void, WRAPNV_CODE) WrapNv_InitInternal( void ); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Cancel( void ); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Read( uint16 id, uint16 idx, tWrapNvRamData buffer, tWrapNvAccessType access); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadAsyncInternal(uint16 id, uint16 idx, tWrapNvRamData buffer, + tWrapNvOpStatus opStatus, tWrapNvAccessType access); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartial( uint16 id, uint16 idx, tWrapNvRamData buffer, uint16 offset, + uint16 length, tWrapNvAccessType access); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialAsyncInternal(uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length, tWrapNvOpStatus opStatus, tWrapNvAccessType access); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Delete( uint16 id, uint16 idx ); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Write( uint16 id, uint16 idx, tWrapNvConstData buffer, tWrapNvAccessType access ); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteAsyncInternal(uint16 id, uint16 idx, tWrapNvConstData buffer, + tWrapNvOpStatus opStatus, tWrapNvAccessType access); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_MainFunction( void ); +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_PollMainFunctions( void ); + +/*********************************************************************************************************************** + * LOCAL FUNCTIONS + **********************************************************************************************************************/ + +/*********************************************************************************************************************** + * WrapNv_GetStatus + **********************************************************************************************************************/ +/*! \brief Checks the process state of the NV + * \return MEMIF_IDLE in case job is finished (failed or OK state), otherwise MEMIF_BUSY + **********************************************************************************************************************/ +STATIC FUNC(MemIf_StatusType, WRAPNV_CODE) WrapNv_GetStatus( void ) +{ + MemIf_StatusType result; + +# if defined( WRAPNV_USECASE_NVM ) + NvM_RequestResultType nvmStatus; + + if (E_OK == NvM_GetErrorStatus(gWrapNvBlockNumber, &nvmStatus)) + { + /* Check if NVM currently processes a request */ + if (NVM_REQ_PENDING == nvmStatus) + { + result = MEMIF_BUSY; + } + else + { + result = MEMIF_IDLE; + } + } + else + { + result = MEMIF_IDLE; + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + result = WrapNv_MemDrvGetStatus(); +# endif /* WRAPNV_USECASE_* */ + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_GetJobResult + **********************************************************************************************************************/ +/*! \brief Checks the result of the last request + * \pre WrapNv_GetStatus has been called and returned MEMIF_IDLE + * \return return MEMIF_JOB_OK in case data could be read successfully + * MEMIF_BLOCK_INCONSISTENT in case data could not be read (e.g. data are corrupt) + * MEMIF_INVALID in case the block has been invalidated previously + * MEMIF_JOB_FAILED otherwise + **********************************************************************************************************************/ +STATIC FUNC(MemIf_JobResultType, WRAPNV_CODE) WrapNv_GetJobResult( void ) +{ + MemIf_JobResultType result; + +# if defined( WRAPNV_USECASE_NVM ) + NvM_RequestResultType nvmStatus; + + if (E_OK == NvM_GetErrorStatus(gWrapNvBlockNumber, &nvmStatus)) + { + /* Remap NVM status to MEMIF status */ + switch (nvmStatus) + { + case NVM_REQ_OK: + { + result = MEMIF_JOB_OK; + break; + } + case NVM_REQ_NOT_OK: + { + result = MEMIF_JOB_FAILED; + break; + } + case NVM_REQ_INTEGRITY_FAILED: + { + result = MEMIF_BLOCK_INCONSISTENT; + break; + } + case NVM_REQ_NV_INVALIDATED: + { + result = MEMIF_BLOCK_INVALID; + break; + } + default: + { + /* Unknown state */ + result = MEMIF_JOB_FAILED; + break; + } + } + } + else + { + result = MEMIF_JOB_FAILED; + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + result = WrapNv_MemDrvGetJobResult(); +# endif /* WRAPNV_USECASE_* */ + + return result; +} + +# if defined( WRAPNV_USECASE_NVM ) +/*********************************************************************************************************************** + * WrapNv_SetDataIndex + **********************************************************************************************************************/ +/*! \brief Sets the data index (dataset) of current block + * \pre Global variables (gWrapNvBlockMaxDataset, gWrapNvBlockNumber and gWrapNvBlockDataset) have to be initialized + * \return return WRAPNV_E_OK in case data index could be set or if it must not be set at all (e.g. only one + * dataset configured/available) + * WRAPNV_E_NOT_OK in case NvM couldn't set data data index + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_SetDataIndex( void ) +{ + WrapNv_ReturnType result; + + /* Initialize variables */ + result = WRAPNV_E_OK; + + /* At least two datasets must be configured/available to set the data index for the NVM */ + if (gWrapNvBlockMaxDataset > 1u) + { + if (E_OK != NvM_SetDataIndex(gWrapNvBlockNumber, (uint8)(gWrapNvBlockDataset & 0xFFu))) + { + result = WRAPNV_E_NOT_OK; + } + } + + return result; +} +# endif /* WRAPNV_USECASE_NVM */ + +/*********************************************************************************************************************** + * WrapNv_InitInternal + **********************************************************************************************************************/ +/*! \brief Initializes internal states/variables + **********************************************************************************************************************/ +STATIC FUNC(void, WRAPNV_CODE) WrapNv_InitInternal( void ) +{ + /* Initialize state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + gWrapNvCurrentOperation = WRAPNV_OPERATION_IDLE; + + /* Initialize variables */ + gWrapNvRecordNumber = 0xFFFFu; + gWrapNvBlockDataset = 0xFFFFu; + gWrapNvReadDataOffset = 0xFFFFu; + gWrapNvReadDataLength = 0xFFFFu; + gWrapNvReadDataBuffer = NULL_PTR; + gWrapNvWriteDataBuffer = NULL_PTR; +} + +/*********************************************************************************************************************** + * WrapNv_Cancel + **********************************************************************************************************************/ +/*! \brief Cancels current pending job + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Cancel( void ) +{ + WrapNv_ReturnType result; + + /* Setup the cancel request */ + gWrapNvCurrentState = WRAPNV_STATE_CANCEL; + result = WrapNv_MainFunction(); + + /* Reset internal states */ + WrapNv_InitInternal(); + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_Read + **********************************************************************************************************************/ +/*! \brief Initialize the read operation + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[out] buffer Pointer to data buffer + * \param[in] access Type of access + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Read( uint16 id, uint16 idx, tWrapNvRamData buffer, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + uint8 errorId; + P2CONST(tWrapNvRecordTbl, AUTOMATIC, WRAPNV_CONST) localRecordPtr; + P2CONST(tWrapNvBlockTbl, AUTOMATIC, WRAPNV_CONST) localBlockPtr; + + /* Initialize variable */ + result = WRAPNV_E_NOT_OK; + errorId = WRAPNV_E_NO_ERROR; + + if (WRAPNV_STATE_IDLE != gWrapNvCurrentState) + { + errorId = WRAPNV_E_NOT_IDLE; + } + /* Check if ID is valid */ + else if (id >= kWrapNvNrOfRecord) + { + errorId = WRAPNV_E_PARAM_ID; + } + /* Check if dataset is valid */ + else if ( (idx >= kWrapNvRecordTbl[id].recordBlockPtr->blockMaxDatasets) + || (idx > 0xFFu)) + { + errorId = WRAPNV_E_PARAM_DATASET; + } + else + { + localRecordPtr = &kWrapNvRecordTbl[id]; + localBlockPtr = localRecordPtr->recordBlockPtr; + + gWrapNvRecordNumber = id; + gWrapNvBlockNumber = localBlockPtr->blockNumber; + gWrapNvBlockDataset = idx; +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockMaxDataset = localBlockPtr->blockMaxDatasets; +# endif /* WRAPNV_USECASE_NVM */ + gWrapNvBlockDefaultValue = localBlockPtr->blockDefaultValue; + + if (access == WRAPNV_ACCESS_DATAELEMENT) + { + gWrapNvReadDataOffset = localRecordPtr->recordDataOffset; + gWrapNvReadDataLength = localRecordPtr->recordDataLength; + } + else + { + gWrapNvReadDataOffset = 0u; + gWrapNvReadDataLength = localBlockPtr->blockLength; + } + + gWrapNvReadDataBuffer = buffer; + + gWrapNvWriteDataOffset = 0u; + gWrapNvWriteDataLength = 0u; + gWrapNvWriteDataBuffer = NULL_PTR; + +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockAccessBuffer = gWrapNvBlockBuffer; +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + gWrapNvBlockAccessBuffer = NULL_PTR; +# endif /* WRAPNV_USECASE_* */ + + gWrapNvCurrentState = WRAPNV_STATE_READ_INIT; + + result = WrapNv_MainFunction(); + } + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) + if(errorId != WRAPNV_E_NO_ERROR) + { + WrapNv_Det_ReportError(WRAPNV_APIID_READ, errorId ); + } +# else + (void)errorId; +# endif /* (WRAPNV_DEV_ERROR_REPORT == STD_ON) */ + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_ReadPartial + **********************************************************************************************************************/ +/*! \brief Initialize operation for reading only partial of the data + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[out] buffer Pointer to data buffer + * \param[in] offset Offset in the entry to read only partial + * \param[in] length Length of the partial read + * \param[in] access Type of access + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +/* PRQA S 6060, 6080 1 */ /* MD_MSR_STPAR, MD_MSR_STMIF */ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartial( uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + uint8 errorId; + P2CONST(tWrapNvRecordTbl, AUTOMATIC, WRAPNV_CONST) localRecordPtr; + P2CONST(tWrapNvBlockTbl, AUTOMATIC, WRAPNV_CONST) localBlockPtr; + + /* Initialize variable */ + result = WRAPNV_E_NOT_OK; + errorId = WRAPNV_E_NO_ERROR; + + if (WRAPNV_STATE_IDLE != gWrapNvCurrentState) + { + errorId = WRAPNV_E_NOT_IDLE; + } + /* Check if ID is valid */ + else if (id >= kWrapNvNrOfRecord) + { + errorId = WRAPNV_E_PARAM_ID; + } + /* Check if dataset is valid */ + else if ( (idx >= kWrapNvRecordTbl[id].recordBlockPtr->blockMaxDatasets) + || (idx > 0xFFu)) + { + errorId = WRAPNV_E_PARAM_DATASET; + } + else if ( ( (access == WRAPNV_ACCESS_DATAELEMENT) && + ( (offset + length) > kWrapNvRecordTbl[id].recordDataLength) ) || + ( (access == WRAPNV_ACCESS_BLOCKELEMENT) && + ( (offset + length) > kWrapNvRecordTbl[id].recordBlockPtr->blockLength) ) ) + { + errorId = WRAPNV_E_PARAM_READ; + } + else + { + localRecordPtr = &kWrapNvRecordTbl[id]; + localBlockPtr = localRecordPtr->recordBlockPtr; + + gWrapNvRecordNumber = id; + gWrapNvBlockNumber = localBlockPtr->blockNumber; + gWrapNvBlockDataset = idx; +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockMaxDataset = localBlockPtr->blockMaxDatasets; +# endif /* WRAPNV_USECASE_NVM */ + gWrapNvBlockDefaultValue = localBlockPtr->blockDefaultValue; + + if (access == WRAPNV_ACCESS_DATAELEMENT) + { + gWrapNvReadDataOffset = localRecordPtr->recordDataOffset + offset; + gWrapNvReadDataLength = length; + } + else + { + gWrapNvReadDataOffset = offset; + gWrapNvReadDataLength = length; + } + + gWrapNvReadDataBuffer = buffer; + + gWrapNvWriteDataOffset = 0u; + gWrapNvWriteDataLength = 0u; + gWrapNvWriteDataBuffer = NULL_PTR; + +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockAccessBuffer = gWrapNvBlockBuffer; +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + gWrapNvBlockAccessBuffer = NULL_PTR; +# endif /* WRAPNV_USECASE_* */ + + gWrapNvCurrentState = WRAPNV_STATE_READ_INIT; + + result = WrapNv_MainFunction(); + } + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) + if(errorId != WRAPNV_E_NO_ERROR) + { + WrapNv_Det_ReportError(WRAPNV_APIID_READPARTIAL, errorId ); + } +# else + (void)errorId; +# endif /* (WRAPNV_DEV_ERROR_REPORT == STD_ON) */ + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_Delete + **********************************************************************************************************************/ +/*! \brief Initialize the delete operation + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Delete( uint16 id, uint16 idx ) +{ + WrapNv_ReturnType result; + uint8 errorId; + P2CONST(tWrapNvRecordTbl, AUTOMATIC, WRAPNV_CONST) localRecordPtr; + P2CONST(tWrapNvBlockTbl, AUTOMATIC, WRAPNV_CONST) localBlockPtr; + + /* Initialize variable */ + result = WRAPNV_E_NOT_OK; + errorId = WRAPNV_E_NO_ERROR; + + if (WRAPNV_STATE_IDLE != gWrapNvCurrentState) + { + errorId = WRAPNV_E_NOT_IDLE; + } + /* Check if ID is valid */ + else if (id >= kWrapNvNrOfRecord) + { + errorId = WRAPNV_E_PARAM_ID; + } + /* Check if dataset is valid */ + else if ( (idx >= kWrapNvRecordTbl[id].recordBlockPtr->blockMaxDatasets) + || (idx > 0xFFu)) + { + errorId = WRAPNV_E_PARAM_DATASET; + } + else + { + localRecordPtr = &kWrapNvRecordTbl[id]; + localBlockPtr = localRecordPtr->recordBlockPtr; + + gWrapNvRecordNumber = id; + gWrapNvBlockNumber = localBlockPtr->blockNumber; + gWrapNvBlockDataset = idx; +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockMaxDataset = localBlockPtr->blockMaxDatasets; +# endif /* WRAPNV_USECASE_NVM */ + gWrapNvBlockDefaultValue = localBlockPtr->blockDefaultValue; + + gWrapNvReadDataOffset = 0u; + gWrapNvReadDataLength = 0u; + gWrapNvReadDataBuffer = NULL_PTR; + + gWrapNvWriteDataOffset = 0u; + gWrapNvWriteDataLength = 0u; + gWrapNvWriteDataBuffer = NULL_PTR; + + gWrapNvBlockAccessBuffer = NULL_PTR; + + gWrapNvCurrentState = WRAPNV_STATE_DELETE_INIT; + + result = WrapNv_MainFunction(); + } + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) + if(errorId != WRAPNV_E_NO_ERROR) + { + WrapNv_Det_ReportError(WRAPNV_APIID_DELETE, errorId ); + } +# else + (void)errorId; +# endif /* (WRAPNV_DEV_ERROR_REPORT == STD_ON) */ + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_Write + **********************************************************************************************************************/ +/*! \brief Initialize the write operation + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] access Type of access + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_Write( uint16 id, uint16 idx, tWrapNvConstData buffer, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + uint8 errorId; + P2CONST(tWrapNvRecordTbl, AUTOMATIC, WRAPNV_CONST) localRecordPtr; + P2CONST(tWrapNvBlockTbl, AUTOMATIC, WRAPNV_CONST) localBlockPtr; + + /* Initialize variable */ + result = WRAPNV_E_NOT_OK; + errorId = WRAPNV_E_NO_ERROR; + + if (WRAPNV_STATE_IDLE != gWrapNvCurrentState) + { + errorId = WRAPNV_E_NOT_IDLE; + } + /* Check if ID is valid */ + else if (id >= kWrapNvNrOfRecord) + { + errorId = WRAPNV_E_PARAM_ID; + } + /* Check if dataset is valid */ + else if ( (idx >= kWrapNvRecordTbl[id].recordBlockPtr->blockMaxDatasets) + || (idx > 0xFFu)) + { + errorId = WRAPNV_E_PARAM_DATASET; + } + else + { + localRecordPtr = &kWrapNvRecordTbl[id]; + localBlockPtr = localRecordPtr->recordBlockPtr; + + gWrapNvRecordNumber = id; + gWrapNvBlockNumber = localBlockPtr->blockNumber; + gWrapNvBlockDataset = idx; +# if defined( WRAPNV_USECASE_NVM ) + gWrapNvBlockMaxDataset = localBlockPtr->blockMaxDatasets; +# endif /* WRAPNV_USECASE_NVM */ + gWrapNvBlockDefaultValue = localBlockPtr->blockDefaultValue; + + if ( (localBlockPtr->blockDataAccess == WRAPNV_RECORDACCESS_STRUCTURED) && + (access == WRAPNV_ACCESS_DATAELEMENT) ) + { + gWrapNvReadDataOffset = 0u; + gWrapNvReadDataLength = localBlockPtr->blockLength; + gWrapNvReadDataBuffer = gWrapNvBlockBuffer; /* Map the read buffer to the same buffer as the access buffer */ + + gWrapNvWriteDataOffset = localRecordPtr->recordDataOffset; + gWrapNvWriteDataLength = localRecordPtr->recordDataLength; + gWrapNvWriteDataBuffer = buffer; + + gWrapNvBlockAccessBuffer = gWrapNvBlockBuffer; + + gWrapNvCurrentState = WRAPNV_STATE_READ_MODIFY_INIT; + } + else + { + gWrapNvReadDataOffset = 0u; + gWrapNvReadDataLength = 0u; + gWrapNvReadDataBuffer = NULL_PTR; + + gWrapNvWriteDataOffset = 0u; + gWrapNvWriteDataLength = 0u; + gWrapNvWriteDataBuffer = NULL_PTR; + + gWrapNvBlockAccessBuffer = (tWrapNvRamData)buffer; /* PRQA S 0311 */ /* MD_WrapNv_0311 */ + + gWrapNvCurrentState = WRAPNV_STATE_WRITE_INIT; + } + + result = WrapNv_MainFunction(); + } + +# if (WRAPNV_DEV_ERROR_REPORT == STD_ON) + if(errorId != WRAPNV_E_NO_ERROR) + { + WrapNv_Det_ReportError(WRAPNV_APIID_WRITE, errorId ); + } +# else + (void)errorId; +# endif /* (WRAPNV_DEV_ERROR_REPORT == STD_ON) */ + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadAsyncInternal +**********************************************************************************************************************/ +/*! \brief Reads specific data asynchronously from a NV block +* \param[in] id Id of record +* \param[in] idx Dataset of block +* \param[out] buffer Pointer to data buffer +* \param[in] opStatus Operation status of calling instance + * \param[in] access Type of access +* \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, +* WRAPNV_E_PENDING if job needs more time +**********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadAsyncInternal(uint16 id, uint16 idx, tWrapNvRamData buffer, + tWrapNvOpStatus opStatus, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + tWrapNvOpStatus currentOpStatus; + + WrapNv_EnterCritical(); + + /* Check if WrapNv is idle so it can accept a new request */ + if (WRAPNV_OPERATION_IDLE == gWrapNvCurrentOperation) + { + /* Check if new job is canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Parameters will be stored in WrapNv_Read() call */ + currentOpStatus = WRAPNV_OPSTATUS_INIT; + gWrapNvCurrentOperation = WRAPNV_OPERATION_READ; + } + } + else + { + /* Check if this is a different request to the current pending request */ + if ((id == gWrapNvRecordNumber) + && (idx == gWrapNvBlockDataset) + && (buffer == gWrapNvReadDataBuffer) + && (WRAPNV_OPERATION_READ == gWrapNvCurrentOperation) + ) + { + /* Check if the current job should be canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Process current request */ + currentOpStatus = WRAPNV_OPSTATUS_PENDING; + } + } + else + { + /* Wait until other request has been finished */ + currentOpStatus = WRAPNV_OPSTATUS_IDLE; + } + } + + WrapNv_LeaveCritical(); + + /* Only init and pending states are allowed at this point */ + switch (currentOpStatus) + { + case WRAPNV_OPSTATUS_INIT: + { + result = WrapNv_Read(id, idx, buffer, access); + break; + } + case WRAPNV_OPSTATUS_PENDING: + { + result = WrapNv_MainFunction(); + break; + } + case WRAPNV_OPSTATUS_IDLE: /* Used when two instances access the WrapNv */ + { + result = WRAPNV_E_PENDING; + break; + } + case WRAPNV_OPSTATUS_CANCEL: + { + result = WrapNv_Cancel(); + break; + } + default: + { /* PRQA S 2880 1 */ /* MD_MSR_Unreachable */ + result = WRAPNV_E_NOT_OK; + break; + } + } + + /* Check if current operation has finished */ + if (WRAPNV_E_PENDING != result) + { + gWrapNvCurrentOperation = WRAPNV_OPERATION_IDLE; + } + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadPartialAsyncInternal +**********************************************************************************************************************/ +/*! \brief Reads partial data asynchronously from a NV block +* \param[in] id Id of record +* \param[in] idx Dataset of block +* \param[out] buffer Pointer to data buffer +* \param[in] offset Offset in the entry to read only partial +* \param[in] length Length of the partial read +* \param[in] opStatus Operation status of calling instance +* \param[in] access Type of access +* \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, +* WRAPNV_E_PENDING if job needs more time +**********************************************************************************************************************/ +/* PRQA S 6060 1 */ /* MD_MSR_STPAR */ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialAsyncInternal(uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length, tWrapNvOpStatus opStatus, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + tWrapNvOpStatus currentOpStatus; + + WrapNv_EnterCritical(); + + /* Check if WrapNv is idle so it can accept a new request */ + if (WRAPNV_OPERATION_IDLE == gWrapNvCurrentOperation) + { + /* Check if new job is canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Parameters will be stored in WrapNv_ReadPartial() call */ + currentOpStatus = WRAPNV_OPSTATUS_INIT; + gWrapNvCurrentOperation = WRAPNV_OPERATION_READPARTIAL; + } + } + else + { + /* Check if this is a different request to the current pending request */ + if ((id == gWrapNvRecordNumber) + && (idx == gWrapNvBlockDataset) + && (buffer == gWrapNvReadDataBuffer) + && (offset == gWrapNvReadDataOffset) + && (length == gWrapNvReadDataLength) + && (WRAPNV_OPERATION_READPARTIAL == gWrapNvCurrentOperation) + ) + { + /* Check if the current job should be canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Process current request */ + currentOpStatus = WRAPNV_OPSTATUS_PENDING; + } + } + else + { + /* Wait until other request has been finished */ + currentOpStatus = WRAPNV_OPSTATUS_IDLE; + } + } + + WrapNv_LeaveCritical(); + + /* Only init and pending states are allowed at this point */ + switch (currentOpStatus) + { + case WRAPNV_OPSTATUS_INIT: + { + result = WrapNv_ReadPartial(id, idx, buffer, offset, length, access); + break; + } + case WRAPNV_OPSTATUS_PENDING: + { + result = WrapNv_MainFunction(); + break; + } + case WRAPNV_OPSTATUS_IDLE: /* Used when two instances access the WrapNv */ + { + result = WRAPNV_E_PENDING; + break; + } + case WRAPNV_OPSTATUS_CANCEL: + { + result = WrapNv_Cancel(); + break; + } + default: + { /* PRQA S 2880 1 */ /* MD_MSR_Unreachable */ + result = WRAPNV_E_NOT_OK; + break; + } + } + + /* Check if current operation has finished */ + if (WRAPNV_E_PENDING != result) + { + gWrapNvCurrentOperation = WRAPNV_OPERATION_IDLE; + } + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_WriteAsyncInternal +**********************************************************************************************************************/ +/*! \brief Writes specific data asynchronously to a NV block +* \param[in] id Id of record +* \param[in] idx Dataset of block +* \param[in] buffer Pointer to data buffer +* \param[in] opStatus Operation status of calling instance +* \param[in] access Type of access +* \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, +* WRAPNV_E_PENDING if job needs more time +**********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteAsyncInternal(uint16 id, uint16 idx, tWrapNvConstData buffer, + tWrapNvOpStatus opStatus, tWrapNvAccessType access) +{ + WrapNv_ReturnType result; + tWrapNvOpStatus currentOpStatus; + + WrapNv_EnterCritical(); + + /* Check if WrapNv is idle so it can accept a new request */ + if (WRAPNV_OPERATION_IDLE == gWrapNvCurrentOperation) + { + /* Check if new job is canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Parameters will be stored in WrapNv_Write() call */ + currentOpStatus = WRAPNV_OPSTATUS_INIT; + gWrapNvCurrentOperation = WRAPNV_OPERATION_WRITE; + } + } + else + { + /* Check if this is a different request to the current pending request */ + if ((id == gWrapNvRecordNumber) + && (idx == gWrapNvBlockDataset) + && ((buffer == gWrapNvWriteDataBuffer) || (buffer == gWrapNvBlockAccessBuffer)) + && (WRAPNV_OPERATION_WRITE == gWrapNvCurrentOperation) + ) + { + /* Check if the current job should be canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Process current request */ + currentOpStatus = WRAPNV_OPSTATUS_PENDING; + } + } + else + { + /* Wait until other request has been finished */ + currentOpStatus = WRAPNV_OPSTATUS_IDLE; + } + } + + WrapNv_LeaveCritical(); + + /* Only init and pending states are allowed at this point */ + switch (currentOpStatus) + { + case WRAPNV_OPSTATUS_INIT: + { + result = WrapNv_Write(id, idx, buffer, access); + break; + } + case WRAPNV_OPSTATUS_PENDING: + { + result = WrapNv_MainFunction(); + break; + } + case WRAPNV_OPSTATUS_IDLE: /* Used when two instances access the WrapNv */ + { + result = WRAPNV_E_PENDING; + break; + } + case WRAPNV_OPSTATUS_CANCEL: + { + result = WrapNv_Cancel(); + break; + } + default: + { /* PRQA S 2880 1 */ /* MD_MSR_Unreachable */ + result = WRAPNV_E_NOT_OK; + break; + } + } + + /* Check if current operation has finished */ + if (WRAPNV_E_PENDING != result) + { + gWrapNvCurrentOperation = WRAPNV_OPERATION_IDLE; + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_MainFunction + **********************************************************************************************************************/ +/*! \brief Main task of the NV-Wrapper to get the current status of the read/write operation + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +/* PRQA S 6030, 6080 1 */ /* MD_MSR_STCYC, MD_MSR_STMIF */ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_MainFunction( void ) +{ + WrapNv_ReturnType result = WRAPNV_E_PENDING; + uint16_least index; + + switch (gWrapNvCurrentState) + { + case WRAPNV_STATE_READ_INIT: /* Intentional fall through */ + case WRAPNV_STATE_READ_MODIFY_INIT: + { + if (MEMIF_IDLE == WrapNv_GetStatus()) + { +# if defined( WRAPNV_USECASE_NVM ) + result = WrapNv_SetDataIndex(); + if (WRAPNV_E_OK == result) + { + /* PRQA S 0314 1 */ /* MD_WrapNv_0314 */ + result = NvM_ReadBlock(gWrapNvBlockNumber, (P2VAR(void, AUTOMATIC, NVM_APPL_DATA))gWrapNvBlockAccessBuffer); + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + result = WrapNv_MemDrvRead(gWrapNvBlockNumber | gWrapNvBlockDataset, gWrapNvReadDataOffset, gWrapNvReadDataBuffer, gWrapNvReadDataLength); +# endif /* WRAPNV_USECASE_* */ + + /* If read request was successful, remap result to WRAPNV_E_PENDING */ + if (WRAPNV_E_OK == result) + { + result = WRAPNV_E_PENDING; + + if (WRAPNV_STATE_READ_INIT == gWrapNvCurrentState) + { + gWrapNvCurrentState = WRAPNV_STATE_READ_PENDING; + } + else + { + gWrapNvCurrentState = WRAPNV_STATE_READ_MODIFY_PENDING; + } + } + else + { + /* Error occurred, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + } + break; + } + case WRAPNV_STATE_READ_PENDING: /* Intentional fall through */ + case WRAPNV_STATE_READ_MODIFY_PENDING: + { + if (MEMIF_IDLE == WrapNv_GetStatus()) + { + switch( WrapNv_GetJobResult() ) + { + case MEMIF_JOB_OK: + { +# if defined( WRAPNV_USECASE_NVM ) + for (index = 0u; index < gWrapNvReadDataLength; index++) + { + gWrapNvReadDataBuffer[index] = gWrapNvBlockAccessBuffer[gWrapNvReadDataOffset + index]; + } +# endif /* WRAPNV_USECASE_NVM */ + + result = WRAPNV_E_OK; + break; + } + case MEMIF_BLOCK_INCONSISTENT: + case MEMIF_BLOCK_INVALID: + { + if (gWrapNvBlockDefaultValue != NULL_PTR) + { + for (index = 0u; index < gWrapNvReadDataLength; index++) + { + gWrapNvReadDataBuffer[index] = gWrapNvBlockDefaultValue[gWrapNvReadDataOffset + index]; + } + } + else + { + /* No explicit default value configured - fill read buffer with default value */ + for (index = 0u; index < gWrapNvReadDataLength; index++) + { + gWrapNvReadDataBuffer[index] = WRAPNV_DEFAULT_VALUE; + } + } + result = WRAPNV_E_OK; + break; + } + default: + { + result = WRAPNV_E_NOT_OK; + break; + } + } + + if (WRAPNV_E_OK == result) + { + if (WRAPNV_STATE_READ_PENDING == gWrapNvCurrentState) + { + /* No more action required - reset state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + else + { + /* This is a read-modify-write operation - remap WRAPNV_E_OK state to WRAPNV_E_PENDING */ + result = WRAPNV_E_PENDING; + gWrapNvCurrentState = WRAPNV_STATE_MODIFY_DATA; + } + } + else + { + /* Error occurred, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + } + break; + } + case WRAPNV_STATE_MODIFY_DATA: + { + /* Modify data with new information */ + for (index = 0u; index < gWrapNvWriteDataLength; index++) + { + gWrapNvBlockAccessBuffer[gWrapNvWriteDataOffset + index] = gWrapNvWriteDataBuffer[index]; + } + + gWrapNvCurrentState = WRAPNV_STATE_WRITE_INIT; + } /* Intentional fall through */ + case WRAPNV_STATE_WRITE_INIT: /* PRQA S 2003 */ /* MD_WrapNv_2003 */ + { + if (MEMIF_IDLE == WrapNv_GetStatus()) + { +# if defined( WRAPNV_USECASE_NVM ) + result = WrapNv_SetDataIndex(); + if (WRAPNV_E_OK == result) + { + /* PRQA S 0314 1 */ /* MD_WrapNv_0314 */ + result = NvM_WriteBlock(gWrapNvBlockNumber, (P2CONST(void, AUTOMATIC, NVM_APPL_DATA))gWrapNvBlockAccessBuffer); + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + result = WrapNv_MemDrvWrite(gWrapNvBlockNumber | gWrapNvBlockDataset, gWrapNvBlockAccessBuffer); +# endif /* WRAPNV_USECASE_* */ + + /* If write request was successful, remap result to WRAPNV_E_PENDING */ + if (WRAPNV_E_OK == result) + { + result = WRAPNV_E_PENDING; + + gWrapNvCurrentState = WRAPNV_STATE_WRITE_PENDING; + } + else + { + /* Error occurred, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + } + break; + } + case WRAPNV_STATE_DELETE_INIT: + { + if (MEMIF_IDLE == WrapNv_GetStatus()) + { +# if defined( WRAPNV_USECASE_NVM ) + result = WrapNv_SetDataIndex(); + if (WRAPNV_E_OK == result) + { + result = NvM_InvalidateNvBlock(gWrapNvBlockNumber); + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + result = WrapNv_MemDrvInvalidateBlock(gWrapNvBlockNumber | gWrapNvBlockDataset); +# endif /* WRAPNV_USECASE_* */ + + /* If invalidate request was successful, remap result to WRAPNV_E_PENDING */ + if (WRAPNV_E_OK == result) + { + result = WRAPNV_E_PENDING; + + gWrapNvCurrentState = WRAPNV_STATE_DELETE_PENDING; + } + else + { + /* Error occurred, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + } + break; + } + case WRAPNV_STATE_WRITE_PENDING: /* Intentional fall through */ + case WRAPNV_STATE_DELETE_PENDING: + { + if (MEMIF_IDLE == WrapNv_GetStatus()) + { + if (MEMIF_JOB_OK == WrapNv_GetJobResult()) + { + result = WRAPNV_E_OK; + } + else + { + result = WRAPNV_E_NOT_OK; + } + + /* Regardless of result, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + } + break; + } + case WRAPNV_STATE_CANCEL: + { +# if defined( WRAPNV_USECASE_NVM ) + result = WrapNv_SetDataIndex(); + if (WRAPNV_E_OK == result) + { + result = NvM_CancelJobs(gWrapNvBlockNumber); + } +# elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) + WrapNv_MemDrvCancel(); + result = WRAPNV_E_OK; +# endif /* WRAPNV_USECASE_* */ + + /* Regardless of result, go back to idle state */ + gWrapNvCurrentState = WRAPNV_STATE_IDLE; + break; + } + default: + { + result = WRAPNV_E_NOT_OK; + break; + } + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_PollMainFunctions + **********************************************************************************************************************/ +/*! \brief Function to poll all sub modules + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +STATIC FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_PollMainFunctions( void ) +{ + WrapNv_ReturnType result; + + result = WrapNv_MainFunction(); + +# if (WRAPNV_MAINFUNCTION_POLLING == STD_ON) + WrapNv_PollMainFunctionsInternalIdle(); + + if (WrapNv_TriggerFct_Callout() == WRAPNV_E_OK) + { + WrapNv_PollMainFunctionsInternalTimer(); + } +# endif + + return result; +} +#endif /* WRAPNV_USECASE_* */ + +/********************************************************************************************************************** + * GLOBAL FUNCTIONS + *********************************************************************************************************************/ + +/*********************************************************************************************************************** + * WrapNv_Init + **********************************************************************************************************************/ +/*! \brief Initializes NV-Wrapper to access FEE/EA/NVM/EEPM/DrvEEP and also async tasks from the NvM + **********************************************************************************************************************/ +FUNC(void, WRAPNV_CODE) WrapNv_Init( void ) +{ +#if defined( WRAPNV_USECASE_DRVEEP ) + (void)EepromDriver_InitSync(((void *)0)); +#elif defined( WRAPNV_USECASE_EEPM ) + (void)EepMgrInitPowerOn(kEepMgrInitFull); +#elif defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) + WrapNv_InitConfig(); + WrapNv_InitInternal(); + +# if defined ( WRAPNV_USECASE_NVM ) && defined( WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING ) + (void)WrapNv_NvM_ReadAllSync(); +# endif /* WRAPNV_USECASE_NVM && WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING */ + +#endif /* WRAPNV_USECASE_* */ +} + +/*********************************************************************************************************************** + * WrapNv_Deinit + **********************************************************************************************************************/ +/*! \brief De-initializes NV-Wrapper tasks from NVM + **********************************************************************************************************************/ +FUNC(void, WRAPNV_CODE) WrapNv_Deinit( void ) +{ +#if defined( WRAPNV_USECASE_NVM ) && defined( WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING ) + (void)WrapNv_NvM_WriteAllSync(); +#endif /* WRAPNV_USECASE_NVM && WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING */ +} + +#if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +/*********************************************************************************************************************** + * WrapNv_ReadSync + **********************************************************************************************************************/ +/*! \brief Reads specific data synchronously from a NV block + * \pre Function must only be called from where MainFunction polling is allowed. + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \return kFblOk if succeeded, kFblFailed otherwise + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadSync( uint16 id, uint16 idx, tWrapNvRamData buffer ) +{ + WrapNv_ReturnType result; + + result = WrapNv_Read(id, idx, buffer, WRAPNV_ACCESS_DATAELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadBlockSync +**********************************************************************************************************************/ +/*! \brief Reads an entire WrapNv block synchronously from a NV block +* \pre Function must only be called from where MainFunction polling is allowed. +* \param[in] id Id of record contained in the block +* \param[in] idx Dataset of block +* \param[in] buffer Pointer to data buffer +* \return kFblOk if succeeded, kFblFailed otherwise +**********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadBlockSync(uint16 id, uint16 idx, tWrapNvRamData buffer) +{ + WrapNv_ReturnType result; + + result = WrapNv_Read(id, idx, buffer, WRAPNV_ACCESS_BLOCKELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_ReadPartialSync + **********************************************************************************************************************/ +/*! \brief Reads partial data synchronously from a NV block + * \pre Function must only be called from where MainFunction polling is allowed. + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] offset Offset in the entry to read only partial + * \param[in] length Length of the partial read + * \return kFblOk if succeeded, kFblFailed otherwise + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialSync( uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length ) +{ + WrapNv_ReturnType result; + + result = WrapNv_ReadPartial(id, idx, buffer, offset, length, WRAPNV_ACCESS_DATAELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadPartialBlockSync +**********************************************************************************************************************/ +/*! \brief Reads partial block synchronously from a NV block +* \pre Function must only be called from where MainFunction polling is allowed. +* \param[in] id Id of record contained in the block +* \param[in] idx Dataset of block +* \param[in] buffer Pointer to data buffer +* \param[in] offset Offset in the entry to read only partial +* \param[in] length Length of the partial read +* \return kFblOk if succeeded, kFblFailed otherwise +**********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialBlockSync(uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length) +{ + WrapNv_ReturnType result; + + result = WrapNv_ReadPartial(id, idx, buffer, offset, length, WRAPNV_ACCESS_BLOCKELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_WriteSync + **********************************************************************************************************************/ +/*! \brief Writes specific data synchronously to a NV block + * \pre Function must only be called from where MainFunction polling is allowed. + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \return kFblOk if succeeded, kFblFailed otherwise + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteSync( uint16 id, uint16 idx, tWrapNvConstData buffer ) +{ + WrapNv_ReturnType result; + + result = WrapNv_Write(id, idx, buffer, WRAPNV_ACCESS_DATAELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_WriteBlockSync +**********************************************************************************************************************/ +/*! \brief Writes specific block synchronously to a NV block +* \pre Function must only be called from where MainFunction polling is allowed. +* \param[in] id Id of record contained in the block +* \param[in] idx Dataset of block +* \param[in] buffer Pointer to data buffer +* \return kFblOk if succeeded, kFblFailed otherwise +**********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteBlockSync(uint16 id, uint16 idx, tWrapNvConstData buffer) +{ + WrapNv_ReturnType result; + + result = WrapNv_Write(id, idx, buffer, WRAPNV_ACCESS_BLOCKELEMENT); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_DeleteSync + **********************************************************************************************************************/ +/*! \brief Delete specific NV block synchronously + * \pre Function must only be called from where MainFunction polling is allowed. + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \return kFblOk if succeeded, kFblFailed otherwise + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_DeleteSync( uint16 id, uint16 idx ) +{ + WrapNv_ReturnType result; + + result = WrapNv_Delete(id, idx); + + while (WRAPNV_E_PENDING == result) + { + result = WrapNv_PollMainFunctions(); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_ReadAsync + **********************************************************************************************************************/ +/*! \brief Reads specific data asynchronously from a NV block + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[out] buffer Pointer to data buffer + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadAsync( uint16 id, uint16 idx, tWrapNvRamData buffer, + tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_ReadAsyncInternal(id, idx, buffer, opStatus, WRAPNV_ACCESS_DATAELEMENT); + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadBlockAsync +**********************************************************************************************************************/ +/*! \brief Reads specific block asynchronously from a NV block + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadBlockAsync(uint16 id, uint16 idx, tWrapNvRamData buffer, + tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_ReadAsyncInternal(id, idx, buffer, opStatus, WRAPNV_ACCESS_BLOCKELEMENT); + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_ReadPartialAsync + **********************************************************************************************************************/ +/*! \brief Reads specific data asynchronously from a NV block + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] offset Offset in the entry to read only partial + * \param[in] length Length of the partial read + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +/* PRQA S 6060 1 */ /* MD_MSR_STPAR */ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialAsync( uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length, tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_ReadPartialAsyncInternal(id, idx, buffer, offset, length, opStatus, WRAPNV_ACCESS_DATAELEMENT); + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_ReadPartialBlockAsync +**********************************************************************************************************************/ +/*! \brief Reads partial data in WrapNv block asynchronously from a NV block + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] offset Offset in the entry to read only partial + * \param[in] length Length of the partial read + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +/* PRQA S 6060 1 */ /* MD_MSR_STPAR */ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialBlockAsync(uint16 id, uint16 idx, tWrapNvRamData buffer, + uint16 offset, uint16 length, tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_ReadPartialAsyncInternal(id, idx, buffer, offset, length, opStatus, WRAPNV_ACCESS_BLOCKELEMENT); + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_WriteAsync + **********************************************************************************************************************/ +/*! \brief Writes specific data asynchronously to a NV block + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] buffer Pointer to data buffer + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteAsync( uint16 id, uint16 idx, tWrapNvConstData buffer, + tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_WriteAsyncInternal(id, idx, buffer, opStatus, WRAPNV_ACCESS_DATAELEMENT); + + return result; +} + +/*********************************************************************************************************************** +* WrapNv_WriteBlockAsync +**********************************************************************************************************************/ +/*! \brief Writes specific block asynchronously to a NV block +* \param[in] id Id of record +* \param[in] idx Dataset of block +* \param[in] buffer Pointer to data buffer +* \param[in] opStatus Operation status of calling instance +* \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, +* WRAPNV_E_PENDING if job needs more time +**********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteBlockAsync(uint16 id, uint16 idx, tWrapNvConstData buffer, + tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + result = WrapNv_WriteAsyncInternal(id, idx, buffer, opStatus, WRAPNV_ACCESS_BLOCKELEMENT); + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_DeleteAsync + **********************************************************************************************************************/ +/*! \brief Delete specific NV block asynchronously + * \param[in] id Id of record + * \param[in] idx Dataset of block + * \param[in] opStatus Operation status of calling instance + * \return result WRAPNV_E_OK on job completion, WRAPNV_E_NOT_OK if job execution failed, + * WRAPNV_E_PENDING if job needs more time + **********************************************************************************************************************/ +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_DeleteAsync( uint16 id, uint16 idx, tWrapNvOpStatus opStatus) +{ + WrapNv_ReturnType result; + tWrapNvOpStatus currentOpStatus; + + WrapNv_EnterCritical(); + + /* Check if WrapNv is idle so it can accept a new request */ + if (WRAPNV_OPERATION_IDLE == gWrapNvCurrentOperation) + { + /* Check if new job is canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Parameters will be stored in WrapNv_Delete() call */ + currentOpStatus = WRAPNV_OPSTATUS_INIT; + gWrapNvCurrentOperation = WRAPNV_OPERATION_DELETE; + } + } + else + { + /* Check if this is a different request to the current pending request */ + if ( (id == gWrapNvRecordNumber) + && (idx == gWrapNvBlockDataset) + && (WRAPNV_OPERATION_DELETE == gWrapNvCurrentOperation) + ) + { + /* Check if the current job should be canceled */ + if (opStatus == WRAPNV_OPSTATUS_CANCEL) + { + currentOpStatus = WRAPNV_OPSTATUS_CANCEL; + } + else + { + /* Process current request */ + currentOpStatus = WRAPNV_OPSTATUS_PENDING; + } + } + else + { + /* Wait until other request has been finished */ + currentOpStatus = WRAPNV_OPSTATUS_IDLE; + } + } + + WrapNv_LeaveCritical(); + + /* Only init and pending states are allowed at this point */ + switch (currentOpStatus) + { + case WRAPNV_OPSTATUS_INIT: + { + result = WrapNv_Delete(id, idx); + break; + } + case WRAPNV_OPSTATUS_PENDING: + { + result = WrapNv_MainFunction(); + break; + } + case WRAPNV_OPSTATUS_IDLE: /* Used when two instances access the WrapNv */ + { + result = WRAPNV_E_PENDING; + break; + } + case WRAPNV_OPSTATUS_CANCEL: + { + result = WrapNv_Cancel(); + break; + } + default: + { /* PRQA S 2880 1 */ /* MD_MSR_Unreachable */ + result = WRAPNV_E_NOT_OK; + break; + } + } + + /* Check if current operation has finished */ + if (WRAPNV_E_PENDING != result) + { + gWrapNvCurrentOperation = WRAPNV_OPERATION_IDLE; + } + + return result; +} + +# if defined( WRAPNV_USECASE_NVM ) +# if defined( WRAPNV_ENABLE_NVMAPIS_HANDLING ) +/*********************************************************************************************************************** + * WrapNv_NvM_WriteBlockSync + **********************************************************************************************************************/ +/*! \brief Synchronous wrapper to the NvM API NvM_WriteBlock + * \param[in] blockId NvM ID of NvM block + * \param[in] buffer Pointer to the RAM buffer NvM shall write + * \return result E_OK on successful operation, E_NOT_OK if operation failed + **********************************************************************************************************************/ +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_WriteBlockSync( NvM_BlockIdType blockId, tWrapNvNvMConstData buffer ) +{ + Std_ReturnType result = E_NOT_OK; + NvM_RequestResultType operationStatus = NVM_REQ_PENDING; + + result = NvM_WriteBlock(blockId, buffer); + while ((result == E_OK) && (operationStatus == NVM_REQ_PENDING)) + { + WrapNv_PollMainFunctionsInternalIdle(); + if (WrapNv_TriggerFct_Callout() == WRAPNV_E_OK) + { + WrapNv_PollMainFunctionsInternalTimer(); + } + result = NvM_GetErrorStatus(blockId, &operationStatus); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_NvM_ReadBlockSync + **********************************************************************************************************************/ +/*! \brief Synchronous wrapper to the NvM API NvM_ReadBlock + * \param[in] blockId NvM ID of NvM block + * \param[in] buffer Pointer to the RAM buffer NvM shall write + * \return result E_OK on successful operation, E_NOT_OK if operation failed + **********************************************************************************************************************/ +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_ReadBlockSync( NvM_BlockIdType blockId, tWrapNvNvMRamData buffer ) +{ + Std_ReturnType result = E_NOT_OK; + NvM_RequestResultType operationStatus = NVM_REQ_PENDING; + + result = NvM_ReadBlock(blockId, buffer); + while ((result == E_OK) && (operationStatus == NVM_REQ_PENDING)) + { + WrapNv_PollMainFunctionsInternalIdle(); + if (WrapNv_TriggerFct_Callout() == WRAPNV_E_OK) + { + WrapNv_PollMainFunctionsInternalTimer(); + } + result = NvM_GetErrorStatus(blockId, &operationStatus); + } + + return result; +} +# endif /* WRAPNV_ENABLE_NVMAPIS_HANDLING */ + +# if defined( WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING ) +/*********************************************************************************************************************** + * WrapNv_NvM_WriteAllSync + **********************************************************************************************************************/ +/*! \brief Executes the NvM API NvM_WriteAll synchronously + * \return result E_OK on successful operation, E_NOT_OK if operation failed + **********************************************************************************************************************/ +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_WriteAllSync( void ) +{ + Std_ReturnType result = E_OK; + NvM_RequestResultType operationStatus = NVM_REQ_PENDING; + + NvM_WriteAll(); + while ((result == E_OK) && (operationStatus == NVM_REQ_PENDING)) + { + WrapNv_PollMainFunctionsInternalIdle(); + if (WrapNv_TriggerFct_Callout() == WRAPNV_E_OK) + { + WrapNv_PollMainFunctionsInternalTimer(); + } + result = NvM_GetErrorStatus(NvMConf___MultiBlockRequest, &operationStatus); + } + + return result; +} + +/*********************************************************************************************************************** + * WrapNv_NvM_ReadAllSync + **********************************************************************************************************************/ +/*! \brief Executes the NvM API NvM_ReadAll synchronously + * \return result E_OK on successful operation, E_NOT_OK if operation failed + **********************************************************************************************************************/ +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_ReadAllSync( void ) +{ + Std_ReturnType result = E_OK; + NvM_RequestResultType operationStatus = NVM_REQ_PENDING; + + NvM_ReadAll(); + while ((result == E_OK) && (operationStatus == NVM_REQ_PENDING)) + { + WrapNv_PollMainFunctionsInternalIdle(); + if (WrapNv_TriggerFct_Callout() == WRAPNV_E_OK) + { + WrapNv_PollMainFunctionsInternalTimer(); + } + result = NvM_GetErrorStatus(NvMConf___MultiBlockRequest, &operationStatus); + } + + return result; +} +# endif /* WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING */ +# endif /* WRAPNV_USECASE_NVM */ +#endif /* WRAPNV_USECASE_* */ + +#define WRAPNV_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +/*********************************************************************************************************************** + * MISRA DEVIATIONS + **********************************************************************************************************************/ + +/* Justification for module-specific MISRA deviations: + + MD_WrapNv_0311: + Reason: Provide simplified function interface and reduce stack consumption by avoiding separate pointers for + read and write buffer. + Risk: The content of the write buffer might be accidentally overwritten. + Prevention: Covered by code review. + + MD_WrapNv_0314: + Reason: API is defined with pointer to void parameter, so pointer has to be casted to or from void. + Risk: Wrong data access or undefined behavior for platforms where the byte alignment is not arbitrary. + Prevention: Code inspection and test with the target compiler/platform in the component test. + + MD_WrapNv_2003: + Reason: Intentionally switch case with out break statement to proceed the next step immediately + Risk: No identifiable risk. + Prevention: Covered by code review. + + MD_WrapNv_3218: + Reason: The usage of variables depend on configuration aspects and may be used only once. + Risk: No identifiable risk. + Prevention: No prevention required. + +*/ + +/*********************************************************************************************************************** + * END OF FILE: WRAPNV.C + **********************************************************************************************************************/ diff --git a/Source/bsw/WrapNv/WrapNv.h b/Source/bsw/WrapNv/WrapNv.h new file mode 100644 index 0000000..0b81d2c --- /dev/null +++ b/Source/bsw/WrapNv/WrapNv.h @@ -0,0 +1,241 @@ +/********************************************************************************************************************** + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file WrapNv.h + * \brief Wrapper for NV-memory access + * ------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/*********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 02.00.00 2016-02-22 visrie ESCAN00088726 Added support for Fee/NvM + * Removed unused code + * 02.01.00 2016-03-09 visrie ESCAN00088817 Removed function call NvM_Errorhook + * ESCAN00088819 Abstraction of Fls interface + * 02.02.00 2016-07-05 visrie ESCAN00090830 Added support for no NV driver use-case + * 02.02.01 2016-09-06 visrie ESCAN00091757 Fixed MISRA findings + * 02.02.02 2016-10-17 visrie ESCAN00092351 Configure used FEE functions + * 02.03.00 2017-09-19 visrie ESCAN00094172 Fixed compiler warning undefined preprocessor define + * ESCAN00095574 Added support for EA + * 02.04.00 2017-11-29 visrie ESCAN00096851 Updated APIs for MSR-Release 18 + * ESCAN00097590 Added error code for Record ID check + * ESCAN00097591 Added support for sequential queue handling of asynchronous access + * 02.04.01 2018-01-11 visrie ESCAN00097944 Fixed state handling + * ESCAN00097953 Fixed endless loop + * 02.05.00 2018-02-08 visrie ESCAN00097770 Consider main function call cycle + * 02.06.00 2018-03-21 visrie ESCAN00098860 Added support for EEL + * 02.06.01 2018-04-06 visrie ESCAN00099015 No changes + * 02.06.02 2018-12-07 visrie ESCAN00099155 No changes + * ESCAN00101194 Reworked include structure + * 03.00.00 2020-04-02 visrie FBL-1331 Support of new generator + * 04.00.00 2020-05-26 visrie FBL-1016 Support EcuM_Init() mechanism + * 04.00.01 2020-07-16 visrie FBL-2160 Removed use case filtering + * 04.00.02 2021-04-01 visrcn FBL-3009 Make polling function configurable + * FBL-3095 Add support for DET usage + * 04.01.00 2022-07-11 vistmo FBL-5336 Adding support for block access + * 04.01.01 2024-07-08 visrie ESCAN00117458 WrapNv doesn't accept further requests + * ESCAN00115730 Compiler warning: no 'break' or comment before case label + * 04.02.00 2024-10-23 visjns FBL-9560 Introduce handling of NvM access by MSR modules + * ESCAN00114856 Compiler warning: zero used for undefined preprocessing identifier + *********************************************************************************************************************/ + +#ifndef WRAPNV_H +#define WRAPNV_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : SysService_WrapperNv CQComponent : Implementation */ +# define SYSSERVICE_WRAPPERNV_VERSION 0x0402u +# define SYSSERVICE_WRAPPERNV_RELEASE_VERSION 0x00u + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +# include "WrapNv_Cfg.h" +# if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +# include "Std_Types.h" +# if defined( WRAPNV_USECASE_NVM ) +# include "NvM.h" +# endif /* WRAPNV_USECASE_NVM */ +# endif /* WRAPNV_USECASE_* */ + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ +# if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +/* Vendor and module identification */ +# define WRAPNV_VENDOR_ID 30u +# define WRAPNV_MODULE_ID 255u +# define WRAPNV_INSTANCE_ID 0u + +/* Service IDs */ +# define WRAPNV_APIID_INIT 0x00u +# define WRAPNV_APIID_READ 0x01u +# define WRAPNV_APIID_READPARTIAL 0x02u +# define WRAPNV_APIID_WRITE 0x03u +# define WRAPNV_APIID_DELETE 0x04u + +/* Development errors */ +# define WRAPNV_E_NO_ERROR 0x10u +# define WRAPNV_E_NOT_IDLE 0x11u +# define WRAPNV_E_PARAM_DATASET 0x12u +# define WRAPNV_E_PARAM_READ 0x13u +# define WRAPNV_E_PARAM_ID 0x14u +# elif defined( WRAPNV_USECASE_EEPM ) +/* PRQA S 3453 3 */ /* MD_MSR_FctLikeMacro */ +# define NV_MK_STRUCT_ID(structure, id) ((((vuint32)(structure)) << 24uL) | (id)) +# define NV_GET_STRUCT_ID(id) ((id) & 0x00FFFFFFuL) +# define NV_GET_STRUCT_HANDLE(id) (((id) & 0xFF000000uL) >> 24uL) +# endif /* WRAPNV_USECASE_* */ + +/** Positive return value of NV-Wrapper */ +# if defined( kFblOk ) +# define WRAPNV_E_OK kFblOk +# elif defined( kEepMgrOk ) +# define WRAPNV_E_OK kEepMgrOk +# elif defined( E_OK ) +# define WRAPNV_E_OK E_OK +# else +# define WRAPNV_E_OK 0u +# endif + +/** Negative return value of NV-Wrapper */ +# if defined( kFblFailed ) +# define WRAPNV_E_NOT_OK kFblFailed +# elif defined( kEepMgrFailed ) +# define WRAPNV_E_NOT_OK kEepMgrFailed +# elif defined( E_NOT_OK ) +# define WRAPNV_E_NOT_OK E_NOT_OK +# else +# define WRAPNV_E_NOT_OK 1u +# endif + +/** Pending return value of NV-Wrapper */ +# if defined( kEepMgrBusy ) +# define WRAPNV_E_PENDING kEepMgrBusy +# elif defined( E_PENDING ) +# define WRAPNV_E_PENDING E_PENDING +# else +# define WRAPNV_E_PENDING 2u +# endif + +/** Return type of NV-Wrapper */ +# if defined( kFblOk ) +# define WrapNv_ReturnType tFblResult +# elif defined( kEepMgrOk ) +# define WrapNv_ReturnType vuint8 +# elif defined( E_OK ) +# define WrapNv_ReturnType Std_ReturnType +# else +# define WrapNv_ReturnType WrapNv_DefaultReturntype +# endif + +/* Compatibility define for non MSR projects */ +# if !defined( FUNC ) +# define FUNC(rettype, memclass) rettype +# endif + +/********************************************************************************************************************** + * TYPEDEFS + *********************************************************************************************************************/ + +/** Operation status for asynchronous access */ +typedef enum +{ + WRAPNV_OPSTATUS_INIT = 0u, /**< Operation has been initialized */ + WRAPNV_OPSTATUS_PENDING, /**< Operation is currently pending */ + WRAPNV_OPSTATUS_CANCEL, /**< Operation has been canceled */ + WRAPNV_OPSTATUS_IDLE /**< Internal: Currently no operation is active */ +} tWrapNvOpStatus; + +/** Type of data access */ +typedef enum +{ + WRAPNV_ACCESS_DATAELEMENT = 0u, /**< Access is performed at element level */ + WRAPNV_ACCESS_BLOCKELEMENT /**< Access is performed at block level */ +} tWrapNvAccessType; + +# if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +typedef P2VAR(uint8, AUTOMATIC, WRAPNV_DATA) tWrapNvRamData; +typedef P2CONST(uint8, AUTOMATIC, WRAPNV_DATA) tWrapNvConstData; +typedef P2VAR(void, AUTOMATIC, WRAPNV_NVM_APPL_DATA) tWrapNvNvMRamData; +typedef P2CONST(void, AUTOMATIC, WRAPNV_NVM_APPL_DATA) tWrapNvNvMConstData; +# endif /* WRAPNV_USECASE_* */ + +typedef unsigned char WrapNv_DefaultReturntype; + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +# define WRAPNV_START_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +FUNC(void, WRAPNV_CODE) WrapNv_Init( void ); +FUNC(void, WRAPNV_CODE) WrapNv_Deinit( void ); + +# if defined( WRAPNV_USECASE_FEE ) || \ + defined( WRAPNV_USECASE_EA ) || \ + defined( WRAPNV_USECASE_NVM ) +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadSync( uint16 id, uint16 idx, tWrapNvRamData buffer ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadBlockSync(uint16 id, uint16 idx, tWrapNvRamData buffer); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialSync( uint16 id, uint16 idx, tWrapNvRamData buffer, uint16 offset, uint16 length ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialBlockSync(uint16 id, uint16 idx, tWrapNvRamData buffer, uint16 offset, uint16 length); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_DeleteSync( uint16 id, uint16 idx ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteSync( uint16 id, uint16 idx, tWrapNvConstData buffer ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteBlockSync( uint16 id, uint16 idx, tWrapNvConstData buffer ); + +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadAsync( uint16 id, uint16 idx, tWrapNvRamData buffer, tWrapNvOpStatus opStatus ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadBlockAsync(uint16 id, uint16 idx, tWrapNvRamData buffer, tWrapNvOpStatus opStatus); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialAsync( uint16 id, uint16 idx, tWrapNvRamData buffer, uint16 offset, uint16 length, tWrapNvOpStatus opStatus ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_ReadPartialBlockAsync( uint16 id, uint16 idx, tWrapNvRamData buffer, uint16 offset, uint16 length, tWrapNvOpStatus opStatus ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_DeleteAsync( uint16 id, uint16 idx, tWrapNvOpStatus opStatus ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteAsync( uint16 id, uint16 idx, tWrapNvConstData buffer, tWrapNvOpStatus opStatus ); +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_WriteBlockAsync(uint16 id, uint16 idx, tWrapNvConstData buffer, tWrapNvOpStatus opStatus); +# if defined( WRAPNV_USECASE_NVM ) +# if defined( WRAPNV_ENABLE_NVMAPIS_HANDLING ) +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_WriteBlockSync( NvM_BlockIdType blockId, tWrapNvNvMConstData buffer ); +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_ReadBlockSync( NvM_BlockIdType blockId, tWrapNvNvMRamData buffer ); +# endif /* WRAPNV_ENABLE_NVMAPIS_HANDLING */ +# if defined( WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING ) +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_WriteAllSync( void ); +FUNC(Std_ReturnType, WRAPNV_CODE) WrapNv_NvM_ReadAllSync( void ); +# endif /* WRAPNV_ENABLE_NVM_MULTIBLOCK_HANDLING */ +# endif /* WRAPNV_USECASE_NVM */ +# endif /* WRAPNV_USECASE_* */ + +# if (WRAPNV_MAINFUNCTION_POLLING == STD_ON) +FUNC(WrapNv_ReturnType, WRAPNV_CODE) WrapNv_TriggerFct_Callout( void ); +# endif + +# define WRAPNV_STOP_SEC_CODE +# include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* WRAPNV_H */ + +/*********************************************************************************************************************** + * END OF FILE: WRAPNV.H + **********************************************************************************************************************/ diff --git a/Source/bsw/WrapNv/_WrapNv_inc.h b/Source/bsw/WrapNv/_WrapNv_inc.h new file mode 100644 index 0000000..500969d --- /dev/null +++ b/Source/bsw/WrapNv/_WrapNv_inc.h @@ -0,0 +1,56 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file WrapNv_inc.h + * \brief Compacts the include files for the NV-Wrapper + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2024 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to the module's header file. + *********************************************************************************************************************/ + +#ifndef WRAPNV_INC_H +#define WRAPNV_INC_H + +/*********************************************************************************************************************** + * INCLUDES + **********************************************************************************************************************/ + +#include "WrapNv.h" +#if defined( WRAPNV_USECASE_EEPM ) || \ + defined( WRAPNV_USECASE_DRVEEP ) +/* Include Vector standard includes first */ +# include "fbl_def.h" + +# include "fbl_inc.h" + +# include "iotypes.h" +# if defined( WRAPNV_USECASE_EEPM ) +# include "fbl_flio_xd1.h" +# include "EepMgr_Inc.h" +# else +# include "EepInc.h" +# include "EepIO.h" +# endif +#endif /* WRAPNV_USECASE_EEPM || WRAPNV_USECASE_DRVEEP */ + +#endif /* WRAPNV_INC_H */ + +/*********************************************************************************************************************** + * END OF FILE: WRAPNV_INC.H + **********************************************************************************************************************/ diff --git a/Source/include/ARMBrsHw_CortexR.h b/Source/include/ARMBrsHw_CortexR.h new file mode 100644 index 0000000..53740d9 --- /dev/null +++ b/Source/include/ARMBrsHw_CortexR.h @@ -0,0 +1,327 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: ARMBrsHw_CortexR.h + * Project: Vector Basic Runtime System + * Module: BrsHw for all platforms with ARM core Cortex-R + * + * \brief Description: This is a global, platform-independent header file for the ARM-BRS. + * This file includes all non-platform dependent functions. + * All the (platform depending) rest needs to be defined in BrsHw.c + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2020-15-19 visbwa New branch for vBaseEnv 2.0, based on zBrs_ArmCommon ARMBrsHw_CortexA.c 4.07.01 and ARMStartup_CortexA.c 1.11.01; + * updated vLinkGen define and struct names to new vLinkGen 2.0 naming schema in ARMStartup_CortexA.c + * 01.00.01 2020-06-08 visbwa Fixed support for Tasking compiler and usage of struct vLinkGen_MemArea (vLinkGen_ZeroInit_Early_Blocks, + * vLinkGen_ZeroInit_Early_Groups) -> size is 16Byte per entry in ARMStartup_CortexA.c + * 01.00.02 2020-06-09 visbwa Fixed IAR code to load stack symbols in ARMStartup_CortexA.c + * 01.00.03 2020-07-03 visbwa Added disabling of abort handler and VIC for TDA4VM88@TI; added support for up to 6 cores in ARMStartup_CortexA.c + * 01.01.00 2020-09-18 visbwa Review according to Brs_Template 1.01.00 + * 01.01.01 2020-10-21 vishci Fixed BRS_ISR_KEYWORD of Arm5, Gnu and Iar compiler abstraction in ARMBrsHw_CortexA.h; update to + * Brs_Template 1.01.01; removed AUTHOR IDENTITY; added new file ARMBrsHwIntTb_CortexR.c for FBL projects w/o OS + * 01.01.02 2020-10-23 visbwa Renamed exception vector table according to Brs_Template in ARMBrsHwIntTb_CortexR.c + * 01.01.03 2020-10-28 visbwa No changes in sourcecode, only within ALM package + * 01.01.04 2020-11-09 visbwa No changes in sourcecode, only within ALM package + * 01.01.05 2020-11-12 visdri Support Jacinto7 Cortex-R cores by merging the Jacinto7 startup code provided by TI (disable TCM and call mpu_init + * for Jacinto7 derivative) and fixed activation of FPU + initialization order (switch to system mode after FPU init) + * in ARMStartup_CortexA.c + * 01.01.06 2020-12-07 visjhr Added support for TPR12 derivative and disabling of abort handler and VIC for it + * 01.01.07 2021-01-14 visbwa Fixed BRANCH to startup_block_zero_init_loop_start for ARM compilers in ARMStartup_CortexA.c + * 01.01.08 2021-03-05 visdri Removed Tasking and HighTec from list of supported compilers, + * removed BRS_EXTERN_BRANCH (separation to BRS_BRANCH not needed on Cortex-A/R) and + * fixed branches to stack pointer init routines for MultiCore in ARMStartup_CortexA.c + * 01.01.09 2021-03-08 visbwa Fixed IAR encapsulation of Brs_IarLoadCore0Id (only for MultiCore) and branch extern in ARMStartup_CortexA.c + * 01.02.00 2021-02-02 vismaa Added BrsHw_GetCore() and macros BRS_READ_COREID + brsHwGetMpidr + * 2021-03-09 visbwa Renamed all files from ARMBrsHw_CortexA into ARMBrsHw_CortexR; update to Brs_Template 1.02.00; moved revision + * history of all .c and .h files into ARMBrsHw_CortexR.h; added SingleCore stubs for Read_COREID (always return 0) + * 01.02.01 2021-03-18 vismaa Fixed memory initialization process in ARMStartup_CortexR.c to work properly in MultiCore environments + * 01.03.00 2021-04-20 vishci Added LlvmDiab compiler support, fixed IAR compiler support in FBL CoreExceptionTable + * 2021-05-04 visbwa Review, generalized BrsHwDisableInterruptAtPowerOn(), removed duplicates in TI compiler abstraction + * 01.03.01 2021-05-11 visbwa Fixed brsExcVect section for Arm6 and LlvmDiab in ARMBrsHwIntTb_CortexR.c + * 01.03.02 2021-07-28 visjhr Fixed bug in brsHwGetMpidr(c) for GCC compilers + * 01.03.03 2021-08-03 visjhr Adapted bugfix of brsHwGetMpidr(c) for LLVMDIAB compiler + * 01.03.04 2021-09-21 visbpz Adaptation for IAR + * 01.04.00 2021-10-18 vishci added LLVMTEXASINSTRUMENTS compiler support + * 01.04.01 2021-10-20 visbpz Fix for 8 byte aligned ECC initialization + * 2021-10-25 visbwa Added usage of alignment parameter to distinguish between 4-Byte and 8-Byte init + * 01.04.02 2022-03-01 visbwa ESCAN00111389 Fixed zero_init loops in ARMStartup_CortexR.c, renamed area_zero_init to group_zero_init, + * ESCAN00111390 introduced BRS_BRANCH_GREATER_THAN_OR_EQUAL + * 01.04.03 2022-03-14 visbwa ESCAN00111478 StartupCode is not mapped into specific section "brsStartup" for Arm6 compiler (ARMStartup_CortexR.c), + * ESCAN00111480 StartupCode is using ARM_LIB_STACK instead of STACK_C0 to initialize stackpointer during startup + * (ARMStartup_CortexR.c); removed useless abstraction for asm in ARMBrsHw_CortexR.c; removed unused + * BRS_SECTION_DATA fragments from some compiler abstractions; replaced BRS_DUMMY_FUNC by Startup_Handler_ASM() + * (adjustment with Cortex-M code) + * 01.04.04 2022-04-06 virmid Support for TDA4VE derivative + * 02.00.00 2022-03-17 visjhr Update to Brs_Template 1.03.04 + * 2022-05-23 visbwa Review, harmonized with Implementation_CortexR52; call of __mpu_init moved to BrsHwEarlyInitPowerOn() of + * platform-specific BrsHw packages; fixed encapsulation of _start (alternative start symbol for OS) + * 2022-07-22 visjhr Updated ARM5 implementation of BRS_READ_COREID; BRS_READ_COREID and BrsHw_GetCore() overloadable in platform + * specific BrsHw; changed implementation of BRS_READ_COREID that only AFF0 will be used for core id + * 2022-07-25 visbwa Review; Removed platform specific code from BrsHwDisableInterruptAtPowerOn() and StartupCode; + * Introduced BrsHwDisableInterruptAtPowerOn_Hook() + * 02.00.01 2022-07-26 visbwa Fixed Arm5 assembly abstraction, introduced usage of BRS_ENABLE_OS_STUB for Arm5/Arm6 + * 02.00.02 2022-07-26 visjhr Fixed exception tables for LLVM DIAB and LLVM TI compiler + * 02.00.03 2022-08-04 visrgm Added BRSHW_PRE_ASM_STARTUP_HOOK_AVAILABLE define to ARMStartup_CortexR.c + * 02.00.04 2022-08-11 mhu Fixed Brs_IarLoadCoreConfigSizeSymbol implementation + * 2022-08-12 visqli Introduced BrsHw_ExceptionTable_Init_PostHook in BrsHw_ExceptionTable_Init + * 02.00.05 2022-09-07 visjhr Added code for restoring default Exception Table code on startup (identical for all exceptions) + * 02.01.00 2022-09-21 visjhr Added exception tables for max 8 cores in multicore setups, updated calculation of active exception table address + * during startup, special implementation if core exception table is located at address 0x0 + * 02.01.01 2022-10-10 mhu Fixed multicore implementation of BRS_READ_COREID and BrsHw_GetCore(); updated declartions and definitions of + * intvect_CoreXExceptions for IAR; adapted the position of BRS_READ_COREID to avoid overwrite of R0 in + * ARMStartup_CortexR.c + * visbwa Review, introduced BRS_LOCAL_FUNCTION_PROTOTYPE + * 02.01.02 2023-02-01 mhu Fixed brsHwGetMpidr() definition with IAR compiler for multicore usecase + * 02.02.00 2023-03-02 virjas Changed syntax of brsHwGetMpidr asm macro fro Llvm and IAR compiler to be c99 (__asm) + * 2023-05-23 visbwa Update to Brs_Template 1.03.09: mapping of BrsHw_CoreExceptionHandler() into startup code section in + * ARMBrsHwIntTb_CortexR.c + * 02.02.01 2023-05-25 visdri Fix multicore exception tables in ARMBrsHwIntTb_CortexR.c for TI compiler. + * 02.02.02 2023-06-05 visbwa Introduction of BrsHw_MultiCoreExceptionHandler() as single and independent handler for all additional cores; + * mapped into startup code section in ARMBrsHwIntTb_CortexR.c + * 02.03.00 2023-06-28 visdri Set SCTLR.TE bit in startup code to enter exceptions in ARM state + * 02.04.00 2024-08-01 vishci BASEENV-12178 Unify naming of coreexception table in RAM for FBL usecase + * 02.04.01 2024-09-05 vishci Fixed core exception intvect_CoreExceptions_Ram_Vectortable bug + * 02.05.00 2024-09-16 kal BASEENV-12584 Implemented cache invalidation for all ARMv7-R cores; bugfix for ARM5 compiler + * 02.05.01 2024-11-22 kal BASEENV-12761 Fixed bad instruction in Arm6 Exception table + * 02.05.02 2024-12-11 mhu Fixed #pragma grammar for Arm6 compiler + * 02.05.03 2025-01-15 mhu Fixed BRSHW_DEFINE_STARTUP_STACK define for Arm6 compiler + * 02.05.04 2025-01-31 vismaa BASEENV-13175 Clearing SCTLR V-Bit, assures base location of exception registers is 0x0000_0000 + * 02.05.05 2025-03-28 visbwa BASEENV-13195 Added compiler error for non-first execution instance and exception table in RAM combination + *********************************************************************************************************************/ + +#ifndef _ARMBRSHW_CORTEXR_H_ +#define _ARMBRSHW_CORTEXR_H_ + +/********************************************************************************************************************** + * MODULE VERSION + *********************************************************************************************************************/ +/* + * Description: This is the BrsHw main and bug fix version. The version numbers are BCD coded. + * E.g. a main version of 1.23 is coded with 0x0123, a bug fix version of 9 is coded 0x09. + */ +#define ARMBRSHW_CORTEXR_VERSION 0x0205u +#define ARMBRSHW_CORTEXR_BUGFIX_VERSION 0x05u + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +/* + * Description: The BrsCfg header is used to configure different types of + * tests and system setups. Therefore it must be included first + * in each BRS and test module. + * This file is part of the BRS. + */ +#include "vBrsCfg.h" + +#include "BrsMain.h" + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +/* Configuration checks performed within platform specific code (BrsHw) */ + +/********************************************************************************************************************** + * GLOBAL TYPE DEFINITIONS + *********************************************************************************************************************/ +#if defined (BRS_ENABLE_OS_MULTICORESUPPORT) +typedef struct +{ + uint32 PhysicalCoreId; + void (*CoreExceptions)(); +}ARMBrsHw_PhysicalCoreId_CoreExceptions_MappingType; +#endif /*BRS_ENABLE_OS_MULTICORESUPPORT*/ + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* + * Description: Macro for access to IO addresses + */ +#define BRSHW_IOS(type, address) (*((volatile type *)(address))) + +#define BRSHWNOP10() do { \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + __asm(" NOP"); \ + } while(0) + +/* + * Description: Macros used in vBRS generated vBrs_Lcfg.c. + */ + #define BRSHW_DEFINE_STARTUP_STACK(x) _STACK_C##x##_LIMIT + + /* No separate ExcVec table on cortexR! OS is defining one interrupt table for exceptions + interrupts */ + #define BRSHW_DEFINE_EXCVEC(x) _OS_EXCVEC_CORE##x##_CODE_START + #define BRSHW_DEFINE_INTVEC(x) _OS_EXCVEC_CORE##x##_CODE_START /* just as dummy to compile vBrs_Lcfg.c, not used in BrsHw_ExceptionTable_Init() */ + +/* Special value, needed for SingleCore UseCase w/o OS (e.g. FBL). vBRS will generate "BRSHW_DEFINE_STARTUP_STACK(BRSHW_INIT_CORE_ID)" + for this. Configure here the valid value for the StartupStack pointer label of the boot core */ +#define _STACK_CBRSHW_INIT_CORE_ID_LIMIT _STACK_C0_LIMIT /* this macro is not used with Arm5/Arm6 compilers */ + +/********************************************************************************************************************** + * Compiler abstraction + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #define ___asm(c) __asm_(c) + #define __asm_(c) __asm(#c); + #define __as1(c, d) __as1_(c, d) + #define __as1_(c, d) __asm( #c " , " #d); + #define __as2(c, d, e) __as2_(c, d, e) + #define __as2_(c, d, e) __asm( #c " , " #d " , " #e); + #define __as3(c, d, e, f) __as3_(c, d, e, f) + #define __as3_(c, d, e, f) __asm( #c " , " #d " , " #e " , " #f); + #define __as4(c, d, e, f, g) __as4_(c, d, e, f, g) + #define __as4_(c, d, e, f, g) __asm( #c " , " #d " , " #e " , " #f " , " #g); + #define __as5(c, d, e, f, g, h) __as5_(c, d, e, f, g, h) + #define __as5_(c, d, e, f, g, h) __asm( #c " , " #d " , " #e " , " #f " , " #g " , " #h); + + #define BRS_MULTILINE_ASM_BEGIN() + #define BRS_MULTILINE_ASM_END() + + #define BRS_ASM_EQU(Label, Value) __as1(.equ Label, Value) + + #define BRS_ISR_KEYWORD __attribute__ ((interrupt("IRQ"))) + + #define BRS_SECTION_CODE(c) __as1(.section .c , "ax" ) + + #define BRS_GLOBAL(c) ___asm(.globl c) + #define BRS_LOCAL_PROTOTYPE(c) void c (void); + #define BRS_LOCAL_FUNCTION_PROTOTYPE(c) void c (void); + #define BRS_LABEL(c) ___asm(c:) + #define BRS_GLOBAL_END() + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# define BRS_EXPORT(Label) ___asm(.global Label) /* Causes the identifier Label to be visible externally */ +# endif + + /* Unconditional branch to c */ + #define BRS_BRANCH(c) ___asm(B c) + #define BRS_EXTERN_BRANCH(c) ___asm(B c) + + /* Branch to e if c and d are equal */ + #define BRS_BRANCH_EQUAL(c,d,e) __as1(CMP c, d) \ + ___asm(BEQ e) + + /* Branch to e if c and d are NOT equal */ + #define BRS_BRANCH_NOT_EQUAL(c,d,e) __as1(CMP c, d) \ + ___asm(BNE e) + + /* Branch to e if c is greater than d*/ + #define BRS_BRANCH_GREATER_THAN(c,d,e) __as1(CMP c, d) \ + ___asm(BGT e) + + /* Branch to e if c is greater or equal than d */ + #define BRS_BRANCH_GREATER_THAN_OR_EQUAL(c,d,e) __as1(CMP c, d) \ + ___asm(BGE e) + +# if (BRS_CPU_CORE_AMOUNT>1) +# if !defined (BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE) + #define BRS_READ_COREID(c) __asm( "mrc p15" "," "#0" "," #c "," "c0" "," "c0" "," "#5" ); \ + __asm( "and r9 " "," #c "," "#255" ); \ + __asm( "and " #c "," #c "," "#0xFF00" ); \ + __asm( "orr " #c "," "r9" "," #c "," "lsr #7" ); + + /* Multiprocessor affinity (MPIDR) */ + #define brsHwGetMpidr(c) __asm("MRC p15, 0, %0, c0, c0, 5" : "=r" (c) :) +# endif /*!BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE*/ + +# else + /* Stub for SingleCore environments, always returns 0 */ + #define BRS_READ_COREID(c) __as1(MOV c, 0) +# endif /*BRS_CPU_CORE_AMOUNT*/ + +#else + #error "Compiler not yet supported" +#endif /*BRS_COMP_x*/ + +/********************************************************************************************************************** + * BrsHW configuration + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* @brief Disable the global system interrupt. + * @pre Must be the first function call in main@BrsMain + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main@BrsMain at power on initialization + *****************************************************************************/ +void BrsHwDisableInterruptAtPowerOn(void); + +/*****************************************************************************/ +/* @brief Copy exception vectors to active exception table + * @pre - + * @param[in] ExcVecLabel - address of the core exception table + * IntVecLabel - address of the interrupt vector table + * Use BRS_DEFINE_ADDRESS_UNUSED for unused values + * @param[out] - + * @return - + * @context Function is called from main@BrsMain at power on initialization + *****************************************************************************/ +void BrsHw_ExceptionTable_Init(Brs_AddressOfConstType, Brs_AddressOfConstType); + +/*****************************************************************************/ +/* @brief This API is used for the BRS time measurement support to get a + * default time value for all measurements with this platform to + * be able to compare time measurements on different dates based + * on this time result. + * @pre Should be called with interrupts global disabled + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from e.g. component testsuits for calibration + *****************************************************************************/ +void BrsHwTime100NOP(void); + +#if !defined (BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE) +/*****************************************************************************/ +/* @brief This API is used to read the core ID of the actual running core + * @pre - + * @param[in] - + * @param[out] - + * @return Core ID of the actual running core + * @context Function is e.g. called from main@BrsMain, to only call HW-init + * code once, on the boot core. + * In MultiCore setups, additional BRSHW_INIT_CORE_ID must be + * declared inside BrsHw.h, to configure the proper core ID value + * of that boot core. + *****************************************************************************/ +uint32 BrsHw_GetCore(void); +#endif /*!BRSHW_PLATFORM_SPECIFIC_GETCORE_AVAILABLE*/ + +#endif /*_ARMBRSHW_CORTEXR_H_*/ diff --git a/Source/include/BrsHw.h b/Source/include/BrsHw.h new file mode 100644 index 0000000..5820368 --- /dev/null +++ b/Source/include/BrsHw.h @@ -0,0 +1,392 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsHw.h + * Project: Vector Basic Runtime System + * Module: BrsHw for platform TexasInstruments Sitara AM263x + * + * \brief Description: This is the hardware specific header file for Vector Basic Runtime System (BRS). + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Description + * -------- ---------- ------ ------------------------------------------------------------------------------------- + * 00.01.00 2022-08-01 visjhr Initial creation, based on Brs_AWRgen2 + * Removed all non supported compilers and eval boards from BrsHw_Ports.h + * 2022-08-11 visbwa Update to Brs_Template 1.03.05; UsageType=external in ALM (DemoComponents concept) + * 00.01.01 2022-08-25 visjhr Added iSystems debugger config + * 00.01.02 2022-09-09 visjhr Added _FirstTimeUseEvalBoardPreparation in svn content and a Brs_Readme.txt in + * content referencing it + * 00.01.03 2022-09-21 visjhr Added #define BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0 + * 00.01.04 2022-09-27 visjhr Added Lauterbach debugger config + * 00.01.05 2022-10-11 visjhr Updated implementation of BrsHwSoftwareResetECU and BrsHwGetResetReasonStartup + * according to initialDE_TPR12_LlvmTI_AM263x_V3 + * 00.01.06 2022-12-22 visjhr Integrated libs and sbl from 20221129_AM263x_V4_VectorDE + * 01.00.00 2023-01-13 visjhr Finalized testing on hardware, updated ReadMe.docx, added V3 Drop SBL for HS-FS + * (general purpose) devices and V4 Drop SBL for HS-SE (Security Enforced) device on + * HSR-9782, added vBaseEnv_SitaraAM263x_handout.docx, removed Brs_Readme.txt + * 01.00.01 2023-03-01 visjhr Updated _FirstTimeUseEvalBoardPreparation\Readme.pdf, added folder + * debug_certificate_creation_HSM_core_on_HS_SE_device to + * _FirstTimeUseEvalBoardPreparation - only in SVN, not in ALM content + * 01.00.02 2025-04-22 kal Removed Ethernet support from package (3rd party MCAL), added missing core IDs + * 01.00.03 2025-10-30 vismaa Updated with Brs_Template@Implementation[1.03.14] + *********************************************************************************************************************/ + +#ifndef _BRSHW_H_ +#define _BRSHW_H_ + +/********************************************************************************************************************** + * MODULE VERSION + *********************************************************************************************************************/ +/* +* Description: This is the BrsHw major, minor and patch version. The version numbers are decimally encoded. +* E.g. a version of 01.03.12 is encoded with major 1u, minor 3u and patch version 12u. +* No leading zeroes shall be used, as they would be treated as octal numbers. +*/ + +/* This is the BrsHw template major, minor and patch version, the platform BrsHw is reviewed to */ +#define BRSHW_SOURCECODE_TEMPLATE_MAJOR_VERSION 1u +#define BRSHW_SOURCECODE_TEMPLATE_MINOR_VERSION 3u +#define BRSHW_SOURCECODE_TEMPLATE_PATCH_VERSION 14u + +#define BRSHW_SOURCECODE_TEMPLATE_VERSION_COMBINED ((BRSHW_SOURCECODE_TEMPLATE_MAJOR_VERSION) * 10000 + \ + (BRSHW_SOURCECODE_TEMPLATE_MINOR_VERSION) * 100 + \ + (BRSHW_SOURCECODE_TEMPLATE_PATCH_VERSION)) + +/* +* Description: This is the legacy BrsHw template main and bug fix version. The version numbers are BCD encoded. +* Nothing to do here, as the version numbers will be generated by macro. +*/ +#define BRSHW_SOURCECODE_TEMPLATE_VERSION (((BRSHW_SOURCECODE_TEMPLATE_MAJOR_VERSION / 10u) << 12u) | \ + ((BRSHW_SOURCECODE_TEMPLATE_MAJOR_VERSION % 10u) << 8u) | \ + ((BRSHW_SOURCECODE_TEMPLATE_MINOR_VERSION / 10u) << 4u) | \ + ((BRSHW_SOURCECODE_TEMPLATE_MINOR_VERSION % 10u))) +#define BRSHW_SOURCECODE_TEMPLATE_BUGFIX_VERSION (((BRSHW_SOURCECODE_TEMPLATE_PATCH_VERSION / 10u) << 4u) | \ + ((BRSHW_SOURCECODE_TEMPLATE_PATCH_VERSION % 10u))) + +/* This is the BrsHw major, minor and patch version */ +#define BRSHW_MAJOR_VERSION 1u +#define BRSHW_MINOR_VERSION 0u +#define BRSHW_PATCH_VERSION 3u + +#define BRSHW_VERSION_COMBINED ((BRSHW_MAJOR_VERSION) * 10000 + (BRSHW_MINOR_VERSION) * 100 + (BRSHW_PATCH_VERSION)) +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +/* + * Description: Inclusion of generic ARM parts + */ +#include "ARMBrsHw_CortexR.h" + +#ifndef SOC_AM263X + #define SOC_AM263X +#endif + +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #include "drivers/hw_include/cslr_soc.h" + #include "drivers/gpio.h" + #include "drivers/soc.h" + #include "drivers/pinmux.h" +#endif + +#if defined (BRS_ENABLE_PORT) + #include "BrsHw_Ports.h" +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +/* The following parameters are necessary for this platform, to be generated by BRS-Cfg5-Generator into BrsCfg.h */ +#if !defined (BRS_OSC_CLK) + #error "BRS CHECK: The parameter BRS_OSC_CLK is missing! Please check your BRS Cfg5 configuration." +#endif + +#if !defined (BRS_TIMEBASE_CLOCK) + #error "BRS CHECK: The parameter BRS_TIMEBASE_CLOCK is missing! Please check your BRS Cfg5 configuration." +#endif + +#if !defined (BRS_PERIPH_CLOCK) + #error "BRS CHECK: The parameter BRS_PERIPH_CLOCK is missing! Please check your BRS Cfg5 configuration." +#endif + +#if !defined (BRS_CPU_MAX_FREQUENCY) + #error "BRS CHECK: The parameter BRS_CPU_MAX_FREQUENCY is missing! Please check your BRS Cfg5 configuration." +#endif + +#if !defined (BRS_CPU_CORE_CORTEX_R5F) + #error "BRS CHECK: The parameter BRS_CPU_CORE_x is missing or not supported! Please check your BRS Cfg5 configuration." +#endif + +#if !defined (BRS_CPU_CORE_AMOUNT) + #error "BRS CHECK: The parameter BRS_CPU_CORE_AMOUNT is missing! Please check your BRS Cfg5 configuration." +#endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* +/* +* Description: This corresponds to the return value of BRS_READ_COREID and BrsHw_GetCore(). +* BRSHW_INIT_CORE_ID is used e.g. in main@BrsMain to detect the valid core for HW initialization +* (boot core) +*/ +#define BRSHW_DERIVATIVE_CORE0_ID 0x00 /*R5FSS0_0*/ +#define BRSHW_DERIVATIVE_CORE1_ID 0x01 /*R5FSS0_1*/ +#define BRSHW_DERIVATIVE_CORE2_ID 0x02 /*R5FSS1_0*/ +#define BRSHW_DERIVATIVE_CORE3_ID 0x03 /*R5FSS0_1*/ +#define BRSHW_INIT_CORE_ID BRSHW_DERIVATIVE_CORE0_ID + +/* Description: Access the active exception table using base address 0 on all cores */ +#define BRSHW_ARMCOMMON_COREEXCEPTIONS_AT_ADDRESS_0 + +/********************************************************************************************************************** + * Compiler abstraction + *********************************************************************************************************************/ +/* part of ArmCommon */ + +/********************************************************************************************************************** + * BrsHW configuration + *********************************************************************************************************************/ +/* part of ArmCommon */ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief This function can be used to initialize controller specific + * stuff that should be handled by the first execution instance, + * even before the memory initialization took place (e.g. + * everything that is necessary to access the memory or to handle + * exceptions). This function is called at the beginning of + * BrsMainStartup(), immediately after the stackpointer was + * initialized in StartupCode + * (if BRSHW_EARLYINIT_AVAILABLE is set in BrsHw.h). + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() at power on + * initialization + *****************************************************************************/ +#define BRSHW_EARLYINIT_AVAILABLE +void BrsHwEarlyInitPowerOn(void); +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +#endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +/*****************************************************************************/ +/* @brief This function can be used to initialize controller specific + * stuff that is not related to one of the other InitPowerOn + * functions (e.g. code that is always mandatory, also if MCAL + * and/or OS is used). This function is called from BrsMain + * immediately after BrsHwDisableInterruptAtPowerOn() during + * initialization (if BRSHW_PREINIT_AVAILABLE is set in BrsHw.h) or + * from the BrsMain_MemoryInit_StageHardReset_Hook() during + * initialization (if BRS_ENABLE_PREFER_PLL_WATCHDOG_INIT is set). + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +#define BRSHW_PREINIT_AVAILABLE +void BrsHwPreInitPowerOn(void); + +#if defined (BRS_ENABLE_WATCHDOG) +/*****************************************************************************/ +/* @brief This function must be used to initialize the Watchdog. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwWatchdogInitPowerOn(void); +#endif /* BRS_ENABLE_WATCHDOG */ + +#if defined (BRS_ENABLE_PLLCLOCKS) +/*****************************************************************************/ +/* @brief This function must be used to initialize the PLL. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwPllInitPowerOn(void); +#endif /* BRS_ENABLE_PLLCLOCKS */ + +#if defined (BRS_ENABLE_PORT) + +/* BrsHwInitPortInput(), BrsHwInitPortOutput(), BrsHwInitPortInputOutput() are replaced by + * proprietary functions provided by TI. */ + +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +/*****************************************************************************/ +/* @brief This function sets the output level of a port pin. + * @pre Port pin configurations available within BrsHw_Ports.h, + * no DrvPort used for port pin initialization and + * transferred port pin has to be initialized as output pin with + * GPIO functionality. + * @param[in] p - brsHw_Port_PortType, to be set, + * Level - level, port pin has to be set to + * (BRSHW_PORT_LOGIC_LOW or BRSHW_PORT_LOGIC_HIGH). + * @param[out] - + * @return - + * @context Function is called from BrsHwPortInitPowerOn() and + * provided to external modules (e.g. BrsMainTogglePin()). + *****************************************************************************/ +void BrsHwPort_SetLevel(brsHw_Port_PortType, uint8); + +/*****************************************************************************/ +/* @brief This function reads the input level of a port pin. + * @pre Port pin configurations available within BrsHw_Ports.h, + * no DrvPort used for port pin initialization and + * transferred port pin has to be initialized as input pin with + * GPIO functionality. + * @param[in] p - brsHw_Port_PortType, to be read. + * @param[out] - + * @return Level, read from port pin + * (BRSHW_PORT_LOGIC_LOW or BRSHW_PORT_LOGIC_HIGH). + * @context Function is provided to external modules. + *****************************************************************************/ +uint8 BrsHwPort_GetLevel(brsHw_Port_PortType); +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif + +/*****************************************************************************/ +/* @brief This function must be used to initialize the used ports. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsMainInit() at power on initialization + *****************************************************************************/ +void BrsHwPortInitPowerOn(void); +#endif /* BRS_ENABLE_PORT */ + +/* BrsHwDisableInterruptAtPowerOn() is part of ArmCommon */ + +/* BrsHw_ExceptionTable_Init() is part of ArmCommon */ + +/*****************************************************************************/ +/* @brief Restart ECU (issue a software reset or jump to startup code) + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from e.g. ECU state handling + *****************************************************************************/ +void BrsHwSoftwareResetECU(void); + +#if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance/executable in the system */ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Get reset reason + * @pre - + * @param[in] - + * @param[out] - + * @return Reset reason + * @context Function is called from BrsMainStartup to determine if reset + * was triggered through software call (BrsHwSoftwareResetECU()). + * The result is stored by BrsMainStartup in the global variable + * brsMain_ResetReason. It should only be called once, during + * startup. The old API name BrsHwGetResetReason() is remapped + * to BrsMainGetResetReason. + *****************************************************************************/ +brsMain_ResetReasonType BrsHwGetResetReasonStartup(void); +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" + +/* +* Wrapper from old BrsHwGetResetReason() function to new BrsMainGetResetReason(). +* This is to prevent multiple selection of reset reason registers, as this is not +* supported on all HW platforms. +*/ +#define BrsHwGetResetReason() BrsMainGetResetReason() +#endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +/* BrsHwTime100NOP() is part of ArmCommon */ + +#if defined (BRS_ENABLE_SAFECTXSUPPORT) +/*****************************************************************************/ +/* @brief This API is used to enable hardware access in untrusted mode + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function must be called after all depending peripheral modules + * are supplied by proper clocks AND before the OS is started. + *****************************************************************************/ +void BrsHw_EnableHwAccess(void); +#endif /* BRS_ENABLE_SAFECTXSUPPORT */ + +/* BrsHw_GetCore() is part of ArmCommon */ + +/*****************************************************************************/ +/* @brief This API is used to enable an interrupt source in the core + * interrupt controller. + * @pre - + * @param[in] Source to be enabled. + * @param[in] Priority level to be set. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_EnableInterrupt(uint32, uint8); + +/*****************************************************************************/ +/* @brief This API is used to disable an interrupt source in the core + * interrupt controller. + * @pre - + * @param[in] Source to be disabled. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_DisableInterrupt(uint32); + +/*****************************************************************************/ +/* @brief This API is used to trigger the given software interrupt source. + * @pre - + * @param[in] Source to be triggered. + * Some derivatives only support few software triggerable sources, + * check for their validity. + * @param[out] - + * @return - + * @context Function is called from HlpTest and other test environments. + *****************************************************************************/ +void BrsHw_TriggerSoftwareInterrupt(uint32); +#endif /*_BRSHW_H_*/ diff --git a/Source/include/BrsHw_Ports.h b/Source/include/BrsHw_Ports.h new file mode 100644 index 0000000..c75d28f --- /dev/null +++ b/Source/include/BrsHw_Ports.h @@ -0,0 +1,149 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsHw_Ports.h + * Project: Vector Basic Runtime System + * Module: BrsHw for platform TexasInstruments Sitara AM263x + * + * \brief Description: This header file contains the information for the evalboard specific port settings, + * supported by this Brs implementation. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsHw.h. + *********************************************************************************************************************/ + +#ifndef _BRSHW_PORTS_H_ +#define _BRSHW_PORTS_H_ + +/******************************************************************************* + * Generic PORT definition types + *******************************************************************************/ +/* GPIO module from TI libraries used for Pin toggling. See GPIO_soc.h for details on the pin declaration */ +typedef struct +{ + uint32 portNumber; +} brsHw_Port_PortType; + +#if defined (_BRSHW_C_) + #define BRSHW_PORT_PIN(name, number) const brsHw_Port_PortType name = {number} +#else + #define BRSHW_PORT_PIN(name, number) extern const brsHw_Port_PortType name +#endif + +#define BRSHW_PORT_LOGIC_HIGH (uint8)1 +#define BRSHW_PORT_LOGIC_LOW (uint8)0 + +/******************************************************************************* + * PIN configuration for alive LED support + *******************************************************************************/ +#if defined (BRS_ENABLE_SUPPORT_LEDS) +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +# if defined (BRS_EVA_BOARD_TI_AM2634_EVM) +BRSHW_PORT_PIN(BRSHW_PORT_LED, /*CSL_MSS_IOMUX_PADCQ_CFG_REG*/ 0); /* GPIOA -> GPIO2 -> T16 */ +# else + #error "Your chosen EvaBoard is not yet supported for LED support. Feel free to add your EvaBoard on top, or disable BRS LED support." +# endif /*BRS_EVA_BOARD_x*/ +# endif /*BRS_COMP_LLVMTEXASINSTRUMENTS*/ +#endif /*BRS_ENABLE_SUPPORT_LEDS*/ + +/******************************************************************************* + * PIN configuration for toggle WD pin support + *******************************************************************************/ +#if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CONST + #include "Brs_MemMap.h" +# endif + + #error "Please configure here the needed WD-toggle pin and uncomment this error, or disable BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN" */ + +BRSHW_PORT_PIN(BRSHW_PORT_TOGGLE_WD, SOC_TPR12_GPIO_x); + +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CONST + #include "Brs_MemMap.h" +# endif +#endif /* BRS_ENABLE_SUPPORT_WD_PIN */ + +/******************************************************************************* + * PIN configuration for toggle CUSTOM pin support + *******************************************************************************/ +#if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CONST + #include "Brs_MemMap.h" +# endif + + #error "Please configure here the needed custom toggle pin and uncomment this error, or disable BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN" */ + +BRSHW_PORT_PIN(BRSHW_PORT_TOGGLE_CUSTOM, SOC_TPR12_GPIO_x); + +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CONST + #include "Brs_MemMap.h" +# endif +#endif /* BRS_ENABLE_SUPPORT_CUSTOM_PIN */ + +/******************************************************************************* + * ------------------------------------------------------------ + * COMMUNICATION DRIVER SPECIFIC PORT SETTINGS + * ------------------------------------------------------------ + *******************************************************************************/ +/******************************************************************************* + * GENERAL COMMUNICATION DRIVER SPECIFIC SETTINGS + *******************************************************************************/ + +/******************************************************************************* + * CAN driver + *******************************************************************************/ +/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ + +/******************************************************************************* + * LIN driver + *******************************************************************************/ +#if defined (BRS_ENABLE_LIN_SUPPORT) + //#error "PortPins for Lin are not yet supported!" +#endif /* BRS_ENABLE_LIN_SUPPORT */ + +/******************************************************************************* + * FLEXRAY driver + *******************************************************************************/ +#if defined (BRS_ENABLE_FLEXRAY_SUPPORT) + #error "PortPins for FlexRay are not yet supported!" +#endif + +/******************************************************************************* + * ETHERNET driver + *******************************************************************************/ +#if defined (BRS_ENABLE_ETHERNET_SUPPORT) + +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) +/* Calls of BrsHwInitPortOutput() and BrsHwInitPortInput() replaced by proprietery SBL image, provided by TI */ +# if defined (BRS_EVA_BOARD_TI_AM2634_EVM) +BRSHW_PORT_PIN(BRSHW_PORT_ETH0_PHY_EN, /*CSL_MSS_IOMUX_PADCQ_CFG_REG*/0); /* GPIOA -> GPIO2 -> T16 */ +BRSHW_PORT_PIN(BRSHW_PORT_ETH0_PHY_N_RESET, /*CSL_MSS_IOMUX_PADBB_CFG_REG*/0); /* GPIOD -> GPIO28 -> R17 */ +# else + #error "Please choose the valid EvalBoard in vBRS setup or define pins for ETH_PHY_EN and ETH_PHY_N_RESET here manually." +# endif /* BRS_EVA_BOARD_x */ +# endif /* BRS_COMP_LLVMTEXASINSTRUMENTS */ +#endif /* BRS_ENABLE_ETHERNET_SUPPORT */ + +#endif /* _BRSHW_PORTS_H_ */ diff --git a/Source/include/BrsMain.h b/Source/include/BrsMain.h new file mode 100644 index 0000000..1b2476b --- /dev/null +++ b/Source/include/BrsMain.h @@ -0,0 +1,807 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain.h + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Main header of BRS contains + * - Main function (called from StartUpCode and calls stack entry EcuM_Init()) + * - Call of BrsHw HW initialization routines + * - 1ms handler, with support of cycle functions with several cycle times + * - Default_Init_Task, Main and Background Task which can be used by the operating system + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * ------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2018-03-20 visbwa Initial creation of new BRS code basis + * 2018-03-27 visbwa Renamed BrsAsrStartup into BrsStartup, added version check, reworked + * includes, added example code text in BrsMainStartup.c + * 2018-05-08 visbwa Introduced support for Generic Testsuite + * (BRS_ENABLE_TESTSUITE_SUPPORT), removed support for all other + * testsuites, introduced BRS_ENABLE_1MS_HANDLER and + * brsMain_CallCounter1sec + * 2018-05-16 visbwa Added extern declaration of brsHwZeroRamAreaSet and + * brsHwInitRamAreaSet in BrsMainStartup.c + * 01.00.01 2018-06-22 visbwa Added CAN stack exclusive area workaround from former + * BswInit_Callout_Stubs.c + * 01.00.02 2018-06-25 visbwa Added configuration check for OS_MS2TICKS_SystemTimer into BrsMain.h + * 01.00.03 2018-07-02 visces Removed outdated brsHwZeroRamAreaSet and brsHwInitRamAreaSet in + * BrsMainStartup.c + * 01.00.04 2018-07-18 visbwa Moved BrsHwDisableInterruptAtPowerOn() from BrsMainInit() into main() + * (OS specifies, this has to be called before Os_Init() and for every + * Core) + * 01.00.05 2018-07-26 visbwa No changes in sourcecode, only within ALM package + * 01.00.06 2018-07-30 visbwa Encapsuled call of BrsHwDisableInterruptAtPowerOn() with + * usecase != VTT + * 01.01.00 2018-08-16 visbwa Replaced include of RamInitSections.h by vLinkGen_RamInitSections.h in + * BrsMainStartup.c to support vLinkGen + * 01.02.00 2018-10-04 visbwa No changes in sourcecode, only within ALM package + * 01.03.00 2018-10-08 visbwa Changed include of BrsCfg.h into vBrsCfg.h (vBaseEnv 1.1.0) + * 01.03.01 2018-10-10 visbwa Moved BrsTestsuiteInit() from BrsMainInit() into Default_Init_Task(), + * removed usage of BRS_ENABLE_HLPTEST_SUPPORT + * (generic Testsuite concept!) + * 01.03.02 2018-11-05 visbwa Fixed include order (Can.h previous to BrsTestsuite.h) + * 01.03.03 2018-11-13 visbwa Implemented Default_Init_Tasks for projects with up to 6 Cores, + * fixed VTT support within IdleTasks (CANoeAPI_ConsumeTicks) + * 01.04.00 2018-11-21 visbwa Added testsuite callouts into every function + * 01.04.01 2018-11-30 visbwa Removed include of Rte_Main.h (Rte_Start() not called any more) + * 01.05.00 2018-12-21 visbwa Added call of new API Os_InitialEnableInterruptSources() within every + * core Default_Init_Task + * 01.05.01 2019-03-06 visbwa Added hint for DrvCan using infix, added wrapper for Can_30_Mcan + * 01.06.00 2019-05-06 visbwa Support for vLinkGen 1.04; renamed struct names of vlinkGen areas in + * BrsMainStartup.c + * - added support for zero init blocks + * - renamed Brs_RamZeroInit() to Brs_MemoryZeroInit() and + * Brs_RomToRamInit() to Brs_MemoryInit() + * - check for missing hard reset detection + * 01.06.01 2019-05-10 visbwa Changed include of vLinkGen header to support new vLinkGen file + * structure in BrsMainStartup.c + * 01.06.02 2019-06-13 vismaa Added additional Default_Init_Task_Core6 + * 01.06.03 2019-06-26 visbwa Moved call of BrsMainInit() previous to call of Os_Init() + * 01.07.00 2019-07-02 visbwa Enhanced FBL support (encapsulations, call of fblmain()) + * 01.07.01 2019-07-22 visbwa Added check for VLINKGEN_ZERO_INIT_BLOCK_COUNT_HARD_RESET in + * BrsMainStartup.c + * 01.07.02 2019-07-29 visbwa Added implementation of BrsMainExceptionStartup() for calls from + * assembly StartUpCode + * 01.08.00 2019-08-08 visbwa Implemented support for different FBL usecases Legacy, + * WithoutOSScheduling and OSScheduling, added BrsMainExceptionHandler + * module code for BrsMainStartup, changed FBL call from fblmain() to + * FblMain() for legacy mode, removed include of fbl_main.h, + * added InitPattern parameter to Brs_MemoryZeroInit() and added the + * new configuration values for the init pattern to the depending calls + * in BrsMainStartup.c, added sample implementation for Hard-reset blocks + * and areas in BrsMainStartup.c + * 01.09.00 2019-08-28 visbwa Changed encapsulation of task implementations (not used for FBL + * usecases Legacy and WithoutOSScheduling any more) + * 2019-10-07 visbwa Added support of platform individual ZeroInit function + * BrsHw_AsmMemoryZeroInitLoop() in Brs_MemoryZeroInit() in + * BrsMainStartup.c + * 2019-10-09 visbwa Enhanced support for VTT platform + * 01.09.01 2019-11-04 visbwa Changed include of Can.h into CanIf.h (get rid of DrvCan with infix + * (Can_30_Mcan.h)), enhanced MemMap + SchM exclusive area abstraction + * for Mcan driver (uses infixes) + * 01.09.02 2020-11-04 visbwa No changes in sourcecode, only within ALM package + * 01.10.00 2019-11-25 visbwa Implemented Default_Init_Task_Trusted and + * Default_Init_Task_Corex_Trusted to allow the SafeContext partitioning + * UseCase + * 2019-11-27 visbwa Changed include structure for vBrsCfg.h in BrsMain.h (does now also + * exist for VTT) + * 2019-11-29 visbwa Enhanced encapsulation with _MICROSOFT_C_VTT_ for DualTarget UseCase + * (no BrsHw!) + * 2019-12-04 visbwa Fixed encapsulation of DrvCan parts + * 01.11.00 2020-02-11 visbwa Support for UseCase HSM (BRS_ENABLE_HSM_SUPPORT, no EcuM), + * added filtering of MultiCore parts through + * C_BRSASR_USECASE_SINGLECORE_COMMENT, + * support for generated DrvCan macros to support modules with infix + * names, removed error directive at usage of BrsHwGetResetReason() in + * BrsMainStartup.c + * 01.12.00 2020-03-12 visbwa Encapsulation of SchM implementation with MemMap defines for UseCase + * FBL, encapsulation of struct brsMain_Cyclic_Callbacks with MemMap and + * 1ms-handler defines + * 01.12.01 2020-04-22 visbwa Added conditional call of BrsHwDisableEccErrorReporting() for FBL + * UseCase + * 02.00.00 2020-05-29 visbwa Major updates for vBaseEnv 2.0.0 + * - added BrsMainTogglePin() (moved from BrsHw.c BrsHwTogglePin()) + * - introduction of BrsMain_Callout_Stubs.c + * - updated vLinkGen define and struct names to new vLinkGen 2.0 naming + * schema, added version check for vLinkGen version in BrsMainStartup.c + * 02.01.00 2020-06-29 visbwa Added support for preferred PLL and Watchdog init in BrsMainInit() and + * BrsMain_MemoryInit_StageOne_Hook(), reduced calls of BrsHw_GetCore() + * inside Brs_PreMainStartup() of BrsMainStartup.c to a single call + * 02.01.01 2020-07-24 visbwa Soft increase for FBL_Legacy support + * 02.02.00 2020-08-10 visbwa Support for FBL Legacy UseCase w/o OS, usage of new FBL UseCase + * defines; + * MemMap encapsulation of BrsMainExceptionHandler(), enabled 1ms handler + * also for FBL, BrsMainCyclic1ms() usable from extern, removed usage of + * BrsAsrApplCanInterruptLockCtr for FBL (FBL is always in polling mode), + * added BrsMain_SoftwareResetECU_Hook() in BrsMain_Callout_Stubs.c, + * encapsuled memPtr in Brs_MemoryZeroInit() of BrsMainStartup.c + * (compiler warnings) + * 02.02.01 2020-10-29 visbwa No changes in sourcecode, only within ALM package + * 02.02.02 2020-10-29 visbwa No changes in sourcecode, only within ALM package + * 02.02.03 2020-10-30 visbwa Added include of Os.h for VTT (usage of ShutdownOS()), removed + * AUTHOR IDENTITY + * 02.02.04 2020-12-07 visbwa Increased for loop variable in Brs_MemoryZeroInit() and + * Brs_MemoryInit() from uint8 + * to uint32 (depending datatypes are increased in vLinkGen) in + * BrsMainStartup.c + * 02.02.05 2021-01-14 visbwa Adapted main() to also call Os_Init() for FBL with VTT + * 02.03.00 2021-03-17 visbwa Moved revision history of all .c and .h files into BrsMain.h, + * elimination of BrsMainStartup.h, added support for new OS + * UseCase INTERRUPT_ONLY and call of BrsMainExceptionHandler() at the + * end of main() for IllegalReturnFromMain + * 02.03.01 2021-03-22 visbwa Added definition of _BRSMAIN_C_ in BrsMain.c, to solve issues in + * vBrsCfg.h if DIO + * channels are used for TogglePin functionality + * 02.04.00 2021-04-07 visbwa Added implementation of BrsMainSuspendAllInterrupts() and + * BrsMainResumeAllInterrupts() for new OS UseCase INTERRUPT_ONLY + * 02.04.01 2021-04-13 visbwa Encapsulation of int main(void) declaration to not appear for VTT, as + * VTT expects void main(void) + * 02.05.00 2021-07-02 visbwa Added support for upcoming Brs_Template 1.03: + * - call of BrsHw_ExceptionTable_Init() in main() + * - introduction of BrsMain_Types.h + * - new MainExceptionHandler ErrorCode kBrsInvalidCoreConfig + * 02.05.01 2021-07-19 visbwa ESCAN00109765 Fixed VTT encapsulation in main() to solve compiler error + * 02.05.02 2021-08-02 visbwa Fixed BrsHw_ExceptionTable_Init() call in main() for FBL Ram exception + * table + * 02.05.03 2021-08-02 visbwa Fixed BRSMAIN_BUGFIX_VERSION in several files of the package + * 02.06.00 2021-08-05 visjhr HALBE-5072 In BrsMain_Types.h: Renamed StartupStackLabel -> StartupStackEndLabel, + * added StartupStackSize + * 2021-10-11 visbwa Introduction of Brs_ApplicationEntry(), BRS_FIRST_INSTANCE usage and + * MemMap concept in BrsMainStartup.c; brsMain_ResetReasonType in + * BrsMain_Types.h; + * moved BrsMainExceptionStartup() from BrsMain.c into BrsMainStartup.c + * and map it into StartupCode section; swap order of HardResetOnly and + * InitOne in BrsMainStartup.c, moved preferred PLL and Watchdog init + * from InitOne hook into HardResetOnly hook to fit with vLinkGen 2.04; + * several small adaptions to reduce compiler warnings; + * introduction of Brs_memMap.h + * 02.06.01 2021-10-20 visbwa Brs_memMap.h fix for GHS + * 02.06.02 2021-10-28 visbwa Encapsulation of _Brs_ExcVectRam_START extern declaration, for better + * VTT support + * 02.07.00 2021-11-09 visbwa Encapsulation of BrsHw_ExceptionTable_Init() in main() for FBL UseCase + * with new parameter BRS_FBL_EXCEPTIONTABLE_IN_RAM + * (vBRSFblSupportExceptionTableInRam); + * use DrvCan MemMap for mapping of BrsAsrApplCanInterruptLockCtr and + * module specific MemMap sections for exclusive area implementation in + * BrsMain.c (including CAN driver name infix wrapper, provided by vBRS + * generator in vBrsCfg.h) + * 02.07.01 2021-11-25 virjas Added missing function prototypes + * 02.07.02 2021-12-02 visbwa Added support for Arm6/TI and warning for GccGnu/Generic compiler in + * Brs_MemMap.h + * 02.08.00 2022-01-12 visbwa Changed call of BrsHw_ExceptionTable_Init() in main() for FBL UseCase + * (_Brs_ExcVectRam_START is now generated into BrsMain_CoreConfig), + * added a check for the vBrs generator version + * (BRS_GENERATED_HW_CONFIG_VERSION) + * 02.08.01 2022-02-04 visrgm Added support for Renesas compiler in Brs_MemMap.h + * 02.08.02 2022-02-18 visbwa Enhanced encapsulation of uint32 i in main() to prevent compiler + * warnings + * 02.08.03 2022-02-18 visbwa Added encapsulation to BrsMainExceptionStartup() (1st execution + * instance) + * 02.08.04 2022-03-23 visbpz Added support for Microchip compiler in Brs_MemMap.h + * 02.08.05 2022-03-23 visbpz Incrementing software version + * 02.08.06 2022-03-30 visbwa Added _BRSMAINSTARTUP_C_ to BrsMainStartup.c + * 02.08.07 2022-04-06 visjhr HALBE-6489 Added Default_Init_Task_Core0 and Default_Init_Task_Core0_Trusted + * 02.08.08 2022-05-12 visbwa Added functionality to override BRSMAIN_CYCLIC_MAX_CALLBACKS in + * BrsMain.c + * 02.09.00 2022-05-05 visbwa Added sections for mapping of exception table const/code in + * Brs_MemMap.h + * 2022-05-30 visbwa Added support for LlvmDiab/LlvmTI compiler and fixed support for + * GccGnu (to allow at least correct mapping for all brsExcVect) in + * Brs_MemMap.h + * 02.09.01 2022-05-31 visbwa Fixed LlvmDiab support in Brs_MemMap.h + * 02.09.02 2022-07-04 visbwa Removed call of BrsHwDisableEccErrorReporting() in BrsMainInit() + * (is called from FBL) + * 02.09.03 2022-07-07 visbwa Readded call of BrsHwDisableEccErrorReporting() and adapted + * encapsulation of BrsHw + * init function calls for FBL UseCases in BrsMainInit() + * 02.10.00 2022-07-14 visbwa Changes in ALM content settings only (usage type partly set to + * external) + * 02.10.01 2022-08-04 visbwa Added LlvmHightec support in Brs_MemMap.h + * 02.11.00 2022-12-07 visbwa Removed support for BrsHw packages with + * BRSHW_SOURCECODE_TEMPLATE_VERSION < 0x0103u; + * brsMain_ResetReason in Brs_PreMainStartup() only set by initCore; + * introduction of BrsMain_Appl.c, call of BrsMain_Appl_Init() from + * BrsMainInit(), moved UserDefined ExclusiveArea handling for CAN + * channels into BrsMain_Appl.c, implementation of FBL Instance Presence + * Pattern in BrsMain_Appl.c; + * support for Ansi/Gnu compiler with VTT/CANoeEmu in Brs_MemMap.h + * 2022-12-13 visdri Fixed LlvmTI compiler support in Brs_MemMap.h + * 02.11.01 2023-01-11 visbwa Fixed single core platform support in Brs_PreMainStartup() of + * BrsMainStartup.c + * 02.11.02 2023-01-11 visbwa Fixed MemMap defines for initialized variables in BrsMainTogglePin() + * 02.12.00 2023-02-16 visjhr HALBE-8511 Removed unused IdleTask{_CoreX},removed filtering ifdefs for + * C_BRSASR_USECASE_STARTAPPLICATION_COMMENT and C_BSWMODULE_ASR_* + * 2023-02-24 visbwa Introduction of BRS_MEMMAP_INLINE_ASSEMBLER_USED in Brs_MemMap.h for + * GHS compiler + * 2023-02-27 visbwa Added call to BrsHwApplicationInit() at beginning of + * Brs_ApplicationEntry() in + * BrsMainStartup.c, to support platform specific initialization per + * execution instance + * 2023-03-07 visbwa Added usage of BrsMain_Appl for UseCase VTT as well + * 02.13.00 2023-03-08 visjhr Added BRS_START/STOP_SEC_BRSAPPLENTRY_CODE for locating + * Brs_ApplicationEntry() to + * the new section "brsApplicationEntry" + * 02.13.01 2023-05-10 sgj Introduction of BRS_MEMMAP_INLINE_ASSEMBLER_USED in Brs_MemMap.h for + * DIAB compiler + * 02.13.02 2023-05-17 visbwa Fixed MemMap defines of brsMain_CallCounter1ms, + * brsMain_CallCounter1sec and brsMain_SuspendAllCounter + * 02.14.00 2023-05-17 visbwa Support of new execution instance HSM_Updater + * (BRS_ENABLE_HSM_UPDATER_SUPPORT) + * 02.14.01 2023-06-02 visbwa Added a check an valid Brs_Template version for USeCase HSM_Updater + * 02.15.00 2023-06-28 visbwa Changed implementation of BrsMainTask (from extended to basic task), + * setting of BrsCyclicAlarm_1ms moved into Default_Init_Task; small + * fixes for HSM-Updater support + * 2023-07-14 visbwa Fixed BRS_START_SEC_EXCVECTRAM_CONST in Brs_MemMap.h + * 02.15.01 2023-07-21 visjhr Added support for CCAC compiler (Brs_MemMap.h) + * 02.15.02 2023-09-13 visbwa Fixed include of CANoeApi.h, to support key sensitive environments (Linux) + * 02.16.00 2023-09-27 visbwa Support for new Can_30_Core and vCan drivers in BrsMain_Appl.c + * 02.16.01 2023-10-25 visbwa Fixed DrvCan header include encapsulation in BrsMain_Appl.c + * 02.16.02 2023-11-13 visbwa Fixed DrvCan header include encapsulation in BrsMain_Appl.c + * 02.16.03 2023-11-28 visbwa Introduction of BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING to + * disable CAN exclusive area handling in BrsMain_Appl.c + * visbwa BASEENV-10659 Added support for Can_30_Core_MemMap.h in BrsMain_Appl.c + * 02.17.00 2023-11-20 visjhr BASEENV-10133 Add support for multiple DrvCan instances in BrsMain_Appl.c + * 2023-11-21 visbwa Added "Change Id" to revision history + * 2023-12-05 visbwa BASEENV-11107 Added sample implementation of DrvCan HardwareCancelByAppl + * functionality to BrsMain_Appl.c as new default, as a replacement of + * the custom defined exclusive area handlings (still available as + * sample, but with danger notice) + * 02.17.01 2024-02-12 vissgj Fixed section pragma of brsSharedVar for DIAB (istring "" , + * ustring "uninitialised section") in Brs_MemMap.h + * 02.17.02 2024-02-23 vissgj Added pragmas ghs start/enddata of brsSharedVar for GHS in + * Brs_MemMap.h to force variables to data area bss + * (excludes data from a special data area sda) + * Added section encapsulation of extern volatile brsMain_ResetReasonType + * brsMain_ResetReason in BrsMain.c + * 02.17.03 2024-02-29 visjhr BASEENV-11377 Changed IAR pragma used for BRS_START/STOP_SEC_FBL_PP_CONST + * (FblPresencePatternSection) + * 02.17.04 2024-03-06 visbwa BASEENV-3450 Added support for QNX QCC compiler in Brs_MemMap.h + * 02.17.05 2024-04-16 visbwa BASEENV-11813 Added BRSMAIN_POSTBRSMAININIT_CALLOUT + * BrsTestsuite_BrsMain_PostBrsMainInit() + * 02.17.06 2024-04-24 vissgj Changed alignment for brsSharedVar section for GccHightec from 8 to 4 + * (else additional space is consumed) + * 02.18.00 2024-06-24 visbwa BASEENV-11442 Fixed Brs_MemoryInit() mechanism in BrsMainStartup.c, to better work + * with vLinkGenVarSectionGroupEndAlignment; + * BASEENV-11563 Enhanced Brs_MemoryZeroInit() mechanism in BrsMainStartup.c, to work + * with different ECC alignment values and implemented 8-Byte aligned + * initailization in Brs_MemoryInit(), encapsulated with + * BRSMAINSTARTUP_64BIT_MEMORYINIT; + * BASEENV-12149 Updated BrsMain_Appl.c for better FBL usage (Appl_30_CoreCanTimer* + * APIs already implemented by fbl_cw) + * 02.19.00 2024-07-08 kal BASEENV-11508 Replaced all _MICROSOFT_C_VTT_ defines with newer VVIRTUALTARGET, to + * also support VTT with GccGnu and CLANG compiler + * 02.19.01 2024-07-29 visbwa Introduced BRS_DUMMY_STATEMENT and usage in BrsMainExceptionHandler() + * 02.20.00 2024-08-06 mna BASEENV-12327 Updated main() for HypervisorMaster support + * 2024-08-19 mna BASEENV-12265 Update Brs_ApplicationEntry() for initialization of groups in new init + * stage POWER_ON + * 2024-08-21 mna BASEENV-12285 Update main() for support of non-Autosar Cores + * 02.20.01 2024-08-29 visbwa ESCAN00118129 Added workaround for vLinkGen Tasking linker issue of empty ROM blocks + * for ROM to RAM copy groups, which triggers error checks in + * Brs_MemoryInit() + * 02.20.02 2024-08-30 visbwa Fix for VTTonly in main(), as BrsMain_NonAsrCore_Hook() not available + * for VTTonly + * 02.21.00 2024-09-02 visbwa BASEENV-12323 Enhanced support for Hypervisor, introduction of BRS_DISABLE_OS_USAGE + * 2024-09-04 mna BASEENV-12291 Enhanced support for non-Autosar cores + * 2024-09-12 visbwa TAR-61084 Fixed RamConstSection for IAR compiler in Brs_MemMap.h + * 2024-09-13 visbwa Added support for new DrvCanGen3_Core@Implementation[4.00.00] + * (CAN_30_CORE_SW_MAJOR_VERSION) in BrsMain_Appl, introduction of + * BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP + * 2024-09-17 visbwa TAR-57340 Added workaround for usage of CanGen3 HW driver with CanGen2 VTT + * driver in Dualtarget setups in BrsMain_Appl + * 02.21.01 2024-10-23 visbwa TAR-62725 Fixed vCan header include in BrsMain_Appl.h + * 02.21.02 2024-11-28 kal TAR-68820 Added prototype for local function BrsHw_AsmMemoryZeroInitLoop_64bit() + * 02.22.00 2024-11-22 mna BASEENV-12737 MemoryInit to support 64bit addressing + * 2024-12-09 visrgm BASEENV-12889 Fixed MemMap encapsulation for BrsAsrApplCanTimerCount in + * BrsMain_Appl.c + * 2024-12-11 sgj BASEENV-12534 Removed workaround for ESCAN00118129 Tasking compiler (requires + * vLinkGen >= 15) + * 2025-01-10 visbwa BASEENV-9206 Introduction of BRSMAIN_MEMINIT_FUNC_PREFIX and BrsMain_Cfg.h, + * removed include of BrsHw.h in BrsMain_Callout_Stubs.c as its redundant + * 2025-01-15 mna BASEENV-13024 Hypervisor Multicore support in BrsMain_Appl_HypervisorApi(); + * Conditional presence and call of BrsHw_UnlockCores() with + * Brs_Template 1.03.13 + * 2025-01-23 visbwa BASEENV-13024 Introduction of BrsMain_Appl_HypervisorStartCoreApi() + * 02.22.01 2025-02-20 visbwa Fixed ALM compiler filter rule for Brs_MemMap.h with VTT DualTarget + * environments + * 02.22.02 2025-02-21 visbwa Fixed definition of BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP in + * BrsMain_Appl.h for newer DrvCanGen3_Core versions + * 02.23.00 2025-03-21 vismaa BASEENV-13397 Introduced BRS_DISABLE_MEMORY_INIT_GLOBALLY in Brs_ApplicationEntry() + * 02.23.01 2025-05-27 kal BASEENV-13873 Added support for ArmTfE compiler (Brs_MemMap.h) + * 02.24.00 2025-06-24 kal BASEENV-13740 Revision according to C coding guidelines and improved MISRA-C + * BASEENV-13830 compliance + * 2025-07-22 visbwa Removed outdated hint for ESCAN00078832 in Default_Init_Task() + * 02.24.01 2025-07-23 visbwa TAR-91131 Enhanced support for new Gen3 Vtt DrvCan in BrsMain_Appl.c + * 02.25.00 2025-08-29 visjhr BASEENV-14263 Introduction of BrsMain_Appl_SuspendAllInterrupts() and + * BrsMain_Appl_ResumeAllInterrupts() in BrsMain_Appl.c for changed + * functionality of vBrs generated SchM stub + * 02.26.00 2025-10-27 sgj BASEENV-14708 Added support for RiscV Tasking compiler (Brs_MemMap.h) + * 02.27.00 2025-11-20 visbwa BASEENV-14777 Added compiler check (DaVinci config to buildenvironment) in + * BrsMain_Appl.c + *********************************************************************************************************************/ + +#ifndef _BRSMAIN_H_ +#define _BRSMAIN_H_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "Compiler.h" + +#include "vBrsCfg.h" + +#if !defined (VVIRTUALTARGET) + #include "BrsMain_Cfg.h" + + #include "BrsMain_Types.h" + + #include "BrsHw.h" +#endif + +#if defined (BRS_ENABLE_FBL_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) || \ + defined (BRS_ENABLE_HYPERVISOR_SUPPORT) + #define BRS_DISABLE_OS_USAGE +#else + #include "Os.h" +#endif + +#if defined (BRS_ENABLE_HSM_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) + #include "vHsm.h" +#elif defined (BRS_ENABLE_HYPERVISOR_SUPPORT) + #include "vHyp.h" +#else +# if !defined (BRS_FBL_NO_ECUMINIT) +/* Ecu State Manager has to be available in system (BSW module or BRS Stub) */ + #include "EcuM.h" +# endif +#endif + +/********************************************************************************************************************** + * MODULE VERSION + *********************************************************************************************************************/ +/* +* Description: This is the BrsMain major, minor and patch version. The version numbers are decimally encoded. +* E.g. a version of 02.23.01 is encoded with major 2u, minor 23u and patch version 1u. +* No leading zeroes shall be used, as they would be treated as octal numbers. +*/ +#define BRSMAIN_MAJOR_VERSION 2u +#define BRSMAIN_MINOR_VERSION 27u +#define BRSMAIN_PATCH_VERSION 0u + +#define BRSMAIN_VERSION_COMBINED ((BRSMAIN_MAJOR_VERSION) * 10000 + (BRSMAIN_MINOR_VERSION) * 100 + \ + (BRSMAIN_PATCH_VERSION)) + +/* +* Description: This is the legacy BrsMain main and bug fix version. The version numbers are BCD encoded. +* Nothing to do here, as the version numbers will be generated by macro. +*/ +#define BRSMAIN_VERSION (((BRSMAIN_MAJOR_VERSION / 10u) << 12u) | ((BRSMAIN_MAJOR_VERSION % 10u) << 8u) | \ + ((BRSMAIN_MINOR_VERSION / 10u) << 4u) | ((BRSMAIN_MINOR_VERSION % 10u))) +#define BRSMAIN_BUGFIX_VERSION (((BRSMAIN_PATCH_VERSION / 10u) << 4u) | (BRSMAIN_PATCH_VERSION % 10u)) + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL TYPE DEFINITIONS + *********************************************************************************************************************/ +#if defined (BRS_ENABLE_TESTSUITE_SUPPORT) || defined (BRS_ENABLE_SUPPORT_LEDS) || \ + defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) || defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) + #define BRS_ENABLE_1MS_HANDLER +#endif + +#if defined (BRS_ENABLE_1MS_HANDLER) +typedef enum +{ + BRSMAIN_CYCLETIME_BACKGROUND, + BRSMAIN_CYCLETIME_1MS, + BRSMAIN_CYCLETIME_10MS, + BRSMAIN_CYCLETIME_100MS, + BRSMAIN_CYCLETIME_250MS, + BRSMAIN_CYCLETIME_500MS, + BRSMAIN_CYCLETIME_1000MS +}brsMain_Cyclic_Cycletime; +#endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +/* +* Expression that is used to determine whether the current core requires re-programming of the Exception Table. +* For application cores, Exception Table shall be re-programmed only for cores configured as AUTOSAR. +*/ +#if defined (BRS_DISABLE_OS_USAGE) + #define BRS_EXCEPTIONTABLE_INIT_NEEDED(i, coreID) (BrsMain_CoreConfig[(i)].PhysicalCoreId == (coreID)) +#else + #define BRS_EXCEPTIONTABLE_INIT_NEEDED(i, coreID) ((BrsMain_CoreConfig[(i)].CoreIsAsr == ASR) && \ + (BrsMain_CoreConfig[(i)].PhysicalCoreId == (coreID))) +#endif + +/* Expression that is used for dummy statements to avoid compile warnings about unused identifiers */ +#define BRS_DUMMY_STATEMENT(x) (void)(x) + +/******************************************************************************* + * ModuleCode for BrsMainExceptionHandler + ******************************************************************************/ +#define BRSERROR_MODULE_BRSHW 0x01u +#define BRSERROR_MODULE_BRSMAIN 0x02u +#define BRSERROR_MODULE_BRSSTARTUP 0x03u +#define BRSERROR_MODULE_BRSMAINSTARTUP 0x04u + +/******************************************************************************* + * ErrorCodes for BrsMainExceptionHandler + * 0x00 to 0x7f are assigned to the BRS + * 0x80 to 0xff are assigned to the application + ******************************************************************************/ +/* General error which is not assigned to a special error class */ +#define kBrsUndefinedError 0x00u + +/* No handler is installed in interrupt vector table for given interrupt */ +#define kBrsInterruptHandlerNotInstalled 0x01u + +/* A GenTool setting is different to the excepted value */ +#define kBrsWrongGenToolSettings 0x02u + +/* BrsHwRestoreInterrupt is called more often than BrsHwDisableInterrupt */ +#define kBrsIllegalInterruptRestoration 0x03u + +/* Hardware configuration like clock setting is wrong */ +#define kBrsIllegalHardwareConfiguration 0x04u + +/* Illegal parameter used like wrong channel parameter */ +#define kBrsIllegalParameter 0x05u + +/* Illegal TCC channel used */ +#define kBrsTccChannelOutOfRange 0x06u + +/* Interrupt from unknown source occurred */ +#define kBrsUnknownInterrupt 0x07u + +/* CAN1 and CAN2 interrupts cannot be distinguished from each other */ +#define kBrsAmbiguousInterruptSource 0x08u + +/* Execution of library version check in Common_SipVersionCheck failed */ +#define kBrsLibraryVersionCheckFailed 0x09u + +/* OS ErrorHook called */ +#define kBrsOsErrorHookCall 0x0Au + +/* BRS not properly initialized */ +#define kBrsConfigUninit 0x0Bu + +/* Application software returned to main */ +#define kBrsIllegalReturnFromMain 0x0Cu + +/* Assembler code reached, which should never be handled */ +#define kBrsIllegalAssemblerReached 0x0Du + +/* No Core config found for actual physical core */ +#define kBrsInvalidCoreConfig 0x0Eu + +/* Configuration is using a functionality, that is not supported yet */ +#define kBrsMissingFunctionality 0x0Fu + +/* A non-Autosar-Core could not be started although it is configured */ +#define kBrsFailedNonAsrCoreStart 0x10u + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +#if !defined (VVIRTUALTARGET) +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Unified routine for Pre Main() Startup. + * @pre Stack pointer needs to be initilialized in StartUpCode before. + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from assembler startup code. + * Called by all cores from the booting execution instance. + * Through Brs_MemMap.h, the API is mapped into section + * brsMainStartup, which allows a fix memory allocation. + *****************************************************************************/ +void Brs_PreMainStartup(void); /* implemented in BrsMainStartup.c */ +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" + +#define BRS_START_SEC_BRSAPPLENTRY_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief Unified application entry for Pre Main() Startup. + * @pre Stack pointer needs to be initilialized in StartUpCode before, + * brsMain_ResetReason needs to be initialized by booting execution + * instance (see Brs_PreMainStartup()). + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from Brs_PreMainStartup() of the booting + * execution instance or is the direct application entry of + * non-booting execution instances (e.g. FBL, with a previously + * running BootManager). Through Brs_MemMap.h, the API is mapped + * into section brsApplicationEntry, which allows a fix memory + * allocation. All APIs are called with current Core ID. + *****************************************************************************/ +void Brs_ApplicationEntry(void); /* implemented in BrsMainStartup.c */ +#define BRS_STOP_SEC_BRSAPPLENTRY_CODE +#include "Brs_MemMap.h" + +# if defined (BRS_ENABLE_SUPPORT_LEDS) +void BrsMainWrapperTogglePinLED(void); /* implemented in BrsMain.c */ +# endif +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) +void BrsMainWrapperTogglePinWD(void); /* implemented in BrsMain.c */ +# endif +# if defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) +void BrsMainWrapperTogglePinCustom(void); /* implemented in BrsMain.c */ +# endif +#endif /* !VVIRTUALTARGET */ + +/*****************************************************************************/ +/* @brief Main initialization routine. + * Contains configuration specific initialization of BrsHw parts + * and BrsMain specific mechanisms. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main + *****************************************************************************/ +void BrsMainInit(void); + +#if !defined (VVIRTUALTARGET) +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage zero. + *****************************************************************************/ +void BrsMain_MemoryInit_StageZero_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage hard reset. + *****************************************************************************/ +void BrsMain_MemoryInit_StageHardReset_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage one. + *****************************************************************************/ +void BrsMain_MemoryInit_StageOne_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage two. + *****************************************************************************/ +void BrsMain_MemoryInit_StageTwo_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage three. + *****************************************************************************/ +void BrsMain_MemoryInit_StageThree_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * previous to the memory initialization, stage Power_On. + *****************************************************************************/ +void BrsMain_MemoryInit_StagePowerOn_Hook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] coreID must declare the ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from Brs_ApplicationEntry() during StartUp, + * after the memory initialization was done. + *****************************************************************************/ +void BrsMain_PreMainHook(uint32 coreId); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is an optional callout + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from BrsHwSoftwareResetECU(), before a + * SW reset is triggered. Implement code here to also reset + * peripherals, if necessary for your UseCase. + *****************************************************************************/ +void BrsMain_SoftwareResetECU_Hook(void); /* implemented in BrsMain_Callout_Stubs.c */ + +/*****************************************************************************/ +/* @brief This API is mandatory callout, if non-ASR cores are configured in OS. + * Project specific implementation for non-ASR cores should be added here. + * @pre non-ASR cores are configured in OS + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main() for non-Autosar-cores. + *****************************************************************************/ +void BrsMain_NonAsrCore_Hook(void); /* implemented in BrsMain_Callout_Stubs.c */ +#endif /* !VVIRTUALTARGET */ + +#if defined (BRS_ENABLE_1MS_HANDLER) +/*****************************************************************************/ +/* @brief Routine to register cyclic callbacks. + * @pre Initialization of BrsMain was done threw call of BrsMainInit(). + * @param[in] FunctionPointer has to be a pointer to a function of type + * void function(void). + * @param[in] Cycletime described the cycletime, the callback should be triggered. + * @param[out] - + * @return - + * @context Function is called from modules that need cyclic callbacks. + *****************************************************************************/ +void BrsMainRegisterCyclic(void (*FunctionPointer)(void), brsMain_Cyclic_Cycletime Cycletime); + +/*****************************************************************************/ +/* @brief One millisecond handler for BrsMain + * - Executes retransmission of BRS TCC messages + * - Toggling of LED (alive signal) + * - BRS Test code (1s cyclic negative TCC response message) + * @pre Initialization of BrsMain was done threw call of BrsMainInit(). + * @param[in] - + * @param[out] - + * @return - + * @context Function is called each millisecond either from the main loop + * or from the BRS main task (TASK(mainTask)) + *****************************************************************************/ +void BrsMainCyclic1ms(void); + +# if !defined (BRS_DISABLE_OS_USAGE) && (!defined (BRS_ENABLE_OS_INTERRUPT_ONLY)) +TASK(BrsMainTask); +TASK(BrsMainBackgroundTask); +# endif +#endif + +#if !defined (BRS_DISABLE_OS_USAGE) && (!defined (BRS_ENABLE_OS_INTERRUPT_ONLY)) +TASK(Default_Init_Task); +TASK(Default_Init_Task_Trusted); + +#endif /* !BRS_DISABLE_OS_USAGE && !BRS_ENABLE_OS_INTERRUPT_ONLY */ + +#if defined (BRS_ENABLE_SUPPORT_LEDS) || \ + defined (BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN) || \ + defined (BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN) +typedef enum +{ + BRSMAIN_TOGGLEPIN_LED, + BRSMAIN_TOGGLEPIN_WD, + BRSMAIN_TOGGLEPIN_CUSTOM +} brsMain_TogglePin; + +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +/*****************************************************************************/ +/* @brief This API is used to toggle a PortPin. + * Per default, the following parameters are available: + * BRSMAIN_TOGGLEPIN_LED + * BRSMAIN_TOGGLEPIN_WD + * BRSMAIN_TOGGLEPIN_CUSTOM + * Depending pins must be configured and initialized within BrsHw. + * @pre - + * @param[in] Pin to be toggled + * @param[out] - + * @return - + * @context Function is called from all modules to set or clear a PortPin + *****************************************************************************/ +void BrsMainTogglePin(brsMain_TogglePin Pin); +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +#endif /* BRS_ENABLE_SUPPORT_LEDS || BRS_ENABLE_SUPPORT_TOGGLE_WD_PIN || BRS_ENABLE_SUPPORT_TOGGLE_CUSTOM_PIN */ + +#if defined (BRS_ENABLE_FBL_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +#endif +void BrsMainExceptionHandler(uint8 ErrorCode, uint8 ModuleCode, uint16 LineNumber); +#if defined (BRS_ENABLE_FBL_SUPPORT) || defined (BRS_ENABLE_HSM_UPDATER_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +#endif + +#if !defined (VVIRTUALTARGET) +# if defined (BRS_FIRST_EXECUTION_INSTANCE) +/* This code is only needed for the first instance in the system */ +#define BRS_START_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +/*****************************************************************************/ +/* @brief This is the central exeption/issue handler of BRS, in startup + * phase. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context This function implements an endless loop. The recommendation is + * to set a breakpoint on top of this function to see if any check + * has failed during the startup code execution. + *****************************************************************************/ +void BrsMainExceptionStartup(void); +#define BRS_STOP_SEC_STARTUP_CODE +#include "Brs_MemMap.h" +# endif /* BRS_FIRST_EXECUTION_INSTANCE */ + +/*****************************************************************************/ +/* @brief Get reset reason + * @pre BrsHwGetResetReasonStartup() is called first and the rest reason + * is saved in global variable brsMain_ResetReason. + * @param[in] - + * @param[out] - + * @return Reset reason + * @context This is a wrapper function for previous BrsHwGetResetReason(). + * This is to prevent multiple selection of reset reason + * registers, as this is not supported on all platforms. + * The HW registers for the reset reason are evaluated via a call + * of BrsHwGetResetReasonStartup() in Brs_PreMainStartup(). + * The result is stored by BrsMainStartup in the global variable + * brsMain_ResetReason. + *****************************************************************************/ +brsMain_ResetReasonType BrsMainGetResetReason(void); + +int main(void); +#endif /* !VVIRTUALTARGET */ + +#if defined (BRS_ENABLE_OS_INTERRUPT_ONLY) +void BrsMainSuspendAllInterrupts(void); +void BrsMainResumeAllInterrupts(void); +#endif + +#endif /* _BRSMAIN_H_ */ diff --git a/Source/include/BrsMain_Appl.h b/Source/include/BrsMain_Appl.h new file mode 100644 index 0000000..c4cdd1d --- /dev/null +++ b/Source/include/BrsMain_Appl.h @@ -0,0 +1,359 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_Appl.h + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Header of additional, Application-specific, implementation + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +#ifndef _BRSMAIN_APPL_H_ +#define _BRSMAIN_APPL_H_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ +#include "BrsMain.h" + +#if defined (BRS_ENABLE_TESTSUITE_SUPPORT) + #include "BrsTestsuite.h" +#endif + +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) +# if defined (BRS_ENABLE_CAN_CORE_SUPPORT) + #include "Can_30_Core.h" + +# if defined (VVIRTUALTARGET) +# if defined (DRVCAN_CANOEEMUCANOEASR_VERSION) + /* + * Combination of CanGen3 HW driver with CanGen2 VTT driver detected. Special exclusive area handling should be + * disabled + */ + #define BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING +# endif +# else + #include BRS_DRVCAN_HEADER_FILENAME +# endif + +# elif defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) + /* Just a check to verify, if either CAN_Classic or CAN_Core is active with CAN support enabled */ + +# else + #error "Neither a classic DrvCan nor a Can_30_Core DrvCan was detected, but DrvCan support is enabled. There seems to be something seems wrong here!" +# endif /* BRS_ENABLE_CAN_X_SUPPORT */ +# endif /* BRS_ENABLE_CAN_SUPPORT */ +#endif /* BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING */ + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL TYPE DEFINITIONS + *********************************************************************************************************************/ +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) && defined (BRS_ENABLE_CAN_SUPPORT) && \ + defined (BRS_ENABLE_CAN_CORE_SUPPORT) +# if defined (CAN_30_CORE_COREVERSION) +# if (CAN_30_CORE_COREVERSION >= 0x0203u) + #define BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP /* include "Can_30_Core_MemMap.h" instead of "MemMap.h" */ +# endif +# elif defined (CAN_30_CORE_SW_MAJOR_VERSION) + #define BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP /* include "Can_30_Core_MemMap.h" instead of "MemMap.h" */ +# else + #error "Detection of Can_30_Core driver version was not possible. Please configure here manually the valid MemMap header of the module." +# endif +#endif + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ +/*****************************************************************************/ +/* @brief Main initialization routine. + * Contains configuration specific initialization of BrsHw parts + * and BrsMain specific mechanisms. + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is called from main + *****************************************************************************/ +void BrsMain_Appl_Init(void); + +#if defined (BRS_ENABLE_SCHM_STUB_GENERATION) +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_START_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +/*****************************************************************************/ +/* @brief Suspend all interrupts via OS call + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is used for SchM_Enter_* defines in vBrs generated + * SchM stub module specific header files. This allows the user to + * add project specific code. As default, SuspendAllInterrupts() is + * defined empty within BrsMain provided Os.h stub for delieveries + * w/o OS (no interrupt locking needed in polling environments) + *****************************************************************************/ +void BrsMain_Appl_SuspendAllInterrupts(void); + +/*****************************************************************************/ +/* @brief Resume all interrupts via OS call + * @pre - + * @param[in] - + * @param[out] - + * @return - + * @context Function is used for SchM_Exit_* defines in vBrs generated + * SchM stub module specific header files. This allows the user to + * add project specific code. As default, ResumeAllInterrupts() is + * defined empty within BrsMain provided Os.h stub for delieveries + * w/o OS (no interrupt locking needed in polling environments) + *****************************************************************************/ +void BrsMain_Appl_ResumeAllInterrupts(void); +# if defined (BRS_ENABLE_FBL_SUPPORT) + #define BRS_STOP_SEC_RAM_CODE + #include "Brs_MemMap.h" +# endif +#endif /* BRS_ENABLE_SCHM_STUB_GENERATION */ + +#if defined (BRS_ENABLE_HYPERVISOR_SUPPORT) +/*****************************************************************************/ +/* @brief Callout to let the additional configured cores started by the + * boot core, if necessary. This is just an initial template and + * may need project specific adaptions. It's called by every core. + * @pre - + * @param[in] coreID is the physical core ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from main, previously to vHyp_Init() + *****************************************************************************/ +void BrsMain_Appl_HypervisorStartCoreApi(uint32 coreID); + +/*****************************************************************************/ +/* @brief Callout to implement user code previous to the call of + * vHyp_Start(). This is just an initial template and may need + * project specific adaptions. It's called by every core. + * @pre - + * @param[in] coreID is the physical core ID of the actual running core + * @param[out] - + * @return - + * @context Function is called from main, previously to vHyp_Start() + *****************************************************************************/ +void BrsMain_Appl_HypervisorApi(uint32 coreID); +#endif + +#if !defined (BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING) +# if defined (BRS_ENABLE_CAN_SUPPORT) +# if defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) +/********************************************************************************************************************** + * A classic (non-Gen3) DrvCan is part of the configuration. "Oldschool" implementation is needed + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * UserDefined ExclusiveArea handling for CAN channels, according to AN-ISC-8-1149_ErrorHook_E_OS_DISABLED_INT.pdf + *********************************************************************************************************************/ +/* Macro is generated in vBrsCfg.h, to support drivers with infix. + Sample w/o infix: void SchM_Enter_Can_CAN_EXCLUSIVE_AREA_0(void) + Can_DisableControllerInterrupts(0u); + Sample w/ infix: void SchM_Enter_Can_30_Mcan_CAN_30_MCAN_EXCLUSIVE_AREA_0(void) + Can_30_Mcan_DisableControllerInterrupts(0u);*/ + +#define CAN_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_0); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_0); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter, EXCLUSIVE_AREA_6); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit, EXCLUSIVE_AREA_6); +#define CAN_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" + +# if !defined (BRS_ENABLE_FBL_SUPPORT) +#define CANIF_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanIf_CANIF_EXCLUSIVE_AREA_0(void); +void SchM_Exit_CanIf_CANIF_EXCLUSIVE_AREA_0(void); +#define CANIF_STOP_SEC_CODE +#include "MemMap.h" + +#define CANSM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_4(void); +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_4(void); +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_1(void); +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_1(void); +#define CANSM_STOP_SEC_CODE +#include "MemMap.h" + +#define COMM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_ComM_COMM_EXCLUSIVE_AREA_1(void); +void SchM_Exit_ComM_COMM_EXCLUSIVE_AREA_1(void); +#define COMM_STOP_SEC_CODE +#include "MemMap.h" +# endif /* !BRS_ENABLE_FBL_SUPPORT */ +# endif /* BRS_ENABLE_CAN_CLASSIC_SUPPORT */ + +# if defined (BRS_ENABLE_CAN_CORE_SUPPORT) +/********************************************************************************************************************** + * A new (Gen3) DrvCan is part of the configuration. New implementation is needed + *********************************************************************************************************************/ +# if (Can_30_Core_IsHardwareCancelByApplOfGeneralFeature(0u) && Can_30_Core_IsHardwareLoopCheckOfGeneralFeature(0u)) + +# if !defined (BRS_ENABLE_FBL_SUPPORT) + /* Within a FBL project, depending APIs are already available within Fbl_cw.c */ +/********************************************************************************************************************** + * Hardware Loop Check / Timeout Monitoring for CAN Driver, according to TechnicalReference_Can_30_Core.pdf, + * chapter 2.8.2 + *********************************************************************************************************************/ +#define CAN_30_CORE_START_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +void Appl_30_CoreCanTimerStart(uint8 Controller, uint8 source); +void Appl_30_CoreCanTimerEnd(uint8 Controller, uint8 source); +Can_ReturnType Appl_30_CoreCanTimerLoop(uint8 Controller, uint8 source); +#define CAN_30_CORE_STOP_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +# endif /* !BRS_ENABLE_FBL_SUPPORT */ + +# else +/********************************************************************************************************************** + * UserDefined ExclusiveArea handling for CAN Driver Core, according to TechnicalReference_Can_30_Core.pdf, Note within + * chapter 3.2 + *********************************************************************************************************************/ +#define CAN_30_CORE_START_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif +void SchM_Enter_Can_30_Core_CAN_30_CORE_EXCLUSIVE_AREA_6(void); +void SchM_Exit_Can_30_Core_CAN_30_CORE_EXCLUSIVE_AREA_6(void); +#define CAN_30_CORE_STOP_SEC_CODE +# if defined (BRSMAIN_CAN_30_CORE_SPECIFIC_MEMMAP) + #include "Can_30_Core_MemMap.h" +# else + #include "MemMap.h" +# endif + +# if !defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) +/********************************************************************************************************************** + * UserDefined ExclusiveArea handling for vCAN Driver, according to TechnicalReference_vCan_30_Mcan.pdf, Note within + * chapter 3.2 + *********************************************************************************************************************/ +#define CAN_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter,EXCLUSIVE_AREA_0); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit,EXCLUSIVE_AREA_0); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Enter,EXCLUSIVE_AREA_1); +BRS_DRVCAN_EXCLUSIVE_AREA_INFIX(Exit,EXCLUSIVE_AREA_1); +#define CAN_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +# endif /* !BRS_ENABLE_CAN_CLASSIC_SUPPORT */ + +# if defined (BRS_DRVCAN1_HEADER_FILENAME) + /* 2nd DrvCan instance detected */ +#define CAN1_START_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Enter,EXCLUSIVE_AREA_0); +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Exit,EXCLUSIVE_AREA_0); +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Enter,EXCLUSIVE_AREA_1); +BRS_DRVCAN1_EXCLUSIVE_AREA_INFIX(Exit,EXCLUSIVE_AREA_1); +#define CAN1_STOP_SEC_CODE +/* +* to support CAN driver name infix, vBRS generator provides a wrapper +* for usage of the driver specific MemMap.h define in vBrsCfg.h +*/ +#include "vBrsCfg.h" +# endif /* BRS_DRVCAN1_HEADER_FILENAME */ + +# if !defined (BRS_ENABLE_FBL_SUPPORT) +# if !defined (BRS_ENABLE_CAN_CLASSIC_SUPPORT) +#define CANIF_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanIf_CANIF_EXCLUSIVE_AREA_0(void); +void SchM_Exit_CanIf_CANIF_EXCLUSIVE_AREA_0(void); +#define CANIF_STOP_SEC_CODE +#include "MemMap.h" + +#define CANSM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_4(void); +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_4(void); +void SchM_Enter_CanSM_CANSM_EXCLUSIVE_AREA_1(void); +void SchM_Exit_CanSM_CANSM_EXCLUSIVE_AREA_1(void); +#define CANSM_STOP_SEC_CODE +#include "MemMap.h" + +#define COMM_START_SEC_CODE +#include "MemMap.h" +void SchM_Enter_ComM_COMM_EXCLUSIVE_AREA_1(void); +void SchM_Exit_ComM_COMM_EXCLUSIVE_AREA_1(void); +#define COMM_STOP_SEC_CODE +#include "MemMap.h" +# endif /* !BRS_ENABLE_CAN_CLASSIC_SUPPORT */ +# endif /* !BRS_ENABLE_FBL_SUPPORT */ +# endif /* Can_30_Core_IsHardwareCancelByApplOfGeneralFeature(0u) && + Can_30_Core_IsHardwareLoopCheckOfGeneralFeature(0u) */ +# endif /* BRS_ENABLE_CAN_CORE_SUPPORT */ +# endif /* BRS_ENABLE_CAN_SUPPORT */ +#endif /* !BRSMAINAPPL_DISABLE_CAN_EXCLUSIVEAREA_HANDLING */ +#endif /* _BRSMAIN_APPL_H_ */ diff --git a/Source/include/BrsMain_Cfg.h b/Source/include/BrsMain_Cfg.h new file mode 100644 index 0000000..a25bb60 --- /dev/null +++ b/Source/include/BrsMain_Cfg.h @@ -0,0 +1,78 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_Cfg.h + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Vector Basic Runtime System config header for BrsMain user optimizations. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +#ifndef _BRSMAIN_CFG_H_ +#define _BRSMAIN_CFG_H_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * MODULE VERSION + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL TYPE DEFINITIONS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ +#if !defined (BRSMAIN_MEMINIT_FUNC_PREFIX) +# if defined (BRS_COMP_LLVMHIGHTEC) + /* + * LlvmHighTec compiler is automatically inlining the memory init helper functions (Brs_MemoryZeroInit(), + * Brs_MemoryInit()). + * This is causing the section .brsApplicationEntry to increase a lot for this specific compiler. + * To prevent this, we add the attribute noinline to the function definitions + */ + #define BRSMAIN_MEMINIT_FUNC_PREFIX __attribute__((noinline)) + +# else + /* If no specific function prefix is defined, make it an empty definition */ + #define BRSMAIN_MEMINIT_FUNC_PREFIX +# endif +#endif + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#endif /* _BRSMAIN_CFG_H_ */ diff --git a/Source/include/BrsMain_Types.h b/Source/include/BrsMain_Types.h new file mode 100644 index 0000000..4b1192c --- /dev/null +++ b/Source/include/BrsMain_Types.h @@ -0,0 +1,108 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: BrsMain_Types.h + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Vector Basic Runtime System types header for vBrs generated structures. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +#ifndef _BRSMAIN_TYPES_H_ +#define _BRSMAIN_TYPES_H_ + +/********************************************************************************************************************** + * INCLUDES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * MODULE VERSION + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL TYPE DEFINITIONS + *********************************************************************************************************************/ +typedef enum +{ + NON_ASR = 0, /* No Autosar OS is configured for this core */ + ASR = 4096 /* An Autosar OS is configured for this core */ +} brsCoreAsrType; + +/* Data type for readable addresses. */ +typedef P2CONST(void, TYPEDEF, AUTOMATIC) Brs_AddressOfConstType; + +#define BRS_DEFINE_ADDRESS_UNUSED (Brs_AddressOfConstType)0xFFFFFFFF + +/* Allocation of physical core to logical cores of a system. */ +typedef struct +{ + /* Logical Id of configured core. */ + uint32 LogicalCoreId; + + /* Phyiscal Id of configured core. */ + uint32 PhysicalCoreId; + + /* End label of the startup stack. */ + Brs_AddressOfConstType StartupStackEndLabel; + + /* startup stack size */ + uint32 StartupStackSize; + + /* Reflects if core is an AUTOSAR core. */ + brsCoreAsrType CoreIsAsr; + + /* Start label of the exception vector table. */ + Brs_AddressOfConstType ExcVecLabel; + + /* Start label of the interrupt vector table. */ + Brs_AddressOfConstType IntVecLabel; +} brsMain_CoreType; + +/* +* Reset reason, mainly used by BrsHwGetResetReason(). +* Necessary to e.g. identify hard reset during memory initialization in BrsMainStartup. +*/ +typedef enum +{ + BRSMAIN_RESET_SW, + BRSMAIN_RESET_OTHER +} brsMain_ResetReasonType; + +/********************************************************************************************************************** + * GLOBAL CONSTANT MACROS + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL VARIABLES + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * GLOBAL FUNCTION PROTOTYPES + *********************************************************************************************************************/ + +#endif /* _BRSMAIN_TYPES_H_ */ diff --git a/Source/include/Brs_MemMap.h b/Source/include/Brs_MemMap.h new file mode 100644 index 0000000..81e1b3a --- /dev/null +++ b/Source/include/Brs_MemMap.h @@ -0,0 +1,350 @@ +/********************************************************************************************************************** + * COPYRIGHT + * ------------------------------------------------------------------------------------------------------------------- + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + * ------------------------------------------------------------------------------------------------------------------- + * FILE DESCRIPTION + * -----------------------------------------------------------------------------------------------------------------*/ +/** \file File: Brs_MemMap.h + * Project: Vector Basic Runtime System + * Module: BrsMain + * + * \brief Description: Module specific MemMap Header to allow linking of specific parts of BRS into specific + * memory sections. + * + * \attention Please note: + * The demo and example programs only show special aspects of the software. With regard to the fact + * that these programs are meant for demonstration purposes only, Vector Informatik liability shall be + * expressly excluded in cases of ordinary negligence, to the extent admissible by law or statute. + *********************************************************************************************************************/ + +/********************************************************************************************************************** + * REVISION HISTORY + * ------------------------------------------------------------------------------------------------------------------- + * Refer to BrsMain.h. + *********************************************************************************************************************/ + +#ifndef BRS_MEMMAP_ERROR + #define BRS_MEMMAP_ERROR +#endif + +#if defined (VVIRTUALTARGET) + /* + * VTT/CANoeEmu is supporting ANSI/GNU/CLANG as compiler values, but does not contain a Makefile which sets + * BRS_COMP_ + */ + /* + * The vVIRTUALtarget ANSI compiler options do not even support #warning: + * fatal error C1021: invalid preprocessor command 'warning' + * So no warnings show up for this compiler on this platform + */ +/* vVIRTUALtarget build settings: Windows x86/x64, Visual Studio */ +# if defined (_MICROSOFT_C_VTT_) + #define BRS_COMP_ANSI +/* vVIRTUALtarget build settings: Windows x86, CMake / MinGW-w64 */ +# elif defined (__MINGW32__) + #define BRS_COMP_GCCGNU +/* vVIRTUALtarget build settings: Linux, CMake / Clang */ +# elif defined (__clang__) + #define BRS_COMP_ARM6 +# endif +#endif + +/********************************************************************************************************************** + * CONFIGURATION CHECK + *********************************************************************************************************************/ +#if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + +#else + #error "Unknown compiler specified! Pragmas for mapping into specific sections not yet implemented for your compiler." +#endif + +/********************************************************************************************************************** + * CODE sections + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* StartupCode part, located in BrsMain, which is only used by first execution + * instance (e.g. Brs_PreMainStartup()) + *****************************************************************************/ +#ifdef BRS_START_SEC_STARTUP_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = ".brsMainStartup" + +# endif + + #undef BRS_START_SEC_STARTUP_CODE + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_STARTUP_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = "" + +# endif + + #undef BRS_STOP_SEC_STARTUP_CODE + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* Brs_ApplicationEntry section, located in BrsMainStartup, which is used by + * every execution instance (Brs_ApplicationEntry()). This allows a fix + * address of application entry, needed by some bootloader use-cases. + *****************************************************************************/ +#ifdef BRS_START_SEC_BRSAPPLENTRY_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = ".brsApplicationEntry" + +# endif + + #undef BRS_START_SEC_BRSAPPLENTRY_CODE + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_BRSAPPLENTRY_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = "" + +# endif + + #undef BRS_STOP_SEC_BRSAPPLENTRY_CODE + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* Code Exception table, configured during startup from first execution + * instance (on platforms, where exception table is code) + *****************************************************************************/ +#ifdef BRS_START_SEC_EXCVECT_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = ".brsExcVect" + +# endif + + #undef BRS_START_SEC_EXCVECT_CODE + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_EXCVECT_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = "" + +# endif + + #undef BRS_STOP_SEC_EXCVECT_CODE + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* Code Exception table that is located in RAM, configured from FBL execution + * instance (on platforms, where exception table is code) + *****************************************************************************/ +#ifdef BRS_START_SEC_EXCVECTRAM_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = ".brsExcVectRam" + +# endif + + #undef BRS_START_SEC_EXCVECTRAM_CODE + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_EXCVECTRAM_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = "" + +# endif + + #undef BRS_STOP_SEC_EXCVECTRAM_CODE + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* FBL/HSM_Updater specific section, to copy parts of BRS into RAM + * (everything, that is needed during re-flashing) + *****************************************************************************/ +#ifdef BRS_START_SEC_RAM_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = ".RamCodeSection" + +# endif + + #undef BRS_START_SEC_RAM_CODE + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_RAM_CODE +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section text = "" + +# endif + + #undef BRS_STOP_SEC_RAM_CODE + #undef BRS_MEMMAP_ERROR +#endif + +/********************************************************************************************************************** + * CONST sections + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* Constants, that are shared between several execution instances + *****************************************************************************/ +#ifdef BRS_START_SEC_SHARED_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = ".brsSharedConst" + +# endif + + #undef BRS_START_SEC_SHARED_CONST + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_SHARED_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = "" + +# endif + + #undef BRS_STOP_SEC_SHARED_CONST + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* Const Exception table, configured during startup from first execution + * instance (on platforms, where exception table is const) + *****************************************************************************/ +#ifdef BRS_START_SEC_EXCVECT_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = ".brsExcVectConst" + +# endif + + #undef BRS_START_SEC_EXCVECT_CONST + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_EXCVECT_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = "" + +# endif + + #undef BRS_STOP_SEC_EXCVECT_CONST + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* Const Exception table that is located in RAM, configured from FBL execution + * instance (on platforms, where exception table is const) + *****************************************************************************/ +#ifdef BRS_START_SEC_EXCVECTRAM_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = ".brsExcVectRamConst" + +# endif + + #undef BRS_START_SEC_EXCVECTRAM_CONST + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_EXCVECTRAM_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = "" + +# endif + + #undef BRS_STOP_SEC_EXCVECTRAM_CONST + #undef BRS_MEMMAP_ERROR +#endif + +/*****************************************************************************/ +/* FBL/HSM_Updater specific section, to copy parts of BRS into RAM + * (everything, that is needed during re-flashing) + *****************************************************************************/ +#ifdef BRS_START_SEC_RAM_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = ".RamConstSection" + +# endif + + #undef BRS_START_SEC_RAM_CONST + #undef BRS_MEMMAP_ERROR +#endif + +#ifdef BRS_STOP_SEC_RAM_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = "" + +# endif + + #undef BRS_STOP_SEC_RAM_CONST + #undef BRS_MEMMAP_ERROR +#endif + +#if defined (BRS_ENABLE_FBL_SUPPORT) +# if defined (BRS_FBL_INSTANCE_FBL) +/*****************************************************************************/ +/* FBL specific section to store the FBL instance presence pattern into a + * dedicated section + *****************************************************************************/ +# ifdef BRS_START_SEC_FBL_PP_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = ".FblPresencePatternSection" + +# endif + + #undef BRS_START_SEC_FBL_PP_CONST + #undef BRS_MEMMAP_ERROR +# endif + +# ifdef BRS_STOP_SEC_FBL_PP_CONST +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section rodata = "" + +# endif + + #undef BRS_STOP_SEC_FBL_PP_CONST + #undef BRS_MEMMAP_ERROR +# endif +# endif /* BRS_FBL_INSTANCE_FBL */ +#endif /* BRS_ENABLE_FBL_SUPPORT */ + +/********************************************************************************************************************** + * VAR sections + *********************************************************************************************************************/ + +/*****************************************************************************/ +/* Variables, that are shared between several execution instances + * (e.g. brsMain_ResetReason) + *****************************************************************************/ +#ifdef BRS_START_SEC_SHARED_VAR +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section bss = ".brsSharedVar" + +# endif + + #undef BRS_START_SEC_SHARED_VAR + #undef BRS_MEMMAP_ERROR +# endif + +#ifdef BRS_STOP_SEC_SHARED_VAR +# if defined (BRS_COMP_LLVMTEXASINSTRUMENTS) + #pragma clang section bss = "" + +# endif + + #undef BRS_STOP_SEC_SHARED_VAR + #undef BRS_MEMMAP_ERROR +#endif + +#if defined (BRS_MEMMAP_ERROR) + #error "Error in Brs_MemMap.h: MemMap section is not included!" +#endif diff --git a/Source/include/bm_ap.h b/Source/include/bm_ap.h new file mode 100644 index 0000000..01c5545 --- /dev/null +++ b/Source/include/bm_ap.h @@ -0,0 +1,203 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Application dependent routines + * + * \note Please note, that this file contains a collection of callback functions to be used with the + * Flash Bootloader. These functions may influence the behavior of the bootloader in principle. + * Therefore, great care must be taken to verify the correctness of the implementation. + * The contents of the originally delivered files are only examples resp. implementation proposals. + * With regard to the fact that these functions are meant for demonstration purposes only, Vector + * Informatik's liability shall be expressly excluded in cases of ordinary negligence, to the extent + * admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-01-28 visrie - Initial version + * 01.01.00 2019-02-18 vismvi ESCAN00102171 No changes + * visrie ESCAN00102310 Added callout to check reprogramming flag + * 01.01.01 2019-03-07 visrie ESCAN00102386 No changes + * ESCAN00102399 No changes + * 02.00.00 2019-05-02 visrie ESCAN00102518 No changes + * ESCAN00102761 No changes + * ESCAN00103026 Provide BmHeader instead of StartAddress to ApplFblBmStartSoftware + * 03.00.00 2019-07-17 visrie ESCAN00103750 Removed target order list configuration + * 03.01.00 2019-08-14 visrie FBL-487 Exclude callouts if overwritten by OEM/HW layer + * 03.01.01 2019-09-04 visrcn ESCAN00103607 Memory qualifier mismatch + * 04.00.00 2019-12-04 visrie FBL-456 No changes + * ESCAN00105135 No changes + * 04.01.00 2020-01-16 visrie FBL-524 Added support for vHsm SecBoot library + * 05.00.00 2020-04-09 visrie FBL-1016 No changes + * 05.01.00 2020-04-29 vistmo FBL-1584 No changes + * 05.02.00 2020-08-13 vistmo FBL-1489 No changes + * 05.02.01 2021-03-17 vishor ESCAN00108386 No changes + * FBL-3018 Added/adapted MemMap sections + * 05.03.00 2021-08-11 visrie FBL-3394 Move default implementation of CheckReprogFlag into FblBm_Ap + * 05.04.00 2021-09-17 visjdn FBL-3865 No changes + * 05.04.01 2022-04-06 vismix FBL-4773 No changes + * 05.05.00 2022-04-07 vishor FBL-4822 No changes + * 05.05.01 2022-06-23 vismix ESCAN00111879 No changes + * 05.06.00 2022-07-13 vismix FBL-5391 Add callout for missing optional dependency + * 05.06.01 2022-11-29 vishor ESCAN00112986 Compiler error: Undefined symbols + * ApplFblPreMemDriver/ApplFblPostMemDriver + * 05.07.00 2023-06-29 vistbe FBL-7052 No changes + * 05.07.01 2023-12-18 visrie ESCAN00104829 No changes + * ESCAN00111036 No changes + * ESCAN00115752 No changes + * 05.08.00 2024-05-16 vishor FBL-8602 Add support for OEM updater solution + * 05.09.00 2025-05-23 dganesh FBL-9715 Extend presence pattern to connect validity information + **********************************************************************************************************************/ + +#ifndef BM_AP_H +#define BM_AP_H + +/*********************************************************************************************************************** + * VERSION + **********************************************************************************************************************/ + +/* ##V_CFG_MANAGEMENT ##CQProject : FblBm_Ap CQComponent : Implementation */ +#define FBLBM_AP_VERSION 0x0509u +#define FBLBM_AP_RELEASE_VERSION 0x00u + +/* Interface version */ +/** Major interface version identifies incompatible changes */ +#define FBLBM_AP_API_VERSION_MAJOR 0x03u +/** Minor interface version identifies backward compatible changes */ +#define FBLBM_AP_API_VERSION_MINOR 0x00u +/** Release interface version identifies cosmetic changes */ +#define FBLBM_AP_API_VERSION_RELEASE 0x00u + +/*********************************************************************************************************************** +* INCLUDES +**********************************************************************************************************************/ + +#include "FblBm_Cfg.h" +#include "bm_types.h" +#include "bm_hdr.h" + +#include "fbl_inc.h" + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) +# define FblRealTimeSupport() FblLookForWatchdog() +#endif + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ + +#define FBLBMAP_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +void ApplFblBmPowerOnPre(void); +void ApplFblBmPowerOnPost(void); +void ApplFblBmInitPre(void); +void ApplFblBmInitPost(void); + +#if defined( FBLBM_AP_CALLOUT_RESET ) +void ApplFblBmReset(void); +#endif /* FBLBM_AP_CALLOUT_RESET */ + +#if defined( FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY ) +tFblResult ApplFblBmCheckTargetValidity(tFblBmHdrTargetHandle targetHandle); +#endif /* FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY */ +#if defined( FBLBM_AP_CALLOUT_IS_VALIDBLOCK ) +tFblResult ApplFblBmIsValidBlock(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock); +#endif /* FBLBM_AP_CALLOUT_IS_VALIDBLOCK */ +#if defined( FBLBM_AP_CALLOUT_IS_OPTIONALBLOCK ) +void ApplFblBmIsOptionalBlock(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock); +#endif /* FBLBM_AP_CALLOUT_IS_OPTIONALBLOCK */ +#if defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +void ApplFblBmStartSoftware(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader); +#endif /* FBLBM_AP_CALLOUT_START_SOFTWARE* */ +#if defined( FBLBM_AP_CALLOUT_FAILSAFE_UPDATER_USER_CHECK ) && defined( FBLBM_ENABLE_UPDATER_FAILSAFE_USER ) +tFblResult ApplFblBmFailsafeUpdaterUserCheck(V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHeader); +#endif + +#if defined( FBLBM_ENABLE_SECURE_BOOT ) +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY ) +# if defined( FBLBM_AP_CALLOUT_GET_KEYEMPTY ) +tFblBmKeyEmptyResult ApplFblBmGetKeyEmpty( void ); +# endif /* FBLBM_AP_CALLOUT_GET_KEYEMPTY */ +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_KEY */ +# if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +# if defined( FBLBM_AP_CALLOUT_GET_FBL_CMACERASED ) +tFblBmMacEmptyResult ApplFblBmGetFblCmacErased( const tFblBmBlockInfo * fblBlockInfo ); +# endif /* FBLBM_AP_CALLOUT_GET_FBL_CMACERASED */ +# endif /* FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC */ +#endif /* FBLBM_ENABLE_SECURE_BOOT */ + +#if defined( FBLBM_AP_CALLOUT_CHECKREPROGFLAG ) +tFblResult ApplFblBmCheckReprogFlag( void ); +#endif /* FBLBM_AP_CALLOUT_CHECKREPROGFLAG */ + +#if defined( FBLBM_ENABLE_UPDATER_FAILSAFE ) +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT ) +tFblResult ApplFblBmSearchUpdaterHeaderInit(void); +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT */ +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS ) +tFblResult ApplFblBmSearchUpdaterHeaderAddress(vuint32 * headerAddress); +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS */ +# if defined( FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT ) +tFblResult ApplFblBmSearchUpdaterHeaderNext(void); +# endif /* FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT */ +#endif /* FBLBM_ENABLE_UPDATER_FAILSAFE */ + +#if defined( FBLBM_AP_CALLOUT_FATAL_ERROR ) +void ApplFblBmFatalError(tFblBmError error); +#endif /* FBLBM_AP_CALLOUT_FATAL_ERROR */ + +#if defined( FBLNVPATTERN_ENABLE_SIGN_PRESENCE_PATTERN ) +# if defined( FBLBM_AP_CALLOUT_GET_PP_SIGN_KEYEMPTY ) +tFblBmKeyEmptyResult ApplFblBmGetPresPattSignInitStatus( void ); +# endif /* FBLBM_AP_CALLOUT_GET_PP_SIGN_KEYEMPTY */ + +# if defined( FBLBM_AP_CALLOUT_IS_VALIDPATTERN ) +tFblResult ApplFblBmCheckPresencePattern(tFblBmHdrTargetHandle targetHandle, + const V_MEMRAM1 tBlockDescriptor V_MEMRAM2 V_MEMRAM3 * pLogicalBlock); +# endif /* FBLBM_AP_CALLOUT_IS_VALIDPATTERN */ +#endif + +/*-- Other callout functions -----------------------------------------------------------------------------------------*/ + +#if defined( FBLBM_ENABLE_STANDALONE_MODE ) +# if defined( FBL_ENABLE_ASSERTION ) +void ApplFblFatalError( FBL_DECL_ASSERT_EXTENDED_INFO(vuint8 errorCode) ); +# endif /* FBL_ENABLE_ASSERTION */ +# if defined( FBL_MIO_ENABLE_HOOKS ) +void ApplFblPreMemDriver( vuint8 device, vuint8 function ); +void ApplFblPostMemDriver( vuint8 device, vuint8 function ); +# endif /* FBL_MIO_ENABLE_HOOKS */ +#endif /* FBLBM_ENABLE_STANDALONE_MODE */ + +#define FBLBMAP_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* BM_AP_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_AP.H + **********************************************************************************************************************/ diff --git a/Source/include/bm_ap_cfg.h b/Source/include/bm_ap_cfg.h new file mode 100644 index 0000000..1a24eaa --- /dev/null +++ b/Source/include/bm_ap_cfg.h @@ -0,0 +1,307 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief Application dependent routines + * + * \note Please note, that this file contains a collection of callback functions to be used with the + * Flash Bootloader. These functions may influence the behavior of the bootloader in principle. + * Therefore, great care must be taken to verify the correctness of the implementation. + * The contents of the originally delivered files are only examples resp. implementation proposals. + * With regard to the fact that these functions are meant for demonstration purposes only, Vector + * Informatik's liability shall be expressly excluded in cases of ordinary negligence, to the extent + * admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2019-01-28 visrie - Initial version + * 01.01.00 2019-02-18 vismvi ESCAN00102171 No changes + * visrie ESCAN00102310 Added callout to check reprogramming flag + * 01.01.01 2019-03-07 visrie ESCAN00102386 No changes + * ESCAN00102399 No changes + * 02.00.00 2019-05-02 visrie ESCAN00102518 No changes + * ESCAN00102761 No changes + * ESCAN00103026 No changes + * 03.00.00 2019-07-17 visrie ESCAN00103750 Removed target order list configuration + * 03.01.00 2019-08-14 visrie FBL-487 Exclude callouts if overwritten by OEM/HW layer + * 03.01.01 2019-09-04 visrcn ESCAN00103607 No changes + * 04.00.00 2019-12-04 visrie FBL-456 No changes + * ESCAN00105135 No changes + * 04.01.00 2020-01-16 visrie FBL-524 No changes + * 05.00.00 2020-04-09 visrie FBL-1016 No changes + * 05.01.00 2020-04-29 vistmo FBL-1584 No changes + * 05.02.00 2020-08-13 vistmo FBL-1489 No changes + * 05.02.01 2021-03-17 vishor ESCAN00108386 No changes + * FBL-3018 No changes + * 05.03.00 2021-08-11 visrie FBL-3394 Move default implementation of CheckReprogFlag into FblBm_Ap + * 05.04.00 2021-09-17 visjdn FBL-3865 No changes + * 05.04.01 2022-04-06 vismix FBL-4773 No changes + * 05.05.00 2022-04-07 vishor FBL-4822 No changes + * 05.05.01 2022-06-23 vismix ESCAN00111879 No changes + * 05.06.00 2022-07-13 vismix FBL-5391 Add callout for missing optional dependency + * 05.06.01 2022-11-29 vishor ESCAN00112986 No changes + * 05.07.00 2023-06-29 vistbe FBL-7052 No changes + * 05.07.01 2023-12-18 visrie ESCAN00104829 No changes + * ESCAN00111036 No changes + * ESCAN00115752 No changes + * 05.08.00 2024-05-16 vishor FBL-8602 Add support for OEM updater solution + * 05.09.00 2025-05-23 dganesh FBL-9715 Extend presence pattern to connect validity information + **********************************************************************************************************************/ + +#ifndef BM_AP_CFG_H +#define BM_AP_CFG_H + +/*********************************************************************************************************************** + * DEFINES + **********************************************************************************************************************/ + +/*-- Processing hook functions ---------------------------------------------------------------------------------------*/ + +/*-- Callout functions -----------------------------------------------------------------------------------------------*/ + +/* Callout implementation is mandatory, but could be overwritten by OEM- or platform-specific variant */ + +/** HW specific initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_PRE_HW) +# define FBLBM_CALLOUT_POWER_ON_PRE_HW() +#endif /* FBLBM_CALLOUT_POWER_ON_PRE_HW */ + +/** OEM specific initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_PRE_OEM ) +# define FBLBM_CALLOUT_POWER_ON_PRE_OEM() +#endif /* FBLBM_CALLOUT_POWER_ON_PRE_OEM */ + +/** Initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_PRE ) +# define FBLBM_CALLOUT_POWER_ON_PRE ApplFblBmPowerOnPre +#endif /* FBLBM_CALLOUT_POWER_ON_PRE */ + +/** HW specific initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_POST_HW ) +# define FBLBM_CALLOUT_POWER_ON_POST_HW() +#endif /* FBLBM_CALLOUT_POWER_ON_POST_HW */ + +/** OEM specific initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_POST_OEM ) +# define FBLBM_CALLOUT_POWER_ON_POST_OEM() +#endif /* FBLBM_CALLOUT_POWER_ON_POST_OEM */ + +/** Initialization callout */ +#if !defined( FBLBM_CALLOUT_POWER_ON_POST ) +# define FBLBM_CALLOUT_POWER_ON_POST ApplFblBmPowerOnPost +#endif /* FBLBM_CALLOUT_POWER_ON_POST */ + +/** HW specific initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_PRE_HW ) +# define FBLBM_CALLOUT_INIT_PRE_HW() +#endif /* FBLBM_CALLOUT_INIT_PRE_HW */ + +/** OEM specific initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_PRE_OEM ) +# define FBLBM_CALLOUT_INIT_PRE_OEM() +#endif /* FBLBM_CALLOUT_INIT_PRE_OEM */ + +/** Initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_PRE ) +# define FBLBM_CALLOUT_INIT_PRE ApplFblBmInitPre +#endif /* FBLBM_CALLOUT_INIT_PRE */ + +/** HW specific initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_POST_HW ) +# define FBLBM_CALLOUT_INIT_POST_HW() +#endif /* FBLBM_CALLOUT_INIT_POST_HW */ + +/** OEM specific initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_POST_OEM ) +# define FBLBM_CALLOUT_INIT_POST_OEM() +#endif /* FBLBM_CALLOUT_INIT_POST_OEM */ + +/** Initialization callout */ +#if !defined( FBLBM_CALLOUT_INIT_POST ) +# define FBLBM_CALLOUT_INIT_POST ApplFblBmInitPost +#endif /* FBLBM_CALLOUT_INIT_POST */ + +/** HW specific deinitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_PRE_HW ) +# define FBLBM_CALLOUT_DEINIT_PRE_HW() +#endif /* FBLBM_CALLOUT_DEINIT_PRE_HW */ + +/** OEM specific deinitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_PRE_OEM ) +# define FBLBM_CALLOUT_DEINIT_PRE_OEM() +#endif /* FBLBM_CALLOUT_DEINIT_PRE_OEM */ + +/** Denitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_PRE ) +# define FBLBM_CALLOUT_DEINIT_PRE() +#endif /* FBLBM_CALLOUT_DEINIT_PRE */ + +/** HW specific deinitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_POST_HW ) +# define FBLBM_CALLOUT_DEINIT_POST_HW() +#endif /* FBLBM_CALLOUT_DEINIT_HW */ + +/** OEM specific deinitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_POST_OEM ) +# define FBLBM_CALLOUT_DEINIT_POST_OEM() +#endif /* FBLBM_CALLOUT_DEINIT_POST_OEM */ + +/** Denitialization callout */ +#if !defined( FBLBM_CALLOUT_DEINIT_POST ) +# define FBLBM_CALLOUT_DEINIT_POST() +#endif /* FBLBM_CALLOUT_DEINIT_POST */ + +/** Callout to perform reset */ +#if !defined( FBLBM_CALLOUT_RESET ) +# define FBLBM_CALLOUT_RESET ApplFblBmReset +# define FBLBM_AP_CALLOUT_RESET +#endif /* FBLBM_CALLOUT_RESET */ + +/** Check appl validity callout */ +#if !defined( FBLBM_CALLOUT_CHECK_TARGET_VALIDITY ) +# define FBLBM_CALLOUT_CHECK_TARGET_VALIDITY ApplFblBmCheckTargetValidity +# define FBLBM_AP_CALLOUT_CHECK_TARGET_VALIDITY +#endif /* FBLBM_CALLOUT_CHECK_TARGET_VALIDITY */ + +/** Checks if the block is valid callout */ +#if !defined( FBLBM_CALLOUT_IS_VALIDBLOCK ) +# define FBLBM_CALLOUT_IS_VALIDBLOCK ApplFblBmIsValidBlock +# define FBLBM_AP_CALLOUT_IS_VALIDBLOCK +#endif /* FBLBM_CALLOUT_IS_VALIDBLOCK */ + +/** Callout when the block is optional */ +#if !defined( FBLBM_CALLOUT_IS_OPTIONALBLOCK ) +# define FBLBM_CALLOUT_IS_OPTIONALBLOCK ApplFblBmIsOptionalBlock +# define FBLBM_AP_CALLOUT_IS_OPTIONALBLOCK +#endif /* FBLBM_CALLOUT_IS_OPTIONALBLOCK */ + +/** Start the Application */ +#if !defined( FBLBM_CALLOUT_CALL_TARGET ) +# define FBLBM_CALLOUT_CALL_TARGET ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_TARGET */ + +/** Start the FBL */ +#if !defined( FBLBM_CALLOUT_CALL_FBL ) +# define FBLBM_CALLOUT_CALL_FBL ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_FBL */ + +/** Start the FBL to initialize the Key */ +#if !defined( FBLBM_CALLOUT_CALL_FBL_INIT_KEYS ) +# define FBLBM_CALLOUT_CALL_FBL_INIT_KEYS ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_FBL_INIT_KEYS */ + +/** Start the FBL to initialize its CMAC */ +#if !defined( FBLBM_CALLOUT_CALL_FBL_INIT_CMAC ) +# define FBLBM_CALLOUT_CALL_FBL_INIT_CMAC ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_FBL_INIT_CMAC */ + +/** Check if user updater is present */ +#if !defined( FBLBM_CALLOUT_FAILSAFE_UPDATER_USER_CHECK ) +# define FBLBM_CALLOUT_FAILSAFE_UPDATER_USER_CHECK(a) ApplFblBmFailsafeUpdaterUserCheck(a) +# define FBLBM_AP_CALLOUT_FAILSAFE_UPDATER_USER_CHECK +#endif /* FBLBM_CALLOUT_FAILSAFE_UPDATER_USER_CHECK */ + +/** Start the Updater */ +#if !defined( FBLBM_CALLOUT_CALL_FAILSAFE_UPDATER ) +# define FBLBM_CALLOUT_CALL_FAILSAFE_UPDATER ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_FAILSAFE_UPDATER */ + +/** Get information if Key is available for MAC verification */ +#if !defined( FBLBM_CALLOUT_GET_KEYEMPTY ) +# define FBLBM_CALLOUT_GET_KEYEMPTY ApplFblBmGetKeyEmpty +# define FBLBM_AP_CALLOUT_GET_KEYEMPTY +#endif /* FBLBM_CALLOUT_GET_KEYEMPTY */ + +/** Check if FBL MAC is available */ +#if !defined( FBLBM_CALLOUT_GET_FBL_CMACERASED ) +# define FBLBM_CALLOUT_GET_FBL_CMACERASED ApplFblBmGetFblCmacErased +# define FBLBM_AP_CALLOUT_GET_FBL_CMACERASED +#endif /* FBLBM_CALLOUT_GET_FBL_CMACERASED */ + +/** Check if the programming request flag is set */ +#if !defined( FBLBM_CALLOUT_CHECKREPROGFLAG ) +# define FBLBM_CALLOUT_CHECKREPROGFLAG ApplFblBmCheckReprogFlag +# define FBLBM_AP_CALLOUT_CHECKREPROGFLAG +#endif /* FBLBM_CALLOUT_CHECKREPROGFLAG */ + +/** Failsafe Updater */ +#if !defined( FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT ) +#define FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT ApplFblBmSearchUpdaterHeaderInit +# define FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT +#endif /* FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_INIT */ + +/** Failsafe Updater */ +#if !defined( FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS ) +#define FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS ApplFblBmSearchUpdaterHeaderAddress +# define FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS +#endif /* FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_HEADER_ADDRESS */ + +/** Failsafe Updater */ +#if !defined( FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT ) +#define FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT ApplFblBmSearchUpdaterHeaderNext +# define FBLBM_AP_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT +#endif /* FBLBM_CALLOUT_SEARCH_FAILSAFE_UPDATER_NEXT */ + +/** Fatal error callout */ +#if !defined( FBLBM_CALLOUT_FATAL_ERROR ) +# define FBLBM_CALLOUT_FATAL_ERROR ApplFblBmFatalError +# define FBLBM_AP_CALLOUT_FATAL_ERROR +#endif /* FBLBM_CALLOUT_FATAL_ERROR */ + +/** Check if Signed Presence pattern is empty */ +#if !defined( FBLBM_CALLOUT_GET_PP_SIGN_KEYEMPTY ) +#define FBLBM_CALLOUT_GET_PP_SIGN_KEYEMPTY ApplFblBmGetPresPattSignInitStatus +# define FBLBM_AP_CALLOUT_GET_PP_SIGN_KEYEMPTY +#endif /* FBLBM_CALLOUT_GET_PP_SIGN_KEYEMPTY */ + +/** Call for Presence pattern validation */ +#if !defined( FBLBM_CALLOUT_IS_VALIDPATTERN ) +#define FBLBM_CALLOUT_IS_VALIDPATTERN ApplFblBmCheckPresencePattern +# define FBLBM_AP_CALLOUT_IS_VALIDPATTERN +#endif /* FBLBM_CALLOUT_IS_VALIDPATTERN */ + +/** Callout to update signed presence pattern */ +#if !defined( FBLBM_CALLOUT_CALL_FBL_INIT_SIGNED_PRESENCEPATTERN ) +#define FBLBM_CALLOUT_CALL_FBL_INIT_SIGNED_PRESENCEPATTERN ApplFblBmStartSoftware +# if !defined( FBLBM_AP_CALLOUT_START_SOFTWARE ) +# define FBLBM_AP_CALLOUT_START_SOFTWARE +# endif /* FBLBM_AP_CALLOUT_START_SOFTWARE */ +#endif /* FBLBM_CALLOUT_CALL_FBL_INIT_SIGNED_PRESENCEPATTERN */ + +#endif /* BM_AP_CFG_H */ + +/*********************************************************************************************************************** + * END OF FILE: BM_AP_CFG.H + **********************************************************************************************************************/ diff --git a/Source/include/fbl_secboot_ap.h b/Source/include/fbl_secboot_ap.h new file mode 100644 index 0000000..c4ed5c4 --- /dev/null +++ b/Source/include/fbl_secboot_ap.h @@ -0,0 +1,81 @@ +/*********************************************************************************************************************** + * FILE DESCRIPTION + * ------------------------------------------------------------------------------------------------------------------*/ +/** \file + * \brief SecureBoot implementation callback file + * + * \note Please note, that this file contains a collection of callback functions to be used with the + * Flash Bootloader. These functions may influence the behavior of the bootloader in principle. + * Therefore, great care must be taken to verify the correctness of the implementation. + * The contents of the originally delivered files are only examples resp. implementation proposals. + * With regard to the fact that these functions are meant for demonstration purposes only, Vector + * Informatik's liability shall be expressly excluded in cases of ordinary negligence, to the extent + * admissible by law or statute. + * + * -------------------------------------------------------------------------------------------------------------------- + * COPYRIGHT + * -------------------------------------------------------------------------------------------------------------------- + * \par Copyright + * \verbatim + * Copyright (c) 2025 by Vector Informatik GmbH. All rights reserved. + * + * This software is copyright protected and proprietary to Vector Informatik GmbH. + * Vector Informatik GmbH grants to you only those rights as set out in the license conditions. + * All other rights remain with Vector Informatik GmbH. + * \endverbatim + */ +/**********************************************************************************************************************/ + +/*********************************************************************************************************************** + * REVISION HISTORY + * -------------------------------------------------------------------------------------------------------------------- + * Version Date Author Change Id Description + * -------------------------------------------------------------------------------------------------------------------- + * 01.00.00 2020-01-07 visrie FBL-524 Initial release + * 01.00.01 2020-04-27 visrie FBL-1773 No changes + * 02.00.00 2020-05-19 vistbe FBL-1016 No changes + * 02.01.00 2021-01-19 visrie FBL-2648 No changes + * FBL-2641 No changes + * 02.02.00 2021-09-03 visjdn FBL-3352 No changes + * 02.03.00 2023-06-21 vistbe FBL-4814 Add support for OTA + * 02.03.01 2024-05-16 viswmo ESCAN00117059 No changes + * 02.04.00 2024-11-18 vismix FBL-9654 No changes + * 02.05.00 2025-01-30 vikatya PIO-1340 No changes + * 02.06.00 2025-02-19 visrie FBL-10209 No changes + **********************************************************************************************************************/ + +#ifndef FBL_SECBOOT_AP_H +#define FBL_SECBOOT_AP_H + +/*********************************************************************************************************************** +* INCLUDES +**********************************************************************************************************************/ + +#include "bm_types.h" +#include "fbl_secboot.h" + +/*********************************************************************************************************************** + * FUNCTION PROTOTYPES + **********************************************************************************************************************/ +#define FBLSB_START_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +void ApplFblSbStartup(void); +#if defined( FBLBM_ENABLE_SECBOOT_FBL_INIT_MAC ) +# if defined( FBLBM_INSTANCE_BOOTMANAGER ) +tFblResult ApplFblSbIsInitialStartup(void); +# endif +void ApplFblSbClrInitialStartup(void); +#endif +tFblResult ApplFblSbGetSignatureInfo(const V_MEMRAM1 tFblBmHdrHeader V_MEMRAM2 V_MEMRAM3 * bmHdrHeader, vuint32 macId, + V_MEMRAM1 vuint32 V_MEMRAM2 V_MEMRAM3 * signatureAddress, + V_MEMRAM1 vuint32 V_MEMRAM2 V_MEMRAM3 * signatureLength); + +#define FBLSB_STOP_SEC_CODE +#include "MemMap.h" /* PRQA S 5087 */ /* MD_MSR_MemMap */ + +#endif /* FBL_SECBOOT_AP_H */ + +/*********************************************************************************************************************** + * END OF FILE: FBL_SECBOOT_AP.H + **********************************************************************************************************************/ diff --git a/b.bat b/b.bat new file mode 100644 index 0000000..a28450c --- /dev/null +++ b/b.bat @@ -0,0 +1,2 @@ +@echo off +call j.bat rebuild %* diff --git a/config/Davinci/Config/AUTOSAR/MemMap_SwAddrMethods.arxml b/config/Davinci/Config/AUTOSAR/MemMap_SwAddrMethods.arxml new file mode 100644 index 0000000..00f5dba --- /dev/null +++ b/config/Davinci/Config/AUTOSAR/MemMap_SwAddrMethods.arxml @@ -0,0 +1,2151 @@ + + + + + + MICROSAR_MemMap + + + SwAddrMethods + + + + + CALLOUT_CODE + CODE + + + CALLOUT_CODE_QM + + + + CODE + + + CALLOUT_CODE_ASIL_A + + + + CODE + + + CALLOUT_CODE_ASIL_B + + + + CODE + + + CALLOUT_CODE_ASIL_C + + + + CODE + + + CALLOUT_CODE_ASIL_D + + + + CODE + + + CODE + CODE + + + CODE_QM + + + + CODE + + + CODE_ASIL_A + + + + CODE + + + CODE_ASIL_B + + + + CODE + + + CODE_ASIL_C + + + + CODE + + + CODE_ASIL_D + + + + CODE + + + CODE_FAST + CODE + + + CODE_FAST_QM + + + + CODE + + + CODE_FAST_ASIL_A + + + + CODE + + + CODE_FAST_ASIL_B + + + + CODE + + + CODE_FAST_ASIL_C + + + + CODE + + + CODE_FAST_ASIL_D + + + + CODE + + + CODE_ISR + CODE + + + CODE_ISR_QM + + + + CODE + + + CODE_ISR_ASIL_A + + + + CODE + + + CODE_ISR_ASIL_B + + + + CODE + + + CODE_ISR_ASIL_C + + + + CODE + + + CODE_ISR_ASIL_D + + + + CODE + + + CODE_SLOW + CODE + + + CODE_SLOW_QM + + + + CODE + + + CODE_SLOW_ASIL_A + + + + CODE + + + CODE_SLOW_ASIL_B + + + + CODE + + + CODE_SLOW_ASIL_C + + + + CODE + + + CODE_SLOW_ASIL_D + + + + CODE + + + + CONFIG_DATA_PREBUILD + + + + CONFIG-DATA + + + CONFIG_DATA_PREBUILD_QM + + + + + CONFIG-DATA + + + CONFIG_DATA_PREBUILD_ASIL_A + + + + + CONFIG-DATA + + + CONFIG_DATA_PREBUILD_ASIL_B + + + + + CONFIG-DATA + + + CONFIG_DATA_PREBUILD_ASIL_C + + + + + CONFIG-DATA + + + CONFIG_DATA_PREBUILD_ASIL_D + + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD_QM + + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD_ASIL_A + + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD_ASIL_B + + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD_ASIL_C + + + + + CONFIG-DATA + + + CONFIG_DATA_POSTBUILD_ASIL_D + + + + + CONFIG-DATA + + + + CONST + CONST + + + CONST_QM + + + + CONST + + + CONST_ASIL_A + + + + CONST + + + CONST_ASIL_B + + + + CONST + + + CONST_ASIL_C + + + + CONST + + + CONST_ASIL_D + + + + CONST + + + CONST_SAVED_RECOVERY_ZONE + CONST + + + CONST_SAVED_RECOVERY_ZONE_QM + + + + CONST + + + CONST_SAVED_RECOVERY_ZONE_ASIL_A + + + + CONST + + + CONST_SAVED_RECOVERY_ZONE_ASIL_B + + + + CONST + + + CONST_SAVED_RECOVERY_ZONE_ASIL_C + + + + CONST + + + CONST_SAVED_RECOVERY_ZONE_ASIL_D + + + + CONST + + + + CONST_FAST + CONST + + + CONST_FAST_QM + + + + CONST + + + CONST_FAST_ASIL_A + + + + CONST + + + CONST_FAST_ASIL_B + + + + CONST + + + CONST_FAST_ASIL_C + + + + CONST + + + CONST_FAST_ASIL_D + + + + CONST + + + + + VAR_INIT + VAR + + + VAR_INIT_QM + + + + VAR + + + VAR_INIT_ASIL_A + + + + VAR + + + VAR_INIT_ASIL_B + + + + VAR + + + VAR_INIT_ASIL_C + + + + VAR + + + VAR_INIT_ASIL_D + + + + VAR + + + + VAR_NO_INIT + NO-INIT + VAR + + + VAR_NO_INIT_QM + + + + NO-INIT + VAR + + + VAR_NO_INIT_ASIL_A + + + + NO-INIT + VAR + + + VAR_NO_INIT_ASIL_B + + + + NO-INIT + VAR + + + VAR_NO_INIT_ASIL_C + + + + NO-INIT + VAR + + + VAR_NO_INIT_ASIL_D + + + + NO-INIT + VAR + + + + VAR_CLEARED + CLEARED + VAR + + + VAR_CLEARED_QM + + + + CLEARED + VAR + + + VAR_CLEARED_ASIL_A + + + + CLEARED + VAR + + + VAR_CLEARED_ASIL_B + + + + CLEARED + VAR + + + VAR_CLEARED_ASIL_C + + + + CLEARED + VAR + + + VAR_CLEARED_ASIL_D + + + + CLEARED + VAR + + + + VAR_POWER_ON_INIT + POWER-ON-INIT + VAR + + + VAR_POWER_ON_INIT_QM + + + + POWER-ON-INIT + VAR + + + VAR_POWER_ON_INIT_ASIL_A + + + + POWER-ON-INIT + VAR + + + VAR_POWER_ON_INIT_ASIL_B + + + + POWER-ON-INIT + VAR + + + VAR_POWER_ON_INIT_ASIL_C + + + + POWER-ON-INIT + VAR + + + VAR_POWER_ON_INIT_ASIL_D + + + + POWER-ON-INIT + VAR + + + + VAR_POWER_ON_CLEARED + POWER-ON-CLEARED + VAR + + + VAR_POWER_ON_CLEARED_QM + + + + POWER-ON-CLEARED + VAR + + + VAR_POWER_ON_CLEARED_ASIL_A + + + + POWER-ON-CLEARED + VAR + + + VAR_POWER_ON_CLEARED_ASIL_B + + + + POWER-ON-CLEARED + VAR + + + VAR_POWER_ON_CLEARED_ASIL_C + + + + POWER-ON-CLEARED + VAR + + + VAR_POWER_ON_CLEARED_ASIL_D + + + + POWER-ON-CLEARED + VAR + + + + VAR_FAST_INIT + VAR-FAST + + + VAR_FAST_INIT_QM + + + + VAR-FAST + + + VAR_FAST_INIT_ASIL_A + + + + VAR-FAST + + + VAR_FAST_INIT_ASIL_B + + + + VAR-FAST + + + VAR_FAST_INIT_ASIL_C + + + + VAR-FAST + + + VAR_FAST_INIT_ASIL_D + + + + VAR-FAST + + + + VAR_FAST_NO_INIT + NO-INIT + VAR-FAST + + + VAR_FAST_NO_INIT_QM + + + + NO-INIT + VAR-FAST + + + VAR_FAST_NO_INIT_ASIL_A + + + + NO-INIT + VAR-FAST + + + VAR_FAST_NO_INIT_ASIL_B + + + + NO-INIT + VAR-FAST + + + VAR_FAST_NO_INIT_ASIL_C + + + + NO-INIT + VAR-FAST + + + VAR_FAST_NO_INIT_ASIL_D + + + + NO-INIT + VAR-FAST + + + + VAR_FAST_CLEARED + CLEARED + VAR-FAST + + + VAR_FAST_CLEARED_QM + + + + CLEARED + VAR-FAST + + + VAR_FAST_CLEARED_ASIL_A + + + + CLEARED + VAR-FAST + + + VAR_FAST_CLEARED_ASIL_B + + + + CLEARED + VAR-FAST + + + VAR_FAST_CLEARED_ASIL_C + + + + CLEARED + VAR-FAST + + + VAR_FAST_CLEARED_ASIL_D + + + + CLEARED + VAR-FAST + + + + VAR_FAST_POWER_ON_INIT + POWER-ON-INIT + VAR-FAST + + + VAR_FAST_POWER_ON_INIT_QM + + + + POWER-ON-INIT + VAR-FAST + + + VAR_FAST_POWER_ON_INIT_ASIL_A + + + + POWER-ON-INIT + VAR-FAST + + + VAR_FAST_POWER_ON_INIT_ASIL_B + + + + POWER-ON-INIT + VAR-FAST + + + VAR_FAST_POWER_ON_INIT_ASIL_C + + + + POWER-ON-INIT + VAR-FAST + + + VAR_FAST_POWER_ON_INIT_ASIL_D + + + + POWER-ON-INIT + VAR-FAST + + + + VAR_FAST_POWER_ON_CLEARED + POWER-ON-CLEARED + VAR-FAST + + + VAR_FAST_POWER_ON_CLEARED_QM + + + + POWER-ON-CLEARED + VAR-FAST + + + VAR_FAST_POWER_ON_CLEARED_ASIL_A + + + + POWER-ON-CLEARED + VAR-FAST + + + VAR_FAST_POWER_ON_CLEARED_ASIL_B + + + + POWER-ON-CLEARED + VAR-FAST + + + VAR_FAST_POWER_ON_CLEARED_ASIL_C + + + + POWER-ON-CLEARED + VAR-FAST + + + VAR_FAST_POWER_ON_CLEARED_ASIL_D + + + + POWER-ON-CLEARED + VAR-FAST + + + + VAR_SAVED_ZONE + POWER-ON-CLEARED + VAR + + + VAR_SAVED_ZONE_QM + + + + POWER-ON-CLEARED + VAR + + + VAR_SAVED_ZONE_ASIL_A + + + + POWER-ON-CLEARED + VAR + + + VAR_SAVED_ZONE_ASIL_B + + + + POWER-ON-CLEARED + VAR + + + VAR_SAVED_ZONE_ASIL_C + + + + POWER-ON-CLEARED + VAR + + + VAR_SAVED_ZONE_ASIL_D + + + + POWER-ON-CLEARED + VAR + + + + VAR_SLOW_INIT + INIT + VAR + + + VAR_SLOW_INIT_QM + + + + INIT + VAR + + + VAR_SLOW_INIT_ASIL_A + + + + INIT + VAR + + + VAR_SLOW_INIT_ASIL_B + + + + INIT + VAR + + + VAR_SLOW_INIT_ASIL_C + + + + INIT + VAR + + + VAR_SLOW_INIT_ASIL_D + + + + INIT + VAR + + + + VAR_SLOW_NO_INIT + NO-INIT + VAR + + + VAR_SLOW_NO_INIT_QM + + + + NO-INIT + VAR + + + VAR_SLOW_NO_INIT_ASIL_A + + + + NO-INIT + VAR + + + VAR_SLOW_NO_INIT_ASIL_B + + + + NO-INIT + VAR + + + VAR_SLOW_NO_INIT_ASIL_C + + + + NO-INIT + VAR + + + VAR_SLOW_NO_INIT_ASIL_D + + + + NO-INIT + VAR + + + + VAR_SLOW_CLEARED + CLEARED + VAR + + + VAR_SLOW_CLEARED_QM + + + + CLEARED + VAR + + + VAR_SLOW_CLEARED_ASIL_A + + + + CLEARED + VAR + + + VAR_SLOW_CLEARED_ASIL_B + + + + CLEARED + VAR + + + VAR_SLOW_CLEARED_ASIL_C + + + + CLEARED + VAR + + + VAR_SLOW_CLEARED_ASIL_D + + + + CLEARED + VAR + + + + VAR_SLOW_POWER_ON_INIT + POWER-ON-INIT + VAR + + + VAR_SLOW_POWER_ON_INIT_QM + + + + POWER-ON-INIT + VAR + + + VAR_SLOW_POWER_ON_INIT_ASIL_A + + + + POWER-ON-INIT + VAR + + + VAR_SLOW_POWER_ON_INIT_ASIL_B + + + + POWER-ON-INIT + VAR + + + VAR_SLOW_POWER_ON_INIT_ASIL_C + + + + POWER-ON-INIT + VAR + + + VAR_SLOW_POWER_ON_INIT_ASIL_D + + + + POWER-ON-INIT + VAR + + + + VAR_SLOW_POWER_ON_CLEARED + POWER-ON-CLEARED + VAR + + + VAR_SLOW_POWER_ON_CLEARED_QM + + + + POWER-ON-CLEARED + VAR + + + VAR_SLOW_POWER_ON_CLEARED_ASIL_A + + + + POWER-ON-CLEARED + VAR + + + VAR_SLOW_POWER_ON_CLEARED_ASIL_B + + + + POWER-ON-CLEARED + VAR + + + VAR_SLOW_POWER_ON_CLEARED_ASIL_C + + + + POWER-ON-CLEARED + VAR + + + VAR_SLOW_POWER_ON_CLEARED_ASIL_D + + + + POWER-ON-CLEARED + VAR + + + + INTERNAL_VAR_INIT + INIT + VAR + + + INTERNAL_VAR_INIT_QM + + + + INIT + VAR + + + INTERNAL_VAR_INIT_ASIL_A + + + + INIT + VAR + + + INTERNAL_VAR_INIT_ASIL_B + + + + INIT + VAR + + + INTERNAL_VAR_INIT_ASIL_C + + + + INIT + VAR + + + INTERNAL_VAR_INIT_ASIL_D + + + + INIT + VAR + + + + INTERNAL_VAR_NO_INIT + NO-INIT + VAR + + + INTERNAL_VAR_NO_INIT_QM + + + + NO-INIT + VAR + + + INTERNAL_VAR_NO_INIT_ASIL_A + + + + NO-INIT + VAR + + + INTERNAL_VAR_NO_INIT_ASIL_B + + + + NO-INIT + VAR + + + INTERNAL_VAR_NO_INIT_ASIL_C + + + + NO-INIT + VAR + + + INTERNAL_VAR_NO_INIT_ASIL_D + + + + NO-INIT + VAR + + + + INTERNAL_VAR_CLEARED + CLEARED + VAR + + + INTERNAL_VAR_CLEARED_QM + + + + CLEARED + VAR + + + INTERNAL_VAR_CLEARED_ASIL_A + + + + CLEARED + VAR + + + INTERNAL_VAR_CLEARED_ASIL_B + + + + CLEARED + VAR + + + INTERNAL_VAR_CLEARED_ASIL_C + + + + CLEARED + VAR + + + INTERNAL_VAR_CLEARED_ASIL_D + + + + CLEARED + VAR + + + + INTERNAL_VAR_POWER_ON_INIT + POWER-ON-INIT + VAR + + + INTERNAL_VAR_POWER_ON_INIT_QM + + + + POWER-ON-INIT + VAR + + + INTERNAL_VAR_POWER_ON_INIT_ASIL_A + + + + POWER-ON-INIT + VAR + + + INTERNAL_VAR_POWER_ON_INIT_ASIL_B + + + + POWER-ON-INIT + VAR + + + INTERNAL_VAR_POWER_ON_INIT_ASIL_C + + + + POWER-ON-INIT + VAR + + + INTERNAL_VAR_POWER_ON_INIT_ASIL_D + + + + POWER-ON-INIT + VAR + + + + INTERNAL_VAR_POWER_ON_CLEARED + POWER-ON-CLEARED + VAR + + + INTERNAL_VAR_POWER_ON_CLEARED_QM + + + + POWER-ON-CLEARED + VAR + + + INTERNAL_VAR_POWER_ON_CLEARED_ASIL_A + + + + POWER-ON-CLEARED + VAR + + + INTERNAL_VAR_POWER_ON_CLEARED_ASIL_B + + + + POWER-ON-CLEARED + VAR + + + INTERNAL_VAR_POWER_ON_CLEARED_ASIL_C + + + + POWER-ON-CLEARED + VAR + + + INTERNAL_VAR_POWER_ON_CLEARED_ASIL_D + + + + POWER-ON-CLEARED + VAR + + + + CALIB + CALPRM + + + CALIB_QM + + + + CALPRM + + + CALIB_ASIL_A + + + + CALPRM + + + CALIB_ASIL_B + + + + CALPRM + + + CALIB_ASIL_C + + + + CALPRM + + + CALIB_ASIL_D + + + + CALPRM + + + + + + + CONST_BOOLEAN + CONST + + + + CONST_8 + CONST + + + + CONST_16 + CONST + + + + CONST_32 + CONST + + + + CONST_64 + CONST + + + + CONST_UNSPECIFIED + CONST + + + + + CONST_FAST_BOOLEAN + CONST + + + + CONST_FAST_8 + CONST + + + + CONST_FAST_16 + CONST + + + + CONST_FAST_32 + CONST + + + + CONST_FAST_64 + CONST + + + + CONST_FAST_UNSPECIFIED + CONST + + + + CONST_PBCFG + CONST + + + + PBCFG_GLOBALROOT + CONST + + + + CONFIG_DATA + CONFIG-DATA + + + + + VAR_PBCFG + VAR + + + + + VAR_SLOW + INIT + VAR + + + + INTERNAL_VAR + INIT + VAR + + + + VAR_INIT_BOOLEAN + VAR + + + + VAR_INIT_8 + VAR + + + + VAR_INIT_16 + VAR + + + + VAR_INIT_32 + VAR + + + + VAR_INIT_64 + VAR + + + + VAR_INIT_UNSPECIFIED + VAR + + + + + VAR_NO_INIT_BOOLEAN + NO-INIT + VAR + + + + VAR_NO_INIT_8 + NO-INIT + VAR + + + + VAR_NO_INIT_16 + NO-INIT + VAR + + + + VAR_NO_INIT_32 + NO-INIT + VAR + + + + VAR_NO_INIT_64 + NO-INIT + VAR + + + + VAR_NO_INIT_UNSPECIFIED + NO-INIT + VAR + + + + + VAR_NOINIT_BOOLEAN + NO-INIT + VAR + + + + VAR_NOINIT_8 + NO-INIT + VAR + + + + VAR_NOINIT_16 + NO-INIT + VAR + + + + VAR_NOINIT_32 + NO-INIT + VAR + + + + VAR_NOINIT_64 + NO-INIT + VAR + + + + VAR_NOINIT_UNSPECIFIED + NO-INIT + VAR + + + + + VAR_CLEARED_BOOLEAN + CLEARED + VAR + + + + VAR_CLEARED_8 + CLEARED + VAR + + + + VAR_CLEARED_16 + CLEARED + VAR + + + + VAR_CLEARED_32 + CLEARED + VAR + + + + VAR_CLEARED_64 + CLEARED + VAR + + + + VAR_CLEARED_UNSPECIFIED + CLEARED + VAR + + + + + VAR_ZERO_INIT + CLEARED + VAR + + + + VAR_ZERO_INIT_BOOLEAN + CLEARED + VAR + + + + VAR_ZERO_INIT_8 + CLEARED + VAR + + + + VAR_ZERO_INIT_16 + CLEARED + VAR + + + + VAR_ZERO_INIT_32 + CLEARED + VAR + + + + VAR_ZERO_INIT_64 + CLEARED + VAR + + + + VAR_ZERO_INIT_UNSPECIFIED + CLEARED + VAR + + + + + VAR_FAST_INIT_BOOLEAN + VAR-FAST + + + + VAR_FAST_INIT_8 + VAR-FAST + + + + VAR_FAST_INIT_16 + VAR-FAST + + + + VAR_FAST_INIT_32 + VAR-FAST + + + + VAR_FAST_INIT_64 + VAR-FAST + + + + VAR_FAST_INIT_UNSPECIFIED + VAR-FAST + + + + + VAR_FAST_NO_INIT_BOOLEAN + NO-INIT + VAR-FAST + + + + VAR_FAST_NO_INIT_8 + NO-INIT + VAR-FAST + + + + VAR_FAST_NO_INIT_16 + NO-INIT + VAR-FAST + + + + VAR_FAST_NO_INIT_32 + NO-INIT + VAR-FAST + + + + VAR_FAST_NO_INIT_64 + NO-INIT + VAR-FAST + + + + VAR_FAST_NO_INIT_UNSPECIFIED + NO-INIT + VAR-FAST + + + + + VAR_FAST_NOINIT_BOOLEAN + NO-INIT + VAR-FAST + + + + VAR_FAST_NOINIT_8 + NO-INIT + VAR-FAST + + + + VAR_FAST_NOINIT_16 + NO-INIT + VAR-FAST + + + + VAR_FAST_NOINIT_32 + NO-INIT + VAR-FAST + + + + VAR_FAST_NOINIT_64 + NO-INIT + VAR-FAST + + + + VAR_FAST_NOINIT_UNSPECIFIED + NO-INIT + VAR-FAST + + + + + VAR_FAST_CLEARED_BOOLEAN + CLEARED + VAR-FAST + + + + VAR_FAST_CLEARED_8 + CLEARED + VAR-FAST + + + + VAR_FAST_CLEARED_16 + CLEARED + VAR-FAST + + + + VAR_FAST_CLEARED_32 + CLEARED + VAR-FAST + + + + VAR_FAST_CLEARED_64 + CLEARED + VAR-FAST + + + + VAR_FAST_CLEARED_UNSPECIFIED + CLEARED + VAR-FAST + + + + + VAR_FAST_ZERO_INIT_BOOLEAN + CLEARED + VAR-FAST + + + + VAR_FAST_ZERO_INIT_8 + CLEARED + VAR-FAST + + + + VAR_FAST_ZERO_INIT_16 + CLEARED + VAR-FAST + + + + VAR_FAST_ZERO_INIT_32 + CLEARED + VAR-FAST + + + + VAR_FAST_ZERO_INIT_64 + CLEARED + VAR-FAST + + + + VAR_FAST_ZERO_INIT_UNSPECIFIED + CLEARED + VAR-FAST + + + + + VAR_NOCACHE_INIT_BOOLEAN + VAR + + + + VAR_NOCACHE_INIT_8 + VAR + + + + VAR_NOCACHE_INIT_16 + VAR + + + + VAR_NOCACHE_INIT_32 + VAR + + + + VAR_NOCACHE_INIT_64 + VAR + + + + VAR_NOCACHE_INIT_UNSPECIFIED + VAR + + + + + VAR_NOCACHE_NO_INIT_BOOLEAN + NO-INIT + VAR + + + + VAR_NOCACHE_NO_INIT_8 + NO-INIT + VAR + + + + VAR_NOCACHE_NO_INIT_16 + NO-INIT + VAR + + + + VAR_NOCACHE_NO_INIT_32 + NO-INIT + VAR + + + + VAR_NOCACHE_NO_INIT_64 + NO-INIT + VAR + + + + VAR_NOCACHE_NO_INIT_UNSPECIFIED + NO-INIT + VAR + + + + + VAR_NOCACHE_NOINIT_BOOLEAN + NO-INIT + VAR + + + + VAR_NOCACHE_NOINIT_8 + NO-INIT + VAR + + + + VAR_NOCACHE_NOINIT_16 + NO-INIT + VAR + + + + VAR_NOCACHE_NOINIT_32 + NO-INIT + VAR + + + + VAR_NOCACHE_NOINIT_64 + NO-INIT + VAR + + + + VAR_NOCACHE_NOINIT_UNSPECIFIED + NO-INIT + VAR + + + + + VAR_NOCACHE_CLEARED_BOOLEAN + CLEARED + VAR + + + + VAR_NOCACHE_CLEARED_8 + CLEARED + VAR + + + + VAR_NOCACHE_CLEARED_16 + CLEARED + VAR + + + + VAR_NOCACHE_CLEARED_32 + CLEARED + VAR + + + + VAR_NOCACHE_CLEARED_64 + CLEARED + VAR + + + + VAR_NOCACHE_CLEARED_UNSPECIFIED + CLEARED + VAR + + + + + VAR_NOCACHE_ZERO_INIT_BOOLEAN + CLEARED + VAR + + + + VAR_NOCACHE_ZERO_INIT_8 + CLEARED + VAR + + + + VAR_NOCACHE_ZERO_INIT_16 + CLEARED + VAR + + + + VAR_NOCACHE_ZERO_INIT_32 + CLEARED + VAR + + + + VAR_NOCACHE_ZERO_INIT_64 + CLEARED + VAR + + + + VAR_NOCACHE_ZERO_INIT_UNSPECIFIED + CLEARED + VAR + + + + + VAR_SAVED_ZONE_BOOLEAN + POWER-ON-CLEARED + VAR + + + + VAR_SAVED_ZONE_8 + POWER-ON-CLEARED + VAR + + + + VAR_SAVED_ZONE_16 + POWER-ON-CLEARED + VAR + + + + VAR_SAVED_ZONE_32 + POWER-ON-CLEARED + VAR + + + + VAR_SAVED_ZONE_64 + POWER-ON-CLEARED + VAR + + + + VAR_SAVED_ZONE_UNSPECIFIED + POWER-ON-CLEARED + VAR + + + + + VAR_NOCACHE_INIT + VAR + + + + + VAR_NOCACHE_NO_INIT + NO-INIT + VAR + + + + + VAR_NOCACHE_CLEARED + CLEARED + VAR + + + + + + + diff --git a/config/Davinci/Config/AUTOSAR/PlatformTypes_AR4.arxml b/config/Davinci/Config/AUTOSAR/PlatformTypes_AR4.arxml new file mode 100644 index 0000000..40d9a67 --- /dev/null +++ b/config/Davinci/Config/AUTOSAR/PlatformTypes_AR4.arxml @@ -0,0 +1,843 @@ + + + + + AUTOSAR_Platform + + + BaseTypes + + + dtRef_const_VOID + FIXED_LENGTH + 32 + VOID + void + + + dtRef_VOID + FIXED_LENGTH + 32 + VOID + void + + + boolean + FIXED_LENGTH + 8 + BOOLEAN + boolean + + + float32 + FIXED_LENGTH + 32 + IEEE754 + float32 + + + float64 + FIXED_LENGTH + 64 + IEEE754 + float64 + + + sint16 + FIXED_LENGTH + 16 + 2C + sint16 + + + sint16_least + FIXED_LENGTH + 64 + 2C + sint16_least + + + sint32 + FIXED_LENGTH + 32 + 2C + sint32 + + + sint32_least + FIXED_LENGTH + 64 + 2C + sint32_least + + + sint64 + FIXED_LENGTH + 64 + 2C + sint64 + + + sint8 + FIXED_LENGTH + 8 + 2C + sint8 + + + sint8_least + FIXED_LENGTH + 64 + 2C + sint8_least + + + uint16 + FIXED_LENGTH + 16 + NONE + uint16 + + + uint16_least + FIXED_LENGTH + 64 + NONE + uint16_least + + + uint32 + FIXED_LENGTH + 32 + NONE + uint32 + + + uint32_least + FIXED_LENGTH + 64 + NONE + uint32_least + + + uint64 + FIXED_LENGTH + 64 + NONE + uint64 + + + uint8 + FIXED_LENGTH + 8 + NONE + uint8 + + + uint8_least + FIXED_LENGTH + 64 + NONE + uint8_least + + + void + VOID + void + + + + + CompuMethods + + + boolean_CompuMethod + TEXTTABLE + + + + FALSE + 0 + 0 + + FALSE + + + + TRUE + 1 + 1 + + TRUE + + + + + + + + + DataConstrs + + + boolean_DataConstr + + + + 0 + 1 + + + + + + float32_DataConstr + + + + -INF + INF + + + + + + float64_DataConstr + + + + -INF + INF + + + + + + sint16_DataConstr + + + + -32768 + 32767 + + + + + + sint16_least_DataConstr + + + + -32768 + 32767 + + + + + + sint32_DataConstr + + + + -2147483648 + 2147483647 + + + + + + sint32_least_DataConstr + + + + -2147483648 + 2147483647 + + + + + + sint64_DataConstr + + + + -9223372036854775808 + 9223372036854775807 + + + + + + sint8_DataConstr + + + + -128 + 127 + + + + + + sint8_least_DataConstr + + + + -128 + 127 + + + + + + uint16_DataConstr + + + + 0 + 65535 + + + + + + uint16_least_DataConstr + + + + 0 + 65535 + + + + + + uint32_DataConstr + + + + 0 + 4294967295 + + + + + + uint32_least_DataConstr + + + + 0 + 4294967295 + + + + + + uint64_DataConstr + + + + 0 + 18446744073709551615 + + + + + + uint8_DataConstr + + + + 0 + 255 + + + + + + uint8_least_DataConstr + + + + 0 + 255 + + + + + + + + ImplementationDataTypes + + + dtRef_const_VOID + DATA_REFERENCE + + + + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/dtRef_const_VOID + CONST + + + + + + + + + + dtRef_VOID + DATA_REFERENCE + + + + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/dtRef_VOID + + + + + + + + + + boolean + + boolean has the value space required to support the mathematical concept of +binary-valued logic: {true, false}. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/boolean + NOT-ACCESSIBLE + /AUTOSAR_Platform/CompuMethods/boolean_CompuMethod + /AUTOSAR_Platform/DataConstrs/boolean_DataConstr + + + + Platform_Types.h + + + float32 + + float32 corresponds to the IEEE single-precision 32-bit floating point type +[IEEE 754-1985]. The basic value space of float32 consists of the values +m * 2^e, where m is an integer whose absolute value is less than 2^24, +and e is an integer between -149 and 104, inclusive. In addition to the basic +value space described above, the value space of float32 also contains the +following special values: positive and negative zero, positive and negative +infinity and not-a-number. The order-relation on float32 is: +x < y if y - x is positive. Positive zero is greater than negative zero. +Not-a-number equals itself and is greater than all float values including positive infinity. + +float32 values have a lexical representation consisting of a mantissa followed, +optionally, by the character "E" or "e", followed by an exponent. The exponent +must be an integer. The mantissa must be a decimal number. The representations +for exponent and mantissa must follow the lexical rules for integer and decimal. +If the "E" or "e" and the following exponent are omitted, an exponent value +of 0 is assumed. + +The special values positive and negative zero, positive and negative infinity +and not-a-number have lexical representations 0, -0, INF, -INF and NaN, +respectively. + +For example, -1E4, 1267.43233E12, 12.78e-2, 12 and INF are all legal literals +for float32. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/float32 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/float32_DataConstr + + + + Platform_Types.h + + + float64 + + The float64 datatype corresponds to IEEE float64-precision 64-bit floating point +type [IEEE 754-1985]. The basic value space of float64 consists of the values +m * 2^e, where m is an integer whose absolute value is less than 2^53, and e is + an integer between -1075 and 970, inclusive. In addition to the basic value +space described above, the value space of float64 also contains the following +special values: positive and negative zero, positive and negative infinity +and not-a-number. +The order-relation on float64 is: x < y if y - x is positive. +Positive zero is greater than negative zero. Not-a-number equals itself and +is greater than all float64 values including positive infinity. + +float64 values have a lexical representation consisting of a mantissa followed, +optionally, by the character "E" or "e", followed by an exponent. +The exponent must be an integer. The mantissa must be a decimal number. +The representations for exponent and mantissa must follow the lexical rules +for integer and decimal. If the "E" or "e" and the following exponent are +omitted, an exponent value of 0 is assumed. + +The special values positive and negative zero, positive and negative infinity +and not-a-number have lexical representations 0, -0, INF, -INF and NaN, +respectively. + +For example, -1E4, 1267.43233E12, 12.78e-2, 12 and INF are all +legal literals for float64. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/float64 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/float64_DataConstr + + + + Platform_Types.h + + + sint16 + + SInt16 represents integers with a minimum value of -32768 and a maximum value +of 32767. The order-relation on sint16 is: x < y if y - x is positive. +sint16 has a lexical representation consisting of an optional sign followed +by a finite-length sequence of decimal digits (#x30-#x39). If the sign is +omitted, "+" is assumed. + +For example: -1, 0, -12678, +10000, 2500 + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint16 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint16_DataConstr + + + + Platform_Types.h + + + sint16_least + + sint16_least represents a signed integer with values defined by at least 16 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint16_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint16_least_DataConstr + + + + Platform_Types.h + + + sint32 + + sint32 represents integers with a minimum value of -2147483648 and a maximum +value of 2147483647. The order-relation on sint32 is: x < y if y - x is +positive. sint32 has a lexical representation consisting of an optional sign +allowed by a finite-length sequence of decimal digits (#x30-#x39). If the +sign is omitted, "+" is assumed. + +For example: -1, 0, -12688778, +10000, 250098675. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint32 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint32_DataConstr + + + + Platform_Types.h + + + sint32_least + + sint32_least represents a signed integer with values defined by at least 32 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint32_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint32_least_DataConstr + + + + Platform_Types.h + + + sint64 + + sint64 represents integers with a minimum value of -9223372036854775808 and a maximum +value of 9223372036854775807. The order-relation on sint64 is: x < y if y - x is +positive. sint64 has a lexical representation consisting of an optional sign +allowed by a finite-length sequence of decimal digits (#x30-#x39). If the +sign is omitted, "+" is assumed. + +For example: -1, 0, -12688778, +10000, 250098675. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint64 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint64_DataConstr + + + + Platform_Types.h + + + sint8 + + sint8 represents integers with a minimum value of -128 and a maximum value of 127. +The order-relation on sint8 is: x < y if y - x is positive. +sint8 has a lexical representation consisting of an optional sign followed +by a finite-length sequence of decimal digits (#x30-#x39). If the sign is +omitted, "+" is assumed. + +For example: -1, 0, 12678, +10000. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint8 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint8_DataConstr + + + + Platform_Types.h + + + sint8_least + + sint8_least represents a signed integer with values defined by at least 8 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/sint8_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/sint8_least_DataConstr + + + + Platform_Types.h + + + uint16 + + uint16 represents integers with a minimum value of 0 and a maximum value of 65535. +The order-relation on uint16 is: x < y if y - x is positive. +uint16 has a lexical representation consisting of a finite-length sequence +of decimal digits (#x30-#x39). + +For example: 1, 0, 1267, +10000. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint16 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint16_DataConstr + + + + Platform_Types.h + + + uint16_least + + uint16_least represents an unsigned integer with values defined by at least 16 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint16_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint16_least_DataConstr + + + + Platform_Types.h + + + uint32 + + uint32 represents integers with a minimum value of 0 and a maximum value +of 4294967295. The order-relation on uint32 is: x < y if y - x is positive. +uint32 has a lexical representation consisting of a finite-length sequence +of decimal digits (#x30-#x39). + +For example: 1, 0, 12234567, 104400. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint32 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint32_DataConstr + + + + Platform_Types.h + + + uint32_least + + uint32_least represents an unsigned integer with values defined by at least 32 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint32_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint32_least_DataConstr + + + + Platform_Types.h + + + uint64 + + uint64 represents integers with a minimum value of 0 and a maximum value +of 18446744073709551615. The order-relation on uint64 is: x < y if y - x is positive. +uint64 has a lexical representation consisting of a finite-length sequence +of decimal digits (#x30-#x39). + +For example: 1, 0, 12234567, 104400. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint64 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint64_DataConstr + + + + Platform_Types.h + + + uint8 + + uint8 represents integers with a minimum value of 0 and a maximum value of 255. +The order-relation on uint8 is: x < y if y - x is positive. +uint8 has a lexical representation consisting of a finite-length sequence +of decimal digits (#x30-#x39). + +For example: 1, 0, 126, +10. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint8 + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint8_DataConstr + + + + Platform_Types.h + + + uint8_least + + uint8_least represents an unsigned integer with values defined by at least 8 bit. + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/uint8_least + NOT-ACCESSIBLE + /AUTOSAR_Platform/DataConstrs/uint8_least_DataConstr + + + + Platform_Types.h + + + VoidPtr + DATA_REFERENCE + + + + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/void + + + + + + + + Platform_Types.h + + + ConstVoidPtr + DATA_REFERENCE + + + + + VALUE + + + + /AUTOSAR_Platform/BaseTypes/void + CONST + + + + + + + + Platform_Types.h + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.Initial.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.Initial.arxml new file mode 100644 index 0000000..ee4910f --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.Initial.arxml @@ -0,0 +1,13 @@ + + + + + InitialEcuC + + + InitialEcuC + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.arxml new file mode 100644 index 0000000..df4aa7d --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM.ecuc.arxml @@ -0,0 +1,66 @@ + + + + + ActiveEcuC + + + ActiveEcuC + + + /ActiveEcuC/MemMap + + + /ActiveEcuC/Csm + + + /ActiveEcuC/FblSb + + + /ActiveEcuC/FblBm + + + /ActiveEcuC/Crypto + + + /ActiveEcuC/vBaseEnv + + + /ActiveEcuC/FblHal + + + /ActiveEcuC/Det + + + /ActiveEcuC/EcuC + + + /ActiveEcuC/Fbl + + + /ActiveEcuC/FblBmHdr + + + /ActiveEcuC/vLinkGen + + + /ActiveEcuC/vBRS + + + /ActiveEcuC/vSet + + + /ActiveEcuC/CryIf + + + /ActiveEcuC/Crypto_001 + + + /ActiveEcuC/FblAsrStubs + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_CryIf_CryIf_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_CryIf_CryIf_ecuc.arxml new file mode 100644 index 0000000..51eeaa1 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_CryIf_CryIf_ecuc.arxml @@ -0,0 +1,183 @@ + + + + + ActiveEcuC + + + CryIf + + + + false + + + + /MICROSAR/CryIf + VARIANT-PRE-COMPILE + /MICROSAR/CryIf_Impl + + + CryIfChannel + /MICROSAR/CryIf/CryIfChannel + + + /MICROSAR/CryIf/CryIfChannel/CryIfChannelId + 0 + + + + + /MICROSAR/CryIf/CryIfChannel/CryIfDriverObjectRef + /ActiveEcuC/Crypto/CryptoDriverObjects/Crypto_30_LibCv + + + + + CryIfCryptoModule + /MICROSAR/CryIf/CryIfCryptoModule + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfCancelJobApiUsesJobType + true + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsKeyElementCopyPartial + false + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsCertificateAPI + true + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsKeyStatusAPI + false + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfSupportsCustomSyncService + false + + + + + /MICROSAR/CryIf/CryIfCryptoModule/CryIfCryptoModuleRef + /ActiveEcuC/Crypto + + + + + CryIfKey_SmhKeyRSA + /MICROSAR/CryIf/CryIfKey + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyId + 2 + + + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyRef + /ActiveEcuC/Crypto/CryptoKeys/SmhKeyRSA + + + + + CryIfKey_Smh_Nist_800_90A + /MICROSAR/CryIf/CryIfKey + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyId + 3 + + + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyRef + /ActiveEcuC/Crypto/CryptoKeys/Smh_CryptoKey_Nist_800_90A + + + + + CryIfKeyDummy + /MICROSAR/CryIf/CryIfKey + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyId + 0 + + + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyRef + /ActiveEcuC/Crypto/CryptoKeys/SmhCryptoKeyDummy + + + + + CryIfChannel_CryptoCv_Fbl_MemDrvCmac + /MICROSAR/CryIf/CryIfChannel + + + /MICROSAR/CryIf/CryIfChannel/CryIfChannelId + 1 + + + + + /MICROSAR/CryIf/CryIfChannel/CryIfDriverObjectRef + /ActiveEcuC/Crypto/CryptoDriverObjects/Crypto_30_LibCv + + + + + CryIfKey_Fbl_MemDrv_Cmac + /MICROSAR/CryIf/CryIfKey + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyId + 1 + + + + + /MICROSAR/CryIf/CryIfKey/CryIfKeyRef + /ActiveEcuC/Crypto/CryptoKeys/CryptoKey_Fbl_MemDrv_Cmac + + + + + CryIfGeneral + /MICROSAR/CryIf/CryIfGeneral + + + /MICROSAR/CryIf/CryIfGeneral/CryIfDevErrorDetect + true + + + /MICROSAR/CryIf/CryIfGeneral/CryIfVersionInfoApi + false + + + /MICROSAR/CryIf/CryIfGeneral/CryIfMaxNumberOfKeyElements + 10 + + + /MICROSAR/CryIf/CryIfGeneral/CryIfMaxSizeOfKeyElement + 32 + + + /MICROSAR/CryIf/CryIfGeneral/CryIfRedirection + false + + + /MICROSAR/CryIf/CryIfGeneral/CryIfSafeBswChecks + true + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_001_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_001_ecuc.arxml new file mode 100644 index 0000000..95117e2 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_001_ecuc.arxml @@ -0,0 +1,242 @@ + + + + + ActiveEcuC + + + Crypto_001 + /MICROSAR/Crypto_30_vHsm/Crypto + VARIANT-PRE-COMPILE + /MICROSAR/Crypto_30_vHsm/Crypto_Impl + + + CryptoGeneral + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoDevErrorDetect + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoVersionInfoApi + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoMainFunctionPeriod + 0.01 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoSafeBswChecks + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoMultiPartitionRuntimeChecks + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoTimeoutCallout + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoGeneral/CryptoTimeoutRecovery + false + + + + + CryptoKeyElements + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements + + + vHsmDummyKeyElement + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + + + + + CryptoKeyTypes + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyTypes + + + vHsmDummyKeyType + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto_001/CryptoKeyElements/vHsmDummyKeyElement + + + + + + + CryptoDriverObjects + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects + + + CryptoDriverObject + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectId + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectQueueSize + 1 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoBufferSize + 128 + + + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoPrimitiveRef + + + + + + + CryptovHsm + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoKeyElementDeleteSupport + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoInterruptMode + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoIpcChannels + 4 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoIpcProtocolVersion + 3 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoRedirection + false + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoIpcMacJobOptimization + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoDetInstanceMask + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoKeyDeriveJobSupport + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoHost2HsmAddress + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoHsm2HostAddress + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoIpcInstanceId + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoIpcInitialization + true + + + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoManagementDriverObject + + + + + CryptoJobResponseInterrupt + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt/CryptoJobResponseInterruptFlagClearAddress + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt/CryptoJobResponseInterruptFlagClearMask + 1 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt/CryptoJobResponseInterruptFlagClearValue + 1 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt/CryptoJobResponseInterruptFlagClearing + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobResponseInterrupt/CryptoJobResponseInterruptFlagClearHandling + CRYPTO_CLEAR_INCLUSIVE_OR_ASSIGNMENT + + + + + CryptoJobRequestInterrupt + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobRequestInterrupt + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobRequestInterrupt/CryptoJobRequestInterruptFlagSetAddress + 0 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobRequestInterrupt/CryptoJobRequestInterruptFlagSetMask + 1 + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobRequestInterrupt/CryptoJobRequestInterruptFlagSetting + true + + + /MICROSAR/Crypto_30_vHsm/Crypto/CryptovHsm/CryptoJobRequestInterrupt/CryptoJobRequestInterruptFlagSetHandling + CRYPTO_SET_INCLUSIVE_OR_ASSIGNMENT + + + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_ecuc.arxml new file mode 100644 index 0000000..b990582 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_Crypto_Crypto_ecuc.arxml @@ -0,0 +1,14788 @@ + + + + + ActiveEcuC + + + Crypto + /MICROSAR/Crypto_30_LibCv/Crypto + VARIANT-PRE-COMPILE + /MICROSAR/Crypto_30_LibCv/Crypto_Impl + + + CryptoKeyElements + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements + + + Crypto_30_LibCv_Signature_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Seed + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_SharedValue + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 9 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Mac_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 13 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_OwnPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Base + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Password + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_IV + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_Proof + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 6 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Mac_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Hash_Result + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerive_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Fips186_Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x00 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_Modulus + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_Pub_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 161 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_Priv_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 162 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 163 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_SaltLength + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 164 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_ANSIP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_PartnerPubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3003 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_NIST80056A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x03 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x04 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_SYM_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ASM_NISTFIPS1864 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x02 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_AdditionalInfo + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 131 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_SCC_Contract_PubKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3013 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3014 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_AdditionalInput + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3016 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Nonce + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3017 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_PrivateString + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3015 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Reseed_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3018 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 0 0 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_PrimeP + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3051 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_PrimeQ + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3052 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_ExponentDp + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3053 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_ExponentDq + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3054 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Rsa_InverseQi + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3055 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x02 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Mac_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_Key_She + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_She_UId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3021 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_She_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 0 0 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3019 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_She_BootProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3056 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_She_DebuggerProtection + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3057 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_SCC_Contract_AAD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 34 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3060 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 130 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Rsa2048_Modulus + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Rsa_Pub_Exponent + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 161 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Rsa_Salt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 163 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Random_PrivateString + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3015 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Random_AdditionalInput + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3016 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Smh_Crypto_30_LibCv_Random_Reseed_Counter + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3018 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 0 0 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Fbl_Decrypt_Aes128_Iv + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Fbl_Decrypt_Aes128_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3058 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x04 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x06 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Mac_Key_She_Ram + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_Key_She_Ram + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ENCRYPTED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Cipher_2NDKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Symmetric_Generic + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Ansi_Nist_Sec_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 14 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x09 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0A + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x07 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Aead_ChaCha_Key + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Aead_ChaCha_Nonce + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 222 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_DENIED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0B + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 14 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_Spake2Plus_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0C + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 6 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_W0 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3084 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_W1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3085 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_L + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3086 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Verification_Result + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3088 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_AdditionalInfo + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 131 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Verification + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3087 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Ed25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3004 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_NISTP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_EcuId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3007 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_NumEcu + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3006 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Intermediate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3005 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0D + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_SECP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x07 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0E + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x0F + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 0x08 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp160r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 40 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp256r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp384r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 96 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp521r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 132 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp160r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp256r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp384r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 48 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EcDsa_SECp521r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 66 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed448_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 57 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_EdDsa_Ed448_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 57 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_EdDsa_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3061 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_P256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 9 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 32 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_Sm2_ID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3092 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3093 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 64 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyGenerate_Algorithm_Sm2P256v1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 17 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Algorithm_NIST800108_CTR_CMAC_AES + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 15 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyDerivation_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3061 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_SlhDsa_Context + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 3062 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyWrap_Aes_PlaintextKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyWrap_Aes_Kek + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 16 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + Crypto_30_LibCv_KeyExchange_Algorithm_P224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementId + 12 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementInitValue + 10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementSize + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementReadAccess + RA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementAllowPartialAccess + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementPersist + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteAccess + WA_ALLOWED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementFormat + CRYPTO_KE_FORMAT_BIN_OCTET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyElements/CryptoKeyElement/CryptoKeyElementWriteOnce + false + + + + + + + CryptoKeyTypes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes + + + Smh_Signature_Rsa2048_Pss_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Rsa2048_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Rsa_Pub_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Rsa_Salt + + + + + Smh_Random_Nist_800_90A_DRBG_AES_NoDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Smh_Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + + + + + CryptoKeyType_Fbl_Decrypt_Aes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Fbl_Decrypt_Aes128_Iv + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Fbl_Decrypt_Aes128_Key + + + + + Cipher + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + + + KeyExchange_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Seed + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + + + Signature + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + + + Mac + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Key + + + + + KeyDerive + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerive_Algorithm + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + + + Random_Fips186_Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Fips186_Sha1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed + + + + + Hash + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Hash_Result + + + + + Signature_Rsa_Pkcs1_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Signature_Rsa_Pkcs1_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Signature_Rsa_Pss_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_SaltLength + + + + + Signature_Rsa_Pss_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Salt + + + + + Signature_Rsa_Pss_Verify_AutoSalt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + KeyExchange_ANSIP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_ANSIP256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyDerive_NIST80056A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_NIST80056A + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_ISO15118_ProvCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + + + KeyDerive_SYM_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_SYM_NIST800108 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + + + KeyDerive_ASM_NISTFIPS1864 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ASM_NISTFIPS1864 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + + + KeyDerive_ISO15118_ContrCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_PubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + + + + + CipherWithoutIv + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key + + + + + CipherShe + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key_She + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Proof + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_She_Counter + + + + + MacShe + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Key_She + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Proof + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_She_Counter + + + + + Random_Nist_800_90A_DRBG_AES_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + Random_Nist_800_90A_DRBG_AES_NoDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + + + Signature_RsaCrt_Pkcs1_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + + + KeyExchange_SECP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + SheInfoKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_She_UId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_She_BootProtection + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_She_DebuggerProtection + + + + + Cipher_Rsa_Oaep_Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Cipher_Rsa_Oaep_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Cipher_RsaCrt_Oaep_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + + + Cipher_Rsa_Pkcs1_Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + Cipher_Rsa_Pkcs1_Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + + + Cipher_Rsa_Oaep_Encrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + Cipher_Rsa_Oaep_Decrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Priv_Exponent + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + Cipher_RsaCrt_Oaep_Decrypt_With_Label + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_PrimeQ + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDp + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_ExponentDq + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_InverseQi + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Label + + + + + KeyExchange_SECP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + Cipher_Rsa_Pkcs1_Decrypt_Pub + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Modulus + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Rsa_Pub_Exponent + + + + + KeyDerive_KDF_X963_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA256 + + + + + CipherSheRam + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Key_She_Ram + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_Proof + + + + + MacSheRam + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Key_She_Ram + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Proof + + + + + MacGmac + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Mac_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Cipher_IV + + + + + KeyGenerate_Symmetric_Generic + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Symmetric_Generic + + + + + KeyGenerate_Ansi_Nist_Sec_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Ansi_Nist_Sec_P256R1 + + + + + KeyGenerate_Nist_Sec_P384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P384R1 + + + + + KeyDerive_PBKDF2_HMAC_SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA1 + + + + + KeyDerive_PBKDF2_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_PBKDF2_HMAC_SHA256 + + + + + KeyDerive_KDF_X963_SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_KDF_X963_SHA512 + + + + + AEAD_ChaCha20_Poly1305 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Aead_ChaCha_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Aead_ChaCha_Nonce + + + + + Random_Nist_800_90A_DRBG_HASH_SHA2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_HASH_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_HASH_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + Random_Nist_800_90A_DRBG_AES256_NoDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + + + Random_Nist_800_90A_DRBG_AES256_DF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Algorithm_Nist_800_90A_DRBG_AES256Df + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Seed_Nist_800_90A_DRBG_AES256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_PrivateString + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_AdditionalInput + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Reseed_Counter + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Random_Nonce + + + + + KeyDerive_HKDF_HMAC_SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_Spake2Plus_P256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_Spake2Plus_P256R1 + + + + + KeyExchange_Spake2Plus_A_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_B_Suite8_1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_L + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_A_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyExchange_Spake2Plus_B_Suite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_Spake2Plus_Suite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_W0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_L + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification_Result + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Verification + + + + + KeyGenerate_ED25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Ed25519 + + + + + KeyExchange_NISTP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_NISTP224R1_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_NumEcu + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_EcuId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Intermediate + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + + + + + KeyDerive_Hkdf_Option1_Sha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA256 + + + + + KeyExchange_SECP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_SECP521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + KeyDerive_HKDF_HMAC_SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Salt + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Iterations_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_HMAC_SHA384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + + + KeyDerive_Hkdf_Option1_Sha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_AdditionalInfo + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_HKDF_Option1_SHA512 + + + + + KeyDerive_ISO15118_20_ProvCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + + + KeyDerive_ISO15118_20_ContrCert + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_ISO15118_20 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_PubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SCC_IV_And_Encrypted_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SCC_Contract_AAD + + + + + KeyExchange_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_X448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + Signature_EcDsa_SECp160r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp160r1_public + + + + + Signature_EcDsa_SECp256r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp256r1_public + + + + + Signature_EcDsa_SECp384r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp384r1_public + + + + + Signature_EcDsa_SECp521r1_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp521r1_public + + + + + Signature_EdDsa_Ed25519_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + + + + + Signature_EcDsa_SECp160r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp160r1_private + + + + + Signature_EcDsa_SECp256r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp256r1_private + + + + + Signature_EcDsa_SECp384r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp384r1_private + + + + + Signature_EcDsa_SECp521r1_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EcDsa_SECp521r1_private + + + + + Signature_EdDsa_Ed25519_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + + + + + Signature_EdDsa_Ed448_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_public + + + + + Signature_EdDsa_Ed448_private + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_private + + + + + Signature_EdDsa_Ed448_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed448_private_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed448_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed25519_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + Signature_EdDsa_Ed25519_private_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_EdDsa_Ed25519_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_EdDsa_Context + + + + + KeyExchange_P256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_P256R1_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_NumEcu + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_EcuId + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Intermediate + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PartnerPubKey_2 + + + + + KeyGenerate_Nist_Sec_P521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Nist_Sec_P521R1 + + + + + Signature_SlhDsaSha2_128s_public + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + + + + + Signature_Sm2_P256Sm2_Generate_withoutID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + + + + + Signature_Sm2_P256Sm2_Verify_withoutID + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + + + + + Signature_Sm2_P256Sm2_Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_P256Sm2_private + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Generate_P256Sm2_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_ID + + + + + Signature_Sm2_P256Sm2_Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2Verify_P256Sm2_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_Sm2_ID + + + + + KeyGenerate_Sm2P256V1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Key + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyGenerate_Algorithm_Sm2P256v1 + + + + + KeyDerive_NIST800108_CTR_CMAC_AES + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Algorithm_NIST800108_CTR_CMAC_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Context + + + + + KeyDerive_NIST800108_CTR + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Password + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Label + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyDerivation_Context + + + + + Signature_SlhDsaSha2_128s_public_ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_Signature_SlhDsaSha2_128s_public + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_SlhDsa_Context + + + + + KeyWrap_Aes_PlaintextKey + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyWrap_Aes_PlaintextKey + + + + + KeyWrap_Aes_Kek + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyWrap_Aes_Kek + + + + + KeyExchange_P224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_Algorithm_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_OwnPubKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_PrivKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeyTypes/CryptoKeyType/CryptoKeyElementRef + /ActiveEcuC/Crypto/CryptoKeyElements/Crypto_30_LibCv_KeyExchange_SharedValue + + + + + + + CryptoDriverObjects + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects + + + Crypto_30_LibCv + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectId + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoDriverObjectQueueSize + 1 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoPrimitiveRef + /ActiveEcuC/Crypto/CryptoPrimitives/RsaPssSha256Verify + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoPrimitiveRef + /ActiveEcuC/Crypto/CryptoPrimitives/SHA256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoPrimitiveRef + /ActiveEcuC/Crypto/CryptoPrimitives/RngDrbgAes128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoDriverObjects/CryptoDriverObject/CryptoPrimitiveRef + /ActiveEcuC/Crypto/CryptoPrimitives/AesCmacGenerate + + + + + + + CryptoGeneral + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoUseVStdLib + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoWatchdogTriggerFunction + FblLookForWatchdogVoid + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoVersionInfoApi + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoMainFunctionPeriod + 0.01 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoDevErrorDetect + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoSafeBswChecks + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoKeyElementDelete + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoAlignKeyStorage + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoNvMEnableSetRamBlockStatus + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoRedirection + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoDefaultRandomMaxRetries + 10 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoNumberOfLongTermPrimitiveWorkspace + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoStrictLengthCheckForKeyElementGet + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoEnableKeyLocking + true + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoMultiPartitionRuntimeChecks + false + + + + + CryptoKeyExchangePrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoKeyExchangePrimitives + + + CryptoKeyDerivePrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoKeyDerivePrimitives + + + CryptoMacPrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoMacPrimitives + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoMacPrimitives/CryptoCmacAesRoundkeyReuse + false + + + + + CryptoCipherPrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoCipherPrimitives + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoCipherPrimitives/CryptoEnableAES192 + false + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoCipherPrimitives/CryptoEnableAES256 + false + + + + + CryptoKeyGeneratePrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoKeyGeneratePrimitives + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoKeyGeneratePrimitives/CryptoKeyGenerateMaxLength + 32 + + + + + CryptoConfigurableCallouts + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoGeneral/CryptoConfigurableCallouts + + + + + CryptoKeys + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys + + + SmhKeyRSA + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyId + 0 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyDeriveIterations + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyNvId + 0 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyTypeRef + /ActiveEcuC/Crypto/CryptoKeyTypes/Smh_Signature_Rsa2048_Pss_Verify + + + + + Smh_CryptoKey_Nist_800_90A + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyId + 2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyDeriveIterations + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyNvId + 2 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyTypeRef + /ActiveEcuC/Crypto/CryptoKeyTypes/Smh_Random_Nist_800_90A_DRBG_AES_NoDF + + + + + SmhCryptoKeyDummy + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyId + 3 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyDeriveIterations + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyNvId + 3 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyTypeRef + /ActiveEcuC/Crypto/CryptoKeyTypes/Hash + + + + + CryptoKey_Fbl_MemDrv_Cmac + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyId + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyNvId + 7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyDeriveIterations + 1 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyTypeRef + /ActiveEcuC/Crypto/CryptoKeyTypes/CryptoKeyType_Fbl_Decrypt_Aes128 + + + + + CryptoKey_Fbl_Decrypt_Aes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyNvId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyId + 1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyDeriveIterations + 1 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoKeys/CryptoKey/CryptoKeyTypeRef + /ActiveEcuC/Crypto/CryptoKeyTypes/CryptoKeyType_Fbl_Decrypt_Aes128 + + + + + + + CryptoPrimitives + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives + + + AesGCMEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesGCMDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_PKCS7 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_PaddingPKCS7 + + + + + AesDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_PADDING_PKCS7 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_ONEWITHZEROS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_PADDING_PKCS7 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_PaddingPKCS7 + + + + + SHA1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + + + SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + AesCmacGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + AesCmacVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + RngFips186Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_FIPS186 + + + + + EcDsaEd25519Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + EcDsaEd25519Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + SipHashGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SIPHASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_SIPHASH_2_4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SipHashVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SIPHASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_SIPHASH_2_4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RsaPkcs1Sha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPkcs1Sha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPkcs1Sha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPkcs1Sha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPssSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPssSha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RsaPssSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPssSha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + RsaPkcs1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RsaPkcs1Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_PKCS1_v1_5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccNistP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HmacSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha1Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + HmacSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha256Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + EccNistP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + RngFips186 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RNG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RngDrbgAes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_DRBG + + + + + RngDrbgAes128Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + RsaPkcs1CrtSha1Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + + + + + RsaPkcs1CrtSha256Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSASSA_PKCS1_v1_5_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + + + + + EccNistP384R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + + + EccSecP384R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + + + EccNistP384R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + RsaOaepSha1Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + + + RsaOaepSha1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + + + RsaOaepSha256Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + + + RsaOaepSha256Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSAES_OAEP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + + + RsaOaepCrtSha1Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_RSAES_OAEP_CRT + + + + + RsaOaepCrtSha256Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_RSAES_OAEP_CRT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_RSAES_OAEP_CRT + + + + + EccNistP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP384R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + SHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + EccNistP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccAnsiP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccSecP256R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + EccNistP384R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccNistP384R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1GenerateSha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + EccSecP384R1VerifySha384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + GmacAesGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + GmacAesVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_GMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + + + HmacSha384Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha384Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + KeySetValid + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_SET_VALID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDeriveX963SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_KDFX963 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyExchangeCalcPubValX25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_X25519 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_X25519 + + + + + KeyExchangeCalcSecretX25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_X25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_X25519 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_X25519 + + + + + KeyExchangeCalcPubValSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcSecretSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcPubValAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcSecretNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyExchangeCalcPubValNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyExchangeCalcSecretNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + RandomSeedRngFips186Sha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + RandomSeedRngDrbgAes128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RandomSeedRngDrbgAes128Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + KeyDeriveIso15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_ISO15118 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ISO15118 + + + + + KeyDeriveSymNist800108CntModeSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveAsymNistFips1864Erb + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_FIPS186 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveNist80056AOnePassSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateSymmetricGeneric + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyGenerateSecP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateSecP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyGenerateNistP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + KeyGenerateNistP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P384R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + + + KeyGenerateAnsiP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HmacRipemd160Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + HmacRipemd160Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccSecP160R1GenerateWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P160R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + + + EccSecP160R1VerifyWithoutPreHashing + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P160R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + + + HashRipemd160 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RIPEMD160 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDerivePbkdf2HmacSha1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA1 + + + + + KeyDerivePbkdf2HmacSha256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_PBKDF2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + KeyDeriveX963SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_KDFX963 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + AeadChaCha20Poly1305Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_20ROUNDS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CHACHA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_POLY_1305 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_POLY1305 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_POLY1305 + + + + + AeadChaCha20Poly1305Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_20ROUNDS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CHACHA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_POLY_1305 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_POLY1305 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_POLY1305 + + + + + RngHashDrbgSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + RandomSeedRngHashDrbgSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + SHA3_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + RngDrbgAes256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RngDrbgAes256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + RandomSeedRngDrbgAes256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + + + RandomSeedRngDrbgAes256Df + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_RANDOM_SEED + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_USE_DF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_DRBG + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_UseDF + + + + + SheCmdGetId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CMD_GET_ID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_CmdGetId + + + + + AesCCMEncrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_CCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_CCM + + + + + AesCCMDecrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_CCM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_AEADDECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_CCM + + + + + KeyDeriveHkdfHmacSHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + KeyExchangeCalcPubValSpake2PlusCipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_MODE_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_CipherSuite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_Mode1 + + + + + KeyExchangeCalcSecretSpake2PlusCipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_MODE_1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_CIPHER_SUITE_8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_CipherSuite8 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_Mode1 + + + + + KeyDeriveSpake2PlusP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_SPAKE2_PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P256R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SPAKE2PLUS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + + + HashMD5 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_MD5 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_MD5 + + + + + KeyGenerateEd25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + Crypto_30_LibCv_PaddingPKCS7 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 133 + + + + + Crypto_30_LibCv_FIPS186 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 132 + + + + + Crypto_30_LibCv_ECCANSI + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 129 + + + + + Crypto_30_LibCv_ECCSEC + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 130 + + + + + Crypto_30_LibCv_DRBG + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 131 + + + + + Crypto_30_LibCv_X25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 135 + + + + + Crypto_30_LibCv_ISO15118 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 136 + + + + + Crypto_30_LibCv_POLY1305 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 137 + + + + + Crypto_30_LibCv_CmdGetId + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 140 + + + + + Crypto_30_LibCv_HKDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 139 + + + + + Crypto_30_LibCv_SPAKE2PLUS + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 138 + + + + + Crypto_30_LibCv_CipherSuite8 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 157 + + + + + Crypto_30_LibCv_MD5 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 191 + + + + + Crypto_30_LibCv_CCM + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 147 + + + + + Crypto_30_LibCv_Mode1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 150 + + + + + Crypto_30_LibCv_P160r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 146 + + + + + Crypto_30_LibCv_P256r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 128 + + + + + Crypto_30_LibCv_P384r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 131 + + + + + Crypto_30_LibCv_RSAES_OAEP_CRT + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 132 + + + + + Crypto_30_LibCv_RSASSA_PKCS1_v1_5_CRT + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 129 + + + + + Crypto_30_LibCv_UseDF + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 130 + + + + + KeyExchangeCalcPubValNistP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyExchangeCalcSecretNistP224R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P224R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM_BD + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + Crypto_30_LibCv_P224r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 148 + + + + + Crypto_30_LibCv_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 141 + + + + + KeyDeriveHkdfOption1SHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + EccSecP521R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + Crypto_30_LibCv_P521r1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 134 + + + + + EccSecP521R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcSecretSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcPubValSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + SHA3_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_224 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHA3_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHA3_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA3_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHAKE128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHAKE128 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + SHAKE256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHAKE256 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + EccNistP521R1GenerateSha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + EccNistP521R1VerifySha512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcSecretNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyExchangeCalcPubValNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM_P521R1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyDeriveHkdfHmacSHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_HKDF + + + + + KeyDeriveHkdfOption1SHA512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_HKDF + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + KeyDeriveIso15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ISO15118_20 + + + + + Crypto_30_LibCv_ISO15118_20 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 193 + + + + + KeyExchangeCalcPubValX448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_X448 + + + + + KeyExchangeCalcSecretX448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_X448 + + + + + Crypto_30_LibCv_X448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 194 + + + + + Crypto_30_LibCv_ED448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 195 + + + + + Crypto_30_LibCv_EdDsaEd448Pure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 199 + + + + + Crypto_30_LibCv_EdDsaEd448Ph + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 200 + + + + + Crypto_30_LibCv_EdDsaEd25519Pure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 174 + + + + + Crypto_30_LibCv_EdDsaEd25519Ctx + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 175 + + + + + Crypto_30_LibCv_EdDsaEd25519Ph + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 176 + + + + + EdDsaEd448PhGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Ph + + + + + EdDsaEd448PhVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Ph + + + + + EdDsaEd25519PureVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Pure + + + + + EdDsaEd25519PhVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ph + + + + + EdDsaEd25519CtxVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ctx + + + + + EdDsaEd25519PhGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ph + + + + + EdDsaEd25519CtxGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Ctx + + + + + EdDsaEd25519PureGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd25519Pure + + + + + EdDsaEd448PureGenerate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Pure + + + + + EdDsaEd448PureVerify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_EdDsaEd448Pure + + + + + HmacSha512Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_GENERATE + + + + + HmacSha512Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_MAC_VERIFY + + + + + Crypto_30_LibCv_HKDF_Expand + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 197 + + + + + KeyDeriveHkdfExpandHmacSHA256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_HKDF_Expand + + + + + KeyDeriveHkdfExpandHmacSHA384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_HMAC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_HKDF_Expand + + + + + Crypto_30_LibCv_IsPrivateKeyOnCurve + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 198 + + + + + Crypto_30_LibCv_IsPublicKeyOnCurve + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 196 + + + + + IsKeyOnCurveP160R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P160r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP256R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP384R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P384r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveEd25519 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ED25519 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + IsKeyOnCurveEd448 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_ED448 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPrivateKeyOnCurve + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_IsPublicKeyOnCurve + + + + + KeyExchangeCalcPubValP256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyExchangeCalcSecretP256R1_BD + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCANSI + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P256r1 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_BD + + + + + KeyGenerateSecP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + KeyGenerateNistP521R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P521r1 + + + + + SlhDsaSha2_128sVerifyPure + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + Crypto_30_LibCv_SLH_DSA + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 199 + + + + + Crypto_30_LibCv_SHA2_128S + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 201 + + + + + Crypto_30_LibCv_SM4 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 200 + + + + + Sm4Encrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_ENCRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SM4 + + + + + Sm4Decrypt + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_DECRYPT + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CBC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_ECB + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SM4 + + + + + Sm3 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM3 + + + + + Sm2Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + Sm2Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + Crypto_30_LibCv_Sm2P256v1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmModeCustom/CryptoPrimitiveAlgorithmModeCustomId + 202 + + + + + KeyGenerate_SM2_Sm2P256V1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SM2 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_Sm2P256v1 + + + + + RsaPssSha384Generate + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_GENERATE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + RsaPssSha384Verify + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + KeySetInvalid + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYSETINVALID + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + KeyDeriveNist800108CtrModeCmacAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_DERIVE + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CTR + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_NIST800108 + + + + + Crypto_30_LibCv_NIST800108 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitiveAlgorithmFamilyCustom/CryptoPrimitiveAlgorithmFamilyCustomId + 202 + + + + + SHA512_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512_224 + + + + + SHA512_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_512_256 + + + + + SHA224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_HASH + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_224 + + + + + SlhDsaSha2_128sVerifyPhSha2_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha2_512_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_512_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_224 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_224 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_384 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_384 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_512 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_512 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhShake128 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE128 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhShake256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHAKE256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + SlhDsaSha2_128sVerifyPhSha3_256 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_SIGNATURE_VERIFY + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA3_256 + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamilyCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SLH_DSA + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_SHA2_128S + + + + + KeyWrapAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_AESKEYWRAP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYWRAP + + + + + KeyUnwrapAes + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_AESKEYWRAP + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEYUNWRAP + + + + + KeyExchangeCalcPubValP224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_PUBVAL + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + + + KeyExchangeCalcSecretValP224R1 + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveService + CRYPTO_KEY_EXCHANGE_CALC_SECRET + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCNIST + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmFamily + CRYPTO_ALGOFAM_ECCSEC + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmMode + CRYPTO_ALGOMODE_CUSTOM + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoPrimitives/CryptoPrimitive/CryptoPrimitiveAlgorithmModeCustomRef + /ActiveEcuC/Crypto/CryptoPrimitives/Crypto_30_LibCv_P224r1 + + + + + + + CryptoNvStorage + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage/CryptoNvManagementDataPerKey + 4 + + + /MICROSAR/Crypto_30_LibCv/Crypto/CryptoNvStorage/CryptoNvWriteBlockFctName + NvM_WriteBlock + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_Csm_Csm_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_Csm_Csm_ecuc.arxml new file mode 100644 index 0000000..4135edc --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_Csm_Csm_ecuc.arxml @@ -0,0 +1,661 @@ + + + + + ActiveEcuC + + + Csm + + + + false + + + + /MICROSAR/Csm + VARIANT-PRE-COMPILE + /MICROSAR/Csm_Impl + + + CsmJobs + /MICROSAR/Csm/CsmJobs + + + CsmJob_RandomGenerate + /MICROSAR/Csm/CsmJobs/CsmJob + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPriority + 0 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobId + 2 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobUsePort + false + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobInterfaceUsePort + CRYPTO_USE_FNC + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmProcessingMode + CRYPTO_PROCESSING_SYNC + + + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobQueueRef + /ActiveEcuC/Csm/CsmQueues/CsmQueue_Standard + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPrimitiveRef + /ActiveEcuC/Csm/CsmPrimitives_RandomGenerate + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobKeyRef + /ActiveEcuC/Csm/CsmKeys/CsmKey_Smh_Nist_800_90A + + + + + CsmJob_SigAsymVer_RsaPssSha256 + /MICROSAR/Csm/CsmJobs/CsmJob + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPriority + 0 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobId + 3 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobUsePort + false + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobInterfaceUsePort + CRYPTO_USE_FNC + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmProcessingMode + CRYPTO_PROCESSING_SYNC + + + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobQueueRef + /ActiveEcuC/Csm/CsmQueues/CsmQueue_Standard + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPrimitiveRef + /ActiveEcuC/Csm/CsmPrimitives_SigAsymVer_RsaPssSha256 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobKeyRef + /ActiveEcuC/Csm/CsmKeys/CsmKey_SmhKeyRSA + + + + + CsmJob_HashSha256 + /MICROSAR/Csm/CsmJobs/CsmJob + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobId + 0 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPriority + 0 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobUsePort + false + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobInterfaceUsePort + CRYPTO_USE_FNC + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmProcessingMode + CRYPTO_PROCESSING_SYNC + + + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobKeyRef + /ActiveEcuC/Csm/CsmKeys/CsmKey_Smh_HashSha256 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPrimitiveRef + /ActiveEcuC/Csm/CsmPrimitives_HashSha256 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobQueueRef + /ActiveEcuC/Csm/CsmQueues/CsmQueue_Standard + + + + + CsmJob_MacGenerate_MemDrvCmac + /MICROSAR/Csm/CsmJobs/CsmJob + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobId + 1 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPriority + 0 + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmProcessingMode + CRYPTO_PROCESSING_SYNC + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobUsePort + false + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobInterfaceUsePort + CRYPTO_USE_FNC + + + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobKeyRef + /ActiveEcuC/Csm/CsmKeys/CsmKey_Fbl_MemDrv_Cmac + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobPrimitiveRef + /ActiveEcuC/Csm/CsmPrimitives_Cmac_Generate + + + /MICROSAR/Csm/CsmJobs/CsmJob/CsmJobQueueRef + /ActiveEcuC/Csm/CsmQueues/CsmQueue_Mac + + + + + + + CsmQueues + /MICROSAR/Csm/CsmQueues + + + CsmQueue_Standard + /MICROSAR/Csm/CsmQueues/CsmQueue + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueSize + 1 + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmTriggerAsynchJobsInCallback + false + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmJobSharing + true + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmOperationModeLimitation + false + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueProcessingMode + CRYPTO_PROCESSING_SYNC + + + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmChannelRef + /ActiveEcuC/CryIf/CryIfChannel + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueMainFunctionRef + /ActiveEcuC/Csm/CsmMainFunction + + + + + CsmQueue_Mac + /MICROSAR/Csm/CsmQueues/CsmQueue + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueSize + 1 + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmTriggerAsynchJobsInCallback + false + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmJobSharing + true + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmOperationModeLimitation + false + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueProcessingMode + CRYPTO_PROCESSING_SYNC + + + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmChannelRef + /ActiveEcuC/CryIf/CryIfChannel_CryptoCv_Fbl_MemDrvCmac + + + /MICROSAR/Csm/CsmQueues/CsmQueue/CsmQueueMainFunctionRef + /ActiveEcuC/Csm/CsmMainFunction + + + + + + + CsmKeys + /MICROSAR/Csm/CsmKeys + + + CsmKey_Smh_HashSha256 + /MICROSAR/Csm/CsmKeys/CsmKey + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyId + 2 + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyUsePort + false + + + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyRef + /ActiveEcuC/CryIf/CryIfKeyDummy + + + + + CsmKey_SmhKeyRSA + /MICROSAR/Csm/CsmKeys/CsmKey + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyId + 1 + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyUsePort + false + + + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyRef + /ActiveEcuC/CryIf/CryIfKey_SmhKeyRSA + + + + + CsmKey_Smh_Nist_800_90A + /MICROSAR/Csm/CsmKeys/CsmKey + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyId + 3 + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyUsePort + false + + + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyRef + /ActiveEcuC/CryIf/CryIfKey_Smh_Nist_800_90A + + + + + CsmKey_Fbl_MemDrv_Cmac + /MICROSAR/Csm/CsmKeys/CsmKey + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyId + 0 + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyUsePort + false + + + + + /MICROSAR/Csm/CsmKeys/CsmKey/CsmKeyRef + /ActiveEcuC/CryIf/CryIfKey_Fbl_MemDrv_Cmac + + + + + + + CsmPrimitives_RandomGenerate + /MICROSAR/Csm/CsmPrimitives + + + CsmRandomGenerate + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate + + + CsmPrimitives_RandomGenerate + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmFamiliy + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateProcessing + CSM_SYNCHRONOUS + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmFamily + CRYPTO_ALGOFAM_CUSTOM + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateResultLength + 16 + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmFamilyCustom + CRYPTO_ALGOFAM_CUSTOM_DRBG + + + /MICROSAR/Csm/CsmPrimitives/CsmRandomGenerate/CsmRandomGenerateConfig/CsmRandomGenerateAlgorithmSecondaryFamilyCustom + CRYPTO_ALGOFAM_AES + + + + + + + + + CsmPrimitives_SigAsymVer_RsaPssSha256 + /MICROSAR/Csm/CsmPrimitives + + + CsmSignatureVerify + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify + + + CsmPrimitives_SigAsymVer_RsaPssSha256 + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyAlgorithmFamily + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyAlgorithmMode + CRYPTO_ALGOMODE_RSASSA_PSS + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyProcessing + CSM_SYNCHRONOUS + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyCompareLength + 1 + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyAlgorithmFamiliy + CRYPTO_ALGOFAM_RSA + + + /MICROSAR/Csm/CsmPrimitives/CsmSignatureVerify/CsmSignatureVerifyConfig/CsmSignatureVerifyKeyLength + 32 + + + + + + + + + CsmGeneral + /MICROSAR/Csm/CsmGeneral + + + /MICROSAR/Csm/CsmGeneral/CsmAsymPrivateKeyMaxLength + 32 + + + /MICROSAR/Csm/CsmGeneral/CsmAsymPublicKeyMaxLength + 1024 + + + /MICROSAR/Csm/CsmGeneral/CsmDevErrorDetect + true + + + /MICROSAR/Csm/CsmGeneral/CsmSymKeyMaxLength + 16 + + + /MICROSAR/Csm/CsmGeneral/CsmUseDeprecated + false + + + /MICROSAR/Csm/CsmGeneral/CsmVersionInfoApi + false + + + /MICROSAR/Csm/CsmGeneral/CsmCallbackStartNotification + false + + + /MICROSAR/Csm/CsmGeneral/CsmCustomIncludeFiles + Crypto_30_LibCv_Custom.h + + + /MICROSAR/Csm/CsmGeneral/CsmCancelationDuringProcessing + false + + + /MICROSAR/Csm/CsmGeneral/CsmSafeBswChecks + true + + + /MICROSAR/Csm/CsmGeneral/CsmSwcMainInterfaceVersion + CSM_ASR_VERSION_R21_11 + + + /MICROSAR/Csm/CsmGeneral/CsmMultiPartitionRuntimeChecks + false + + + + + CsmJobTypeLayout + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutVarMembers + true + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutAsr430Compatibility + true + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutInput64 + false + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutOutput64Ptr + false + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutRedirectionInfoRef + true + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutJobInfoPtr + true + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutSecureCounterId + false + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutCallbackUpdateNotification + false + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutResultLength + false + + + /MICROSAR/Csm/CsmGeneral/CsmJobTypeLayout/CsmJobTypeLayoutFieldOrdering + CSM_ASR_VERSION_R21_11 + + + + + CsmBswApiCompatibility + /MICROSAR/Csm/CsmGeneral/CsmBswApiCompatibility + + + /MICROSAR/Csm/CsmGeneral/CsmBswApiCompatibility/CsmDefaultJobKeyApiVersion + CSM_ASR_VERSION_4_04 + + + + + + + CsmPrimitives_HashSha256 + /MICROSAR/Csm/CsmPrimitives + + + CsmHash + /MICROSAR/Csm/CsmPrimitives/CsmHash + + + CsmPrimitives_HashSha256 + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashAlgorithmFamiliy + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashAlgorithmFamily + CRYPTO_ALGOFAM_SHA2_256 + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashAlgorithmMode + CRYPTO_ALGOMODE_NOT_SET + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashProcessing + CSM_SYNCHRONOUS + + + /MICROSAR/Csm/CsmPrimitives/CsmHash/CsmHashConfig/CsmHashResultLength + 32 + + + + + + + + + CsmPrimitives_Cmac_Generate + /MICROSAR/Csm/CsmPrimitives + + + CsmMacGenerate + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate + + + CsmPrimitives_Cmac_Generate + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateAlgorithmFamily + CRYPTO_ALGOFAM_AES + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateAlgorithmKeyLength + 16 + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateAlgorithmMode + CRYPTO_ALGOMODE_CMAC + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateAlgorithmSecondaryFamily + CRYPTO_ALGOFAM_NOT_SET + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateProcessing + CSM_SYNCHRONOUS + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateResultLength + 16 + + + /MICROSAR/Csm/CsmPrimitives/CsmMacGenerate/CsmMacGenerateConfig/CsmMacGenerateAlgorithmFamiliy + CRYPTO_ALGOFAM_AES + + + + + + + + + CsmMainFunction + /MICROSAR/Csm/CsmMainFunction + + + /MICROSAR/Csm/CsmMainFunction/CsmMainFunctionPartitionRef + /ActiveEcuC/EcuC/EcucPartitionCollection/EcucPartition + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_Det_Det_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_Det_Det_ecuc.arxml new file mode 100644 index 0000000..ecfb383 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_Det_Det_ecuc.arxml @@ -0,0 +1,89 @@ + + + + + ActiveEcuC + + + Det + + + + false + + + + /MICROSAR/Det + VARIANT-PRE-COMPILE + /MICROSAR/Det_Impl + + + DetGeneral + /MICROSAR/Det/DetGeneral + + + /MICROSAR/Det/DetGeneral/DetEnableDet + true + + + /MICROSAR/Det/DetGeneral/DetVersionInfoApi + false + + + /MICROSAR/Det/DetGeneral/DetExtDebugSupport + false + + + /MICROSAR/Det/DetGeneral/DetGlobalFilterSize + 0 + + + /MICROSAR/Det/DetGeneral/DetBreakFilterSize + 0 + + + /MICROSAR/Det/DetGeneral/DetLogBufferSize + 0 + + + /MICROSAR/Det/DetGeneral/DetReportErrorRecursionLimit + 0 + + + /MICROSAR/Det/DetGeneral/DetReportRuntimeErrorRecursionLimit + 0 + + + /MICROSAR/Det/DetGeneral/DetReportTransientFaultRecursionLimit + 0 + + + /MICROSAR/Det/DetGeneral/DetDltFilterSize + 0 + + + + + DetNotification + /MICROSAR/Det/DetNotification + + + /MICROSAR/Det/DetNotification/DetErrorHook + ApplFbl_DetEntryHandler + + + /MICROSAR/Det/DetNotification/DetReportRuntimeErrorCallout + ApplFbl_DetEntryHandler + + + /MICROSAR/Det/DetNotification/DetReportTransientFaultCallout + ApplFbl_DetEntryHandler + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_EcuC_EcuC_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_EcuC_EcuC_ecuc.arxml new file mode 100644 index 0000000..b6f97e9 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_EcuC_EcuC_ecuc.arxml @@ -0,0 +1,691 @@ + + + + + ActiveEcuC + + + EcuC + + + + false + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/CryIf_InitMemory + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/CryIf_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Crypto_30_LibCv_InitMemory + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Crypto_30_LibCv_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Crypto_30_vHsm_InitMemory + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Crypto_30_vHsm_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Csm_InitMemory + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Csm_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Det_Init + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Det_Start + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Det_InitMemory + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/Brs_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/vBaseEnv_Init + + + + + /ActiveEcuC/EcuC/EcucGeneral/BswInitialization/vLinkGen_Init + + + + + + /MICROSAR/EcuC + VARIANT-PRE-COMPILE + /MICROSAR/EcuC_Impl + + + EcucGeneral + /MICROSAR/EcuC/EcucGeneral + + + /MICROSAR/EcuC/EcucGeneral/DummyFunction + false + + + /MICROSAR/EcuC/EcucGeneral/DummyStatement + true + + + /MICROSAR/EcuC/EcucGeneral/StructAlignment + Auto + + + /MICROSAR/EcuC/EcucGeneral/ArrayAlignment + Auto + + + /MICROSAR/EcuC/EcucGeneral/StructInArrayAlignment + Auto + + + /MICROSAR/EcuC/EcucGeneral/SizeOfEnum + Size32Bit + + + /MICROSAR/EcuC/EcucGeneral/SizeOfROMPointer + Size32Bit + + + /MICROSAR/EcuC/EcucGeneral/SizeOfRAMPointer + Size32Bit + + + /MICROSAR/EcuC/EcucGeneral/DummyStatementKind + SelfAssignment + + + /MICROSAR/EcuC/EcucGeneral/AtomicBitAccessInBitfield + false + + + /MICROSAR/EcuC/EcucGeneral/AtomicVariableAccess + Atomic32BitAccess + + + /MICROSAR/EcuC/EcucGeneral/CPUType + CPU32Bit + + + /MICROSAR/EcuC/EcucGeneral/SizeOfInt + Size32Bit + + + /MICROSAR/EcuC/EcucGeneral/ByteOrder + LITTLE_ENDIAN + + + /MICROSAR/EcuC/EcucGeneral/BitOrder + LSB_to_MSB + + + /MICROSAR/EcuC/EcucGeneral/BitFieldDataType + INT + + + /MICROSAR/EcuC/EcucGeneral/ConditionalGenerating + true + + + /MICROSAR/EcuC/EcucGeneral/EcucBswImplementationCodeType + EcuCSourceCode + + + /MICROSAR/EcuC/EcucGeneral/EcuCUseStdReturnTypeForRte + false + + + + + BswInitialization + /MICROSAR/EcuC/EcucGeneral/BswInitialization + + + CryIf_InitMemory + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Interface +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + CryIf.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_MEMORY + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/CryIf + + +
+ + CryIf_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Interface +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + CryIf.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_TWO_IF + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/CryIf + + +
+ + Crypto_30_LibCv_InitMemory + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Driver +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Crypto_30_LibCv.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_MEMORY + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Crypto + + +
+ + Crypto_30_LibCv_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Driver +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Crypto_30_LibCv.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_TWO_DRV + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Crypto + + +
+ + Crypto_30_vHsm_InitMemory + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Driver +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Crypto_30_vHsm.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_MEMORY + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Crypto_001 + + +
+ + Crypto_30_vHsm_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Driver +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Crypto_30_vHsm.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_TWO_DRV + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Crypto_001 + + +
+ + Csm_InitMemory + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Service Manager +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Csm.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_MEMORY + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Csm + + +
+ + Csm_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Service Manager +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Csm.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_TWO_SYS + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Csm + + +
+ + Det_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Init function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Det.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_ZERO + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ConfigType + Det_ConfigType + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ConfigPtrClass + DET_INIT_DATA + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ConfigPtrName + Det_Config_Ptr + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Det + + +
+ + Det_Start + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ PostInit function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Det.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_ONE + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Det + + +
+ + Det_InitMemory + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ InitMemory function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + Det.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + INIT_MEMORY + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/Det + + +
+ + Brs_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Automatically generated by BswInitFctConfigurationService. +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + NO_INIT + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/vBRS + + +
+ + vBaseEnv_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Created vBaseEnv_Init by Extended Init XML Service +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + NO_INIT + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/vBaseEnv + + +
+ + vLinkGen_Init + + + + DV:EcucBswInitFunction + +

+ PLAIN_TEXT +

+

+ Dummy initialization of the vLinkGen +

+
+
+
+ /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/Header + vLinkGen_Lcfg.h + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/InitPhase + NO_INIT + + + + + /MICROSAR/EcuC/EcucGeneral/BswInitialization/InitFunction/ModuleRef + /ActiveEcuC/vLinkGen + + +
+
+
+
+
+
+
+
+
+
+
diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_FblAsrStubs_FblAsrStubs_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblAsrStubs_FblAsrStubs_ecuc.arxml new file mode 100644 index 0000000..a405315 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblAsrStubs_FblAsrStubs_ecuc.arxml @@ -0,0 +1,36 @@ + + + + + ActiveEcuC + + + FblAsrStubs + /MICROSAR/FblAsrStubs + VARIANT-LINK-TIME + /MICROSAR/FblAsrStubs_Impl + + + FblAsrStubsModuleConfigDefines + /MICROSAR/FblAsrStubs/FblAsrStubsModuleConfigDefines + + + /MICROSAR/FblAsrStubs/FblAsrStubsModuleConfigDefines/FblAsrStubsCreateGptConfigDefines + false + + + /MICROSAR/FblAsrStubs/FblAsrStubsModuleConfigDefines/FblAsrStubsCreateDemConfigDefines + false + + + /MICROSAR/FblAsrStubs/FblAsrStubsModuleConfigDefines/FblAsrStubsCreateComConfigDefines + false + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBmHdr_FblBmHdr_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBmHdr_FblBmHdr_ecuc.arxml new file mode 100644 index 0000000..e3d1cdb --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBmHdr_FblBmHdr_ecuc.arxml @@ -0,0 +1,121 @@ + + + + + ActiveEcuC + + + FblBmHdr + + + + false + + + + /MICROSAR/FblBmHdr + VARIANT-PRE-COMPILE + /MICROSAR/FblBmHdr_Impl + + + FblBmHdrHeader + /MICROSAR/FblBmHdr/FblBmHdrHeader + + + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrBlockStartAddress + 0 + + + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrBlockLength + 1 + + + + + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrTargetRef + /ActiveEcuC/FblBmHdr/Fbl + + + + + FblBmHdrVariant + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrVariant + + + FblBmHdrAuthenticationHeader + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrVariant/FblBmHdrAuthenticationHeader + + + /MICROSAR/FblBmHdr/FblBmHdrHeader/FblBmHdrVariant/FblBmHdrAuthenticationHeader/FblBmHdrAuthenticationHeaderAddress + 0 + + + + + + + + + Appl + /MICROSAR/FblBmHdr/FblBmHdrTarget + + + /MICROSAR/FblBmHdr/FblBmHdrTarget/FblBmHdrTargetId + 2 + + + + + Data + /MICROSAR/FblBmHdr/FblBmHdrTarget + + + /MICROSAR/FblBmHdr/FblBmHdrTarget/FblBmHdrTargetId + 3 + + + + + Fbl + /MICROSAR/FblBmHdr/FblBmHdrTarget + + + /MICROSAR/FblBmHdr/FblBmHdrTarget/FblBmHdrTargetId + 0 + + + + + FblUpdater + /MICROSAR/FblBmHdr/FblBmHdrTarget + + + /MICROSAR/FblBmHdr/FblBmHdrTarget/FblBmHdrTargetId + 1 + + + + + FblBmHdrGeneral + /MICROSAR/FblBmHdr/FblBmHdrGeneral + + + /MICROSAR/FblBmHdr/FblBmHdrGeneral/FblBmHdrMaxVerificationEntries + 1 + + + /MICROSAR/FblBmHdr/FblBmHdrGeneral/FblBmHdrSbVerificationList + false + + + /MICROSAR/FblBmHdr/FblBmHdrGeneral/FblBmHdrAllowTargetsWithoutMacOperation + false + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBm_FblBm_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBm_FblBm_ecuc.arxml new file mode 100644 index 0000000..86ebc35 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblBm_FblBm_ecuc.arxml @@ -0,0 +1,71 @@ + + + + + ActiveEcuC + + + FblBm + + + + false + + + + /MICROSAR/FblBm + VARIANT-PRE-COMPILE + /MICROSAR/FblBm_Impl + + + FblBmGeneral + /MICROSAR/FblBm/FblBmGeneral + + + /MICROSAR/FblBm/FblBmGeneral/FblBmFailsafeUpdater + false + + + /MICROSAR/FblBm/FblBmGeneral/FblBmIncludeHardwareConfiguration + false + + + /MICROSAR/FblBm/FblBmGeneral/FblBmInitializeKeys + true + + + /MICROSAR/FblBm/FblBmGeneral/FblBmSecureBoot + true + + + /MICROSAR/FblBm/FblBmGeneral/FblBmStandaloneMode + true + + + /MICROSAR/FblBm/FblBmGeneral/FblBmInitializeMacOfBootloader + false + + + /MICROSAR/FblBm/FblBmGeneral/FblBmIncludeOemConfiguration + false + + + /MICROSAR/FblBm/FblBmGeneral/FblBmHeaderAddress + 0 + + + /MICROSAR/FblBm/FblBmGeneral/FblBmExecutionInstance + BootManager + + + /MICROSAR/FblBm/FblBmGeneral/FblBmFailsafeUpdaterUser + false + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_FblHal_FblHal_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblHal_FblHal_ecuc.arxml new file mode 100644 index 0000000..3f83e81 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblHal_FblHal_ecuc.arxml @@ -0,0 +1,72 @@ + + + + + ActiveEcuC + + + FblHal + /MICROSAR/FblHal + VARIANT-LINK-TIME + /MICROSAR/FblHal_Impl + + + FblHalGeneral + /MICROSAR/FblHal/FblHalGeneral + + + /MICROSAR/FblHal/FblHalGeneral/FblHalFlashCodeBufferSize + 2048 + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define V_COMP_LLVMTI + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define V_COMP_LLVMTI_SITARA + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define V_CPU_SITARA + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define C_CPUTYPE_32BIT + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define V_SUPPRESS_EXTENDED_VERSION_CHECK + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define VGEN_ENABLE_CANFBL + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define FBL_RTI_BASE 0x52180000uL /**< RTI0 base address */ + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define FBL_SFR_BASE_ADRESSES_PRECONFIGURED + + + /MICROSAR/FblHal/FblHalGeneral/FblHalDerivativeSpecificDefines + #define V_ENABLE_CAN_ASR_ABSTRACTION + + + /MICROSAR/FblHal/FblHalGeneral/FblHalECCSafeRead + false + + + /MICROSAR/FblHal/FblHalGeneral/FblHalTimerClockFreq + 0 + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_FblSb_FblSb_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblSb_FblSb_ecuc.arxml new file mode 100644 index 0000000..e50dd00 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_FblSb_FblSb_ecuc.arxml @@ -0,0 +1,84 @@ + + + + + ActiveEcuC + + + FblSb + + + + false + + + + /MICROSAR/FblSb + VARIANT-PRE-COMPILE + /MICROSAR/FblSb_Impl + + + FblSbGeneral + /MICROSAR/FblSb/FblSbGeneral + + + /MICROSAR/FblSb/FblSbGeneral/FblSbHeaderVerification + false + + + /MICROSAR/FblSb/FblSbGeneral/FblSbVerificationList + false + + + /MICROSAR/FblSb/FblSbGeneral/FblSbCopyFlashDriver + false + + + /MICROSAR/FblSb/FblSbGeneral/FblSbFblLbtVerification + false + + + + + FblSbMacOperation + /MICROSAR/FblSb/FblSbMacOperation + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbMacOperationId + 0 + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbGroupId + 0 + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbVerifyForceSequential + false + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbVerificationMethod + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbSecureBootUpdateSignatureAlgorithm + ED25519 + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbSecureBootUpdateSignatureLength + 64 + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbSecureBootUpdateSignaturePosition + BeforeSegmentList + + + /MICROSAR/FblSb/FblSbMacOperation/FblSbConfirmationMode + false + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_Fbl_Fbl_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_Fbl_Fbl_ecuc.arxml new file mode 100644 index 0000000..2ff8fe3 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_Fbl_Fbl_ecuc.arxml @@ -0,0 +1,428 @@ + + + + + ActiveEcuC + + + Fbl + /MICROSAR/Fbl + VARIANT-LINK-TIME + /MICROSAR/Fbl_Impl + + + FblMemoryDeviceTable + /MICROSAR/Fbl/FblMemoryDeviceTable + + + Ram + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdErasedValue + 255 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdSegmentSize + 1 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdIndex + 0 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdInitHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdDeinitHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdReadHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdEraseHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdWriteHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdVerifyHook + false + + + + + Flash + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdIndex + 1 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdSegmentSize + 1 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdErasedValue + 255 + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdInitHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdDeinitHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdReadHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdEraseHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdWriteHook + false + + + /MICROSAR/Fbl/FblMemoryDeviceTable/FblMemoryDevice/FblMdVerifyHook + false + + + + + + + FblGeneral + /MICROSAR/Fbl/FblGeneral + + + /MICROSAR/Fbl/FblGeneral/FblApplicationStateTask + false + + + /MICROSAR/Fbl/FblGeneral/FblStayInBoot + true + + + /MICROSAR/Fbl/FblGeneral/FblPresencePattern + true + + + /MICROSAR/Fbl/FblGeneral/FblCompressionMode + true + + + /MICROSAR/Fbl/FblGeneral/FblCommonData + true + + + /MICROSAR/Fbl/FblGeneral/FblWriteSegmentation + 256 + + + /MICROSAR/Fbl/FblGeneral/FblWatchdogService + true + + + /MICROSAR/Fbl/FblGeneral/FblVerificationSegmentation + 256 + + + /MICROSAR/Fbl/FblGeneral/FblUnalignedDataTransfer + true + + + /MICROSAR/Fbl/FblGeneral/FblStartFunction + true + + + /MICROSAR/Fbl/FblGeneral/FblPipelinedProgramming + true + + + /MICROSAR/Fbl/FblGeneral/FblPipelinedVerification + false + + + /MICROSAR/Fbl/FblGeneral/FblMaximumNumberOfSegments + 16 + + + /MICROSAR/Fbl/FblGeneral/FblInternalMemoryCopy + true + + + /MICROSAR/Fbl/FblGeneral/FblDiagnosticBufferSize + 2050 + + + /MICROSAR/Fbl/FblGeneral/FblDataProcessingBufferSize + 256 + + + /MICROSAR/Fbl/FblGeneral/FblVerificationFunction + false + + + /MICROSAR/Fbl/FblGeneral/FblUserConfigFile + $(DpaProjectFolder)\Config\Fbl_Usr.cfg + + + /MICROSAR/Fbl/FblGeneral/FblGapFilling + false + + + /MICROSAR/Fbl/FblGeneral/FblAdaptiveDataTransferRcrrp + false + + + /MICROSAR/Fbl/FblGeneral/FblGatewaySupport + false + + + /MICROSAR/Fbl/FblGeneral/FblInputVerification + false + + + /MICROSAR/Fbl/FblGeneral/FblP2Server + 25 + + + /MICROSAR/Fbl/FblGeneral/FblS3ServerExtendedSession + 0 + + + /MICROSAR/Fbl/FblGeneral/FblResponseAfterReset + false + + + /MICROSAR/Fbl/FblGeneral/FblSuspendDriverOperation + false + + + /MICROSAR/Fbl/FblGeneral/FblSleepMode + false + + + /MICROSAR/Fbl/FblGeneral/FblSleepTime + 0 + + + /MICROSAR/Fbl/FblGeneral/FblProcessedVerification + false + + + /MICROSAR/Fbl/FblGeneral/FblOutputVerification + true + + + /MICROSAR/Fbl/FblGeneral/FblEncryptionMode + false + + + /MICROSAR/Fbl/FblGeneral/FblFlashDriverUsage + DOWNLOAD_DRIVER + + + /MICROSAR/Fbl/FblGeneral/FblReprogrammableLbt + false + + + /MICROSAR/Fbl/FblGeneral/FblOta + false + + + /MICROSAR/Fbl/FblGeneral/FblHardwareSwap + false + + + /MICROSAR/Fbl/FblGeneral/FblProjectState + INTEGRATION + + + /MICROSAR/Fbl/FblGeneral/FblApplicationTimerTask + false + + + /MICROSAR/Fbl/FblGeneral/FblHeaderAddress + 0 + + + /MICROSAR/Fbl/FblGeneral/FblP2StarServer + 5000 + + + /MICROSAR/Fbl/FblGeneral/FblS3ServerProgrammingSession + 5000 + + + /MICROSAR/Fbl/FblGeneral/FblFillCode + 255 + + + /MICROSAR/Fbl/FblGeneral/FblUserSubfunction + false + + + /MICROSAR/Fbl/FblGeneral/FblUserService + false + + + /MICROSAR/Fbl/FblGeneral/FblUserRoutine + false + + + /MICROSAR/Fbl/FblGeneral/FblWatchdogTriggerCycle + 1 + + + /MICROSAR/Fbl/FblGeneral/FblMaximumAmountOfLogicalBlocks + 8 + + + /MICROSAR/Fbl/FblGeneral/FblBlockStartAddress + 0 + + + /MICROSAR/Fbl/FblGeneral/FblBlockLength + 0 + + + /MICROSAR/Fbl/FblGeneral/FblOneStepUpdater + false + + + /MICROSAR/Fbl/FblGeneral/FblXcpSupport + false + + + + + FblLogicalBlockTable + /MICROSAR/Fbl/FblLogicalBlockTable + + + SBL + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbBlockType + SBL + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbDisposability + OPTIONAL + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbOutputVerification + SecM_Default + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbBlockIndex + 0 + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbStartAddress + 0 + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbEndAddress + 0 + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbHeaderAddress + 0 + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbDescription + + + + /MICROSAR/Fbl/FblLogicalBlockTable/FblLogicalBlock/FblLbBmHeaderAddress + 0 + + + + + + + FblFord + /MICROSAR/Fbl/FblFord + + + /MICROSAR/Fbl/FblFord/FblValidationStructure + true + + + /MICROSAR/Fbl/FblFord/FblSigningSolutionKey + SINGLE_KEY + + + /MICROSAR/Fbl/FblFord/FblWriteDataByIdentifierService + true + + + /MICROSAR/Fbl/FblFord/FblRequestUploadService + true + + + /MICROSAR/Fbl/FblFord/FblValidationStructureBeginTag + 1961616914 + + + /MICROSAR/Fbl/FblFord/FblValidationStructureEndTag + 4046069293 + + + /MICROSAR/Fbl/FblFord/FblFlashErasedDetection + false + + + /MICROSAR/Fbl/FblFord/FblFlashErasedDetectionPatternSize + 16 + + + /MICROSAR/Fbl/FblFord/FblSeedKeyModule + true + + + /MICROSAR/Fbl/FblFord/FblSecretKey + FFFFFFFFFFFFFFFFFFFFFFFF + + + /MICROSAR/Fbl/FblFord/FblSecretKeyUpdate + false + + + /MICROSAR/Fbl/FblFord/FblMaximumReadableDataIdentifiers + 5 + + + /MICROSAR/Fbl/FblFord/FblKeyExpLength + 256 + + + /MICROSAR/Fbl/FblFord/FblTokenDownloadHandling + true + + + + + FblFlashBlockTable + /MICROSAR/Fbl/FblFlashBlockTable + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_MemMap_MemMap_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_MemMap_MemMap_ecuc.arxml new file mode 100644 index 0000000..f100632 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_MemMap_MemMap_ecuc.arxml @@ -0,0 +1,5441 @@ + + + + + ActiveEcuC + + + MemMap + + + + false + + + + /MICROSAR/MemMap + VARIANT-PRE-COMPILE + /MICROSAR/MemMap_Impl + + + vHsmGlobalRamBuffer + /MICROSAR/MemMap/MemMapAddressingModeSet + + + vHsmGlobalRamBuffer + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vHsmGlobalRamBuffer + + + + + + + vHsmIpcMemory + /MICROSAR/MemMap/MemMapAddressingModeSet + + + vHsmIpcMemory + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vHsmIpcMemory + + + + + + + vHsm_Generic + /MICROSAR/MemMap/MemMapAllocation + + + vHsmGlobalRamBuffer + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/vHsmGlobalRamBuffer + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapMemorySectionRef + /MICROSAR/Crypto_30_vHsm/Crypto_Impl/ResourceConsumption/CRYPTO_30_VHSM_GLOBAL_VAR_NOINIT_32BIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapMemorySectionRef + /MICROSAR/Crypto_30_vHsm/Crypto_Impl/ResourceConsumption/CRYPTO_30_VHSM_GLOBAL_VAR_NOINIT_UNSPECIFIED + + + + + vHsmIpcMemory + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/vHsmIpcMemory + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapMemorySectionRef + /MICROSAR/Crypto_30_vHsm/Crypto_Impl/ResourceConsumption/CRYPTO_30_VHSM_IPC_MEMORY_VAR_NOINIT_32BIT + + + + + vHsmRamCode + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/vHsmRamCode + + + /MICROSAR/MemMap/MemMapAllocation/MemMapSectionSpecificMapping/MemMapMemorySectionRef + /MICROSAR/Crypto_30_vHsm/Crypto_Impl/ResourceConsumption/CRYPTO_30_VHSM_RAMCODE + + + + + + + vHsmRamCode + /MICROSAR/MemMap/MemMapAddressingModeSet + + + vHsmRamCode + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + + + + + MemMap_Common + /MICROSAR/MemMap/MemMapModule + + + /MICROSAR/MemMap/MemMapModule/MemMapGenerateAdditionalMemorySections + true + + + + + CODE + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CODE + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE + + + + + CODE_FAST + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CODE_FAST + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST + + + + + CODE_ISR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CODE_ISR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR + + + + + CONST + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + + + CONST_FAST_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_FAST_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_FAST_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + + + CONST_PBCFG + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + CONST_PBCFG + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_PBCFG + + + + + PBCFG_GLOBALROOT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + PBCFG_GLOBALROOT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/PBCFG_GLOBALROOT + + + + + VAR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + + + VAR_NOINIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOINIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NOINIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOINIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NOINIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOINIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NOINIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOINIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NOINIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOINIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_NO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + + + VAR_ZERO_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_ZERO_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_ZERO_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_ZERO_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_ZERO_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_ZERO_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_ZERO_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_ZERO_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_CLEARED_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_CLEARED_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_ZERO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_ZERO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + + + VAR_FAST_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + + + VAR_FAST_NOINIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NOINIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NOINIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NOINIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NOINIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NOINIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NOINIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NOINIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NOINIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NOINIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_NO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_NO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + + + VAR_FAST_ZERO_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_ZERO_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_ZERO_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_ZERO_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_ZERO_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_ZERO_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_ZERO_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_ZERO_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_ZERO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_ZERO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_FAST_CLEARED_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_FAST_CLEARED_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + + + VAR_NOCACHE_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + + + VAR_NOCACHE_NOINIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NOINIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NOINIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NOINIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NOINIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NOINIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NOINIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NOINIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NOINIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NOINIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_NO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_NO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + + + VAR_NOCACHE_ZERO_INIT_8BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_ZERO_INIT_8BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_ZERO_INIT_16BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_ZERO_INIT_16BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_ZERO_INIT_32BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_ZERO_INIT_32BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_ZERO_INIT_64BIT + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_ZERO_INIT_64BIT + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_ZERO_INIT_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_ZERO_INIT_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_8 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 8 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_8 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_16 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 16 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_16 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_32 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 32 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_32 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_64 + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + 64 + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_64 + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_PTR + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + PTR + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_PTR + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_NOCACHE_CLEARED_UNSPECIFIED + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_NOCACHE_CLEARED_UNSPECIFIED + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + + + VAR_PBCFG + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionAlignment + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionFileName + MemMap_Common.h + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionPrefix + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSymbol + VAR_PBCFG + + + + + /MICROSAR/MemMap/MemMapModule/MemMapAdditionalMemorySection/MemMapMemorySectionSwAddrMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_PBCFG + + + + + + + MemMapGeneral + /MICROSAR/MemMap/MemMapGeneral + + + /MICROSAR/MemMap/MemMapGeneral/MemMapGeneratePragmasForNearAddressing + false + + + /MICROSAR/MemMap/MemMapGeneral/MemMapGeneration + FULL + + + /MICROSAR/MemMap/MemMapGeneral/MemMapCompatibilityGeneration + FULL + + + /MICROSAR/MemMap/MemMapGeneral/MemMapTypedPragmas + true + + + /MICROSAR/MemMap/MemMapGeneral/MemMapGeneratePragmas + true + + + /MICROSAR/MemMap/MemMapGeneral/MemMapErrorChecks + ALL + + + + + MSR_Generic + /MICROSAR/MemMap/MemMapAllocation + + + MSR_CODE + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALLOUT_CODE_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_FAST_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_ISR_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CODE_SLOW_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_CODE + + + + + MSR_CONST + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_CONST + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_PREBUILD_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONFIG_DATA_POSTBUILD_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_FAST_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CALIB_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_SAVED_RECOVERY_ZONE_ASIL_D + + + + + MSR_PBCFG_CONST + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/CONST_PBCFG + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_PBCFG_CONST + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/PBCFG_GLOBALROOT + + + + + MSR_PBCFG_VAR + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_PBCFG + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_PBCFG_VAR + + + + + MSR_VAR_CLEARED + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_ZERO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_ZERO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_ZERO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_CLEARED_ASIL_D + + + + + MSR_VAR_INIT + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_INIT_ASIL_D + + + + + MSR_VAR_NO_INIT + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOINIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NOINIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NOINIT_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NO_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_NO_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_NOCACHE_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_NO_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_NO_INIT_ASIL_D + + + + + MSR_VAR_POWER_ON_CLEARED + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_POWER_ON_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_CLEARED_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_CLEARED_ASIL_D + + + + + MSR_VAR_POWER_ON_INIT + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_POWER_ON_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_POWER_ON_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_FAST_POWER_ON_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SLOW_POWER_ON_INIT_ASIL_D + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/INTERNAL_VAR_POWER_ON_INIT_ASIL_D + + + + + MSR_VAR_SAVED_ZONE + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapAddressingModeSetRef + /ActiveEcuC/MemMap/MSR_VAR_SAVED_ZONE + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_BOOLEAN + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_8 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_16 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_32 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_64 + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_QM + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_ASIL_A + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_ASIL_B + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_ASIL_C + + + /MICROSAR/MemMap/MemMapAllocation/MemMapGenericMapping/MemMapSwAddressMethodRef + /MICROSAR_MemMap/SwAddrMethods/VAR_SAVED_ZONE_ASIL_D + + + + + + + MSR_CODE + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_CODE + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_CODE + + + + + + + MSR_CONST + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_CONST + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_CONST + + + + + + + MSR_PBCFG_CONST + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_PBCFG_CONST + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_PBCFG_CONST + + + + + + + MSR_PBCFG_VAR + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_PBCFG_VAR + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_PBCFG_VAR + + + + + + + MSR_VAR_CLEARED + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_CLEARED + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR + + + + + + + MSR_VAR_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR + + + + + + + MSR_VAR_NO_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_NO_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR + + + + + + + MSR_VAR_POWER_ON_CLEARED + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_POWER_ON_CLEARED + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR + + + + + + + MSR_VAR_POWER_ON_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_POWER_ON_INIT + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR + + + + + + + MSR_VAR_SAVED_ZONE + /MICROSAR/MemMap/MemMapAddressingModeSet + + + MSR_VAR_SAVED_ZONE + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + UNSPECIFIED + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 8 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 16 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 32 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + 64 + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + BOOLEAN + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapAlignmentSelector + PTR + + + + + /MICROSAR/MemMap/MemMapAddressingModeSet/MemMapAddressingMode/MemMapLinkerLogicalGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/MSR_VAR_SAVED_ZONE + + + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_vBRS_vBRS_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_vBRS_vBRS_ecuc.arxml new file mode 100644 index 0000000..c1b8f60 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_vBRS_vBRS_ecuc.arxml @@ -0,0 +1,216 @@ + + + + + ActiveEcuC + + + vBRS + /MICROSAR/vBRS + VARIANT-PRE-COMPILE + /MICROSAR/vBRS_Impl + + + vBRSGeneral + /MICROSAR/vBRS/vBRSGeneral + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableEcuMStubGeneration + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSchmStubGeneration + true + + + /MICROSAR/vBRS/vBRSGeneral/vBRSExecutionInstance + FBL + + + /MICROSAR/vBRS/vBRSGeneral/vBRSFblSupportExceptionTableInRam + true + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableCoreSpecificVLinkGenConfig + true + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSupportLEDs + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSafeContextSupport + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableMultiCoreSupport + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSupportToggleWdPin + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSupportToggleCustomPin + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSDisableSetupSupport + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSchmStubSupportDrvCanAN + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSFirstInstance + true + + + /MICROSAR/vBRS/vBRSGeneral/vBRSFblSupportEcuMInit + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSEnableSmallDevicesOptimization + false + + + /MICROSAR/vBRS/vBRSGeneral/vBRSHypervisorGuest + false + + + + + vBRSHwConfig + /MICROSAR/vBRS/vBRSHwConfig + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEnablePLLClocksHandling + true + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEnablePortHandling + true + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEnableWatchdogHandling + true + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSPreferPLLWatchdogInit + false + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_INCLUDES += LlvmTi + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS = -L LlvmTi/drivers/lib + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -L LlvmTi/kernel/lib + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -Xlinker --library=drivers.am263x.r5f.ti_arm_clang.debug.lib + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -Xlinker --library=nortos.am263x.r5f.ti_arm_clang.debug.lib + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -Xlinker --retain='*(.brsExcVect1*)' + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -Xlinker --retain='*(.brsExcVect2*)' + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSMakefileUserCode + ADDITIONAL_LDFLAGS_FROM_VBRS += -Xlinker --retain='*(.brsExcVect3*)' + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSOscClock + 25000000 + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSPeriphClock + 12500000 + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSTimebaseClock + 400000000 + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSCompilerInstructionSet + ARM + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSCompilerEnableFPU + true + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSPeriphClockDescription + SBL powers up the timers and clock sources. RTI1 Timer: 12.5MHz + + + + + TI_AM2634_EVM + /MICROSAR/vBRS/vBRSHwConfig/vBRSEvalBoardInfo + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEvalBoardInfo/vBRSEvalBoard + TI_AM2634_EVM + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEvalBoardInfo/vBRSEvalBoardDescription + User LEDs -> GPIO1 (on unused QSPI0_CSn1) + + + /MICROSAR/vBRS/vBRSHwConfig/vBRSEvalBoardInfo/vBRSEvalBoardOscClock + 25000000 + + + + + + + vBRSMemoryInit + /MICROSAR/vBRS/vBRSMemoryInit + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSInitPatternBlocks + 0 + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSInitPatternHardResetBlocks + 0 + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSInitPatternAreas + 0 + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSInitPatternHardResetAreas + 0 + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSInitEnable64BitInitPattern + false + + + /MICROSAR/vBRS/vBRSMemoryInit/vBRSDisableMemoryInitGlobally + false + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_vBaseEnv_vBaseEnv_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_vBaseEnv_vBaseEnv_ecuc.arxml new file mode 100644 index 0000000..82911f0 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_vBaseEnv_vBaseEnv_ecuc.arxml @@ -0,0 +1,255 @@ + + + + + ActiveEcuC + + + vBaseEnv + /MICROSAR/vBaseEnv + VARIANT-PRE-COMPILE + /MICROSAR/vBaseEnv_Impl + + + vBaseEnvGeneral + /MICROSAR/vBaseEnv/vBaseEnvGeneral + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvTestedDerivativeRef + + + + + AM2634 + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Can + 4 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Lin + 5 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Ethernet + 2 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Flexray + 0 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvCpuCore + CORTEX_R5F + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvCpuCoreAmount + 4 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvCpuInitCore + 0 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvCpuMaxFrequency + 400000000 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvTestedDerivative + AM2634 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvTestedDerivativeDescription + TI AM2634 Grade O, Device Rev B (SR1.0A) (Infos accord. to AM263x__DS__2022_02_04__SPRSP74.pdf) + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_I2c + 4 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Spi + 5 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_Hyperbus + 0 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvAvailableChannels_EthernetSwitch + 0 + + + + + OCSRAM + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 1879048192 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 2097152 + + + + + R5SS0_CORE0_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 0 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS0_CORE0_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 524288 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS0_CORE1_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2015363072 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS0_CORE1_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2016411648 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS1_CORE0_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2017460224 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS1_CORE0_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2018508800 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS1_CORE1_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2019557376 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + R5SS1_CORE1_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionStartAddress + 2020605952 + + + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvDerivativeInformation/vBaseEnvMemLayoutHwRegion/vBaseEnvHwRegionSize + 32768 + + + + + + + OCSRAM + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS0_CORE0_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS0_CORE0_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS0_CORE1_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS0_CORE1_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS1_CORE0_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS1_CORE0_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS1_CORE1_TCMA + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + R5SS1_CORE1_TCMB + /MICROSAR/vBaseEnv/vBaseEnvGeneral/vBaseEnvMemLayoutHwRegion + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_vLinkGen_vLinkGen_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_vLinkGen_vLinkGen_ecuc.arxml new file mode 100644 index 0000000..c17711c --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_vLinkGen_vLinkGen_ecuc.arxml @@ -0,0 +1,6505 @@ + + + + + ActiveEcuC + + + vLinkGen + + + + false + + + + /MICROSAR/vLinkGen + VARIANT-PRE-COMPILE + /MICROSAR/vLinkGen_Impl + + + vLinkGenMemLayout + /MICROSAR/vLinkGen/vLinkGenMemLayout + + + vHsm + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 16384 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + vGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 15104 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/vHsmGlobalRamBuffer + + + + + vHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 1280 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/vHsmIpcMemory + + + + + + + vLinkGenLinkerSections + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections + + + vHsmGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + vHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + svHsmGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + svHsmGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + svHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + svHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + vHsmGlobalRamBuffer_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmGlobalRamBuffer_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + vHsmGlobalRamBuffer_INIT_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmGlobalRamBuffer_INIT_FAST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + + + vHsmGlobalRamBuffer_NO_INIT_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmGlobalRamBuffer_NO_INIT_FAST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + + + vHsmIpcMemory_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmIpcMemory_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + vHsmIpcMemory_INIT_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmIpcMemory_INIT_FAST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + + + vHsmIpcMemory_NO_INIT_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + vHsmIpcMemory_NO_INIT_FAST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + + + RamCodeSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + RamCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionAlignment + 0 + + + + + EepDummySection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + EepDummySection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionAlignment + 0 + + + + + BmHeaderSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + BmHeaderSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionAlignment + 0 + + + + + RamConstSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + RamConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionAlignment + 0 + + + + + FblHeaderSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + FblHeaderSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionAlignment + 0 + + + + + BmHdrHeaderSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + BmHdrHeaderSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionAlignment + 0 + + + + + MagicFlagSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MagicFlagSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionAlignment + 0 + + + + + FblPresencePatternSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + FblPresencePatternSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + ApplVectSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + ApplVectSection + + + + + FblFlashDrvSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + FblFlashDrvSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionAlignment + 0 + + + + + FlashDrvHeaderSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + FlashDrvHeaderSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + FlashDrvFooterSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + FlashDrvFooterSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + MSR_CODE + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + MSR_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + MSR_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + MSR_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + MSR_PBCFG_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + MSR_PBCFG_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + MSR_PBCFG_VAR + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_NO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_CONST_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + MSR_CONST_FAST + + + + + MSR_VAR_FAST_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_FAST_CLEARED + + + + + MSR_VAR_FAST_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_FAST_INIT + + + + + MSR_VAR_FAST_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_FAST_NO_INIT + + + + + MSR_PBCFG_CONST_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + MSR_PBCFG_CONST_FAST + + + + + MSR_PBCFG_VAR_FAST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR_FAST + + + + + MSR_PBCFG_VAR_FAST_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR_FAST_NO_INIT + + + + + MSR_PBCFG_VAR_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR_NO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_SAVED_ZONE_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_SAVED_ZONE_POWER_ON_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_SAVED_ZONE_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_SAVED_ZONE_POWER_ON_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_SAVED_ZONE_FAST_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_SAVED_ZONE_FAST_POWER_ON_INIT + + + + + MSR_VAR_SAVED_ZONE_FAST_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_SAVED_ZONE_FAST_POWER_ON_CLEARED + + + + + MSR_PBCFG_VAR_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_PBCFG_VAR_FAST_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_PBCFG_VAR_FAST_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + true + + + + + MSR_VAR_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_POWER_ON_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_FAST_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_FAST_POWER_ON_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_POWER_ON_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MSR_VAR_FAST_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + MSR_VAR_FAST_POWER_ON_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + brsStartup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsStartup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + startupCode + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + startupCode + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsExcVect1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsExcVect1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsExcVect2 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsExcVect2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsExcVect3 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsExcVect3 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + startupData + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + startupData + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + DMSC_INTERNAL_const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + const.devgroup.DMSC_INTERNAL + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + MAIN_const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + const.devgroup.MAIN + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + MCU_WAKEUP_const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + const.devgroup.MCU_WAKEUP + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + brsExcVect1Const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + brsExcVect1Const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + brsExcVect2Const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + brsExcVect2Const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + brsExcVect3Const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + brsExcVect3Const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + BOARDCFG_DATA + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + boardcfg_data + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + DATA_USER + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + data_user + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + DMSC_INTERNAL_var + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + bss.devgroup.DMSC_INTERNAL + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MAIN_var + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + bss.devgroup.MAIN + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + MCU_WAKEUP_var + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + bss.devgroup.MCU_WAKEUP + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + brsExcVectRamConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + brsExcVectRamConst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + brsExcVectRam + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsExcVectRam + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsExcVect + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsExcVect + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsMainStartup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsMainStartup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsSharedConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsSharedConst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + brsApplicationEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + brsExcVectConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + brsExcVectConst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + brsSharedVar + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + brsSharedVar + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + text + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionName + text + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerCodeSection/vLinkGenLinkerCodeSectionFast + false + + + + + rodata + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionName + rodata + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerConstSection/vLinkGenLinkerConstSectionFast + false + + + + + rodata_const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerSpecSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerSpecSection/vLinkGenLinkerSpecSectionValue + .const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerSpecSection/vLinkGenLinkerSpecSectionPad + 0 + + + + + data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + data + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + bss + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + bss + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + stack + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + stack + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + heap + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionName + heap + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vLinkGenLinkerVarSection/vLinkGenLinkerVarSectionFast + false + + + + + + + vHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vHsm/vHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/vHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + vHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 64 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/svHsmIpcMemory + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmIpcMemory_NO_INIT_FAST + + + + + vHsmIpcMemory_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 64 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmIpcMemory_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmIpcMemory_INIT_FAST + + + + + + + vHsmGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vHsm/vGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/vHsmGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + vHsmGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/svHsmGlobalRamBuffer + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmGlobalRamBuffer_NO_INIT_FAST + + + + + vHsmGlobalRamBuffer_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmGlobalRamBuffer_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/vHsmGlobalRamBuffer_INIT_FAST + + + + + + + Var_EepDummyArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 256 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + EepDummy + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 256 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + + + + + Var_MagicFlagArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 8 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + MagicFlag + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 8 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + + + + + Const_BmHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + BmHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 32 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + + + Const_FlashBootloader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + FblHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 512 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + FblBmHdrHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 512 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + FblApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 256 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + FblRomArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 3 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + FblReserved + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 4096 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + FblBlockValPresencePattern + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + + + Const_ApplicationOrUpdater + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + ApplStartupCode_FirstExecInst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 1504 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplCoreExceptions_FirstExecInst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 512 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplVect + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 3 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 8 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 256 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplRomArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 5 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplBmHdrHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 512 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + ApplReserved + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 4096 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + + + Data_Default + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 1000 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenVarGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/data + + + + + bss + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/bss + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/stack + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/heap + + + + + + + MSR_PBCFG_VAR + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenVarGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_PBCFG_VAR_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR_FAST + + + + + MSR_PBCFG_VAR_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR_NO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR_FAST_NO_INIT + + + + + MSR_PBCFG_VAR_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_VAR_FAST_CLEARED + + + + + + + MSR_VAR + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenVarGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_VAR_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_FAST_CLEARED + + + + + MSR_VAR_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_FAST_INIT + + + + + MSR_VAR_NO_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_NO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_FAST_NO_INIT + + + + + MSR_VAR_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + POWER_ON + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_POWER_ON_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_FAST_POWER_ON_CLEARED + + + + + MSR_VAR_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + POWER_ON + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_POWER_ON_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_FAST_POWER_ON_INIT + + + + + + + MSR_VAR_SAVED_ZONE + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RETENTION_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenVarGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificRomRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariantHandling/vLinkGenVarGroupVariantSpecifics/vLinkGenVarGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_VAR_SAVED_ZONE_POWER_ON_INIT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + POWER_ON + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_SAVED_ZONE_POWER_ON_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_SAVED_ZONE_FAST_POWER_ON_INIT + + + + + MSR_VAR_SAVED_ZONE_POWER_ON_CLEARED + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + POWER_ON + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_SAVED_ZONE_POWER_ON_CLEARED + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_VAR_SAVED_ZONE_FAST_POWER_ON_CLEARED + + + + + + + Brs_Startup_Code + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/STARTUP_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/StartupCode_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoUpd + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplStartupCode_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + + + Brs_Startup_Code + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsStartup + + + + + BrsMain_Startup_Code + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsMainStartup + + + + + + + Brs_Shared_Var + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/SHARED_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/Variables_Shared + + + + + Brs_Shared_Var + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsSharedVar + + + + + + + Brs_Shared_Const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + Brs_Shared_Const + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsSharedConst + + + + + + + Brs_ExcVect + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/R5SS0_CORE1_TCMA/CoreExceptions_R5SS0_CORE1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoUpd + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplCoreExceptions_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + + + Brs_ExcVect + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVectConst + + + + + + + Brs_ExcVectRam + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupInitCore + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + Brs_ExcVectRam + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + COPY_TO_RAM + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVectRam + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVectRamConst + + + + + + + Brs_ApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/APPLICATION_ENTRY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/ApplicationEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblApplicationEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplApplicationEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + Brs_ApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsApplicationEntry + + + + + + + Const_Default + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1000 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + text + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/text + + + + + rodata + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/rodata + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/rodata_const + + + + + + + MSR_CODE + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_CODE + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_CODE + + + + + + + MSR_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_CONST_FAST + + + + + + + MSR_PBCFG_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + MSR_PBCFG_CONST + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MSR_PBCFG_CONST_FAST + + + + + + + Fbl_EepDummy_Shared + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_EepDummyArea/EepDummy + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + EepDummySection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + HARD_RESET_ONLY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/EepDummySection + + + + + + + Fbl_MagicFlag_Shared + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_MagicFlagArea/MagicFlag + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + MagicFlagSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + ZERO_INIT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + HARD_RESET_ONLY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MagicFlagSection + + + + + + + Fbl_EepDummy_SharedNoinit + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_EepDummyArea/EepDummy + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + EepDummySectionNoinit + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/EepDummySection + + + + + + + Fbl_MagicFlag_SharedNoinit + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_MagicFlagArea/MagicFlag + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + MagicFlagSectionNoinit + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MagicFlagSection + + + + + + + Fbl_FblHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblHeader + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + FblHeaderSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FblHeaderSection + + + + + + + FblAppl_BmHdrHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblBmHdrHeader + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + FblBmHdrHeaderGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/BmHdrHeaderSection + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblBmHdrHeader + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplBmHdrHeader + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + + + Fbl_PresencePattern + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblBlockValPresencePattern + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + Fbl_PP + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FblPresencePatternSection + + + + + + + Appl_ApplVect + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplVect + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + APPLVECT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupSize + 8 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/ApplVectSection + + + + + + + Bm_BmHeader + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_BmHeader/BmHeader + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + + + BmHeaderSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/BmHeaderSection + + + + + + + FblUpd_RamCode + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + RamCodeSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + COPY_TO_RAM + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/RamCodeSection + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + + + FblUpd_RamConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupInitCore + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + RamConstSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + COPY_TO_RAM + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/RamConstSection + + + + + vMemHeaderSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 100 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FlashDrvHeaderSection + + + + + vMemFooterSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 100 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FlashDrvFooterSection + + + + + vLinkGenConstGroupVariantHandling + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling + + + DemoFbl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_FlashBootloader/FblRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + + + DemoUpd_DemoAppl + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Const_ApplicationOrUpdater/ApplRomArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariantHandling/vLinkGenConstGroupVariantSpecifics/vLinkGenConstGroupSpecificVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + + + + + Startup_Labels_NoFirstExec + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + + + Startup_Label_NoFirstExec + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolName + brsStartupEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolValue + Brs_ApplicationEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolPosition + 0 + + + + + + + ApplVectSymbols + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + + + RESETVECT + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolName + RESETVECT + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolValue + brsStartupEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolPosition + 0 + + + + + RESETVECT_1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolName + _START + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolValue + brsStartupEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolPosition + 0 + + + + + RESETVECT_2 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolName + Startup_Handler + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolValue + brsStartupEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolPosition + 0 + + + + + + + FlashDrv_CodeConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1000 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_FlashDrvArea/FlashDrvArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FlashDrv + + + + + text + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/text + + + + + rodata + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/rodata + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/rodata_const + + + + + FlashDrv_RamCodeSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/RamCodeSection + + + + + FlashDrv_RamConstSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/RamConstSection + + + + + + + FlashDrv_Data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 250 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_FlashDrvArea/FlashDrvArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FlashDrv + + + + + data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/data + + + + + bss + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 500 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/bss + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/stack + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/heap + + + + + + + Var_FlashDrvArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + + + + + FlashDrvArea + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitCore + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + HARD_RESET_ONLY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + + + + + FlashDrv_Header + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FlashDrv + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_FlashDrvArea/FlashDrvArea + + + + + FlashDrvHeaderSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FlashDrvHeaderSection + + + + + + + FlashDrv_Footer + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 2000 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FlashDrv + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_FlashDrvArea/FlashDrvArea + + + + + FlashDrvFooterSectionGroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FlashDrvFooterSection + + + + + + + FblUpd_FlashDrv + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 0 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/Var_FlashDrvArea/FlashDrvArea + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoFbl + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoUpd + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FirstExecInst + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_DemoAppl + + + + + FblFlashDrvSection + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/FblFlashDrvSection + + + + + + + FlashDrvSymbols + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupPosition + 3 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenSymbolGroupVariant + /ActiveEcuC/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant_FlashDrv + + + + + StartupEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolName + brsStartupEntry + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalSymbolGroup/vLinkGenLinkerSymbol/vLinkGenLinkerSymbolValue + 0 + + + + + + + OCSRAM + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + /ActiveEcuC/vBaseEnv/vBaseEnvGeneral/OCSRAM + + + + + StartupCode_FirstExecInst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 1024 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/STARTUP_CODE + + + + + ApplicationEntry + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 256 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/APPLICATION_ENTRY + + + + + OCSRAM + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_INTVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_INTVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_INTVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_INTVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_EXCVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_EXCVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/STACKS + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CODE_COPY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CONST_COPY + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RETENTION_DATA + + + + + Variables_Shared + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 16 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/SHARED_DATA + + + + + StartupStack_Shared + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 4096 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + UPPER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/STARTUP_STACK + + + + + + + R5SS0_CORE0_TCMA + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + /ActiveEcuC/vBaseEnv/vBaseEnvGeneral/R5SS0_CORE0_TCMA + + + + + CoreExceptions_R5SS0_CORE0 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 96 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockCore + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + + + + + R5SS0_CORE1_TCMA + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + /ActiveEcuC/vBaseEnv/vBaseEnvGeneral/R5SS0_CORE1_TCMA + + + + + CoreExceptions_R5SS0_CORE1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 96 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockCore + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + + + + + R5SS1_CORE0_TCMA + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + /ActiveEcuC/vBaseEnv/vBaseEnvGeneral/R5SS1_CORE0_TCMA + + + + + CoreExceptions_R5SS1_CORE0 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 96 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockCore + 2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + + + + + R5SS1_CORE1_TCMA + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddrOffset + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionSize + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionAvailable + true + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionHwRegion + /ActiveEcuC/vBaseEnv/vBaseEnvGeneral/R5SS1_CORE1_TCMA + + + + + CoreExceptions_R5SS1_CORE1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockSize + 96 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockCore + 3 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockAddress + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockBoundary + LOWER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockInitStage + NONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CODE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenMemoryRegion/vLinkGenMemoryRegionBlock/vLinkGenMemoryRegionBlockContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + + + + + Brs_ExcVect1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupCore + 1 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/R5SS0_CORE1_TCMA/CoreExceptions_R5SS0_CORE1 + + + + + Brs_ExcVect1 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect1Const + + + + + + + Brs_ExcVect2 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupCore + 2 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/R5SS0_CORE1_TCMA/CoreExceptions_R5SS0_CORE1 + + + + + Brs_ExcVect2 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect2 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect2Const + + + + + + + Brs_ExcVect3 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 1 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupCore + 3 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupContentType + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_EXCVEC_CONST + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/R5SS0_CORE1_TCMA/CoreExceptions_R5SS0_CORE1 + + + + + Brs_ExcVect3 + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect3 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVect3Const + + + + + + + R5F_Startup_Code + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + R5F_Startup_Code + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/startupCode + + + + + + + R5F_Startup_Data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + R5F_Startup_Data + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/startupData + + + + + + + TI_sysfw_sections_const_devgroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + TI_sysfw_sections_const_devgroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupEndAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/DMSC_INTERNAL_const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MAIN_const + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MCU_WAKEUP_const + + + + + + + TI_sysfw_sections_bss_devgroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarGroupRegion + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/OCSRAM/OCSRAM + + + + + TI_sysfw_sections_bss_devgroup + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupEndAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInit + NONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupInitStage + ONE + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/BOARDCFG_DATA + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/DATA_USER + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/DMSC_INTERNAL_var + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MAIN_var + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalVarGroup/vLinkGenVarSectionGroup/vLinkGenVarSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/MCU_WAKEUP_var + + + + + + + Brs_ExcVectRamConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupPosition + 5 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstGroupRegion + + + + + Brs_ExcVectRamConst + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInit + COPY_TO_RAM + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupInitStage + ONE + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupPosition + 0 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupAlignment + 4 + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupEndAlignment + 4 + + + + + /MICROSAR/vLinkGen/vLinkGenMemLayout/vLinkGenLogicalConstGroup/vLinkGenConstSectionGroup/vLinkGenConstSectionGroupRef + /ActiveEcuC/vLinkGen/vLinkGenMemLayout/vLinkGenLinkerSections/brsExcVectRamConst + + + + + + + + + vLinkGenContentTypes + /MICROSAR/vLinkGen/vLinkGenContentTypes + + + vHsmGlobalRamBuffer + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + + + vHsmIpcMemory + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + + + RAM_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CODE_COPY + + + + + RAM_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/RAM_CONST_COPY + + + + + GLOBAL_DATA + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + + + LOCAL_DATA + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + true + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/LOCAL_CONST + + + + + RETENTION_DATA + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeCopyRef + /ActiveEcuC/vLinkGen/vLinkGenContentTypes/GLOBAL_CONST + + + + + GLOBAL_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + GLOBAL_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + GLOBAL_EXCVEC_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_EXCVEC_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + GLOBAL_EXCVEC_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_EXCVEC_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + GLOBAL_INTVEC_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_INTVEC_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + GLOBAL_INTVEC_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + LOCAL_INTVEC_CONST + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + true + + + + + STARTUP_CODE + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + STARTUP_STACK + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + true + + + + + STACKS + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + true + + + + + RAM_CODE_COPY + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + RAM_CONST_COPY + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + SHARED_DATA + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenVarContentType/vLinkGenVarContentTypeLocal + false + + + + + APPLICATION_ENTRY + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType + + + /MICROSAR/vLinkGen/vLinkGenContentTypes/vLinkGenConstContentType/vLinkGenConstContentTypeLocal + false + + + + + + + vLinkGenGeneral + /MICROSAR/vLinkGen/vLinkGenGeneral + + + /MICROSAR/vLinkGen/vLinkGenGeneral/vLinkGenFileGeneration + ONE_FILE_PER_VARIANT + + + /MICROSAR/vLinkGen/vLinkGenGeneral/vLinkGen64BitMemoryMode + false + + + + + vLinkGenVariantHandling + /MICROSAR/vLinkGen/vLinkGenVariantHandling + + + vLinkGenVariant_FirstExecInst + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant + + + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant/vLinkGenVariant_isFirstExec + true + + + + + vLinkGenVariant_DemoFbl + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant + + + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant/vLinkGenVariant_isStandardAppl + true + + + + + vLinkGenVariant_DemoAppl + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant + + + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant/vLinkGenVariant_isStandardAppl + true + + + + + vLinkGenVariant_DemoUpd + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant + + + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant/vLinkGenVariant_isStandardAppl + true + + + + + vLinkGenVariant_FlashDrv + /MICROSAR/vLinkGen/vLinkGenVariantHandling/vLinkGenVariant + + + + + vLinkGenPublishedInformation + /MICROSAR/vLinkGen/vLinkGenPublishedInformation + + + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenGeneration + 2 + + + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenDuplicatedLabels + false + + + + + vLinkGenRegionBlockFlags + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenRegionBlockFlags + + + EXECUTE + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenRegionBlockFlags/vLinkGenRegionBlockFlag + + + READ + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenRegionBlockFlags/vLinkGenRegionBlockFlag + + + WRITE + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenRegionBlockFlags/vLinkGenRegionBlockFlag + + + INIT + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenRegionBlockFlags/vLinkGenRegionBlockFlag + + + + + vLinkGenConstGroupFlags + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenConstGroupFlags + + + NOLOAD + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenConstGroupFlags/vLinkGenConstGroupFlag + + + PALIGN_BLOCK + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenConstGroupFlags/vLinkGenConstGroupFlag + + + + + vLinkGenVarGroupFlags + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenVarGroupFlags + + + NOLOAD + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenVarGroupFlags/vLinkGenVarGroupFlag + + + PALIGN_BLOCK + /MICROSAR/vLinkGen/vLinkGenPublishedInformation/vLinkGenVarGroupFlags/vLinkGenVarGroupFlag + + + + + + + + + + + diff --git a/config/Davinci/Config/ECUC/FLex_OBC_BM_vSet_vSet_ecuc.arxml b/config/Davinci/Config/ECUC/FLex_OBC_BM_vSet_vSet_ecuc.arxml new file mode 100644 index 0000000..823b4d6 --- /dev/null +++ b/config/Davinci/Config/ECUC/FLex_OBC_BM_vSet_vSet_ecuc.arxml @@ -0,0 +1,837 @@ + + + + + ActiveEcuC + + + vSet + + + + false + + + + + /ActiveEcuC/vSet/vSetBswInitialization/CryIf_InitMemory + + + /ActiveEcuC/vSet/vSetBswInitialization/CryIf_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/CryIf_InitMemory/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/CryIf_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_LibCv_InitMemory + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_LibCv_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_LibCv_InitMemory/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_LibCv_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_vHsm_InitMemory + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_vHsm_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_vHsm_InitMemory/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Crypto_30_vHsm_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Csm_InitMemory + + + /ActiveEcuC/vSet/vSetBswInitialization/Csm_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Csm_InitMemory/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Csm_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_Init + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_Start + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_InitMemory + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_Start/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Det_InitMemory/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Brs_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/Brs_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/vBaseEnv_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/vBaseEnv_Init/vSetInitFunctionInstance + + + + + /ActiveEcuC/vSet/vSetBswInitialization/vLinkGen_Init + + + + + /ActiveEcuC/vSet/vSetBswInitialization/vLinkGen_Init/vSetInitFunctionInstance + + + + + + /MICROSAR/vSet + VARIANT-PRE-COMPILE + /MICROSAR/vSet_Impl + + + vSetGeneral + /MICROSAR/vSet/vSetGeneral + + + /MICROSAR/vSet/vSetGeneral/vSetDummyStatementKind + SelfAssignment + + + + + vSetPlatform + /MICROSAR/vSet/vSetPlatform + + + /MICROSAR/vSet/vSetPlatform/vSetSizeOfRAMPointer + Size32Bit + + + /MICROSAR/vSet/vSetPlatform/vSetSizeOfEnum + Size32Bit + + + /MICROSAR/vSet/vSetPlatform/vSetBitOrder + LSB_to_MSB + + + /MICROSAR/vSet/vSetPlatform/vSetSizeOfInt + Size32Bit + + + /MICROSAR/vSet/vSetPlatform/vSetCPUType + CPU32Bit + + + /MICROSAR/vSet/vSetPlatform/vSetSizeOfROMPointer + Size32Bit + + + /MICROSAR/vSet/vSetPlatform/vSetByteOrder + LITTLE_ENDIAN + + + + + vSetCalibration + /MICROSAR/vSet/vSetCalibration + + + vSetBswInitialization + /MICROSAR/vSet/vSetBswInitialization + + + CryIf_InitMemory + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Interface +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + CryIf.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/CryIf + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_MEMORY + + + + +
+ + CryIf_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Interface +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + CryIf.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/CryIf + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_TWO_IF + + + + +
+ + Crypto_30_LibCv_InitMemory + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Driver +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Crypto_30_LibCv.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Crypto + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_MEMORY + + + + +
+ + Crypto_30_LibCv_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Driver +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Crypto_30_LibCv.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Crypto + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_TWO_DRV + + + + +
+ + Crypto_30_vHsm_InitMemory + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Driver +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Crypto_30_vHsm.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Crypto_001 + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_MEMORY + + + + +
+ + Crypto_30_vHsm_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Driver +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Crypto_30_vHsm.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Crypto_001 + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_TWO_DRV + + + + +
+ + Csm_InitMemory + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes variables of the Crypto Service Manager +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Csm.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Csm + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_MEMORY + + + + +
+ + Csm_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Initializes the Crypto Service Manager +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Csm.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Csm + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_TWO_SYS + + + + +
+ + Det_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Init function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Det.h + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetConfigType + Det_ConfigType + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetConfigPtrClass + DET_INIT_DATA + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Det + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_ZERO + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetConfigPtrName + Det_Config_Ptr + + + + +
+ + Det_Start + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ PostInit function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Det.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Det + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_ONE + + + + +
+ + Det_InitMemory + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ InitMemory function description of Det in UnfilteredViewInInvariantProject (UnfilteredInvariantProjectModelView) . +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + Det.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/Det + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + INIT_MEMORY + + + + +
+ + Brs_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Automatically generated by BswInitFctConfigurationService. +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/vBRS + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + NO_INIT + + + + +
+ + vBaseEnv_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Created vBaseEnv_Init by Extended Init XML Service +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/vBaseEnv + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + NO_INIT + + + + +
+ + vLinkGen_Init + + + + DV:vSetBswInitFunction + +

+ PLAIN_TEXT +

+

+ Dummy initialization of the vLinkGen +

+
+
+
+ /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetHeader + vLinkGen_Lcfg.h + + + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetModuleRef + /ActiveEcuC/vLinkGen + + + + + vSetInitFunctionInstance + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance + + + /MICROSAR/vSet/vSetBswInitialization/vSetInitFunction/vSetInitFunctionInstance/vSetInitPhase + NO_INIT + + + + +
+
+
+
+
+
+
+
+
diff --git a/config/Davinci/Config/InternalBehavior/Crypto_30_LibCv_ib_bswmd.arxml b/config/Davinci/Config/InternalBehavior/Crypto_30_LibCv_ib_bswmd.arxml new file mode 100644 index 0000000..5d8ded0 --- /dev/null +++ b/config/Davinci/Config/InternalBehavior/Crypto_30_LibCv_ib_bswmd.arxml @@ -0,0 +1,76 @@ + + + + + MICROSAR + + + Crypto_30_LibCv_ib_bswmd + + + BswModuleDescriptions + + + Crypto + + + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto_30_LibCv_MainFunction + + + + + Crypto_30_LibCv + + + CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0 + + This critical section protects workspace locking resources, the job queue and the NvBlock state. Furthermore, it ensures the consistency of the global RAM variables for the last job and default random source data.Therefore the critical section enclosed with CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0 should never be interrupted by any other API. For more details, see DocTechRef. + + + + CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1 + + This critical section protects key locking resources and ensures the consistency of the key data. If the CRYPTO is accessed by multiple partitions, either key locking has to be disabled (then this critical section implementation can be configured as None) or this critical section implementation has to be configured as Spinlock.Therefore the critical section enclosed with CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1 should never be interrupted by any other API. For more details, see DocTechRef. + + + + CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2 + + This critical section protects long-term workspace locking resources. If the CRYPTO is accessed by multiple partitions, either the services which use a long-term workspace have only to be used on one partition or this critical section implementation has to be configured as Spinlock. Therefore the critical section enclosed with CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2 should never be interrupted by any other API. For more details, see DocTechRef. + + + + + + Crypto_30_LibCv_MainFunction + + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_LibCv/CRYPTO_30_LIBCV_EXCLUSIVE_AREA_0 + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_LibCv/CRYPTO_30_LIBCV_EXCLUSIVE_AREA_1 + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_LibCv/CRYPTO_30_LIBCV_EXCLUSIVE_AREA_2 + + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto_30_LibCv_MainFunction + + + + + Crypto_30_LibCv_MainFunctionTimingEvent0 + /MICROSAR/Crypto_30_LibCv_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_LibCv/Crypto_30_LibCv_MainFunction + 0.01 + + + + + + + Crypto_30_LibCv_MainFunction + SCHEDULED + TASK + + + + + + + + + diff --git a/config/Davinci/Config/InternalBehavior/Crypto_30_vHsm_ib_bswmd.arxml b/config/Davinci/Config/InternalBehavior/Crypto_30_vHsm_ib_bswmd.arxml new file mode 100644 index 0000000..55d8d03 --- /dev/null +++ b/config/Davinci/Config/InternalBehavior/Crypto_30_vHsm_ib_bswmd.arxml @@ -0,0 +1,90 @@ + + + + + MICROSAR + + + Crypto_30_vHsm_ib_bswmd + + + BswModuleDescriptions + + + Crypto + + + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto_30_vHsm_MainFunction + + + + + Crypto_30_vHsm + + + CRYPTO_30_VHSM_EXCLUSIVE_AREA_0 + + This critical section protects workspace locking resources. Therefore the critical section enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_0 should never be interrupted by any other API. For more details, see DocTechRef. + + + + CRYPTO_30_VHSM_EXCLUSIVE_AREA_1 + + This critical section ensures that a forwarded DET from the vHsm is processed only once (Flag is located in the IPC memory).Therefore the critical section enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_1 should ensure that the Crypto_30_vHsm_MainFuncion does not interrupt an ongoing Job Processing. Otherwise, a DET could be notified twice. + + + + CRYPTO_30_VHSM_EXCLUSIVE_AREA_2 + + This critical section protects workspace locking resources when it can not be ensured that uint32 write access is atomic.The critical section enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_2 does not need to be protected against interruption by other API calls when the combination of hardware and compiler can guarantee atomic uint32 write operations.The critical section can therefore be empty in this case. If atomic uint32 write access can not be guaranteed, the critical sections enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_2 should ensure that they should never be interrupted by any other API + + + + CRYPTO_30_VHSM_EXCLUSIVE_AREA_3 + + This critical section protects workspace locking resources when it can not be ensured that uint32 write access is atomic.The critical section enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_3 does not need to be protected against interruption by other API calls when the combination of hardware and compiler can guarantee atomic uint32 write operations.The critical section can therefore be empty in this case. If atomic uint32 write access can not be guaranteed, the critical sections enclosed with CRYPTO_30_VHSM_EXCLUSIVE_AREA_3 should ensure that they should never be interrupted by any other API. If interrupt mode of the driver is used and ISRs can not be interrupted by other interrupts, this critical section does not need to be protected. + + + + CRYPTO_30_VHSM_EXCLUSIVE_AREA_4 + + This critical section protects HOST2HSM register via a spinlock if multiple partitions are configured because multiple cores need to write to the register._EXCLUSIVE_AREA_4 should ensure that write access does not happen from two partitions at the same time. If only one partition is configured, this critical section does not need to be protected + + + + + + Crypto_30_vHsm_MainFunction + + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/CRYPTO_30_VHSM_EXCLUSIVE_AREA_0 + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/CRYPTO_30_VHSM_EXCLUSIVE_AREA_1 + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/CRYPTO_30_VHSM_EXCLUSIVE_AREA_2 + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/CRYPTO_30_VHSM_EXCLUSIVE_AREA_3 + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/CRYPTO_30_VHSM_EXCLUSIVE_AREA_4 + + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto_30_vHsm_MainFunction + + + + + Crypto_30_vHsm_MainFunctionTimingEvent0 + /MICROSAR/Crypto_30_vHsm_ib_bswmd/BswModuleDescriptions/Crypto/Crypto_30_vHsm/Crypto_30_vHsm_MainFunction + 0.01 + + + + + + + Crypto_30_vHsm_MainFunction + SCHEDULED + TASK + + + + + + + + + diff --git a/config/Davinci/Config/InternalBehavior/Csm_ib_bswmd.arxml b/config/Davinci/Config/InternalBehavior/Csm_ib_bswmd.arxml new file mode 100644 index 0000000..ace0a53 --- /dev/null +++ b/config/Davinci/Config/InternalBehavior/Csm_ib_bswmd.arxml @@ -0,0 +1,55 @@ + + + + + MICROSAR + + + Csm_ib_bswmd + + + BswModuleDescriptions + + + Csm + + + /MICROSAR/Csm_ib_bswmd/BswModuleDescriptions/Csm_Virtual + + + + + Behavior + + + CSM_EXCLUSIVE_AREA_0 + + This critical section protects queuing resources that can be accessed from various contexts. Therefore the critical section enclosed with CSM_EXCLUSIVE_AREA_0 should never be interrupted by any Csm API which accesses queuing resources. For more details, see DocTechRef. + + + + + + Csm_Virtual + + /MICROSAR/Csm_ib_bswmd/BswModuleDescriptions/Csm/Behavior/CSM_EXCLUSIVE_AREA_0 + + /MICROSAR/Csm_ib_bswmd/BswModuleDescriptions/Csm_Virtual + + + + + + + Csm_Virtual + REGULAR + TASK + + + + + + + + + diff --git a/config/Davinci/Config/InternalBehavior/Det_ib_bswmd.arxml b/config/Davinci/Config/InternalBehavior/Det_ib_bswmd.arxml new file mode 100644 index 0000000..5843542 --- /dev/null +++ b/config/Davinci/Config/InternalBehavior/Det_ib_bswmd.arxml @@ -0,0 +1,55 @@ + + + + + MICROSAR + + + Det_ib_bswmd + + + BswModuleDescriptions + + + Det + + + /MICROSAR/Det_ib_bswmd/BswModuleDescriptions/Det_Virtual + + + + + DetBehavior + + + DET_EXCLUSIVE_AREA_0 + + Critical section to guarantee atomic handling of log buffer, requires global interrupt disabling. + + + + + + Det_Virtual + + /MICROSAR/Det_ib_bswmd/BswModuleDescriptions/Det/DetBehavior/DET_EXCLUSIVE_AREA_0 + + /MICROSAR/Det_ib_bswmd/BswModuleDescriptions/Det_Virtual + + + + + + + Det_Virtual + REGULAR + TASK + + + + + + + + + diff --git a/config/Davinci/FLex_OBC_BM.JidhinAngadithazha.silent.dcusr b/config/Davinci/FLex_OBC_BM.JidhinAngadithazha.silent.dcusr new file mode 100644 index 0000000..31dadc5 --- /dev/null +++ b/config/Davinci/FLex_OBC_BM.JidhinAngadithazha.silent.dcusr @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/Davinci/FLex_OBC_BM.dpa b/config/Davinci/FLex_OBC_BM.dpa new file mode 100644 index 0000000..aa5a36a --- /dev/null +++ b/config/Davinci/FLex_OBC_BM.dpa @@ -0,0 +1,309 @@ + + + + FLex_OBC_BM + 1.0 + JidhinAngadithazha + + + + AM263P4 + LlvmTexasInstruments + + CBD2501331_D00 + + Real Target + + + + false + false + + + Standard + + + bootmanager + + + .\Config\ECUC + ..\..\Source\GenData + .\Appl\GenDataVtt + ..\..\Source + .\Config\ServiceComponents + .\Log + .\..\..\..\..\vector\CBD2501331_D00_fbl-2 + + + .\Config\ApplicationComponents + + + .\Config\TimingExtensions + + .\Config\InternalBehavior + .\Config\McData + .\DefRestrict + .\Config\AUTOSAR + + + + + false + false + false + true + false + + + + + .\Config\ECUC\FLex_OBC_BM.ecuc.arxml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + true + + + .\Config\ECUC\FLex_OBC_BM.ecuc.arxml + + + + All + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + false + false + + + diff --git a/config/Davinci/Log/automationScriptRunHistory.log b/config/Davinci/Log/automationScriptRunHistory.log new file mode 100644 index 0000000..e69de29 diff --git a/j.bat b/j.bat new file mode 100644 index 0000000..25b451a --- /dev/null +++ b/j.bat @@ -0,0 +1,2 @@ +@echo off +call m.bat -j %NUMBER_OF_PROCESSORS% %* diff --git a/m.bat b/m.bat new file mode 100644 index 0000000..74670f7 --- /dev/null +++ b/m.bat @@ -0,0 +1,80 @@ +@echo off + +rem ***************************************************************************** +rem * This is a template batch file. The path might be adapted +rem ***************************************************************************** + +rem ***************************************************************************** +rem * MAKESUPPORT_DIR has to be set to MakeSupport root directory +rem * There MUST NOT be any blanks between the '=' sign and the path string +rem * Example: +rem * set MAKESUPPORT_DIR=..\..\MakeSupport +rem ***************************************************************************** + +set MAKESUPPORT_DIR=$$MAKESUPPORT_DIR + +rem Check if SWCP was used to set MAKESUPPORT_DIR +rem If not, its value is set to "" +set VAR_NAME=MAKESUPPORT_DIR +if %MAKESUPPORT_DIR% == $$%VAR_NAME% set MAKESUPPORT_DIR= + +rem ***************************************************************************** +rem * DO NOT EDIT ANYTHING BELOW THIS +rem * +rem * %~dp0 is the location where this file is started from. +rem ***************************************************************************** + +if "%MAKESUPPORT_DIR% "==" " goto ErrorNotSet +if not exist %MAKESUPPORT_DIR% goto ErrorWrongPath + +set PATH_OLD=%PATH% +call %~dp0%MAKESUPPORT_DIR%\set_cygwin_path.bat + +rem Replace GNU make help with MakeSupport help when 'm -h' is executed +if ["%~1"]==["-h"] ( + make help + goto Skip +) + +rem ***************************************************************************** +rem * Run make and store its return value afterwards. +rem * The return value is passed to the caller of m.bat at the end of the file. +rem ***************************************************************************** +make -Otarget %* + +:Skip + +SET GNU_MAKE_RETURN_CODE=%ERRORLEVEL% +set PATH=%PATH_OLD% +set PATH_OLD= + +if "%GNU_MAKE_RETURN_CODE%" NEQ "0" goto ErrorGnuMake +set RETURN_CODE=0 + +goto End + +:ErrorNotSet +set RETURN_CODE=1 +echo ******************************************************************************** +echo Error: MAKESUPPORT_DIR has to be set to MakeSupport\cygwin_root\cmd directory! +echo Please correct setting in this batch file and try again! +echo ******************************************************************************** +goto End + +:ErrorWrongPath +set RETURN_CODE=1 +echo ******************************************************************************** +echo Error: %MAKESUPPORT_DIR% does not exist +echo Please correct setting in this batch file and try again! +echo ******************************************************************************** +goto End + +:ErrorGnuMake +set RETURN_CODE=1 +echo ******************************************************************************** +echo Error: GNU make returned code "%GNU_MAKE_RETURN_CODE%" +echo ******************************************************************************** + +:End +set MAKESUPPORT_DIR= +exit /b %RETURN_CODE%