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 v4-17-test 1498b464 Lines: 4 6 66.7 %
Date: 2024-06-13 04:01:37 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          38 : 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          38 :    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          38 :    if (MP_HAS(S_MP_INVMOD_FAST) && MP_IS_ODD(b)) {
      16          38 :       return s_mp_invmod_fast(a, b, c);
      17             :    }
      18             : 
      19             :    return MP_HAS(S_MP_INVMOD_SLOW)
      20             :           ? s_mp_invmod_slow(a, b, c)
      21           0 :           : MP_VAL;
      22             : }
      23             : #endif

Generated by: LCOV version 1.13