Mercurial > dropbear
comparison libtommath/bn_mp_init_copy.c @ 1733:d529a52b2f7c coverity coverity
merge coverity from main
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 26 Jun 2020 21:07:34 +0800 |
parents | 1051e4eea25a |
children |
comparison
equal
deleted
inserted
replaced
1643:b59623a64678 | 1733:d529a52b2f7c |
---|---|
1 #include <tommath_private.h> | 1 #include "tommath_private.h" |
2 #ifdef BN_MP_INIT_COPY_C | 2 #ifdef BN_MP_INIT_COPY_C |
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis | 3 /* LibTomMath, multiple-precision integer library -- Tom St Denis */ |
4 * | 4 /* SPDX-License-Identifier: Unlicense */ |
5 * LibTomMath is a library that provides multiple-precision | |
6 * integer arithmetic as well as number theoretic functionality. | |
7 * | |
8 * The library was designed directly after the MPI library by | |
9 * Michael Fromberger but has been written from scratch with | |
10 * additional optimizations in place. | |
11 * | |
12 * The library is free for all purposes without any express | |
13 * guarantee it works. | |
14 * | |
15 * Tom St Denis, [email protected], http://libtom.org | |
16 */ | |
17 | 5 |
18 /* creates "a" then copies b into it */ | 6 /* creates "a" then copies b into it */ |
19 int mp_init_copy (mp_int * a, mp_int * b) | 7 mp_err mp_init_copy(mp_int *a, const mp_int *b) |
20 { | 8 { |
21 int res; | 9 mp_err err; |
22 | 10 |
23 if ((res = mp_init_size (a, b->used)) != MP_OKAY) { | 11 if ((err = mp_init_size(a, b->used)) != MP_OKAY) { |
24 return res; | 12 return err; |
25 } | 13 } |
26 | 14 |
27 if((res = mp_copy (b, a)) != MP_OKAY) { | 15 if ((err = mp_copy(b, a)) != MP_OKAY) { |
28 mp_clear(a); | 16 mp_clear(a); |
29 } | 17 } |
30 | 18 |
31 return res; | 19 return err; |
32 } | 20 } |
33 #endif | 21 #endif |
34 | |
35 /* ref: $Format:%D$ */ | |
36 /* git commit: $Format:%H$ */ | |
37 /* commit time: $Format:%ai$ */ |