bignum.h 520 Bytes
Newer Older
Niels Möller's avatar
Niels Möller committed
1
2
3
4
5
6
7
8
9
/* bignum.h
 *
 * Interface and conversion functions for GMP.
 */

#ifndef LSH_BIGNUM_H_INCLUDED
#define LSH_BIGNUM_H_INCLUDED

#include <gmp.h>
10

Niels Möller's avatar
Niels Möller committed
11
#include "lsh_types.h"
12
13
14
#include "randomness.h"

#define bignum mpz_t
Niels Möller's avatar
Niels Möller committed
15

16
17
18
void bignum_parse(bignum n, UINT32 length, UINT8 *data);
UINT32 bignum_format_length(bignum n);
UINT32 bignum_format(bignum n, UINT8 *data);
Niels Möller's avatar
Niels Möller committed
19

20
21
/* Generates a random number in the interval 0 <= x < n */
void bignum_random(bignum x, struct randomness *random, bignum n);
Niels Möller's avatar
Niels Möller committed
22
23

#endif /* LSH_BIGNUM_H_INCLUDED */