00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BIGNUM_H
00016 #define BIGNUM_H
00017
00018 struct bignum;
00019
00020 struct bignum * bignum_init(void);
00021 void bignum_deinit(struct bignum *n);
00022 size_t bignum_get_unsigned_bin_len(struct bignum *n);
00023 int bignum_get_unsigned_bin(const struct bignum *n, u8 *buf, size_t *len);
00024 int bignum_set_unsigned_bin(struct bignum *n, const u8 *buf, size_t len);
00025 int bignum_cmp(const struct bignum *a, const struct bignum *b);
00026 int bignum_cmp_d(const struct bignum *a, unsigned long b);
00027 int bignum_add(const struct bignum *a, const struct bignum *b,
00028 struct bignum *c);
00029 int bignum_sub(const struct bignum *a, const struct bignum *b,
00030 struct bignum *c);
00031 int bignum_mul(const struct bignum *a, const struct bignum *b,
00032 struct bignum *c);
00033 int bignum_mulmod(const struct bignum *a, const struct bignum *b,
00034 const struct bignum *c, struct bignum *d);
00035 int bignum_exptmod(const struct bignum *a, const struct bignum *b,
00036 const struct bignum *c, struct bignum *d);
00037
00038 #endif