1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-05 19:35:48 +03:00

Reduce code size for exp_mod_get_window_size

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman
2023-08-09 20:17:40 +01:00
parent ebcd78561c
commit 4883f109a0

View File

@@ -686,16 +686,16 @@ cleanup:
static size_t exp_mod_get_window_size(size_t Ebits) static size_t exp_mod_get_window_size(size_t Ebits)
{ {
size_t wsize = (Ebits > 671) ? 6 : (Ebits > 239) ? 5 : #if MBEDTLS_MPI_WINDOW_SIZE >= 6
(Ebits > 79) ? 4 : 1; return (Ebits > 671) ? 6 : (Ebits > 239) ? 5 : (Ebits > 79) ? 4 : 1;
#elif MBEDTLS_MPI_WINDOW_SIZE == 5
#if (MBEDTLS_MPI_WINDOW_SIZE < 6) return (Ebits > 239) ? 5 : (Ebits > 79) ? 4 : 1;
if (wsize > MBEDTLS_MPI_WINDOW_SIZE) { #elif MBEDTLS_MPI_WINDOW_SIZE > 1
wsize = MBEDTLS_MPI_WINDOW_SIZE; return (Ebits > 79) ? MBEDTLS_MPI_WINDOW_SIZE : 1;
} #else
(void) Ebits;
return 1;
#endif #endif
return wsize;
} }
size_t mbedtls_mpi_core_exp_mod_working_limbs(size_t AN_limbs, size_t E_limbs) size_t mbedtls_mpi_core_exp_mod_working_limbs(size_t AN_limbs, size_t E_limbs)