corrected copyright notices
[gnutls.git] / lib / gnutls_mpi.h
blob2ae3c58f47266127715738b63b0e44314fed5b7a
1 /*
2 * Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
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 3 of
11 * the License, or (at your option) any later version.
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.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef GNUTLS_MPI_H
24 #define GNUTLS_MPI_H
26 #include <gnutls_int.h>
28 #include <crypto-backend.h>
30 extern int crypto_bigint_prio;
31 extern gnutls_crypto_bigint_st _gnutls_mpi_ops;
33 bigint_t _gnutls_mpi_randomize (bigint_t, unsigned int bits,
34 gnutls_rnd_level_t level);
36 #define _gnutls_mpi_new(x) _gnutls_mpi_ops.bigint_new(x)
37 #define _gnutls_mpi_cmp(x,y) _gnutls_mpi_ops.bigint_cmp(x,y)
38 #define _gnutls_mpi_cmp_ui(x,y) _gnutls_mpi_ops.bigint_cmp_ui(x,y)
39 #define _gnutls_mpi_mod(x,y) _gnutls_mpi_ops.bigint_mod(x,y)
40 #define _gnutls_mpi_set(x,y) _gnutls_mpi_ops.bigint_set(x,y)
41 #define _gnutls_mpi_set_ui(x,y) _gnutls_mpi_ops.bigint_set_ui(x,y)
42 #define _gnutls_mpi_get_nbits(x) _gnutls_mpi_ops.bigint_get_nbits(x)
43 #define _gnutls_mpi_alloc_like(x) _gnutls_mpi_new(_gnutls_mpi_get_nbits(x))
44 #define _gnutls_mpi_powm(x,y,z,w) _gnutls_mpi_ops.bigint_powm(x,y,z,w)
45 #define _gnutls_mpi_addm(x,y,z,w) _gnutls_mpi_ops.bigint_addm(x,y,z,w)
46 #define _gnutls_mpi_subm(x,y,z,w) _gnutls_mpi_ops.bigint_subm(x,y,z,w)
47 #define _gnutls_mpi_mulm(x,y,z,w) _gnutls_mpi_ops.bigint_mulm(x,y,z,w)
48 #define _gnutls_mpi_add(x,y,z) _gnutls_mpi_ops.bigint_add(x,y,z)
49 #define _gnutls_mpi_sub(x,y,z) _gnutls_mpi_ops.bigint_sub(x,y,z)
50 #define _gnutls_mpi_mul(x,y,z) _gnutls_mpi_ops.bigint_mul(x,y,z)
51 #define _gnutls_mpi_div(x,y,z) _gnutls_mpi_ops.bigint_div(x,y,z)
52 #define _gnutls_mpi_add_ui(x,y,z) _gnutls_mpi_ops.bigint_add_ui(x,y,z)
53 #define _gnutls_mpi_sub_ui(x,y,z) _gnutls_mpi_ops.bigint_sub_ui(x,y,z)
54 #define _gnutls_mpi_mul_ui(x,y,z) _gnutls_mpi_ops.bigint_mul_ui(x,y,z)
55 #define _gnutls_prime_check(z) _gnutls_mpi_ops.bigint_prime_check(z)
56 #define _gnutls_mpi_print(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_USG)
57 #define _gnutls_mpi_print_lz(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_STD)
58 #define _gnutls_mpi_print_pgp(x,y,z) _gnutls_mpi_ops.bigint_print(x,y,z,GNUTLS_MPI_FORMAT_PGP)
59 #define _gnutls_mpi_copy( a) _gnutls_mpi_set( NULL, a)
61 void _gnutls_mpi_release (bigint_t * x);
63 int _gnutls_mpi_scan (bigint_t * ret_mpi, const void *buffer, size_t nbytes);
64 int _gnutls_mpi_scan_nz (bigint_t * ret_mpi, const void *buffer,
65 size_t nbytes);
66 int _gnutls_mpi_scan_pgp (bigint_t * ret_mpi, const void *buffer,
67 size_t nbytes);
69 int _gnutls_mpi_dprint_lz (const bigint_t a, gnutls_datum_t * dest);
70 int _gnutls_mpi_dprint (const bigint_t a, gnutls_datum_t * dest);
71 int _gnutls_mpi_dprint_size (const bigint_t a, gnutls_datum_t * dest,
72 size_t size);
74 #define _gnutls_mpi_generate_group( gg, bits) _gnutls_mpi_ops.bigint_generate_group( gg, bits)
76 #endif