LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_invmod.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 4 8 50.0 %
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_INVMOD_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* hac 14.61, pp608 */
       7         139 : mp_err mp_invmod(const mp_int *a, const mp_int *b, mp_int *c)
       8             : {
       9             :    /* b cannot be negative and has to be >1 */
      10         139 :    if ((b->sign == MP_NEG) || (mp_cmp_d(b, 1uL) != MP_GT)) {
      11           0 :       return MP_VAL;
      12             :    }
      13             : 
      14             :    /* if the modulus is odd we can use a faster routine instead */
      15         139 :    if (MP_HAS(S_MP_INVMOD_FAST) && MP_IS_ODD(b)) {
      16         139 :       return s_mp_invmod_fast(a, b, c);
      17             :    }
      18             : 
      19           0 :    return MP_HAS(S_MP_INVMOD_SLOW)
      20           0 :           ? s_mp_invmod_slow(a, b, c)
      21           0 :           : MP_VAL;
      22             : }
      23             : #endif

Generated by: LCOV version 1.14