Problem with RSA encryption

Hi,

Some “security” functions need a lot of CPU resources.

This is the case with ngcBNModExp function: in your case it takes more than 40s to compute the result (on Q2687 running at 104MHz).

But if an Open AT task is using the CPU more than 8 seconds then a watchdog reset occurs.

So, for such functions you need to do 2 things:

  • switch the CPU speed from NORMAL (26Mhz) to BOOST (104MHz) --> this will increase the computation speed.
  • delay the watchdog reset to 60 seconds (or more) --> this will forbid the watchdog reset.

Nota: if you are doing your heavy computations in the main Open AT task then AT commands will be not available during the computation.

s32 VariSpeedHandle, TreatmentDuration;

VariSpeedHandle = adl_vsSubscribe();

...

adl_wdPut2Sleep(ADL_TMR_S_TO_TICK(60));
adl_vsSetClockMode ( VariSpeedHandle, ADL_VS_MODE_BOOST );
ngcBNModExp(_s, pre_encry, _d, _n, ctx);
adl_vsSetClockMode ( VariSpeedHandle, ADL_VS_MODE_STANDARD );
TreatmentDuration = adl_wdAwake();
TRACE((1, "Done in %d ticks!", ADL_TMR_S_TO_TICK(60) - TreatmentDuration));

Regards,

JayM2M