diff options
Diffstat (limited to 'pyecsca/codegen/templates/rand.c')
| -rw-r--r-- | pyecsca/codegen/templates/rand.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pyecsca/codegen/templates/rand.c b/pyecsca/codegen/templates/rand.c new file mode 100644 index 0000000..e39c829 --- /dev/null +++ b/pyecsca/codegen/templates/rand.c @@ -0,0 +1,16 @@ +#include "bn/bn.h" +#include "action.h" +{% from "action.c" import start_action, end_action %} + +bn_err bn_rand_mod(bn_t *out, const bn_t *mod) { + {{ start_action("random_mod") }} + + #if MOD_RAND == MOD_RAND_SAMPLE + bn_err err = bn_rand_mod_sample(out, mod); + #elif MOD_RAND == MOD_RAND_REDUCE + bn_err err = bn_rand_mod_reduce(out, mod); + #endif + + {{ end_action("random_mod") }} + return err; +}
\ No newline at end of file |
