Today I like to share some encryption code, which can be used in various situations – and is also useful for embedded systems.
It is a unique implementation of the AES 256 / CBC crypto algorithm. The goal of this implementation was neither speed nor size. It was written to inline it into existing code.
The compiler will create a new instance of the algorithm on the fly, at the place where you insert it into the code. Depending of used optimization flags, this inlined code can get very compact.
I had numerous goals and constraints while I created this implementation:
- Completely inline.
- Generated by the compiler on the fly.
- Easy to read and understand.
- Suitable for embedded processors.
- No static tables (S-Box) in memory or the binary.
- Minimal dependencies (
- Compatible with other AES 256 / CBC implementation.
The following things were not relevant to me:
- Multiple algorithms
- Error checking of inputs
Requirements and Usage
The requirements are very minimal, all