Skip to content

Commit 8988b6e

Browse files
committed
[M2351] Hook crypto interrupt handler without NVIC_SetVector
1 parent 267f62e commit 8988b6e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ static SingletonPtr<PlatformMutex> crypto_ecc_mutex;
6060
/* Atomic flag for crypto SHA AC management */
6161
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;
6262

63-
/* NOTE: There's inconsistency in cryptography related naming, Crpt or Crypto. For example, cryptography IRQ
64-
* handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override default cryptography IRQ handler, see
65-
* device/startup_{CHIP}.c for its name or call NVIC_SetVector regardless of its name. */
66-
void CRPT_IRQHandler();
67-
6863

6964
/* Crypto (AES, DES, SHA, etc.) init counter. Crypto's keeps active as it is non-zero. */
7065
static uint16_t crypto_init_counter = 0U;
@@ -104,8 +99,7 @@ void crypto_init(void)
10499
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
105100
*/
106101
CLK_EnableModuleClock_S(CRPT_MODULE);
107-
108-
NVIC_SetVector(CRPT_IRQn, (uint32_t) CRPT_IRQHandler);
102+
109103
NVIC_EnableIRQ(CRPT_IRQn);
110104
}
111105
core_util_critical_section_exit();
@@ -315,8 +309,13 @@ static bool crypto_submodule_wait(volatile uint16_t *submodule_done)
315309
return false;
316310
}
317311

318-
/* Crypto interrupt handler */
319-
void CRPT_IRQHandler()
312+
/* Crypto interrupt handler
313+
*
314+
* There's inconsistency in cryptography related naming, Crpt or Crypto. For example,
315+
* cryptography IRQ handler could be CRPT_IRQHandler or CRYPTO_IRQHandler. To override
316+
* default cryptography IRQ handler, see device/startup_{CHIP}.c for its correct name
317+
* or call NVIC_SetVector() in crypto_init() regardless of its name. */
318+
extern "C" void CRPT_IRQHandler()
320319
{
321320
uint32_t intsts;
322321

0 commit comments

Comments
 (0)