RAND: cleanup after merge

This commit is contained in:
hasufell 2014-05-19 21:58:56 +02:00
parent 2e222ccad3
commit cd1611c018
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 21 additions and 9 deletions

View File

@ -43,13 +43,14 @@
static mp_digit get_int_dev_random(void);
static mp_digit get_int_dev_urandom(void);
static mp_digit get_random_ternary(mp_digit random_int, int* sign);
static mp_int *get_random_bigint(mp_int *upper_bound, mp_int *lower_bound,
static mp_int *get_random_bigint(mp_int *upper_bound,
mp_int *lower_bound,
int entropy_source);
static unsigned int check_allowed_zeros(pb_poly *polynom);
/**
* Reads a single mp_digit out of /dev/random and returns this mp_digit
*
*
* @return the randomly chosen integer
*/
static mp_digit get_int_dev_random(void)
@ -126,11 +127,12 @@ static mp_digit get_random_ternary(mp_digit random_int, int* sign)
* entropy_source random_int TODO
* @return a mp_int with the random number
*/
static mp_int *get_random_bigint(mp_int *upper_bound, mp_int *lower_bound,
static mp_int *get_random_bigint(mp_int *upper_bound,
mp_int *lower_bound,
int entropy_source)
{
mp_int result;
init_integer(&result);
mp_int *result = NULL;
init_integer(result);
//TODO
@ -193,14 +195,19 @@ pb_poly *ntru_get_random_poly_ternary(size_t length, int entropy_source)
/**
* Gets a random polynomial with coefficients
* from the the borders of lower_bound to upper_bound using the given entropy source
* from the the borders of lower_bound to upper_bound
* using the given entropy source
*
* @param length the amount of coefficients
* @param entropy_source the source of entropy you want
* @return newly allocated polynomial, must be freed with delete_polynom()
*/
pb_poly *ntru_get_random_poly(int length, int entropy_source, mp_int *upper_bound,
pb_poly *ntru_get_random_poly(int length,
int entropy_source,
mp_int *upper_bound,
mp_int *lower_bound)
{
//TODO
return NULL;
}

View File

@ -22,6 +22,7 @@
#ifndef NTRU_RAND_H
#define NTRU_RAND_H
#include "context.h"
#include <tompoly.h>
@ -36,8 +37,12 @@
*/
#define GET_INT_FROM_RRAND 3
pb_poly *ntru_get_random_poly_ternary(int length, int entropy_source);
pb_poly *ntru_get_random_poly(size_t length, int entropy_source, mp_int *upper_bound,
pb_poly *ntru_get_random_poly_ternary(size_t length, int entropy_source);
pb_poly *ntru_get_random_poly(int length,
int entropy_source,
mp_int *upper_bound,
mp_int *lower_bound);
#endif /* NTRU_RAND_H */