rand_poly initial setup
This commit is contained in:
27
tests/test.c
Normal file
27
tests/test.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "test_util.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
printf("Running Test....\n");
|
||||
|
||||
uint16_t i;
|
||||
uint16_t modulus;
|
||||
uint16_t N;
|
||||
// int16_t coeffs[NTRU_INT_POLY_SIZE];
|
||||
// uint16_t a;
|
||||
|
||||
|
||||
|
||||
modulus = 4;
|
||||
N = 739;
|
||||
NtruIntPoly a, c;
|
||||
// a = 739;
|
||||
|
||||
printf("%d\n", modulus);
|
||||
printf("%d\n", N);
|
||||
// printf("%d\n", &a);
|
||||
|
||||
rand_poly(&a, N, modulus);
|
||||
}
|
||||
19
tests/test_util.c
Normal file
19
tests/test_util.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "test_util.h"
|
||||
|
||||
|
||||
void rand_poly(NtruIntPoly *a, uint16_t N, uint16_t modulus){
|
||||
uint16_t i;
|
||||
int16_t coeffs[N];
|
||||
// int16_t coeffs;
|
||||
a->N = N;
|
||||
printf("-> ");
|
||||
for (i=0; i<N; i++){
|
||||
a->coeffs[i] = random() % modulus;
|
||||
printf("%d %d\n ", i+1, coeffs[i] );
|
||||
}
|
||||
}
|
||||
|
||||
11
tests/test_util.h
Normal file
11
tests/test_util.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef TEST_UTIL_H
|
||||
#define TEST_UTIL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "types.h"
|
||||
|
||||
void rand_poly(NtruIntPoly *a, uint16_t N, uint16_t modulus);
|
||||
|
||||
int main(int argc, char** argv);
|
||||
|
||||
#endif
|
||||
9
tests/testparams.h
Normal file
9
tests/testparams.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdint.h>
|
||||
#include <types.h>
|
||||
|
||||
#define NTRU_P 739
|
||||
#define NTRU_Q 9820
|
||||
#define NTRU_T 204
|
||||
|
||||
|
||||
uint8_t ntruprime_mult_poly(NtruIntPoly *a, NtruIntPoly *b, NtruIntPoly *c, uint16_t modulus);
|
||||
Reference in New Issue
Block a user