LCOV - code coverage report
Current view: top level - third_party/heimdal/lib/hcrypto/libtommath - bn_mp_init_size.c (source / functions) Hit Total Coverage
Test: coverage report for vadcx-master-patch-75612 fe003de8 Lines: 8 9 88.9 %
Date: 2024-02-29 22:57:05 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "tommath_private.h"
       2             : #ifdef BN_MP_INIT_SIZE_C
       3             : /* LibTomMath, multiple-precision integer library -- Tom St Denis */
       4             : /* SPDX-License-Identifier: Unlicense */
       5             : 
       6             : /* init an mp_init for a given size */
       7       54756 : mp_err mp_init_size(mp_int *a, int size)
       8             : {
       9       54756 :    size = MP_MAX(MP_MIN_PREC, size);
      10             : 
      11             :    /* alloc mem */
      12       54756 :    a->dp = (mp_digit *) MP_CALLOC((size_t)size, sizeof(mp_digit));
      13       54756 :    if (a->dp == NULL) {
      14           0 :       return MP_MEM;
      15             :    }
      16             : 
      17             :    /* set the members */
      18       54756 :    a->used  = 0;
      19       54756 :    a->alloc = size;
      20       54756 :    a->sign  = MP_ZPOS;
      21             : 
      22       54756 :    return MP_OKAY;
      23             : }
      24             : #endif

Generated by: LCOV version 1.14