Coverage Report

Created: 2023-03-20 06:28

/src/dropbear/libtommath/bn_mp_submod.c
Line
Count
Source (jump to first uncovered line)
1
#include "tommath_private.h"
2
#ifdef BN_MP_SUBMOD_C
3
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
4
/* SPDX-License-Identifier: Unlicense */
5
6
/* d = a - b (mod c) */
7
mp_err mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d)
8
0
{
9
0
   mp_err err;
10
0
   mp_int t;
11
12
0
   if ((err = mp_init(&t)) != MP_OKAY) {
13
0
      return err;
14
0
   }
15
16
0
   if ((err = mp_sub(a, b, &t)) != MP_OKAY) {
17
0
      goto LBL_ERR;
18
0
   }
19
0
   err = mp_mod(&t, c, d);
20
21
0
LBL_ERR:
22
0
   mp_clear(&t);
23
0
   return err;
24
0
}
25
#endif