Skip to content

Commit 227838b

Browse files
authored
Merge pull request #261 from libtom/improve/test_without_mpi
make it possible to 'make all' w/o an MPI provider
2 parents 7993ce8 + a65cfb8 commit 227838b

14 files changed

Lines changed: 46 additions & 34 deletions

demos/timing.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,11 @@ static void time_hash(void)
520520
}
521521

522522
/*#warning you need an mp_rand!!!*/
523-
#ifndef USE_LTM
523+
#if !defined(USE_LTM) && !defined(USE_TFM) && !defined(USE_GMP) && !defined(EXT_MATH_LIB)
524524
#undef LTC_MPI
525+
#undef LTC_TEST_MPI
526+
#else
527+
#define LTC_TEST_MPI
525528
#endif
526529

527530
#ifdef LTC_MPI
@@ -642,7 +645,7 @@ static void time_prng(void)
642645
}
643646
}
644647

645-
#ifdef LTC_MDSA
648+
#if defined(LTC_MDSA) && defined(LTC_TEST_MPI)
646649
/* time various DSA operations */
647650
static void time_dsa(void)
648651
{
@@ -695,7 +698,7 @@ static void time_dsa(void) { fprintf(stderr, "NO DSA\n"); }
695698
#endif
696699

697700

698-
#ifdef LTC_MRSA
701+
#if defined(LTC_MRSA) && defined(LTC_TEST_MPI)
699702
/* time various RSA operations */
700703
static void time_rsa(void)
701704
{
@@ -819,7 +822,7 @@ static void time_rsa(void)
819822
static void time_rsa(void) { fprintf(stderr, "NO RSA\n"); }
820823
#endif
821824

822-
#ifdef LTC_MKAT
825+
#if defined(LTC_MKAT) && defined(LTC_TEST_MPI)
823826
/* time various KAT operations */
824827
static void time_katja(void)
825828
{
@@ -889,7 +892,7 @@ static void time_katja(void)
889892
static void time_katja(void) { fprintf(stderr, "NO Katja\n"); }
890893
#endif
891894

892-
#ifdef LTC_MDH
895+
#if defined(LTC_MDH) && defined(LTC_TEST_MPI)
893896
/* time various DH operations */
894897
static void time_dh(void)
895898
{
@@ -926,7 +929,7 @@ static void time_dh(void)
926929
static void time_dh(void) { fprintf(stderr, "NO DH\n"); }
927930
#endif
928931

929-
#ifdef LTC_MECC
932+
#if defined(LTC_MECC) && defined(LTC_TEST_MPI)
930933
/* time various ECC operations */
931934
static void time_ecc(void)
932935
{
@@ -1427,9 +1430,11 @@ register_all_prngs();
14271430
ltc_mp = tfm_desc;
14281431
#elif defined(USE_GMP)
14291432
ltc_mp = gmp_desc;
1430-
#else
1431-
extern ltc_math_descriptor EXT_MATH_LIB;
1432-
ltc_mp = EXT_MATH_LIB;
1433+
#elif defined(EXT_MATH_LIB)
1434+
{
1435+
extern ltc_math_descriptor EXT_MATH_LIB;
1436+
ltc_mp = EXT_MATH_LIB;
1437+
}
14331438
#endif
14341439

14351440
if ((err = rng_make_prng(128, find_prng("yarrow"), &yarrow_prng, NULL)) != CRYPT_OK) {

tests/der_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <gmp.h>
1212
#endif
1313

14-
#ifndef LTC_DER
14+
#if !defined(LTC_DER) || !defined(LTC_TEST_MPI)
1515

1616
int der_test(void)
1717
{

tests/dh_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_MDH
11+
#if defined(LTC_MDH) && defined(LTC_TEST_MPI)
1212

1313
#ifdef LTC_DH4096
1414
#define KEYSIZE 4096

tests/dsa_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_MDSA
11+
#if defined(LTC_MDSA) && defined(LTC_TEST_MPI)
1212

1313
/* This is the private key from test_dsa.key */
1414
static const unsigned char openssl_priv_dsa[] = {

tests/ecc_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_MECC
11+
#if defined(LTC_MECC) && defined(LTC_TEST_MPI)
1212

1313
static unsigned int sizes[] = {
1414
#ifdef LTC_ECC112

tests/katja_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_MKAT
11+
#if defined(LTC_MKAT) && defined(LTC_TEST_MPI)
1212

1313
int katja_test(void)
1414
{

tests/mpi_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_MPI
11+
#if defined(LTC_MPI) && defined(LTC_TEST_MPI)
1212
static int _radix_to_bin_test(void)
1313
{
1414
/* RADIX 16 */

tests/pkcs_1_eme_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_PKCS_1
11+
#if defined(LTC_PKCS_1) && defined(LTC_TEST_MPI)
1212

1313
#include "../notes/rsa-testvectors/pkcs1v15crypt-vectors.c"
1414

tests/pkcs_1_emsa_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_PKCS_1
11+
#if defined(LTC_PKCS_1) && defined(LTC_TEST_MPI)
1212

1313
#include "../notes/rsa-testvectors/pkcs1v15sign-vectors.c"
1414

tests/pkcs_1_oaep_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include <tomcrypt_test.h>
1010

11-
#ifdef LTC_PKCS_1
11+
#if defined(LTC_PKCS_1) && defined(LTC_TEST_MPI)
1212

1313
#include "../notes/rsa-testvectors/oaep-vect.c"
1414

0 commit comments

Comments
 (0)