LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_init.c (source / functions) Hit Total Coverage
Test: coverage report for v4-17-test 1498b464 Lines: 7 8 87.5 %
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_INIT_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* init a new mp_int */
       7        1962 : mp_err mp_init(mp_int *a)
       8             : {
       9             :    /* allocate memory required and clear it */
      10        1962 :    a->dp = (mp_digit *) MP_CALLOC((size_t)MP_PREC, sizeof(mp_digit));
      11        1962 :    if (a->dp == NULL) {
      12           0 :       return MP_MEM;
      13             :    }
      14             : 
      15             :    /* set the used to zero, allocated digits to the default precision
      16             :     * and sign to positive */
      17        1962 :    a->used  = 0;
      18        1962 :    a->alloc = MP_PREC;
      19        1962 :    a->sign  = MP_ZPOS;
      20             : 
      21        1962 :    return MP_OKAY;
      22             : }
      23             : #endif

Generated by: LCOV version 1.13