diff options
| author | J08nY | 2019-11-25 17:45:35 +0100 |
|---|---|---|
| committer | J08nY | 2019-11-25 17:45:35 +0100 |
| commit | 8a56c7a95e662862cfe78b834ccb091e95d5372f (patch) | |
| tree | 1fd57480b7fc681f00c0bfb6c0e5cfea86762f87 /pyecsca/codegen/main.c | |
| parent | c8d0bff46001bd5636825c5b0bb4c896cb34a4e6 (diff) | |
| download | pyecsca-codegen-8a56c7a95e662862cfe78b834ccb091e95d5372f.tar.gz pyecsca-codegen-8a56c7a95e662862cfe78b834ccb091e95d5372f.tar.zst pyecsca-codegen-8a56c7a95e662862cfe78b834ccb091e95d5372f.zip | |
Add libtommath, HOST build, and a simple PRNG.
Diffstat (limited to 'pyecsca/codegen/main.c')
| -rw-r--r-- | pyecsca/codegen/main.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pyecsca/codegen/main.c b/pyecsca/codegen/main.c index 65cf444..fba5dc2 100644 --- a/pyecsca/codegen/main.c +++ b/pyecsca/codegen/main.c @@ -4,22 +4,22 @@ #include "hal/hal.h" #include "simpleserial/simpleserial.h" #include "hash/hash.h" +#include "bn.h" +#include "prng.h" +#include <string.h> -uint8_t cmd_set_curve(uint8_t *data, uint16_t len) { +uint8_t cmd_init_prng(uint8_t *data, uint16_t len) { + prng_seed(data, len); return 0; } int main(void) { platform_init(); + prng_init(); init_uart(); trigger_setup(); simpleserial_init(); - void *ctx = hash_new_ctx(); - uint8_t thing[10] = {1,2,3,4,5,6,7,8,9,10}; - uint8_t out[hash_size(10)]; - hash_init(ctx); - hash_final(ctx, 10, thing, out); - simpleserial_addcmd('a', 256, cmd_set_curve); + simpleserial_addcmd('i', 4, cmd_init_prng); while(1) simpleserial_get(); return 0; |
