C implementation of the PRESENT Block Cipher.
PRESENT is a lightweight block cipher algorithm designed in 2007 by Andrey Bogdanov, Lars R. Knudsen, Gregor Leander, Christof Paar, Axel Poschmann, Matthew J. B. Robshaw, Yannick Seurin, and C. Vikkelsoe.
The project was designed mainly for embedded systems but it is suitable to use in any platform.
The module could be used by either adding source files directly to the project, or compiling as a static library via pre-included build system.
To build the module as a static library, TYPE
tag in the
Config.mk file must be chosen as SLIB
. Additional source
files could be added. The build system detects and adds those file directly
to the source tree.
Object files(and assembly files if the ASM_GEN
flag is set) and out file
are placed to bin
folder.
By default, the project has a test main file under the test
folder.
To adding custom main function, the test_main.c
file must be excluded from
the source tree.
To build the project, at the project root folder, run:
$ make
By default, make
command compile files only when something changes in the
source code. To build whole project in any case, run:
$ make rebuild
To remove all generated files, run:
$ make clean
The project has a test code which could be found under test
folder. The code
demonstrates encrypt and decrypt operations with text blocks and keys given in
appendix I of the article.
Test outputs are placed to bin/test
folder. Results could be seen by running
test out files.
To build test files, run:
$ make
Project configurations grouped under two category; module configurations and build configurations. If the module is not compiled as static library, build configurations are negligible.
Module configurations are found under conf.h file. All options related with modules are documented in that file.
Build configurations are found under Config.mk file. All options related with build system are documented in that file.
Additionally, tools used to build project could be configured via Tools.mk file and build rules could be configured via Rules.mk file.
NOTE: Every compiler has different features and flags. Therefore, Tools.mk and Rules.mk files may have to be rewritten.
This project is licensed under the MIT License - see the LICENSE file for details.