Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 4
    $\begingroup$ Note that this is not a secure sample code because a smart compiler will notice that power_temp is never used and that its defining RHS doesn't have side-effects as per the language specification and will optimize it away. A better solution would be to remove the if and add a constant time conditional copy in the next line. $\endgroup$ Commented Oct 31, 2019 at 18:49
  • $\begingroup$ @SEJPM I'll look into that. $\endgroup$ Commented Oct 31, 2019 at 18:56
  • 2
    $\begingroup$ I think the basic python interpreter doesn't do dead-store / dead-code elimination. But I suppose it's not a great idea to make such an implicit assumption about the interpreter / compiler and "just providing a secure example" might be a better plan. Also to counter power-analysis attacks multiplicative blinding may be necessary. $\endgroup$ Commented Oct 31, 2019 at 19:19