bignum.h File Reference

Big number interface. More...

#include <stddef.h>
#include <stdint.h>
#include "epid/common/stdtypes.h"
#include "epid/common/errors.h"
#include "epid/common/types.h"

Typedefs

typedef struct BigNum BigNum
 Internal representation of large numbers.
 

Functions

EpidStatus NewBigNum (size_t data_size_bytes, BigNum **bignum)
 Constructs a new BigNum. More...
 
void DeleteBigNum (BigNum **bignum)
 Deletes a previously allocated BigNum. More...
 
EpidStatus ReadBigNum (void const *bn_str, size_t strlen, BigNum *bn)
 Deserializes a BigNum from a string. More...
 
EpidStatus WriteBigNum (BigNum const *bn, size_t strlen, void *bn_str)
 Serializes a BigNum to a string. More...
 
EpidStatus BigNumAdd (BigNum const *a, BigNum const *b, BigNum *r)
 Adds two BigNum values. More...
 
EpidStatus BigNumSub (BigNum const *a, BigNum const *b, BigNum *r)
 Subtracts two BigNum values. More...
 
EpidStatus BigNumMul (BigNum const *a, BigNum const *b, BigNum *r)
 Multiplies two BigNum values. More...
 
EpidStatus BigNumDiv (BigNum const *a, BigNum const *b, BigNum *q, BigNum *r)
 Divides two BigNum values. More...
 
EpidStatus BigNumMod (BigNum const *a, BigNum const *b, BigNum *r)
 Computes modular reduction for BigNum value by specified modulus. More...
 
EpidStatus BigNumIsEven (BigNum const *a, bool *is_even)
 Checks if a BigNum is even. More...
 
EpidStatus BigNumIsZero (BigNum const *a, bool *is_zero)
 Checks if a BigNum is zero. More...
 
EpidStatus BigNumPow2N (unsigned int n, BigNum *r)
 Raises 2 to the given power. More...
 

Detailed Description

Big number interface.