BeRTOS
random.h
Go to the documentation of this file.
00001 
00042 #ifndef SEC_RANDOM_H
00043 #define SEC_RANDOM_H
00044 
00045 #include "cfg/cfg_random.h"
00046 #include <cfg/compiler.h>
00047 
00085 #define RANDOM_SECURITY_MINIMUM        0
00086 #define RANDOM_SECURITY_MEDIUM         1
00087 #define RANDOM_SECURITY_STRONG         2
00088 
00090 void random_init(void);
00091 
00092 void random_gen(uint8_t *out, size_t len);
00093 
00094 INLINE uint8_t random_gen8(void)
00095 {
00096     uint8_t x;
00097     random_gen(&x, 1);
00098     return x;
00099 }
00100 
00101 INLINE uint16_t random_gen16(void)
00102 {
00103     uint8_t x;
00104     random_gen(&x, 2);
00105     return x;
00106 }
00107 
00108 INLINE uint32_t random_gen32(void)
00109 {
00110     uint8_t x;
00111     random_gen(&x, 4);
00112     return x;
00113 }
00114 
00115 #endif /* SEC_RANDOM_H */