all repos — TinyCrypT @ 43e5111ab6cd81f31651342552a4b451f9f0fff2

Short and sweet classical cryptographic primitives

tinycrypt/pctablegen.c (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
#include "tinycrypt/ed25519.h"
#include <stdint.h>
#include <stdio.h>

int
main (int argc, const char **argv)
{
  uint8_t lut[61440];
  tct_ed25519_pctable_gen (lut);
  printf ("#include <stdint.h>\n");
  printf ("const static uint8_t PRECOMPUTE_TABLE[61440] = {\n    ");
  for (unsigned int i = 0; i < 61440; ++i)
    {
      printf ("0x%02x, ", lut[i]);
      if (i % 16 == 15)
        {
          printf ("\n    ");
        }
    }
  printf ("};\n");
  return 0;
}