MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxCsslParamIntegrity.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-2021, 2025 NXP */
3/* */
4/* SPDX-License-Identifier: BSD-3-Clause */
5/* */
6/* Redistribution and use in source and binary forms, with or without */
7/* modification, are permitted provided that the following conditions are */
8/* met: */
9/* */
10/* 1. Redistributions of source code must retain the above copyright */
11/* notice, this list of conditions and the following disclaimer. */
12/* */
13/* 2. Redistributions in binary form must reproduce the above copyright */
14/* notice, this list of conditions and the following disclaimer in the */
15/* documentation and/or other materials provided with the distribution. */
16/* */
17/* 3. Neither the name of the copyright holder nor the names of its */
18/* contributors may be used to endorse or promote products derived from */
19/* this software without specific prior written permission. */
20/* */
21/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS */
22/* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
23/* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A */
24/* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
25/* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
26/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
27/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR */
28/* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
29/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
30/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
31/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
32/*--------------------------------------------------------------------------*/
33
42
43#ifndef MCUXCSSLPARAMINTEGRITY_H
44#define MCUXCSSLPARAMINTEGRITY_H
45
46#include <stdint.h>
47#include <stddef.h>
48#include <stdbool.h>
51
59
66
67#define MCUXCSSLPARAMINTEGRITY_BASE_CHECKSUM ((mcuxCsslParamIntegrity_Checksum_t)0xb7151628u)
68
69#define MCUXCSSLPARAMINTEGRITY_CHECK_VALID ((mcuxCsslParamIntegrity_Checksum_t)0x6969u)
70
71#define MCUXCSSLPARAMINTEGRITY_CHECK_INVALID ((mcuxCsslParamIntegrity_Checksum_t)0x9696u)
72
73#define MCUX_CSSL_PI_PARAM_ADD_CASTED_ARG(x) ,( \
74 MCUX_CSSL_ANALYSIS_START_SUPPRESS_TYPECAST_BETWEEN_INTEGER_AND_POINTER("Typecast pointer to integer for parameter integrity evaluation") \
75 (mcuxCsslParamIntegrity_Param_t)(x) \
76 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_TYPECAST_BETWEEN_INTEGER_AND_POINTER())
77
78#define MCUX_CSSL_PI_VALIDATE(chk, ...) (mcuxCsslParamIntegrity_Validate(chk, MCUX_CSSL_CPP_ARGCOUNT(__VA_ARGS__) MCUX_CSSL_CPP_MAP(MCUX_CSSL_PI_PARAM_ADD_CASTED_ARG, __VA_ARGS__)))
79
80#define MCUX_CSSL_PI_PROTECT(...) (mcuxCsslParamIntegrity_Protect(MCUX_CSSL_CPP_ARGCOUNT(__VA_ARGS__) MCUX_CSSL_CPP_MAP(MCUX_CSSL_PI_PARAM_ADD_CASTED_ARG, __VA_ARGS__)))
81
85
92
96typedef void * mcuxCsslParamIntegrity_AssertionCpuWordSize_t[(4u == sizeof(size_t)) ? (+1) : (-1)];
97
102
107
108
112
119
129
142
146
150
151#endif
Provides the API for the CSSL flow protection mechanism.
Definition of function identifiers for the flow protection mechanism.
#define MCUX_CSSL_FP_FUNCTION_DECL(...)
Declaration of a flow protected function.
Definition mcuxCsslFlowProtection.h:186
#define MCUX_CSSL_FP_PROTECTED_TYPE(resultType)
Based on a given base type, builds a return type with flow protection.
Definition mcuxCsslFlowProtection.h:158
uint32_t mcuxCsslParamIntegrity_Param_t
Type of a parameter for the checksum calculation.
Definition mcuxCsslParamIntegrity.h:106
uint32_t mcuxCsslParamIntegrity_Checksum_t
Type of a parameter checksum.
Definition mcuxCsslParamIntegrity.h:101
void * mcuxCsslParamIntegrity_AssertionCpuWordSize_t[(4u==sizeof(size_t)) ?(+1) :(-1)]
Build time assertion to ensure CPU word size of 32 bit.
Definition mcuxCsslParamIntegrity.h:96
mcuxCsslParamIntegrity_Checksum_t mcuxCsslParamIntegrity_Validate(mcuxCsslParamIntegrity_Checksum_t chk, uint32_t nargs,...)
Verifies the correctness of a parameter checksum.
mcuxCsslParamIntegrity_Checksum_t mcuxCsslParamIntegrity_Protect(uint32_t nargs,...)
Calculates a parameter checksum.