I am trying to perform simple power analysis on RSA. In particular focusing the modular exponentiation module and for this I have implemented left-to-right variant of binary exponentiation.
pseudo code of the implemented algorithm is as follows:
Result = a^b mod N k = length(b); Result = 1; for i = k-1 to 0 do Result = (Result X Result) mod N; // SQUARING if b[i] == 1 Result = (Result X a) mod N; // MULTIPLICATION end if end for
From the acquired power trace, I cannot differentiate between square and multiplication samples just by looking at the trace.
I also tried by performing a correlation test between the first operation(i.e. square) and all the other operations but i get the same level of correlation peaks for all the operations.
So from these observations can I conclude that my implementation is SPA resistant at least with respect to the regularity between the patterns of both operations.
My second question is, if it is SPA resistant then why in some of the cases which I read on internet have different pattern for both operations. Even though in practice they also use same multiplication algorithm for both squaring and multiplication as I did.