1 /* LibTomPoly, Polynomial Basis Math -- Tom St Denis
3 * LibTomPoly is a public domain library that provides
4 * polynomial basis arithmetic support. It relies on
5 * LibTomMath for large integer support.
7 * This library is free for all purposes without any
8 * express guarantee that it works.
10 * Tom St Denis, tomstdenis@iahu.ca, http://poly.libtomcrypt.org
15 int pb_init_multi(mp_int
*characteristic
, pb_poly
*pb
, ...)
17 mp_err res
= MP_OKAY
; /* Assume ok until proven otherwise */
18 int n
= 0; /* Number of ok inits */
19 pb_poly
* cur_arg
= pb
;
22 va_start(args
, pb
); /* init args to next argument from caller */
23 while (cur_arg
!= NULL
) {
24 if (pb_init(cur_arg
, characteristic
) != MP_OKAY
) {
25 /* Oops - error! Back-track and mp_clear what we already
26 succeeded in init-ing, then return error.
30 /* end the current list */
33 /* now start cleaning up */
35 va_start(clean_args
, pb
);
38 cur_arg
= va_arg(clean_args
, pb_poly
*);
45 cur_arg
= va_arg(args
, pb_poly
*);
48 return res
; /* Assumed ok, if error flagged above. */