wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
bignum.h
Go to the documentation of this file.
1 
5 #ifndef BIGNUM_H
6 #define BIGNUM_H
7 
8 struct bignum;
9 
10 struct bignum * bignum_init(void);
11 void bignum_deinit(struct bignum *n);
12 size_t bignum_get_unsigned_bin_len(struct bignum *n);
13 int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len);
14 int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len);
15 int bignum_cmp(const struct bignum *a, const struct bignum *b);
16 int bignum_cmp_d(const struct bignum *a, unsigned long b);
17 int bignum_add(const struct bignum *a, const struct bignum *b,
18  struct bignum *c);
19 int bignum_sub(const struct bignum *a, const struct bignum *b,
20  struct bignum *c);
21 int bignum_mul(const struct bignum *a, const struct bignum *b,
22  struct bignum *c);
23 int bignum_mulmod(const struct bignum *a, const struct bignum *b,
24  const struct bignum *c, struct bignum *d);
25 int bignum_exptmod(const struct bignum *a, const struct bignum *b,
26  const struct bignum *c, struct bignum *d);
27 
28 #endif /* BIGNUM_H */
int bignum_cmp(const struct bignum *a, const struct bignum *b)
Signed comparison.
Definition: bignum.c:111
int bignum_mulmod(const struct bignum *a, const struct bignum *b, const struct bignum *c, struct bignum *d)
d = a * b (mod c)
Definition: bignum.c:191
int bignum_exptmod(const struct bignum *a, const struct bignum *b, const struct bignum *c, struct bignum *d)
Modular exponentiation: d = a^b (mod c)
Definition: bignum.c:211
int bignum_add(const struct bignum *a, const struct bignum *b, struct bignum *c)
c = a + b
Definition: bignum.c:136
struct bignum * bignum_init(void)
Allocate memory for bignum.
Definition: bignum.c:26
int bignum_cmp_d(const struct bignum *a, unsigned long b)
Compare bignum to standard integer.
Definition: bignum.c:123
int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len)
Set bignum based on unsigned binary buffer.
Definition: bignum.c:95
int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len)
Set binary buffer to unsigned bignum.
Definition: bignum.c:71
void bignum_deinit(struct bignum *n)
Free bignum.
Definition: bignum.c:43
size_t bignum_get_unsigned_bin_len(struct bignum *n)
Get length of bignum as an unsigned binary buffer.
Definition: bignum.c:57
int bignum_sub(const struct bignum *a, const struct bignum *b, struct bignum *c)
c = a - b
Definition: bignum.c:154
int bignum_mul(const struct bignum *a, const struct bignum *b, struct bignum *c)
c = a * b
Definition: bignum.c:172