logoalt Hacker News

the8472 • today at 12:41 PM • 0 replies • view on HN

aws-lc is a lot of assembly, which you kinda need anyway. Neither Rust nor C are fully suitable for cryptography because common optimizing compiler backends (LLVM, GCC, MSVC) can introduce branches (even if you wrote it in a branchless manner!), making the crypto code vulnerable to side-channel attacks.

So the options are

  - write it in assembly
  - use a high-level language, then verify the generated assembly the compiler generates
  - write a new or modify an existing backend to support timing-independent code
aws-lc does the first, some other crypto libs try to do the 2nd but I don't know how solid that is and the 3rd one takes time.

base64 encode hopefully isn't used in places where it would be a timing channel, so it could still benefit from a safe Rust impl. And at least it's API could benefit from slices and Result