Merge pull request #578 from PX4/fix_mp_prime_strong_lucas_lefridge_compilation
[libtommath.git] / mp_init_copy.c
blob4d0773badec202253293af6e810eded91f48b9bc
1 #include "tommath_private.h"
2 #ifdef MP_INIT_COPY_C
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */
4 /* SPDX-License-Identifier: Unlicense */
6 /* creates "a" then copies b into it */
7 mp_err mp_init_copy(mp_int *a, const mp_int *b)
9 mp_err err;
11 if ((err = mp_init_size(a, b->used)) != MP_OKAY) {
12 return err;
15 if ((err = mp_copy(b, a)) != MP_OKAY) {
16 mp_clear(a);
19 return err;
21 #endif