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 master 2f515e9b Lines: 8 9 88.9 %
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_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       57110 : mp_err mp_init_size(mp_int *a, int size)
       8             : {
       9       57110 :    size = MP_MAX(MP_MIN_PREC, size);
      10             : 
      11             :    /* alloc mem */
      12       57110 :    a->dp = (mp_digit *) MP_CALLOC((size_t)size, sizeof(mp_digit));
      13       57110 :    if (a->dp == NULL) {
      14           0 :       return MP_MEM;
      15             :    }
      16             : 
      17             :    /* set the members */
      18       57110 :    a->used  = 0;
      19       57110 :    a->alloc = size;
      20       57110 :    a->sign  = MP_ZPOS;
      21             : 
      22       57110 :    return MP_OKAY;
      23             : }
      24             : #endif

Generated by: LCOV version 1.14