#define MBEDTLS_LN_2_DIV_LN_10_SCALE100 332
#define MBEDTLS_MPI_RW_BUFFER_SIZE ( ((MBEDTLS_MPI_MAX_BITS_SCALE100 + MBEDTLS_LN_2_DIV_LN_10_SCALE100 - 1) / MBEDTLS_LN_2_DIV_LN_10_SCALE100) + 10 + 6 )
+#if !defined(MBEDTLS_BIGNUM_ALT)
+
/*
* Define the base integer type, architecture-wise.
*
int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int dh_flag,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng );
+#else /* MBEDTLS_BIGNUM_ALT */
+#include "bignum_alt.h"
+#endif /* MBEDTLS_BIGNUM_ALT */
/**
* \brief Checkup routine
#define mbedtls_free free
#endif
+#if !defined(MBEDTLS_BIGNUM_ALT)
+
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_mpi_zeroize( mbedtls_mpi_uint *v, size_t n ) {
volatile mbedtls_mpi_uint *p = v; while( n-- ) *p++ = 0;
return( mbedtls_mpi_sub_mpi( X, A, &_B ) );
}
+#if !defined(MBEDTLS_MPI_MUL_MPI_ALT) || !defined(MBEDTLS_MPI_EXP_MOD_ALT)
+
/*
* Helper for mbedtls_mpi multiplication
*/
*/
__attribute__ ((noinline))
#endif
+
void mpi_mul_hlp( size_t i, mbedtls_mpi_uint *s, mbedtls_mpi_uint *d, mbedtls_mpi_uint b )
{
mbedtls_mpi_uint c = 0, t = 0;
while( c != 0 );
}
+#endif
+
+#if !defined(MBEDTLS_MPI_MUL_MPI_ALT)
/*
* Baseline multiplication: X = A * B (HAC 14.12)
*/
return( ret );
}
+#endif
/*
* Baseline multiplication: X = A * b
return( 0 );
}
+#if !defined(MBEDTLS_MPI_EXP_MOD_ALT)
+
/*
* Fast Montgomery initialization (thanks to Tom St Denis)
*/
return( ret );
}
+#endif
/*
* Greatest common divisor: G = gcd(A, B) (HAC 14.54)
}
#endif /* MBEDTLS_GENPRIME */
+#endif /* MBEDTLS_BIGNUM_ALT */
#if defined(MBEDTLS_SELF_TEST)