Skip to content

Commit

Permalink
[M2351] Hook crypto interrupt handler without NVIC_SetVector
Browse files Browse the repository at this point in the history
  • Loading branch information
ccli8 committed Feb 11, 2019
1 parent 267f62e commit 8988b6e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions targets/TARGET_NUVOTON/TARGET_M2351/crypto/crypto-misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ static SingletonPtr<PlatformMutex> crypto_ecc_mutex;
/* Atomic flag for crypto SHA AC management */
static core_util_atomic_flag crypto_sha_atomic_flag = CORE_UTIL_ATOMIC_FLAG_INIT;

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


/* Crypto (AES, DES, SHA, etc.) init counter. Crypto's keeps active as it is non-zero. */
static uint16_t crypto_init_counter = 0U;
Expand Down Expand Up @@ -104,8 +99,7 @@ void crypto_init(void)
* NOTE: We must call secure version (from non-secure domain) because SYS/CLK regions are secure.
*/
CLK_EnableModuleClock_S(CRPT_MODULE);

NVIC_SetVector(CRPT_IRQn, (uint32_t) CRPT_IRQHandler);

NVIC_EnableIRQ(CRPT_IRQn);
}
core_util_critical_section_exit();
Expand Down Expand Up @@ -315,8 +309,13 @@ static bool crypto_submodule_wait(volatile uint16_t *submodule_done)
return false;
}

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

Expand Down

0 comments on commit 8988b6e

Please sign in to comment.