MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxCsslFlowProtection_None.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2020-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
38
39#ifndef MCUX_CSSL_FLOW_PROTECTION_NONE_H_
40#define MCUX_CSSL_FLOW_PROTECTION_NONE_H_
41
42/* Include the CSSL C pre-processor support functionality. */
44
52
53
61
69#define MCUX_CSSL_FP_COUNTER_STMT_IMPL(statement) \
70 /* Intentionally empty. */
71
72
78
90#define MCUX_CSSL_FP_CONDITIONAL_IMPL(condition, ...) \
91 /* Intentionally empty. */
92
102#define MCUX_CSSL_FP_VOID_EXPECTATION_IMPL() \
103 (0u)
104
118#define MCUX_CSSL_FP_EXPECT_IMPL(...) \
119 /* Intentionally empty. */
120
129#define MCUX_CSSL_FP_ASSERT_IMPL(...) \
130 /* Intentionally empty. */
131
141
152#define MCUX_CSSL_FP_PROTECTED_TYPE_IMPL(resultType) \
153 resultType
154
166#define MCUX_CSSL_FP_FUNCTION_DECL_IMPL(...) \
167 /* Intentionally empty. */
168
177#define MCUX_CSSL_FP_FUNCTION_DEF_IMPL(...) \
178 /* Intentionally empty. */
179
188#define MCUX_CSSL_FP_FUNCTION_POINTER_IMPL(type, definition) \
189 definition
190
200#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL(...) \
201 /* Intentionally empty. */
202
211#define MCUX_CSSL_FP_RESULT_IMPL2(type, return) \
212 MCUX_CSSL_ANALYSIS_START_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES() \
213 MCUX_CSSL_ANALYSIS_START_SUPPRESS_TYPECAST_BETWEEN_INTEGER_AND_POINTER("Proper alignment is ensured during type cast") \
214 ((type)(return)) \
215 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_TYPECAST_BETWEEN_INTEGER_AND_POINTER() \
216 MCUX_CSSL_ANALYSIS_STOP_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
217
225#define MCUX_CSSL_FP_RESULT_IMPL1(return) \
226 (return)
227
236#define MCUX_CSSL_FP_RESULT_IMPL(...) \
237 MCUX_CSSL_CPP_OVERLOADED2(MCUX_CSSL_FP_RESULT_IMPL, __VA_ARGS__)
238
246#define MCUX_CSSL_FP_PROTECTION_TOKEN_IMPL(return) \
247 (0u)
248
262#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn(id, result, ...) \
263 return (result)
264
277#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1(id) \
278 MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn(id, 0u, 0u)
279
294#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2(id, result) \
295 MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn(id, result, 0u)
296
316#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL(...) \
317 MCUX_CSSL_CPP_OVERLOADED2(MCUX_CSSL_FP_FUNCTION_EXIT_IMPL, __VA_ARGS__)
318
334#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL(id, pass, fail,...) \
335 return (pass)
336
348#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL(...) \
349 return
350
360#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL3(type, result, call) \
361 type const result = MCUX_CSSL_FP_RESULT(type,call)
362
363
372#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL2(result, call) \
373 MCUX_CSSL_FP_FUNCTION_CALL_IMPL3(uint32_t, result, call)
374
387#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL(...) \
388 MCUX_CSSL_ANALYSIS_START_SUPPRESS_NULL_POINTER_CONSTANT("False positive, due to macro expansion, any usage of NULL is considered as 0 by Coverity") \
389 MCUX_CSSL_CPP_OVERLOADED3(MCUX_CSSL_FP_FUNCTION_CALL_IMPL, __VA_ARGS__) \
390 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_NULL_POINTER_CONSTANT()
391
402#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_IMPL(call) \
403 MCUX_CSSL_ANALYSIS_START_SUPPRESS_NULL_POINTER_CONSTANT("False positive, due to macro expansion, any usage of NULL is considered as 0 by Coverity") \
404 (call) \
405 MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_NULL_POINTER_CONSTANT()
406
419#define MCUX_CSSL_FP_FUNCTION_CALL_PROTECTED_IMPL(result, token, call) \
420 const uint32_t result = (call); \
421 const uint32_t token = 0u
422
434#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_PROTECTED_IMPL(token, call) \
435 (call); \
436 const uint32_t token = 0u
437
449#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL(result, token, call) \
450 MCUX_CSSL_FP_FUNCTION_CALL_PROTECTED_IMPL(result, token, call)
451
458#define MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL() \
459 /* Intentionally empty. */
460
471#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL(token, call) \
472 MCUX_CSSL_FP_FUNCTION_CALL_VOID_PROTECTED_IMPL(token, call)
473
480#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL() \
481 /* Intentionally empty. */
482
483
497#define MCUX_CSSL_FP_FUNCTION_CALLED_IMPL(id) \
498 (0u)
499
513#define MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL(id) \
514 (0u)
515
525
533#define MCUX_CSSL_FP_LOOP_DECL_IMPL(id) \
534 /* Intentionally empty. */
535
545#define MCUX_CSSL_FP_LOOP_ITERATION_IMPL(...) \
546 /* Intentionally empty. */
547
556#define MCUX_CSSL_FP_LOOP_ITERATIONS_IMPL(id, count) \
557 /* Intentionally empty. */
558
559
560
570
578#define MCUX_CSSL_FP_BRANCH_DECL_IMPL(id) \
579 /* Intentionally empty. */
580
596#define MCUX_CSSL_FP_BRANCH_POSITIVE_IMPL(...) \
597 /* Intentionally empty. */
598
614#define MCUX_CSSL_FP_BRANCH_NEGATIVE_IMPL(...) \
615 /* Intentionally empty. */
616
625#define MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE_IMPL(...) \
626 /* Intentionally empty. */
627
636#define MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE_IMPL(...) \
637 /* Intentionally empty. */
638
639
640
650
658#define MCUX_CSSL_FP_SWITCH_DECL_IMPL(id) \
659 /* Intentionally empty. */
660
671#define MCUX_CSSL_FP_SWITCH_CASE_IMPL(...) \
672 /* Intentionally empty. */
673
683#define MCUX_CSSL_FP_SWITCH_DEFAULT_IMPL(...) \
684 /* Intentionally empty. */
685
696#define MCUX_CSSL_FP_SWITCH_TAKEN_IMPL(...) \
697 /* Intentionally empty. */
698
707#define MCUX_CSSL_FP_SWITCH_TAKEN_DEFAULT_IMPL(...) \
708 /* Intentionally empty. */
709
710
711#endif /* MCUX_CSSL_FLOW_PROTECTION_NONE_H_ */
The default implementation is based on standard C preprocessor functionality.