mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 17:48:33 -04:00
Update CyaSSL to latest version.
This commit is contained in:
parent
5fcd270398
commit
3d007d0b4b
445 changed files with 162375 additions and 26182 deletions
|
@ -1,6 +1,6 @@
|
|||
/* tfm.h
|
||||
*
|
||||
* Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
*
|
||||
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifndef NO_64BIT
|
||||
/* autodetect x86-64 and make sure we are using 64-bit digits with x86-64 asm */
|
||||
#if defined(__x86_64__)
|
||||
#if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM)
|
||||
|
@ -72,6 +73,12 @@
|
|||
#if defined(__x86_64__) && !defined(FP_64BIT)
|
||||
#define FP_64BIT
|
||||
#endif
|
||||
/* if intel compiler doesn't provide 128 bit type don't turn on 64bit */
|
||||
#if defined(FP_64BIT) && defined(__INTEL_COMPILER) && !defined(HAVE___UINT128_T)
|
||||
#undef FP_64BIT
|
||||
#undef TFM_X86_64
|
||||
#endif
|
||||
#endif /* NO_64BIT */
|
||||
|
||||
/* try to detect x86-32 */
|
||||
#if defined(__i386__) && !defined(TFM_SSE2)
|
||||
|
@ -198,24 +205,24 @@
|
|||
*/
|
||||
#if defined(FP_64BIT)
|
||||
/* for GCC only on supported platforms */
|
||||
#ifndef CRYPT
|
||||
typedef unsigned long ulong64;
|
||||
#endif
|
||||
typedef ulong64 fp_digit;
|
||||
typedef unsigned long long fp_digit; /* 64bit, 128 uses mode(TI) below */
|
||||
typedef unsigned long fp_word __attribute__ ((mode(TI)));
|
||||
#else
|
||||
/* this is to make porting into LibTomCrypt easier :-) */
|
||||
#ifndef CRYPT
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||
typedef unsigned __int64 ulong64;
|
||||
typedef signed __int64 long64;
|
||||
#else
|
||||
typedef unsigned long long ulong64;
|
||||
typedef signed long long long64;
|
||||
#endif
|
||||
#endif
|
||||
typedef unsigned int fp_digit;
|
||||
typedef ulong64 fp_word;
|
||||
|
||||
#ifndef NO_64BIT
|
||||
typedef unsigned int fp_digit;
|
||||
typedef ulong64 fp_word;
|
||||
#else
|
||||
/* some procs like coldfire prefer not to place multiply into 64bit type
|
||||
even though it exists */
|
||||
typedef unsigned short fp_digit;
|
||||
typedef unsigned int fp_word;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* # of digits this is */
|
||||
|
@ -291,7 +298,7 @@ typedef struct {
|
|||
#define TFM_MUL12
|
||||
#define TFM_MUL17
|
||||
#endif
|
||||
#ifdef TFM_SMALL_SET
|
||||
#ifdef TFM_HUGE_SET
|
||||
#define TFM_MUL20
|
||||
#define TFM_MUL24
|
||||
#define TFM_MUL28
|
||||
|
@ -314,7 +321,7 @@ typedef struct {
|
|||
#define TFM_SQR12
|
||||
#define TFM_SQR17
|
||||
#endif
|
||||
#ifdef TFM_SMALL_SET
|
||||
#ifdef TFM_HUGE_SET
|
||||
#define TFM_SQR20
|
||||
#define TFM_SQR24
|
||||
#define TFM_SQR28
|
||||
|
@ -357,7 +364,7 @@ typedef struct {
|
|||
void fp_set(fp_int *a, fp_digit b);
|
||||
|
||||
/* copy from a to b */
|
||||
#define fp_copy(a, b) (void)(((a) != (b)) ? (XMEMCPY((b), (a), sizeof(fp_int))) : (void)0)
|
||||
#define fp_copy(a, b) (void)(((a) != (b)) ? ((void)XMEMCPY((b), (a), sizeof(fp_int))) : (void)0)
|
||||
#define fp_init_copy(a, b) fp_copy(b, a)
|
||||
|
||||
/* clamp digits */
|
||||
|
@ -370,6 +377,9 @@ void fp_set(fp_int *a, fp_digit b);
|
|||
/* right shift x digits */
|
||||
void fp_rshd(fp_int *a, int x);
|
||||
|
||||
/* right shift x bits */
|
||||
void fp_rshb(fp_int *a, int x);
|
||||
|
||||
/* left shift x digits */
|
||||
void fp_lshd(fp_int *a, int x);
|
||||
|
||||
|
@ -485,6 +495,7 @@ int fp_exptmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);
|
|||
|
||||
/* radix conersions */
|
||||
int fp_count_bits(fp_int *a);
|
||||
int fp_leading_bit(fp_int *a);
|
||||
|
||||
int fp_unsigned_bin_size(fp_int *a);
|
||||
void fp_read_unsigned_bin(fp_int *a, unsigned char *b, int c);
|
||||
|
@ -504,104 +515,104 @@ void s_fp_add(fp_int *a, fp_int *b, fp_int *c);
|
|||
void s_fp_sub(fp_int *a, fp_int *b, fp_int *c);
|
||||
void fp_reverse(unsigned char *s, int len);
|
||||
|
||||
void fp_mul_comba(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba(fp_int *a, fp_int *b, fp_int *c);
|
||||
|
||||
#ifdef TFM_SMALL_SET
|
||||
void fp_mul_comba_small(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba_small(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
|
||||
#ifdef TFM_MUL3
|
||||
void fp_mul_comba3(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba3(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL4
|
||||
void fp_mul_comba4(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba4(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL6
|
||||
void fp_mul_comba6(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba6(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL7
|
||||
void fp_mul_comba7(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba7(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL8
|
||||
void fp_mul_comba8(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba8(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL9
|
||||
void fp_mul_comba9(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba9(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL12
|
||||
void fp_mul_comba12(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba12(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL17
|
||||
void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba17(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
|
||||
#ifdef TFM_MUL20
|
||||
void fp_mul_comba20(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba20(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL24
|
||||
void fp_mul_comba24(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba24(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL28
|
||||
void fp_mul_comba28(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba28(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL32
|
||||
void fp_mul_comba32(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba32(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL48
|
||||
void fp_mul_comba48(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba48(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
#ifdef TFM_MUL64
|
||||
void fp_mul_comba64(fp_int *A, fp_int *B, fp_int *C);
|
||||
void fp_mul_comba64(fp_int *a, fp_int *b, fp_int *c);
|
||||
#endif
|
||||
|
||||
void fp_sqr_comba(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba(fp_int *a, fp_int *b);
|
||||
|
||||
#ifdef TFM_SMALL_SET
|
||||
void fp_sqr_comba_small(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba_small(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
|
||||
#ifdef TFM_SQR3
|
||||
void fp_sqr_comba3(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba3(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR4
|
||||
void fp_sqr_comba4(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba4(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR6
|
||||
void fp_sqr_comba6(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba6(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR7
|
||||
void fp_sqr_comba7(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba7(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR8
|
||||
void fp_sqr_comba8(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba8(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR9
|
||||
void fp_sqr_comba9(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba9(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR12
|
||||
void fp_sqr_comba12(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba12(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR17
|
||||
void fp_sqr_comba17(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba17(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
|
||||
#ifdef TFM_SQR20
|
||||
void fp_sqr_comba20(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba20(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR24
|
||||
void fp_sqr_comba24(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba24(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR28
|
||||
void fp_sqr_comba28(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba28(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR32
|
||||
void fp_sqr_comba32(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba32(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR48
|
||||
void fp_sqr_comba48(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba48(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
#ifdef TFM_SQR64
|
||||
void fp_sqr_comba64(fp_int *A, fp_int *B);
|
||||
void fp_sqr_comba64(fp_int *a, fp_int *b);
|
||||
#endif
|
||||
/*extern const char *fp_s_rmap;*/
|
||||
|
||||
|
@ -636,7 +647,7 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c);
|
|||
int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d);
|
||||
int mp_mod(mp_int *a, mp_int *b, mp_int *c);
|
||||
int mp_invmod(mp_int *a, mp_int *b, mp_int *c);
|
||||
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y);
|
||||
int mp_exptmod (mp_int * g, mp_int * x, mp_int * p, mp_int * y);
|
||||
|
||||
int mp_cmp(mp_int *a, mp_int *b);
|
||||
int mp_cmp_d(mp_int *a, mp_digit b);
|
||||
|
@ -650,12 +661,14 @@ int mp_copy(fp_int* a, fp_int* b);
|
|||
int mp_isodd(mp_int* a);
|
||||
int mp_iszero(mp_int* a);
|
||||
int mp_count_bits(mp_int *a);
|
||||
int mp_leading_bit(mp_int *a);
|
||||
int mp_set_int(fp_int *a, fp_digit b);
|
||||
void mp_rshb(mp_int *a, int x);
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
int mp_read_radix(mp_int* a, const char* str, int radix);
|
||||
int mp_set(fp_int *a, fp_digit b);
|
||||
int mp_sqr(fp_int *A, fp_int *B);
|
||||
int mp_sqr(fp_int *a, fp_int *b);
|
||||
int mp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp);
|
||||
int mp_montgomery_setup(fp_int *a, fp_digit *rho);
|
||||
int mp_div_2(fp_int * a, fp_int * b);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue