BeRTOS
isaac.h
Go to the documentation of this file.
00001 
00038 #ifndef SEC_PRNG_ISAAC_H
00039 #define SEC_PRNG_ISAAC_H
00040 
00041 #include <sec/prng.h>
00042 
00057 #define CONFIG_ISAAC_RANDSIZL   (3)
00058 #define CONFIG_ISAAC_RANDSIZ    (1<<(CONFIG_ISAAC_RANDSIZL))
00059 
00060 typedef struct IsaacContext
00061 {
00062     PRNG prng;
00063     uint32_t randcnt;
00064     uint32_t randrsl[CONFIG_ISAAC_RANDSIZ];
00065     uint32_t randmem[CONFIG_ISAAC_RANDSIZ];
00066     uint32_t randa;
00067     uint32_t randb;
00068     uint32_t randc;
00069 } IsaacContext;
00070 
00071 void isaac_init(IsaacContext *ctx);
00072 
00073 #define isaac_stackinit(...) \
00074     ({ IsaacContext *ctx = alloca(sizeof(IsaacContext)); isaac_init(ctx , ##__VA_ARGS__); &ctx->prng; })
00075 
00076 
00077 #endif /* SEC_PRNG_ISAAC_H */