https://github.com/cjhdev/moda
Modular AES
https://github.com/cjhdev/moda
Last synced: about 1 year ago
JSON representation
Modular AES
- Host: GitHub
- URL: https://github.com/cjhdev/moda
- Owner: cjhdev
- Created: 2014-12-29T19:34:34.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-12T12:49:54.000Z (over 9 years ago)
- Last Synced: 2025-01-21T03:42:37.538Z (over 1 year ago)
- Language: C
- Homepage: http://cjhdev.github.io/moda/
- Size: 679 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# MODA - Modular AES
[](https://travis-ci.org/cjhdev/moda)
An easy to integrate AES implementation for resource constrained targets.
Highlights:
- Source linted to MISRA 2012
- Embedded interface documentation
- Tests
- Compile time options for porting
## Modules
- AES
- byte oriented (512B of tables)
- support for 128, 196 and 256 bit keys
- AES GCM
- depends on AES
- table-less
- vector operations optimised for target word size
- single pass mode only
- AES Key Wrap
- depends on AES
- RFC 3394:2002
- AES CMAC
- depends on AES
- vector operations optimised for target word size
- NIST SP 800-38B
- single pass mode only
## Integrating With Your Project
Example makefile snippet:
~~~ mf
INCLUDES += $(DIR_MODA)/include
VPATH += $(DIR_MODA)/src
SRC += $(wildcard $(DIR_MODA)/src/*.c)
OBJECTS += $(SRC:.c=.o)
~~~
Add `#include "moda.h"` to source files that use the MODA API.
## Build Time Options
~~~
// define to remove assert.h (as per usual)
-DNDEBUG
// define to set target endian as big endian
// default: undefined (not relevant if MODA_WORD_SIZE == 1)
-DMODA_BIG_ENDIAN
// define to set target word size {1, 2, 4 or 8}
// default: 1
-DMODA_WORD_SIZE=4
// define to apply compiler specific restrict attribute
// default: __restrict__
-DMODA_RESTRICT=__restrict__
// include settings for putting constant data into program memory for avr gcc
// default: undefined
-DMODA_AVR_GCC_PROGMEM
// define to apply target specific attribute after sbox, rsbox and rcon constants
// default: undefined
-DMODA_CONST_POST=PROGMEM
// define to apply target specific attribute before sbox, rsbox and rcon constants
// default: undefined
-D'MODA_CONST_PRE=__flash'
// define an alternate instruction to use to access rsbox constant
// default: rsbox[C]
-D'RSBOX(C)=pgm_read_byte(&rsbox[C])'
// define an alternate instruction to use to access sbox constant
// default: sbox[C]
-D'SBOX(C)=pgm_read_byte(&sbox[C])'
// define an alternate instruction to use to access rcon constant
// default: rcon[C]
-D'RCON(C)=pgm_read_byte(&rcon[C])'
~~~
## Recommended Further Reading
[https://en.wikipedia.org/wiki/Side-channel_attack](https://en.wikipedia.org/wiki/Side-channel_attack)
## License
Moda has an MIT license.