1 #include "tommath_private.h"
2 #ifdef BN_MP_INIT_MULTI_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
8 mp_err
mp_init_multi(mp_int
*mp
, ...)
10 mp_err err
= MP_OKAY
; /* Assume ok until proven otherwise */
11 int n
= 0; /* Number of ok inits */
15 va_start(args
, mp
); /* init args to next argument from caller */
16 while (cur_arg
!= NULL
) {
17 if (mp_init(cur_arg
) != MP_OKAY
) {
18 /* Oops - error! Back-track and mp_clear what we already
19 succeeded in init-ing, then return error.
23 /* now start cleaning up */
25 va_start(clean_args
, mp
);
28 cur_arg
= va_arg(clean_args
, mp_int
*);
35 cur_arg
= va_arg(args
, mp_int
*);
38 return err
; /* Assumed ok, if error flagged above. */