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

public API, random polynomials More...

#include <ntru.h>
#include <fmpz_poly.h>
#include <fmpz.h>
#include <stdint.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

public API, random polynomials

This file holds the public API of generating random ternary polynomials of the pqc NTRU implementation and is meant to be installed on the client system.

Definition in file ntru_rnd.h.

Function Documentation

int get_rnd_int ( void  )

Get a random integer from /dev/random.

Returns
random integer
int get_urnd_int ( void  )

Get a pseudo random integer from /dev/urandom.

Returns
pseudo-random integer.
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