#ifndef HLM_BIGNUM_H
#define HLM_BIGNUM_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define HLM_BN_MAX_LIMBS 128
typedef struct {
uint32_t v[HLM_BN_MAX_LIMBS];
int n;
} hlm_bn;
void hlm_bn_zero(hlm_bn *a);
void hlm_bn_from_u32(hlm_bn *a, uint32_t x);
int hlm_bn_from_bytes_be(hlm_bn *a, const uint8_t *bytes, size_t len);
int hlm_bn_to_bytes_be(const hlm_bn *a, uint8_t *bytes, size_t len);
int hlm_bn_is_zero(const hlm_bn *a);
int hlm_bn_cmp(const hlm_bn *a, const hlm_bn *b);
int hlm_bn_bitlen(const hlm_bn *a);
int hlm_bn_bit(const hlm_bn *a, int i);
void hlm_bn_copy(hlm_bn *dst, const hlm_bn *src);
int hlm_bn_add(hlm_bn *r, const hlm_bn *a, const hlm_bn *b);
void hlm_bn_sub(hlm_bn *r, const hlm_bn *a, const hlm_bn *b);
void hlm_bn_mod(hlm_bn *r, const hlm_bn *a, const hlm_bn *m);
void hlm_bn_modadd(hlm_bn *r, const hlm_bn *a, const hlm_bn *b, const hlm_bn *m);
void hlm_bn_modsub(hlm_bn *r, const hlm_bn *a, const hlm_bn *b, const hlm_bn *m);
void hlm_bn_modmul(hlm_bn *r, const hlm_bn *a, const hlm_bn *b, const hlm_bn *m);
void hlm_bn_modexp(hlm_bn *r, const hlm_bn *base, const hlm_bn *exp, const hlm_bn *m);
#ifdef __cplusplus
}
#endif
#endif