mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/crypto: define ciphers via pseudomodules
This commit is contained in:
parent
dc89c279b2
commit
f6c4e269b1
@ -9,6 +9,7 @@ PSEUDOMODULES += cord_ep_standalone
|
||||
PSEUDOMODULES += core_%
|
||||
PSEUDOMODULES += cortexm_fpu
|
||||
PSEUDOMODULES += cpu_check_address
|
||||
PSEUDOMODULES += crypto_% # crypto_aes or crypto_3des
|
||||
PSEUDOMODULES += devfs_%
|
||||
PSEUDOMODULES += dhcpv6_%
|
||||
PSEUDOMODULES += ecc_%
|
||||
|
@ -16,7 +16,11 @@ ifneq (,$(filter i2c_scan,$(USEMODULE)))
|
||||
endif
|
||||
|
||||
ifneq (,$(filter prng_fortuna,$(USEMODULE)))
|
||||
CFLAGS += -DCRYPTO_AES
|
||||
USEMODULE += crypto_aes
|
||||
endif
|
||||
|
||||
ifneq (,$(filter crypto_%,$(USEMODULE)))
|
||||
USEMODULE += crypto
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/sys/test_utils/Makefile.dep
|
||||
|
@ -30,17 +30,10 @@ extern "C" {
|
||||
|
||||
/* Shared header file for all cipher algorithms */
|
||||
|
||||
/* Set the algorithms that should be compiled in here. When these defines
|
||||
* are set, then packets will be compiled 5 times.
|
||||
*/
|
||||
// #define CRYPTO_THREEDES
|
||||
// #define CRYPTO_AES
|
||||
|
||||
/** @brief the length of keys in bytes */
|
||||
#define CIPHERS_MAX_KEY_SIZE 20
|
||||
#define CIPHER_MAX_BLOCK_SIZE 16
|
||||
|
||||
|
||||
/**
|
||||
* Context sizes needed for the different ciphers.
|
||||
* Always order by number of bytes descending!!! <br><br>
|
||||
@ -48,9 +41,9 @@ extern "C" {
|
||||
* threedes needs 24 bytes <br>
|
||||
* aes needs CIPHERS_MAX_KEY_SIZE bytes <br>
|
||||
*/
|
||||
#if defined(CRYPTO_THREEDES)
|
||||
#if defined(MODULE_CRYPTO_3DES)
|
||||
#define CIPHER_MAX_CONTEXT_SIZE 24
|
||||
#elif defined(CRYPTO_AES)
|
||||
#elif defined(MODULE_CRYPTO_AES)
|
||||
#define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE
|
||||
#else
|
||||
/* 0 is not a possibility because 0-sized arrays are not allowed in ISO C */
|
||||
|
Loading…
Reference in New Issue
Block a user