bignum.c File Reference
#include "includes.h"
#include "common.h"
#include "bignum.h"
#include <tommath.h>
Go to the source code of this file.
Functions |
int | bignum_add (const struct bignum *a, const struct bignum *b, struct bignum *c) |
int | bignum_cmp (const struct bignum *a, const struct bignum *b) |
int | bignum_cmp_d (const struct bignum *a, unsigned long b) |
void | bignum_deinit (struct bignum *n) |
int | bignum_exptmod (const struct bignum *a, const struct bignum *b, const struct bignum *c, struct bignum *d) |
int | bignum_get_unsigned_bin (const struct bignum *n, u8 *buf, size_t *len) |
size_t | bignum_get_unsigned_bin_len (struct bignum *n) |
struct bignum * | bignum_init (void) |
int | bignum_mul (const struct bignum *a, const struct bignum *b, struct bignum *c) |
int | bignum_mulmod (const struct bignum *a, const struct bignum *b, const struct bignum *c, struct bignum *d) |
int | bignum_set_unsigned_bin (struct bignum *n, const u8 *buf, size_t len) |
int | bignum_sub (const struct bignum *a, const struct bignum *b, struct bignum *c) |
Function Documentation
int bignum_add |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b, |
|
|
struct bignum * |
c | |
|
) |
| | |
int bignum_cmp |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b | |
|
) |
| | |
int bignum_cmp_d |
( |
const struct bignum * |
a, |
|
|
unsigned long |
b | |
|
) |
| | |
bignum_cmd_d - Compare bignum to standard integer : Bignum from bignum_init() : Small integer Returns: 0 on success, -1 on failure
Definition at line 133 of file bignum.c.
void bignum_deinit |
( |
struct bignum * |
n |
) |
|
int bignum_exptmod |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b, |
|
|
const struct bignum * |
c, |
|
|
struct bignum * |
d | |
|
) |
| | |
int bignum_get_unsigned_bin |
( |
const struct bignum * |
n, |
|
|
u8 * |
buf, |
|
|
size_t * |
len | |
|
) |
| | |
bignum_get_unsigned_bin - Set binary buffer to unsigned bignum
: Bignum from bignum_init() : Buffer for the binary number : Length of the buffer, can be NULL if buffer is known to be long enough. Set to used buffer length on success if not NULL. Returns: 0 on success, -1 on failure
Definition at line 81 of file bignum.c.
size_t bignum_get_unsigned_bin_len |
( |
struct bignum * |
n |
) |
|
bignum_get_unsigned_bin - Get length of bignum as an unsigned binary buffer
: Bignum from bignum_init() Returns: Length of n if written to a binary buffer
Definition at line 67 of file bignum.c.
struct bignum* bignum_init |
( |
void |
|
) |
[read] |
bignum_init - Allocate memory for bignum Returns: Pointer to allocated bignum or NULL on failure
Definition at line 36 of file bignum.c.
int bignum_mul |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b, |
|
|
struct bignum * |
c | |
|
) |
| | |
int bignum_mulmod |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b, |
|
|
const struct bignum * |
c, |
|
|
struct bignum * |
d | |
|
) |
| | |
int bignum_set_unsigned_bin |
( |
struct bignum * |
n, |
|
|
const u8 * |
buf, |
|
|
size_t |
len | |
|
) |
| | |
bignum_set_unsigned_bin - Set bignum based on unsigned binary buffer
: Bignum from bignum_init(); to be set to the given value : Buffer with unsigned binary value : Length of buf in octets Returns: 0 on success, -1 on failure
Definition at line 105 of file bignum.c.
int bignum_sub |
( |
const struct bignum * |
a, |
|
|
const struct bignum * |
b, |
|
|
struct bignum * |
c | |
|
) |
| | |