LCOV - code coverage report
Current view: top level - builds/gnutls/coverage/gnutls-git/lib - mpi.h (source / functions) Hit Total Coverage
Test: GnuTLS-3.6.14 Code Coverage Lines: 4 4 100.0 %
Date: 2020-10-30 04:50:48 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2000-2012 Free Software Foundation, Inc.
       3             :  *
       4             :  * Author: Nikos Mavrogiannopoulos
       5             :  *
       6             :  * This file is part of GnuTLS.
       7             :  *
       8             :  * The GnuTLS is free software; you can redistribute it and/or
       9             :  * modify it under the terms of the GNU Lesser General Public License
      10             :  * as published by the Free Software Foundation; either version 2.1 of
      11             :  * the License, or (at your option) any later version.
      12             :  *
      13             :  * This library is distributed in the hope that it will be useful, but
      14             :  * WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :  * Lesser General Public License for more details.
      17             :  *
      18             :  * You should have received a copy of the GNU Lesser General Public License
      19             :  * along with this program.  If not, see <https://www.gnu.org/licenses/>
      20             :  *
      21             :  */
      22             : 
      23             : #ifndef GNUTLS_LIB_MPI_H
      24             : #define GNUTLS_LIB_MPI_H
      25             : 
      26             : #include "gnutls_int.h"
      27             : 
      28             : #include <crypto-backend.h>
      29             : 
      30             : extern int crypto_bigint_prio;
      31             : extern gnutls_crypto_bigint_st _gnutls_mpi_ops;
      32             : 
      33             : bigint_t _gnutls_mpi_random_modp(bigint_t, bigint_t p,
      34             :                                gnutls_rnd_level_t level);
      35             : 
      36             : #define _gnutls_mpi_init _gnutls_mpi_ops.bigint_init
      37             : #define _gnutls_mpi_init_multi _gnutls_mpi_ops.bigint_init_multi
      38             : #define _gnutls_mpi_clear _gnutls_mpi_ops.bigint_clear
      39             : #define _gnutls_mpi_cmp _gnutls_mpi_ops.bigint_cmp
      40             : #define _gnutls_mpi_cmp_ui _gnutls_mpi_ops.bigint_cmp_ui
      41             : #define _gnutls_mpi_mod _gnutls_mpi_ops.bigint_mod
      42             : #define _gnutls_mpi_modm _gnutls_mpi_ops.bigint_modm
      43             : #define _gnutls_mpi_set _gnutls_mpi_ops.bigint_set
      44             : #define _gnutls_mpi_set_ui _gnutls_mpi_ops.bigint_set_ui
      45             : #define _gnutls_mpi_get_nbits _gnutls_mpi_ops.bigint_get_nbits
      46             : #define _gnutls_mpi_powm _gnutls_mpi_ops.bigint_powm
      47             : #define _gnutls_mpi_addm _gnutls_mpi_ops.bigint_addm
      48             : #define _gnutls_mpi_subm _gnutls_mpi_ops.bigint_subm
      49             : #define _gnutls_mpi_mulm _gnutls_mpi_ops.bigint_mulm
      50             : #define _gnutls_mpi_add _gnutls_mpi_ops.bigint_add
      51             : #define _gnutls_mpi_sub _gnutls_mpi_ops.bigint_sub
      52             : #define _gnutls_mpi_mul _gnutls_mpi_ops.bigint_mul
      53             : #define _gnutls_mpi_div _gnutls_mpi_ops.bigint_div
      54             : #define _gnutls_mpi_add_ui _gnutls_mpi_ops.bigint_add_ui
      55             : #define _gnutls_mpi_sub_ui _gnutls_mpi_ops.bigint_sub_ui
      56             : #define _gnutls_mpi_mul_ui _gnutls_mpi_ops.bigint_mul_ui
      57             : #define _gnutls_prime_check _gnutls_mpi_ops.bigint_prime_check
      58             : #define _gnutls_mpi_print(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_USG)
      59             : #define _gnutls_mpi_print_lz(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_STD)
      60             : #define _gnutls_mpi_print_le(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_ULE)
      61             : #define _gnutls_mpi_copy _gnutls_mpi_ops.bigint_copy
      62             : #define _gnutls_mpi_scan(r, b, s) _gnutls_mpi_ops.bigint_scan(r, b, s, GNUTLS_MPI_FORMAT_USG)
      63             : #define _gnutls_mpi_scan_le(r, b, s) _gnutls_mpi_ops.bigint_scan(r, b, s, GNUTLS_MPI_FORMAT_ULE)
      64             : 
      65             : inline static
      66      269681 : void _gnutls_mpi_release(bigint_t * x)
      67             : {
      68      266527 :         if (*x == NULL)
      69             :                 return;
      70             : 
      71      236263 :         _gnutls_mpi_ops.bigint_release(*x);
      72      254182 :         *x = NULL;
      73             : }
      74             : 
      75             : int _gnutls_mpi_init_scan(bigint_t * ret_mpi, const void *buffer,
      76             :                      size_t nbytes);
      77             : int _gnutls_mpi_init_scan_nz(bigint_t * ret_mpi, const void *buffer,
      78             :                         size_t nbytes);
      79             : int _gnutls_mpi_init_scan_le(bigint_t * ret_mpi, const void *buffer,
      80             :                              size_t nbytes);
      81             : 
      82             : int _gnutls_mpi_dprint_le(const bigint_t a, gnutls_datum_t * dest);
      83             : int _gnutls_mpi_dprint_lz(const bigint_t a, gnutls_datum_t * dest);
      84             : int _gnutls_mpi_dprint(const bigint_t a, gnutls_datum_t * dest);
      85             : int _gnutls_mpi_dprint_size(const bigint_t a, gnutls_datum_t * dest,
      86             :                             size_t size);
      87             : int _gnutls_mpi_bprint_size(const bigint_t a, uint8_t *buf, size_t size);
      88             : 
      89             : typedef int (*mpi_dprint_func)(const bigint_t a, gnutls_datum_t * dest);
      90             : 
      91             : #define _gnutls_mpi_generate_group( gg, bits) _gnutls_mpi_ops.bigint_generate_group( gg, bits)
      92             : 
      93             : #endif /* GNUTLS_LIB_MPI_H */

Generated by: LCOV version 1.14