diff --git a/src/poly.c b/src/poly.c index b5b6dd7..c60b24b 100644 --- a/src/poly.c +++ b/src/poly.c @@ -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 diff --git a/src/poly.h b/src/poly.h index 9c2f988..20132cb 100644 --- a/src/poly.h +++ b/src/poly.h @@ -32,6 +32,9 @@ #include + +void init_integers(mp_int *new_int, ...); + unsigned int get_degree(pb_poly const * const poly); #define MP_SET(...) mp_set(__VA_ARGS__)