This is a port of cyaSSL 2.7.0.

Dependents:   CyaSSL_DTLS_Cellular CyaSSL_DTLS_Ethernet

Committer:
ashleymills
Date:
Thu Sep 05 15:55:50 2013 +0000
Revision:
1:c0ce1562443a
Parent:
0:714293de3836
Nothing;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 0:714293de3836 1 /* integer.h
ashleymills 0:714293de3836 2 *
ashleymills 0:714293de3836 3 * Copyright (C) 2006-2013 wolfSSL Inc.
ashleymills 0:714293de3836 4 *
ashleymills 0:714293de3836 5 * This file is part of CyaSSL.
ashleymills 0:714293de3836 6 *
ashleymills 0:714293de3836 7 * CyaSSL is free software; you can redistribute it and/or modify
ashleymills 0:714293de3836 8 * it under the terms of the GNU General Public License as published by
ashleymills 0:714293de3836 9 * the Free Software Foundation; either version 2 of the License, or
ashleymills 0:714293de3836 10 * (at your option) any later version.
ashleymills 0:714293de3836 11 *
ashleymills 0:714293de3836 12 * CyaSSL is distributed in the hope that it will be useful,
ashleymills 0:714293de3836 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ashleymills 0:714293de3836 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ashleymills 0:714293de3836 15 * GNU General Public License for more details.
ashleymills 0:714293de3836 16 *
ashleymills 0:714293de3836 17 * You should have received a copy of the GNU General Public License
ashleymills 0:714293de3836 18 * along with this program; if not, write to the Free Software
ashleymills 0:714293de3836 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
ashleymills 0:714293de3836 20 */
ashleymills 0:714293de3836 21
ashleymills 0:714293de3836 22 /*
ashleymills 0:714293de3836 23 * Based on public domain LibTomMath 0.38 by Tom St Denis, tomstdenis@iahu.ca,
ashleymills 0:714293de3836 24 * http://math.libtomcrypt.com
ashleymills 0:714293de3836 25 */
ashleymills 0:714293de3836 26
ashleymills 0:714293de3836 27
ashleymills 0:714293de3836 28 #ifndef CTAO_CRYPT_INTEGER_H
ashleymills 0:714293de3836 29 #define CTAO_CRYPT_INTEGER_H
ashleymills 0:714293de3836 30
ashleymills 0:714293de3836 31 /* may optionally use fast math instead, not yet supported on all platforms and
ashleymills 0:714293de3836 32 may not be faster on all
ashleymills 0:714293de3836 33 */
ashleymills 0:714293de3836 34 #include <cyassl/ctaocrypt/types.h> /* will set MP_xxBIT if not default */
ashleymills 0:714293de3836 35 #ifdef USE_FAST_MATH
ashleymills 0:714293de3836 36 #include <cyassl/ctaocrypt/tfm.h>
ashleymills 0:714293de3836 37 #else
ashleymills 0:714293de3836 38
ashleymills 0:714293de3836 39 #ifndef CHAR_BIT
ashleymills 0:714293de3836 40 #include <limits.h>
ashleymills 0:714293de3836 41 #endif
ashleymills 0:714293de3836 42
ashleymills 0:714293de3836 43 #include <cyassl/ctaocrypt/mpi_class.h>
ashleymills 0:714293de3836 44
ashleymills 0:714293de3836 45 #ifndef MIN
ashleymills 0:714293de3836 46 #define MIN(x,y) ((x)<(y)?(x):(y))
ashleymills 0:714293de3836 47 #endif
ashleymills 0:714293de3836 48
ashleymills 0:714293de3836 49 #ifndef MAX
ashleymills 0:714293de3836 50 #define MAX(x,y) ((x)>(y)?(x):(y))
ashleymills 0:714293de3836 51 #endif
ashleymills 0:714293de3836 52
ashleymills 0:714293de3836 53 #ifdef __cplusplus
ashleymills 0:714293de3836 54 extern "C" {
ashleymills 0:714293de3836 55
ashleymills 0:714293de3836 56 /* C++ compilers don't like assigning void * to mp_digit * */
ashleymills 0:714293de3836 57 #define OPT_CAST(x) (x *)
ashleymills 0:714293de3836 58
ashleymills 0:714293de3836 59 #else
ashleymills 0:714293de3836 60
ashleymills 0:714293de3836 61 /* C on the other hand doesn't care */
ashleymills 0:714293de3836 62 #define OPT_CAST(x)
ashleymills 0:714293de3836 63
ashleymills 0:714293de3836 64 #endif
ashleymills 0:714293de3836 65
ashleymills 0:714293de3836 66
ashleymills 0:714293de3836 67 /* detect 64-bit mode if possible */
ashleymills 0:714293de3836 68 #if defined(__x86_64__)
ashleymills 0:714293de3836 69 #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT))
ashleymills 0:714293de3836 70 #define MP_64BIT
ashleymills 0:714293de3836 71 #endif
ashleymills 0:714293de3836 72 #endif
ashleymills 0:714293de3836 73
ashleymills 0:714293de3836 74 /* some default configurations.
ashleymills 0:714293de3836 75 *
ashleymills 0:714293de3836 76 * A "mp_digit" must be able to hold DIGIT_BIT + 1 bits
ashleymills 0:714293de3836 77 * A "mp_word" must be able to hold 2*DIGIT_BIT + 1 bits
ashleymills 0:714293de3836 78 *
ashleymills 0:714293de3836 79 * At the very least a mp_digit must be able to hold 7 bits
ashleymills 0:714293de3836 80 * [any size beyond that is ok provided it doesn't overflow the data type]
ashleymills 0:714293de3836 81 */
ashleymills 0:714293de3836 82 #ifdef MP_8BIT
ashleymills 0:714293de3836 83 typedef unsigned char mp_digit;
ashleymills 0:714293de3836 84 typedef unsigned short mp_word;
ashleymills 0:714293de3836 85 #elif defined(MP_16BIT) || defined(NO_64BIT)
ashleymills 0:714293de3836 86 typedef unsigned short mp_digit;
ashleymills 0:714293de3836 87 typedef unsigned int mp_word;
ashleymills 0:714293de3836 88 #elif defined(MP_64BIT)
ashleymills 0:714293de3836 89 /* for GCC only on supported platforms */
ashleymills 0:714293de3836 90 typedef unsigned long long mp_digit; /* 64 bit type, 128 uses mode(TI) */
ashleymills 0:714293de3836 91 typedef unsigned long mp_word __attribute__ ((mode(TI)));
ashleymills 0:714293de3836 92
ashleymills 0:714293de3836 93 #define DIGIT_BIT 60
ashleymills 0:714293de3836 94 #else
ashleymills 0:714293de3836 95 /* this is the default case, 28-bit digits */
ashleymills 0:714293de3836 96
ashleymills 0:714293de3836 97 #if defined(_MSC_VER) || defined(__BORLANDC__)
ashleymills 0:714293de3836 98 typedef unsigned __int64 ulong64;
ashleymills 0:714293de3836 99 #else
ashleymills 0:714293de3836 100 typedef unsigned long long ulong64;
ashleymills 0:714293de3836 101 #endif
ashleymills 0:714293de3836 102
ashleymills 0:714293de3836 103 typedef unsigned int mp_digit; /* long could be 64 now, changed TAO */
ashleymills 0:714293de3836 104 typedef ulong64 mp_word;
ashleymills 0:714293de3836 105
ashleymills 0:714293de3836 106 #ifdef MP_31BIT
ashleymills 0:714293de3836 107 /* this is an extension that uses 31-bit digits */
ashleymills 0:714293de3836 108 #define DIGIT_BIT 31
ashleymills 0:714293de3836 109 #else
ashleymills 0:714293de3836 110 /* default case is 28-bit digits, defines MP_28BIT as a handy test macro */
ashleymills 0:714293de3836 111 #define DIGIT_BIT 28
ashleymills 0:714293de3836 112 #define MP_28BIT
ashleymills 0:714293de3836 113 #endif
ashleymills 0:714293de3836 114 #endif
ashleymills 0:714293de3836 115
ashleymills 0:714293de3836 116
ashleymills 0:714293de3836 117 /* otherwise the bits per digit is calculated automatically from the size of
ashleymills 0:714293de3836 118 a mp_digit */
ashleymills 0:714293de3836 119 #ifndef DIGIT_BIT
ashleymills 0:714293de3836 120 #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1)))
ashleymills 0:714293de3836 121 /* bits per digit */
ashleymills 0:714293de3836 122 #endif
ashleymills 0:714293de3836 123
ashleymills 0:714293de3836 124 #define MP_DIGIT_BIT DIGIT_BIT
ashleymills 0:714293de3836 125 #define MP_MASK ((((mp_digit)1)<<((mp_digit)DIGIT_BIT))-((mp_digit)1))
ashleymills 0:714293de3836 126 #define MP_DIGIT_MAX MP_MASK
ashleymills 0:714293de3836 127
ashleymills 0:714293de3836 128 /* equalities */
ashleymills 0:714293de3836 129 #define MP_LT -1 /* less than */
ashleymills 0:714293de3836 130 #define MP_EQ 0 /* equal to */
ashleymills 0:714293de3836 131 #define MP_GT 1 /* greater than */
ashleymills 0:714293de3836 132
ashleymills 0:714293de3836 133 #define MP_ZPOS 0 /* positive integer */
ashleymills 0:714293de3836 134 #define MP_NEG 1 /* negative */
ashleymills 0:714293de3836 135
ashleymills 0:714293de3836 136 #define MP_OKAY 0 /* ok result */
ashleymills 0:714293de3836 137 #define MP_MEM -2 /* out of mem */
ashleymills 0:714293de3836 138 #define MP_VAL -3 /* invalid input */
ashleymills 0:714293de3836 139 #define MP_RANGE MP_VAL
ashleymills 0:714293de3836 140
ashleymills 0:714293de3836 141 #define MP_YES 1 /* yes response */
ashleymills 0:714293de3836 142 #define MP_NO 0 /* no response */
ashleymills 0:714293de3836 143
ashleymills 0:714293de3836 144 /* Primality generation flags */
ashleymills 0:714293de3836 145 #define LTM_PRIME_BBS 0x0001 /* BBS style prime */
ashleymills 0:714293de3836 146 #define LTM_PRIME_SAFE 0x0002 /* Safe prime (p-1)/2 == prime */
ashleymills 0:714293de3836 147 #define LTM_PRIME_2MSB_ON 0x0008 /* force 2nd MSB to 1 */
ashleymills 0:714293de3836 148
ashleymills 0:714293de3836 149 typedef int mp_err;
ashleymills 0:714293de3836 150
ashleymills 0:714293de3836 151 /* define this to use lower memory usage routines (exptmods mostly) */
ashleymills 0:714293de3836 152 #define MP_LOW_MEM
ashleymills 0:714293de3836 153
ashleymills 0:714293de3836 154 /* default precision */
ashleymills 0:714293de3836 155 #ifndef MP_PREC
ashleymills 0:714293de3836 156 #ifndef MP_LOW_MEM
ashleymills 0:714293de3836 157 #define MP_PREC 32 /* default digits of precision */
ashleymills 0:714293de3836 158 #else
ashleymills 0:714293de3836 159 #define MP_PREC 1 /* default digits of precision */
ashleymills 0:714293de3836 160 #endif
ashleymills 0:714293de3836 161 #endif
ashleymills 0:714293de3836 162
ashleymills 0:714293de3836 163 /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD -
ashleymills 0:714293de3836 164 BITS_PER_DIGIT*2) */
ashleymills 0:714293de3836 165 #define MP_WARRAY (1 << (sizeof(mp_word) * CHAR_BIT - 2 * DIGIT_BIT + 1))
ashleymills 0:714293de3836 166
ashleymills 0:714293de3836 167 /* the infamous mp_int structure */
ashleymills 0:714293de3836 168 typedef struct {
ashleymills 0:714293de3836 169 int used, alloc, sign;
ashleymills 0:714293de3836 170 mp_digit *dp;
ashleymills 0:714293de3836 171 } mp_int;
ashleymills 0:714293de3836 172
ashleymills 0:714293de3836 173 /* callback for mp_prime_random, should fill dst with random bytes and return
ashleymills 0:714293de3836 174 how many read [upto len] */
ashleymills 0:714293de3836 175 typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
ashleymills 0:714293de3836 176
ashleymills 0:714293de3836 177
ashleymills 0:714293de3836 178 #define USED(m) ((m)->used)
ashleymills 0:714293de3836 179 #define DIGIT(m,k) ((m)->dp[(k)])
ashleymills 0:714293de3836 180 #define SIGN(m) ((m)->sign)
ashleymills 0:714293de3836 181
ashleymills 0:714293de3836 182
ashleymills 0:714293de3836 183 /* ---> Basic Manipulations <--- */
ashleymills 0:714293de3836 184 #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO)
ashleymills 0:714293de3836 185 #define mp_iseven(a) \
ashleymills 0:714293de3836 186 (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO)
ashleymills 0:714293de3836 187 #define mp_isodd(a) \
ashleymills 0:714293de3836 188 (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO)
ashleymills 0:714293de3836 189
ashleymills 0:714293de3836 190
ashleymills 0:714293de3836 191 /* number of primes */
ashleymills 0:714293de3836 192 #ifdef MP_8BIT
ashleymills 0:714293de3836 193 #define PRIME_SIZE 31
ashleymills 0:714293de3836 194 #else
ashleymills 0:714293de3836 195 #define PRIME_SIZE 256
ashleymills 0:714293de3836 196 #endif
ashleymills 0:714293de3836 197
ashleymills 0:714293de3836 198 #define mp_prime_random(a, t, size, bbs, cb, dat) \
ashleymills 0:714293de3836 199 mp_prime_random_ex(a, t, ((size) * 8) + 1, (bbs==1)?LTM_PRIME_BBS:0, cb, dat)
ashleymills 0:714293de3836 200
ashleymills 0:714293de3836 201 #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len))
ashleymills 0:714293de3836 202 #define mp_raw_size(mp) mp_signed_bin_size(mp)
ashleymills 0:714293de3836 203 #define mp_toraw(mp, str) mp_to_signed_bin((mp), (str))
ashleymills 0:714293de3836 204 #define mp_read_mag(mp, str, len) mp_read_unsigned_bin((mp), (str), (len))
ashleymills 0:714293de3836 205 #define mp_mag_size(mp) mp_unsigned_bin_size(mp)
ashleymills 0:714293de3836 206 #define mp_tomag(mp, str) mp_to_unsigned_bin((mp), (str))
ashleymills 0:714293de3836 207
ashleymills 0:714293de3836 208 #define mp_tobinary(M, S) mp_toradix((M), (S), 2)
ashleymills 0:714293de3836 209 #define mp_tooctal(M, S) mp_toradix((M), (S), 8)
ashleymills 0:714293de3836 210 #define mp_todecimal(M, S) mp_toradix((M), (S), 10)
ashleymills 0:714293de3836 211 #define mp_tohex(M, S) mp_toradix((M), (S), 16)
ashleymills 0:714293de3836 212
ashleymills 0:714293de3836 213 #define s_mp_mul(a, b, c) s_mp_mul_digs(a, b, c, (a)->used + (b)->used + 1)
ashleymills 0:714293de3836 214
ashleymills 0:714293de3836 215 extern const char *mp_s_rmap;
ashleymills 0:714293de3836 216
ashleymills 0:714293de3836 217 /* 6 functions needed by Rsa */
ashleymills 0:714293de3836 218 int mp_init (mp_int * a);
ashleymills 0:714293de3836 219 void mp_clear (mp_int * a);
ashleymills 0:714293de3836 220 int mp_unsigned_bin_size(mp_int * a);
ashleymills 0:714293de3836 221 int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c);
ashleymills 0:714293de3836 222 int mp_to_unsigned_bin (mp_int * a, unsigned char *b);
ashleymills 0:714293de3836 223 int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y);
ashleymills 0:714293de3836 224 /* end functions needed by Rsa */
ashleymills 0:714293de3836 225
ashleymills 0:714293de3836 226 /* functions added to support above needed, removed TOOM and KARATSUBA */
ashleymills 0:714293de3836 227 int mp_count_bits (mp_int * a);
ashleymills 0:714293de3836 228 int mp_init_copy (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 229 int mp_copy (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 230 int mp_grow (mp_int * a, int size);
ashleymills 0:714293de3836 231 int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d);
ashleymills 0:714293de3836 232 void mp_zero (mp_int * a);
ashleymills 0:714293de3836 233 void mp_clamp (mp_int * a);
ashleymills 0:714293de3836 234 void mp_exch (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 235 void mp_rshd (mp_int * a, int b);
ashleymills 0:714293de3836 236 int mp_mod_2d (mp_int * a, int b, mp_int * c);
ashleymills 0:714293de3836 237 int mp_mul_2d (mp_int * a, int b, mp_int * c);
ashleymills 0:714293de3836 238 int mp_lshd (mp_int * a, int b);
ashleymills 0:714293de3836 239 int mp_abs (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 240 int mp_invmod (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 241 int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 242 int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 243 int mp_cmp_mag (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 244 int mp_cmp (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 245 int mp_cmp_d(mp_int * a, mp_digit b);
ashleymills 0:714293de3836 246 void mp_set (mp_int * a, mp_digit b);
ashleymills 0:714293de3836 247 int mp_mod (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 248 int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d);
ashleymills 0:714293de3836 249 int mp_div_2(mp_int * a, mp_int * b);
ashleymills 0:714293de3836 250 int mp_add (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 251 int s_mp_add (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 252 int s_mp_sub (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 253 int mp_sub (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 254 int mp_reduce_is_2k_l(mp_int *a);
ashleymills 0:714293de3836 255 int mp_reduce_is_2k(mp_int *a);
ashleymills 0:714293de3836 256 int mp_dr_is_modulus(mp_int *a);
ashleymills 0:714293de3836 257 int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int);
ashleymills 0:714293de3836 258 int mp_montgomery_setup (mp_int * n, mp_digit * rho);
ashleymills 0:714293de3836 259 int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho);
ashleymills 0:714293de3836 260 int mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho);
ashleymills 0:714293de3836 261 void mp_dr_setup(mp_int *a, mp_digit *d);
ashleymills 0:714293de3836 262 int mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k);
ashleymills 0:714293de3836 263 int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d);
ashleymills 0:714293de3836 264 int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs);
ashleymills 0:714293de3836 265 int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs);
ashleymills 0:714293de3836 266 int mp_reduce_2k_setup_l(mp_int *a, mp_int *d);
ashleymills 0:714293de3836 267 int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d);
ashleymills 0:714293de3836 268 int mp_reduce (mp_int * x, mp_int * m, mp_int * mu);
ashleymills 0:714293de3836 269 int mp_reduce_setup (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 270 int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode);
ashleymills 0:714293de3836 271 int mp_montgomery_calc_normalization (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 272 int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs);
ashleymills 0:714293de3836 273 int s_mp_sqr (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 274 int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs);
ashleymills 0:714293de3836 275 int fast_s_mp_sqr (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 276 int mp_init_size (mp_int * a, int size);
ashleymills 0:714293de3836 277 int mp_div_3 (mp_int * a, mp_int *c, mp_digit * d);
ashleymills 0:714293de3836 278 int mp_mul_2(mp_int * a, mp_int * b);
ashleymills 0:714293de3836 279 int mp_mul (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 280 int mp_sqr (mp_int * a, mp_int * b);
ashleymills 0:714293de3836 281 int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d);
ashleymills 0:714293de3836 282 int mp_mul_d (mp_int * a, mp_digit b, mp_int * c);
ashleymills 0:714293de3836 283 int mp_2expt (mp_int * a, int b);
ashleymills 0:714293de3836 284 int mp_reduce_2k_setup(mp_int *a, mp_digit *d);
ashleymills 0:714293de3836 285 int mp_add_d (mp_int* a, mp_digit b, mp_int* c);
ashleymills 0:714293de3836 286 int mp_set_int (mp_int * a, unsigned long b);
ashleymills 0:714293de3836 287 /* end support added functions */
ashleymills 0:714293de3836 288
ashleymills 0:714293de3836 289 /* added */
ashleymills 0:714293de3836 290 int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e,
ashleymills 0:714293de3836 291 mp_int* f);
ashleymills 0:714293de3836 292
ashleymills 0:714293de3836 293 #if defined(HAVE_ECC) || defined(CYASSL_KEY_GEN)
ashleymills 0:714293de3836 294 int mp_sqrmod(mp_int* a, mp_int* b, mp_int* c);
ashleymills 0:714293de3836 295 #endif
ashleymills 0:714293de3836 296 #ifdef HAVE_ECC
ashleymills 0:714293de3836 297 int mp_read_radix(mp_int* a, const char* str, int radix);
ashleymills 0:714293de3836 298 #endif
ashleymills 0:714293de3836 299
ashleymills 0:714293de3836 300 #ifdef CYASSL_KEY_GEN
ashleymills 0:714293de3836 301 int mp_prime_is_prime (mp_int * a, int t, int *result);
ashleymills 0:714293de3836 302 int mp_gcd (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 303 int mp_lcm (mp_int * a, mp_int * b, mp_int * c);
ashleymills 0:714293de3836 304 #endif
ashleymills 0:714293de3836 305
ashleymills 0:714293de3836 306 #if defined(HAVE_ECC) || !defined(NO_PWDBASED)
ashleymills 0:714293de3836 307 int mp_sub_d (mp_int * a, mp_digit b, mp_int * c);
ashleymills 0:714293de3836 308 #endif
ashleymills 0:714293de3836 309
ashleymills 0:714293de3836 310 #ifdef __cplusplus
ashleymills 0:714293de3836 311 }
ashleymills 0:714293de3836 312 #endif
ashleymills 0:714293de3836 313
ashleymills 0:714293de3836 314
ashleymills 0:714293de3836 315 #endif /* USE_FAST_MATH */
ashleymills 0:714293de3836 316
ashleymills 0:714293de3836 317 #endif /* CTAO_CRYPT_INTEGER_H */
ashleymills 0:714293de3836 318