Exemplo n.º 1
0
static void gen_a(poly *a, const unsigned char *seed)
{
    poly_uniform(a,seed);
}
Exemplo n.º 2
0
int main(void)
{
  poly sk_a;
  unsigned char key_a[32], key_b[32];
  unsigned char senda[NTESTS*NEWHOPE_SENDABYTES];
  unsigned char sendb[NTESTS*NEWHOPE_SENDBBYTES];
  unsigned char seed[NEWHOPE_SEEDBYTES];
  int i;

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    randombytes(seed, NEWHOPE_SEEDBYTES);
    poly_uniform(&sk_a, seed);
  }
  print_results("poly_uniform: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    poly_ntt(&sk_a);
  }
  print_results("poly_ntt: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    poly_invntt(&sk_a);
  }
  print_results("poly_invntt: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    poly_getnoise(&sk_a,seed,0);
  }
  print_results("poly_getnoise: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    helprec(&sk_a, &sk_a, seed, 0);
  }
  print_results("helprec: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    rec(key_a, &sk_a, &sk_a);
  }
  print_results("rec: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    newhope_keygen(senda+i*NEWHOPE_SENDABYTES, &sk_a);
  }
  print_results("newhope_keygen: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    newhope_sharedb(key_b, sendb+i*NEWHOPE_SENDBBYTES, senda+i*NEWHOPE_SENDABYTES);
  }
  print_results("newhope_sharedb: ", t, NTESTS);

  for(i=0; i<NTESTS; i++)
  {
    t[i] = cpucycles();
    newhope_shareda(key_a, &sk_a, sendb+i*NEWHOPE_SENDBBYTES);
  }
  print_results("newhope_shareda: ", t, NTESTS);
    
  
  return 0;
}