POLY: add init_integers()

This commit is contained in:
hasufell 2014-04-30 17:18:08 +02:00
parent 12fa21f5b2
commit 9c89b79627
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
2 changed files with 23 additions and 0 deletions

View File

@ -55,6 +55,26 @@ void init_integer(mp_int *new_int)
}
}
/**
* Initialize one ore more mp_int and check if this was successful, the
* caller must free new_int with mp_clear().
*
* @param new_int a pointer to the mp_int you want to initialize
*/
void init_integers(mp_int *new_int, ...)
{
mp_int *next_mp;
va_list args;
next_mp = new_int;
va_start(args, new_int);
while (next_mp != NULL) {
init_integer(next_mp);
next_mp = va_arg(args, mp_int*);
}
va_end(args);
}
/**
* Initialize a Polynom with a pb_poly and a mp_int as characteristic.
* Checks if everything went fine. The caller must free new_poly

View File

@ -32,6 +32,9 @@
#include <stdbool.h>
void init_integers(mp_int *new_int, ...);
unsigned int get_degree(pb_poly const * const poly);
#define MP_SET(...) mp_set(__VA_ARGS__)