/src/dropbear/libtommath/bn_mp_init_copy.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include "tommath_private.h" |
2 | | #ifdef BN_MP_INIT_COPY_C |
3 | | /* LibTomMath, multiple-precision integer library -- Tom St Denis */ |
4 | | /* SPDX-License-Identifier: Unlicense */ |
5 | | |
6 | | /* creates "a" then copies b into it */ |
7 | | mp_err mp_init_copy(mp_int *a, const mp_int *b) |
8 | 60 | { |
9 | 60 | mp_err err; |
10 | | |
11 | 60 | if ((err = mp_init_size(a, b->used)) != MP_OKAY) { |
12 | 0 | return err; |
13 | 0 | } |
14 | | |
15 | 60 | if ((err = mp_copy(b, a)) != MP_OKAY) { |
16 | 0 | mp_clear(a); |
17 | 0 | } |
18 | | |
19 | 60 | return err; |
20 | 60 | } |
21 | | #endif |