Select Git revision
-
Henrik (Grubba) Grubbström authored
Rev: src/fdlib.c:1.43
Henrik (Grubba) Grubbström authoredRev: src/fdlib.c:1.43
bignum.h 3.60 KiB
/* bignum.h
Bignum operations that are missing from gmp.
Copyright (C) 2001 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.
or both in parallel, as here.
GNU Nettle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#ifndef NETTLE_BIGNUM_H_INCLUDED
#define NETTLE_BIGNUM_H_INCLUDED
#include "nettle-meta.h"
#include "nettle-types.h"
/* For NETTLE_USE_MINI_GMP */
#include "version.h"
#if NETTLE_USE_MINI_GMP
# include "mini-gmp.h"
# define GMP_NUMB_MASK (~(mp_limb_t) 0)
/* Function missing in older gmp versions, and checked for with ifdef */
# define mpz_limbs_read mpz_limbs_read
/* Side-channel silent powm not available in mini-gmp. */
# define mpz_powm_sec mpz_powm
#else
# include <gmp.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Size needed for signed encoding, including extra sign byte if
* necessary. */
size_t
nettle_mpz_sizeinbase_256_s(const mpz_t x);
/* Size needed for unsigned encoding */
size_t
nettle_mpz_sizeinbase_256_u(const mpz_t x);
/* Writes an integer as length octets, using big endian byte order,