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

          Line data    Source code
       1             : #include "tommath_private.h"
       2             : #ifdef BN_MP_REDUCE_2K_SETUP_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* determines the setup value */
       7           0 : mp_err mp_reduce_2k_setup(const mp_int *a, mp_digit *d)
       8             : {
       9           0 :    mp_err err;
      10           0 :    mp_int tmp;
      11           0 :    int    p;
      12             : 
      13           0 :    if ((err = mp_init(&tmp)) != MP_OKAY) {
      14           0 :       return err;
      15             :    }
      16             : 
      17           0 :    p = mp_count_bits(a);
      18           0 :    if ((err = mp_2expt(&tmp, p)) != MP_OKAY) {
      19           0 :       mp_clear(&tmp);
      20           0 :       return err;
      21             :    }
      22             : 
      23           0 :    if ((err = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) {
      24           0 :       mp_clear(&tmp);
      25           0 :       return err;
      26             :    }
      27             : 
      28           0 :    *d = tmp.dp[0];
      29           0 :    mp_clear(&tmp);
      30           0 :    return MP_OKAY;
      31             : }
      32             : #endif

Generated by: LCOV version 1.14