forked from wolfSSL/wolfssl
Merge pull request #909 from dgarske/fix_no_harden
Fix issue with --disable-harden
This commit is contained in:
@@ -1926,29 +1926,6 @@ done:
|
|||||||
|
|
||||||
#if !defined(FREESCALE_LTC_ECC)
|
#if !defined(FREESCALE_LTC_ECC)
|
||||||
|
|
||||||
#ifndef WC_NO_CACHE_RESISTANT
|
|
||||||
#if defined(TFM_TIMING_RESISTANT) && defined(USE_FAST_MATH) && \
|
|
||||||
!defined(__cplusplus)
|
|
||||||
/* let's use the one we already have */
|
|
||||||
extern const wolfssl_word wc_off_on_addr[2];
|
|
||||||
#else
|
|
||||||
static const wolfssl_word wc_off_on_addr[2] =
|
|
||||||
{
|
|
||||||
#if defined(WC_64BIT_CPU)
|
|
||||||
W64LIT(0x0000000000000000),
|
|
||||||
W64LIT(0xffffffffffffffff)
|
|
||||||
#elif defined(WC_16BIT_CPU)
|
|
||||||
0x0000U,
|
|
||||||
0xffffU
|
|
||||||
#else
|
|
||||||
/* 32 bit */
|
|
||||||
0x00000000U,
|
|
||||||
0xffffffffU
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
#endif /* TFM_TIMING_RESISTANT && USE_FAST_MATH */
|
|
||||||
#endif /* WC_NO_CACHE_RESISTANT */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Perform a point multiplication
|
Perform a point multiplication
|
||||||
k The scalar to multiply by
|
k The scalar to multiply by
|
||||||
|
@@ -1045,26 +1045,6 @@ int fp_addmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
|||||||
|
|
||||||
#ifdef TFM_TIMING_RESISTANT
|
#ifdef TFM_TIMING_RESISTANT
|
||||||
|
|
||||||
#ifndef WC_NO_CACHE_RESISTANT
|
|
||||||
/* all off / all on pointer addresses for constant calculations */
|
|
||||||
/* ecc.c uses same table */
|
|
||||||
const wolfssl_word wc_off_on_addr[2] =
|
|
||||||
{
|
|
||||||
#if defined(WC_64BIT_CPU)
|
|
||||||
W64LIT(0x0000000000000000),
|
|
||||||
W64LIT(0xffffffffffffffff)
|
|
||||||
#elif defined(WC_16BIT_CPU)
|
|
||||||
0x0000U,
|
|
||||||
0xffffU
|
|
||||||
#else
|
|
||||||
/* 32 bit */
|
|
||||||
0x00000000U,
|
|
||||||
0xffffffffU
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* WC_NO_CACHE_RESISTANT */
|
|
||||||
|
|
||||||
/* timing resistant montgomery ladder based exptmod
|
/* timing resistant montgomery ladder based exptmod
|
||||||
Based on work by Marc Joye, Sung-Ming Yen, "The Montgomery Powering Ladder",
|
Based on work by Marc Joye, Sung-Ming Yen, "The Montgomery Powering Ladder",
|
||||||
Cryptographic Hardware and Embedded Systems, CHES 2002
|
Cryptographic Hardware and Embedded Systems, CHES 2002
|
||||||
|
@@ -52,6 +52,29 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(WC_NO_CACHE_RESISTANT) && \
|
||||||
|
((defined(HAVE_ECC) && defined(ECC_TIMING_RESISTANT)) || \
|
||||||
|
(defined(USE_FAST_MATH) && defined(TFM_TIMING_RESISTANT)))
|
||||||
|
|
||||||
|
/* all off / all on pointer addresses for constant calculations */
|
||||||
|
/* ecc.c uses same table */
|
||||||
|
const wolfssl_word wc_off_on_addr[2] =
|
||||||
|
{
|
||||||
|
#if defined(WC_64BIT_CPU)
|
||||||
|
W64LIT(0x0000000000000000),
|
||||||
|
W64LIT(0xffffffffffffffff)
|
||||||
|
#elif defined(WC_16BIT_CPU)
|
||||||
|
0x0000U,
|
||||||
|
0xffffU
|
||||||
|
#else
|
||||||
|
/* 32 bit */
|
||||||
|
0x00000000U,
|
||||||
|
0xffffffffU
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int get_digit_count(mp_int* a)
|
int get_digit_count(mp_int* a)
|
||||||
{
|
{
|
||||||
if (a == NULL)
|
if (a == NULL)
|
||||||
|
@@ -37,6 +37,14 @@
|
|||||||
#ifndef __WOLFMATH_H__
|
#ifndef __WOLFMATH_H__
|
||||||
#define __WOLFMATH_H__
|
#define __WOLFMATH_H__
|
||||||
|
|
||||||
|
/* timing resistance array */
|
||||||
|
#if !defined(WC_NO_CACHE_RESISTANT) && \
|
||||||
|
((defined(HAVE_ECC) && defined(ECC_TIMING_RESISTANT)) || \
|
||||||
|
(defined(USE_FAST_MATH) && defined(TFM_TIMING_RESISTANT)))
|
||||||
|
|
||||||
|
extern const wolfssl_word wc_off_on_addr[2];
|
||||||
|
#endif
|
||||||
|
|
||||||
/* common math functions */
|
/* common math functions */
|
||||||
int get_digit_count(mp_int* a);
|
int get_digit_count(mp_int* a);
|
||||||
mp_digit get_digit(mp_int* a, int n);
|
mp_digit get_digit(mp_int* a, int n);
|
||||||
|
Reference in New Issue
Block a user