• This repository has been archived on 25/Nov/2023
  • Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    C
  • License
    The Unlicense
  • Created over 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unlicensed tiny / small portable implementation of 128/256-bit AES encryption in C, x86, AMD64, ARM32 and ARM64 assembly

AES Block Cipher

AES-dust is a compact Implementation of the AES block cipher with support for 128-bit keys.

Modes Supported

Mode Description Available
ECB Electronic Code Book Yes
CBC Cipher Block Chaining Yes
OFB Output Feedback Yes
CTR Counter No
GCM Galois/Counter No
CFB Cipher Feedback No

All code is intentionally optimized for size rather than speed making it suitable for resource constrained environments. It has been tested successfully on 32 and 64-bit architectures (running in little-endian mode) and on an Arduino Uno.

Files

All files with .s and .asm extensions are compatible with the GNU assembler (GAS) except for the files in the MSVC folder that will assemble with either NASM or YASM.

File Description
aes.c AES-128 and AES-256 in C for 8-bit, 32-bit and 64-bit architectures.
mctest.c Monte Carlo test for AES-128 and AES-256 in ECB mode.
test128.c Test unit for AES-128 in ECB and CTR mode.
asm/x86/ax.s AES-128 in x86 assembly.
asm/amd64/ax.s AES-128 in AMD64 assembly.
asm/arm32/ax.s AES-128 in ARM32 assembly.
asm/arm64/ax.s AES-128 in ARM64 assembly.

Assembly

The below table shows code sizes for the hand written versions of AES-128

Architecture ECB CTR
x86 188 255
AMD64 315 339
ARM32 352
ARM64 352

C generated assembly

The following table lists the size of assembly code generated by the GNU C compiler.

Architecture ECB CTR
x86 524 701
AMD64 451 682
ARM32 480 668
ARM64 640 940

The following table lists the size of assembly code generated by the Microsoft C compiler.

Architecture ECB CTR
x86 358 493
AMD64 481 693
ARM32 372 502
ARM64 536 880

Side channel attacks

AES was never intended to be resistant against side channel attacks. However, if you decide to use this code for an embedded project that requires a high level of security, first evaluate whether the code is sufficient against such attacks before including in your project.

Acknowledgements

MarkC for optimizations.

Licensing information

Initially this was published with a BSD license. I decided to unlicense hoping more people would use and provide useful feedback.

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/