31 #ifndef BIGINT_IMPL_HEADER 32 #define BIGINT_IMPL_HEADER 35 #define BIGINT_M_OFFSET 0 36 #ifdef CONFIG_BIGINT_CRT 37 #define BIGINT_P_OFFSET 1 38 #define BIGINT_Q_OFFSET 2 39 #define BIGINT_NUM_MODS 3 41 #define BIGINT_NUM_MODS 1 45 #if defined(CONFIG_INTEGER_8BIT) 46 #define COMP_RADIX 256U 47 #define COMP_MAX 0xFFFFU 48 #define COMP_BIT_SIZE 8 49 #define COMP_BYTE_SIZE 1 50 #define COMP_NUM_NIBBLES 2 52 typedef uint16_t long_comp; 53 typedef int16_t slong_comp; 54 #elif defined(CONFIG_INTEGER_16BIT) 55 #define COMP_RADIX 65536U 56 #define COMP_MAX 0xFFFFFFFFU 57 #define COMP_BIT_SIZE 16 58 #define COMP_BYTE_SIZE 2 59 #define COMP_NUM_NIBBLES 4 60 typedef uint16_t comp; 61 typedef uint32_t long_comp; 62 typedef int32_t slong_comp; 65 #define COMP_RADIX 4294967296i64 66 #define COMP_MAX 0xFFFFFFFFFFFFFFFFui64 68 #define COMP_RADIX 4294967296ULL 69 #define COMP_MAX 0xFFFFFFFFFFFFFFFFULL 71 #define COMP_BIT_SIZE 32 72 #define COMP_BYTE_SIZE 4 73 #define COMP_NUM_NIBBLES 8 74 typedef uint32_t comp; 75 typedef uint64_t long_comp; 76 typedef int64_t slong_comp; 105 #if defined(CONFIG_BIGINT_MONTGOMERY) 106 bigint *bi_RR_mod_m[BIGINT_NUM_MODS];
107 bigint *bi_R_mod_m[BIGINT_NUM_MODS];
108 comp N0_dash[BIGINT_NUM_MODS];
109 #elif defined(CONFIG_BIGINT_BARRETT) 110 bigint *bi_mu[BIGINT_NUM_MODS];
112 bigint *bi_normalised_mod[BIGINT_NUM_MODS];
118 #ifdef CONFIG_BIGINT_MONTGOMERY 119 uint8_t use_classical;
125 #define max(a,b) ((a)>(b)?(a):(b)) 126 #define min(a,b) ((a)<(b)?(a):(b)) 129 #define PERMANENT 0x7FFF55AA int free_count
Number of free bigints.
Definition: bigint_impl.h:116
int refs
An internal reference count.
Definition: bigint_impl.h:88
int active_count
Number of active bigints.
Definition: bigint_impl.h:115
bigint * free_list
Bigints not used.
Definition: bigint_impl.h:101
struct _bigint * next
The next bigint in the cache.
Definition: bigint_impl.h:85
short max_comps
The heapsize allocated for this bigint.
Definition: bigint_impl.h:87
bigint * active_list
Bigints currently used.
Definition: bigint_impl.h:100
short size
The number of components in this bigint.
Definition: bigint_impl.h:86
bigint * bi_radix
The radix used.
Definition: bigint_impl.h:102
uint8_t mod_offset
The mod offset we are using.
Definition: bigint_impl.h:121
int window
The size of the sliding window.
Definition: bigint_impl.h:114
A big integer basic object.
Definition: bigint_impl.h:83
comp * comps
A ptr to the actual component data.
Definition: bigint_impl.h:89
bigint ** g
Used by sliding-window.
Definition: bigint_impl.h:113
Maintains the state of the cache, and a number of variables used in reduction.
Definition: bigint_impl.h:98