File indexing completed on 2025-01-18 10:02:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #ifndef NETTLE_BIGNUM_H_INCLUDED
0035 #define NETTLE_BIGNUM_H_INCLUDED
0036
0037 #include "nettle-types.h"
0038
0039
0040 #include "version.h"
0041
0042 #if NETTLE_USE_MINI_GMP
0043 # include "mini-gmp.h"
0044
0045 # define GMP_NUMB_MASK (~(mp_limb_t) 0)
0046
0047
0048 # define mpz_powm_sec mpz_powm
0049 #else
0050 # include <gmp.h>
0051 #endif
0052
0053 #ifdef __cplusplus
0054 extern "C" {
0055 #endif
0056
0057
0058
0059 size_t
0060 nettle_mpz_sizeinbase_256_s(const mpz_t x);
0061
0062
0063 size_t
0064 nettle_mpz_sizeinbase_256_u(const mpz_t x);
0065
0066
0067
0068 void
0069 nettle_mpz_get_str_256(size_t length, uint8_t *s, const mpz_t x);
0070
0071
0072 void
0073 nettle_mpz_set_str_256_s(mpz_t x,
0074 size_t length, const uint8_t *s);
0075
0076 void
0077 nettle_mpz_init_set_str_256_s(mpz_t x,
0078 size_t length, const uint8_t *s);
0079
0080
0081
0082 void
0083 nettle_mpz_set_str_256_u(mpz_t x,
0084 size_t length, const uint8_t *s);
0085
0086 void
0087 nettle_mpz_init_set_str_256_u(mpz_t x,
0088 size_t length, const uint8_t *s);
0089
0090
0091 void
0092 nettle_mpz_random_size(mpz_t x,
0093 void *ctx, nettle_random_func *random,
0094 unsigned bits);
0095
0096
0097
0098 void
0099 nettle_mpz_random(mpz_t x,
0100 void *ctx, nettle_random_func *random,
0101 const mpz_t n);
0102
0103 void
0104 nettle_random_prime(mpz_t p, unsigned bits, int top_bits_set,
0105 void *ctx, nettle_random_func *random,
0106 void *progress_ctx, nettle_progress_func *progress);
0107
0108
0109
0110 struct sexp_iterator;
0111
0112
0113
0114 int
0115 nettle_mpz_set_sexp(mpz_t x, unsigned limit, struct sexp_iterator *i);
0116
0117
0118
0119 struct asn1_der_iterator;
0120
0121 int
0122 nettle_asn1_der_get_bignum(struct asn1_der_iterator *iterator,
0123 mpz_t x, unsigned max_bits);
0124
0125 #ifdef __cplusplus
0126 }
0127 #endif
0128
0129 #endif