post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
ntru_rnd.h File Reference

header for ntru_rnd.c More...

#include "ntru_params.h"
#include <stdlib.h>
#include <fmpz_poly.h>
Include dependency graph for ntru_rnd.h:

Go to the source code of this file.

Functions

int get_rnd_int (void)
 
int get_urnd_int (void)
 
void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
 

Detailed Description

header for ntru_rnd.c

Header for the internal API of ntru_rnd.c.

Definition in file ntru_rnd.h.

Function Documentation

int get_rnd_int ( void  )

Get a random integer from /dev/random.

Returns
random integer

Definition at line 42 of file ntru_rnd.c.

int get_urnd_int ( void  )

Get a pseudo random integer from /dev/urandom.

Returns
pseudo-random integer.

Definition at line 66 of file ntru_rnd.c.

void ntru_get_rnd_tern_poly_num ( fmpz_poly_t  poly,
const ntru_params params,
uint32_t  num_ones,
uint32_t  num_neg_ones,
int(*)(void)  rnd_int 
)

Get a random ternary polynomial with specified numbers of 1 coefficients and -1 coefficients.

Parameters
polythe resulting random polynomial [out]
paramsthe NTRU context
num_onesthe number of 1 coefficients
num_neg_onesthe number of -1 coefficients
rnd_intfunction callback which should return a random integer

Definition at line 86 of file ntru_rnd.c.