From 07d8df90c971cf844bb066cafb523d73a898e0cd Mon Sep 17 00:00:00 2001 From: arighi Date: Wed, 9 Feb 2011 15:23:48 +0000 Subject: [PATCH] random: integrate the random module into the wizard git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4692 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cfg/cfg_random.h | 65 +++++++++++++++++++++++++++++++++++++++++ bertos/sec/prng/isaac.c | 1 + bertos/sec/random.h | 20 +++++++++---- 3 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 bertos/cfg/cfg_random.h diff --git a/bertos/cfg/cfg_random.h b/bertos/cfg/cfg_random.h new file mode 100644 index 00000000..5e3afdff --- /dev/null +++ b/bertos/cfg/cfg_random.h @@ -0,0 +1,65 @@ +/** + * \file + * + * + * \author Andrea Righi + * + * \brief Configuration file for the "random" module + */ + +#ifndef CFG_RANDOM_H +#define CFG_RANDOM_H + +/** + * Module logging level. + * + * $WIZ$ type = "enum" + * $WIZ$ value_list = "log_level" + */ +#define RANDOM_LOG_LEVEL LOG_LVL_INFO + +/** + * module logging format. + * + * $WIZ$ type = "enum" + * $WIZ$ value_list = "log_format" + */ +#define RANDOM_LOG_FORMAT LOG_FMT_TERSE + +/** + * Random security level. + * + * $WIZ$ type = "enum" + * $WIZ$ value_list = "random_level" + */ +#define RANDOM_SECURITY_LEVEL RANDOM_SECURITY_MINIMUM + +#endif /* CFG_RANDOM_H */ diff --git a/bertos/sec/prng/isaac.c b/bertos/sec/prng/isaac.c index f3320a54..6c0ddc1c 100644 --- a/bertos/sec/prng/isaac.c +++ b/bertos/sec/prng/isaac.c @@ -48,6 +48,7 @@ MODIFIED: #include "isaac.h" #include +#include #include #include #include diff --git a/bertos/sec/random.h b/bertos/sec/random.h index 04f570bb..cd103e70 100644 --- a/bertos/sec/random.h +++ b/bertos/sec/random.h @@ -33,18 +33,21 @@ * \brief High-level random number generation functions. * \author Giovanni Bajo * + * $WIZ$ module_name = "random" + * $WIZ$ module_configuration = "bertos/cfg/cfg_random.h" + * $WIZ$ module_supports = "stm32 or lm3s" */ #ifndef SEC_RANDOM_H #define SEC_RANDOM_H +#include "cfg/cfg_random.h" #include -#define RANDOM_SECURITY_MINIMUM 0 -#define RANDOM_SECURITY_MEDIUM 1 -#define RANDOM_SECURITY_STRONG 2 - /** + * \name Security level definition + * + * * Configure the security level required by the application. * * Application developers are suggested to keep the strongest @@ -74,9 +77,14 @@ * random numbers. Even if the generator is still secure on * paper, its seeding will not be safe (though still entropic * to allow different sequences to be generated after each reset). + * + * $WIZ$ random_level = "RANDOM_SECURITY_MINIMUM", "RANDOM_SECURITY_MEDIUM", "RANDOM_SECURITY_STRONG" + * \{ */ -#define RANDOM_SECURITY_LEVEL RANDOM_SECURITY_STRONG - +#define RANDOM_SECURITY_MINIMUM 0 +#define RANDOM_SECURITY_MEDIUM 1 +#define RANDOM_SECURITY_STRONG 2 +/** \} */ void random_init(void); -- 2.25.1