LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_s_mp_prime_is_divisible.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 0 12 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_S_MP_PRIME_IS_DIVISIBLE_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* determines if an integers is divisible by one
       7             :  * of the first PRIME_SIZE primes or not
       8             :  *
       9             :  * sets result to 0 if not, 1 if yes
      10             :  */
      11           0 : mp_err s_mp_prime_is_divisible(const mp_int *a, mp_bool *result)
      12             : {
      13           0 :    int      ix;
      14           0 :    mp_err   err;
      15           0 :    mp_digit res;
      16             : 
      17             :    /* default to not */
      18           0 :    *result = MP_NO;
      19             : 
      20           0 :    for (ix = 0; ix < PRIVATE_MP_PRIME_TAB_SIZE; ix++) {
      21             :       /* what is a mod LBL_prime_tab[ix] */
      22           0 :       if ((err = mp_mod_d(a, s_mp_prime_tab[ix], &res)) != MP_OKAY) {
      23           0 :          return err;
      24             :       }
      25             : 
      26             :       /* is the residue zero? */
      27           0 :       if (res == 0u) {
      28           0 :          *result = MP_YES;
      29           0 :          return MP_OKAY;
      30             :       }
      31             :    }
      32             : 
      33           0 :    return MP_OKAY;
      34             : }
      35             : #endif

Generated by: LCOV version 1.14