LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_sqr.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 13 16 81.2 %
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_SQR_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* computes b = a*a */
       7      718732 : mp_err mp_sqr(const mp_int *a, mp_int *b)
       8             : {
       9       33132 :    mp_err err;
      10      718732 :    if (MP_HAS(S_MP_TOOM_SQR) && /* use Toom-Cook? */
      11      718732 :        (a->used >= MP_TOOM_SQR_CUTOFF)) {
      12           0 :       err = s_mp_toom_sqr(a, b);
      13      718732 :    } else if (MP_HAS(S_MP_KARATSUBA_SQR) &&  /* Karatsuba? */
      14      685600 :               (a->used >= MP_KARATSUBA_SQR_CUTOFF)) {
      15        2869 :       err = s_mp_karatsuba_sqr(a, b);
      16      715863 :    } else if (MP_HAS(S_MP_SQR_FAST) && /* can we use the fast comba multiplier? */
      17      715863 :               (((a->used * 2) + 1) < MP_WARRAY) &&
      18      682731 :               (a->used < (MP_MAXFAST / 2))) {
      19      715863 :       err = s_mp_sqr_fast(a, b);
      20           0 :    } else if (MP_HAS(S_MP_SQR)) {
      21           0 :       err = s_mp_sqr(a, b);
      22             :    } else {
      23             :       err = MP_VAL;
      24             :    }
      25      718732 :    b->sign = MP_ZPOS;
      26      718732 :    return err;
      27             : }
      28             : #endif

Generated by: LCOV version 1.14