Merge pull request #5337 from douzzer/20220707-DtlsUpdateWindowGTSeq-overshift

20220707-DtlsUpdateWindowGTSeq-overshift
This commit is contained in:
David Garske
2022-07-07 21:53:26 -07:00
committed by GitHub
2 changed files with 28 additions and 25 deletions

View File

@@ -15380,7 +15380,10 @@ static void _DtlsUpdateWindowGTSeq(word32 diff, word32* window)
else { else {
temp |= (oldWindow[i-idx] << diff); temp |= (oldWindow[i-idx] << diff);
window[i] = temp; window[i] = temp;
temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - diff); if (diff > 0)
temp = oldWindow[i-idx] >> (DTLS_WORD_BITS - diff);
else
temp = 0;
} }
} }
} }

View File

@@ -1887,34 +1887,34 @@ extern void uITRON4_free(void *p) ;
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* Math Library Selection (in order of preference) * Math Library Selection (in order of preference)
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------
/* Only evaluate this if: */
* A) Not fips
* B) FIPS 140-3 (v5 or greater) */
#if !defined(HAVE_FIPS_VERSION) || \ #if !defined(HAVE_FIPS_VERSION) || \
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 5)) (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 5))
/* 1) SP Math: wolfSSL proprietary math implementation (sp_int.c). #if defined(WOLFSSL_SP_MATH_ALL)
* Constant time: Always /* 1) SP Math: wolfSSL proprietary math implementation (sp_int.c).
* Enable: WOLFSSL_SP_MATH_ALL * Constant time: Always
* * Enable: WOLFSSL_SP_MATH_ALL
* 2) Fast Math: Stack based (tfm.c) */
* Constant time: Only with TFM_TIMING_RESISTANT #elif defined(WOLFSSL_SP_MATH)
* Enable: USE_FAST_MATH /* 2) SP Math with restricted key sizes: wolfSSL proprietary math
* * implementation (sp_*.c).
* 3) Integer Heap Math: Heap based (integer.c) * Constant time: Always
* Constant time: Not supported * Enable: WOLFSSL_SP_MATH
* Enable: USE_INTEGER_HEAP_MATH */
*/
#if defined(WOLFSSL_SP_MATH_ALL) || \
(!defined(USE_FAST_MATH) && !defined(USE_INTEGER_HEAP_MATH))
/* 1) Using wolfSSL SP Math (sp_int.c) */
#ifndef WOLFSSL_SP_MATH_ALL
#define WOLFSSL_SP_MATH_ALL
#endif
#elif defined(USE_FAST_MATH) #elif defined(USE_FAST_MATH)
/* 2) Using fast math (tfm.c) - USE_FAST_MATH */ /* 3) Tom's Fast Math: Stack based (tfm.c)
* Constant time: Only with TFM_TIMING_RESISTANT
* Enable: USE_FAST_MATH
*/
#elif defined(USE_INTEGER_HEAP_MATH)
/* 4) Integer Heap Math: Heap based (integer.c)
* Constant time: Not supported
* Enable: USE_INTEGER_HEAP_MATH
*/
#else #else
/* 3) Using heap math (integer.c) - USE_INTEGER_HEAP_MATH */ /* default is SP Math. */
#define WOLFSSL_SP_MATH_ALL
#endif #endif
#else #else
/* FIPS 140-2 or older */ /* FIPS 140-2 or older */