MCUX CLNS
MCUX Crypto Library Normal Secure
Loading...
Searching...
No Matches
mcuxCsslFlowProtection_SecureCounter_Local_AssemblyMacros.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/* Copyright 2025 NXP */
3/* */
4/* NXP Confidential and Proprietary. This software is owned or controlled */
5/* by NXP and may only be used strictly in accordance with the applicable */
6/* license terms. By expressly accepting such terms or by downloading, */
7/* installing, activating and/or otherwise using the software, you are */
8/* agreeing that you have read, and that you agree to comply with and are */
9/* bound by, such license terms. If you do not agree to be bound by the */
10/* applicable license terms, then you may not retain, install, activate or */
11/* otherwise use the software. */
12/*--------------------------------------------------------------------------*/
13
18
19#ifndef MCUXCSSLFLOWPROTECTION_SECURECOUNTER_LOCAL_ASSEMBLYMACROS_H_
20#define MCUXCSSLFLOWPROTECTION_SECURECOUNTER_LOCAL_ASSEMBLYMACROS_H_
21
23
29/* TODO: CLNS-18893 - Refactor header files to extract constants and prevent code duplication */
30#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_EXIT_MASK 0x5A5A5A5A
31
32#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) || defined(__GNUC__)
33
34.macro MCUX_CSSL_FP_ASM_FUNCTION_ENTRY rSc, rTmp, funcID
35 MCUX_CSSL_SC_ASM_INIT_BASE \rSc
36 ldr \rTmp, =(\funcID & MCUX_CSSL_FP_FUNCTION_ID_ENTRY_EXIT_MASK)
37 MCUX_CSSL_SC_ASM_ADD \rSc, \rTmp
38 .endm
39
40.macro MCUX_CSSL_FP_ASM_FUNCTION_CALL rSc, func
41 bl \func
42 MCUX_CSSL_SC_ASM_ADD \rSc, r1
43 .endm
44
45.macro MCUX_CSSL_FP_ASM_FUNCTION_EXIT rSc, rTmp, funcID
46 ldr \rTmp, =(\funcID - (\funcID & MCUX_CSSL_FP_FUNCTION_ID_ENTRY_EXIT_MASK))
47 MCUX_CSSL_SC_ASM_ADD \rSc, \rTmp /* rSc = VALUE(fn_identifier) - VALUE(fn_identifier) & EXIT_MASK */
48 .endm
49
50#elif defined(__IASMARM__) || defined(__ICCARM__)
51
52MCUX_CSSL_FP_ASM_FUNCTION_ENTRY macro rSc, rTmp, funcID
53 MCUX_CSSL_SC_ASM_INIT_BASE rSc
55 MCUX_CSSL_SC_ASM_ADD rSc, rTmp
56 endm
57
58MCUX_CSSL_FP_ASM_FUNCTION_CALL macro rSc, func
59 bl func
60 MCUX_CSSL_SC_ASM_ADD rSc, r1
61 endm
62
63MCUX_CSSL_FP_ASM_FUNCTION_EXIT macro rSc, rTmp, funcID
64 ldr rTmp, =(funcID - (funcID & MCUX_CSSL_FP_FUNCTION_ID_ENTRY_EXIT_MASK))
65 MCUX_CSSL_SC_ASM_ADD rSc, rTmp /* rSc = VALUE(fn_identifier) - VALUE(fn_identifier) & EXIT_MASK */
66 endm
67
68#endif /* defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) || defined(__GNUC__) */
69
70#endif /* MCUXCSSLFLOWPROTECTION_SECURECOUNTER_LOCAL_ASSEMBLYMACROS_H_ */
Assembly macros for the secure counter.
#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_EXIT_MASK
Mask to be used to derive entry and exit parts from a function identifier.
Definition mcuxCsslFlowProtection_SecureCounter_Local_AssemblyMacros.h:30