I have been searching many websites for source code of AES whether it is ECB, CBC, CTR or any other method but can't find any. Can anyone please help me in getting the source code? I have to implement timing analysis on that code to see whether the code is leaky or non-leaky.

  • $\begingroup$ Do you have a specific target? Without it this is a broad question, with it, it may be off-topic! $\endgroup$ – kelalaka Dec 9 '19 at 21:21
  • 2
    $\begingroup$ There are quite a few AES implementations out there, and some will have timing side channel leaks, and some won't. Which implementation are you interested in? $\endgroup$ – poncho Dec 9 '19 at 21:26
  • $\begingroup$ AES with ECB, CBC, CTR is here and many other places. There's a simple 1-block AES-128 encryption in this answer. It will be leaky, or not, depending on platform and compilation parameters. $\endgroup$ – fgrieu Dec 9 '19 at 22:34
  • $\begingroup$ there are literally thousands of code samples for AES out there, possibly millions, openssl, wifi, and the linux kernel are the most common, and that code is everywhere $\endgroup$ – Richie Frame Dec 10 '19 at 0:38

As already mentioned in the comments to your question, implementations of AES are aplenty on Github, depending on the language you want to use and on the type of requirements you have, including the original ANSI C reference implementation.

However, if you are interested in timing analysis of AES implementations, you might as well want to take a look at the Dudect code.

Dudect comes from a paper named "Dude, is my code constant time?", it is a tool meant to detect timing discrepancies using Welch's t-test. It compares actual runs of a given source code against the null hypothesis that the code running is constant time.

It notably features as an example of variable time code a T-tables implementation of AES, which is a typical example of variable-time AES implementation. But it also bundles another example, which is a bitsliced constant-time AES implementation, to show the differences between variable time and constant time code.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.