LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_mulmod.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 9 11 81.8 %
Date: 2024-04-21 15:09:00 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "tommath_private.h"
       2             : #ifdef BN_MP_MULMOD_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* d = a * b (mod c) */
       7         922 : mp_err mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d)
       8             : {
       9          32 :    mp_err err;
      10          32 :    mp_int t;
      11             : 
      12         922 :    if ((err = mp_init_size(&t, c->used)) != MP_OKAY) {
      13           0 :       return err;
      14             :    }
      15             : 
      16         922 :    if ((err = mp_mul(a, b, &t)) != MP_OKAY) {
      17           0 :       goto LBL_ERR;
      18             :    }
      19         922 :    err = mp_mod(&t, c, d);
      20             : 
      21         922 : LBL_ERR:
      22         922 :    mp_clear(&t);
      23         922 :    return err;
      24             : }
      25             : #endif

Generated by: LCOV version 1.14