bigint.c File Reference

#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include "bigint.h"
#include "crypto.h"

Go to the source code of this file.

Functions

static bigintbi_int_multiply (BI_CTX *ctx, bigint *bia, comp b)
 Perform a multiply between a bigint an an (unsigned) integer.
static bigintbi_int_divide (BI_CTX *ctx, bigint *biR, comp denom)
static bigint __malloc * alloc (BI_CTX *ctx, int size)
static biginttrim (bigint *bi)
static void more_comps (bigint *bi, int n)
BI_CTXbi_initialize (void)
 Start a new bigint context.
void bi_terminate (BI_CTX *ctx)
 Close the bigint context and free any resources.
bigintbi_copy (bigint *bi)
 Increment the number of references to this object.
void bi_permanent (bigint *bi)
 Simply make a bigint object "unfreeable" if bi_free() is called on it.
void bi_depermanent (bigint *bi)
 Take a permanent object and make it eligible for freedom.
void bi_free (BI_CTX *ctx, bigint *bi)
 Free a bigint object so it can be used again.
bigintint_to_bi (BI_CTX *ctx, comp i)
 Convert an (unsigned) integer into a bigint.
bigintbi_clone (BI_CTX *ctx, const bigint *bi)
 Do a full copy of the bigint object.
bigintbi_add (BI_CTX *ctx, bigint *bia, bigint *bib)
 Perform an addition operation between two bigints.
bigintbi_subtract (BI_CTX *ctx, bigint *bia, bigint *bib, int *is_negative)
 Perform a subtraction operation between two bigints.
bigintbi_divide (BI_CTX *ctx, bigint *u, bigint *v, int is_mod)
 Does both division and modulo calculations.
static bigintbi_int_divide (BI_CTX *ctx __unused, bigint *biR, comp denom)
bigintbi_import (BI_CTX *ctx, const uint8_t *data, int size)
 Allow a binary sequence to be imported as a bigint.
void bi_export (BI_CTX *ctx, bigint *x, uint8_t *data, int size)
 Take a bigint and convert it into a byte sequence.
void bi_set_mod (BI_CTX *ctx, bigint *bim, int mod_offset)
 Pre-calculate some of the expensive steps in reduction.
void bi_free_mod (BI_CTX *ctx, int mod_offset)
 Used when cleaning various bigints at the end of a session.
static bigintregular_multiply (BI_CTX *ctx, bigint *bia, bigint *bib)
 Perform a standard multiplication between two bigints.
bigintbi_multiply (BI_CTX *ctx, bigint *bia, bigint *bib)
 Perform a multiplication operation between two bigints.
int bi_compare (bigint *bia, bigint *bib)
 Compare two bigints.
static int find_max_exp_index (bigint *biexp)
static int exp_bit_is_one (bigint *biexp, int offset)
bigintbi_mod_power (BI_CTX *ctx, bigint *bi, bigint *biexp)
 Perform a modular exponentiation.
bigintbi_mod_power2 (BI_CTX *ctx, bigint *bi, bigint *bim, bigint *biexp)
 Perform a modular exponentiation using a temporary modulus.


Generated on Tue Apr 6 20:01:15 2010 for gPXE by  doxygen 1.5.7.1