Browse Source

make PK_MAX_RETRIES a config option

Steffen Jaeckel 8 years ago
parent
commit
342a10cc14

+ 5 - 0
src/headers/tomcrypt_custom.h

@@ -500,6 +500,11 @@
 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
    /* Include the MPI functionality?  (required by the PK algorithms) */
    #define LTC_MPI
+
+   #ifndef LTC_PK_MAX_RETRIES
+      /* iterations limit for retry-loops */
+      #define LTC_PK_MAX_RETRIES  20
+   #endif
 #endif
 
 #ifdef LTC_MRSA

+ 0 - 3
src/headers/tomcrypt_pk.h

@@ -17,9 +17,6 @@ enum {
 /* Indicates standard output formats that can be read e.g. by OpenSSL or GnuTLS */
 #define PK_STD          0x1000
 
-/* iterations limit for retry-loops */
-#define PK_MAX_RETRIES  20
-
 int rand_prime(void *N, long len, prng_state *prng, int wprng);
 
 #ifdef LTC_SOURCE

+ 4 - 1
src/misc/crypt/crypt.c

@@ -301,7 +301,7 @@ const char *crypt_build_settings =
     "   SOBER128\n"
 #endif
 
-    "\nPK Algs:\n"
+    "\nPK Crypto:\n"
 #if defined(LTC_MRSA)
     "   RSA"
 #if defined(LTC_RSA_BLINDING) && defined(LTC_RSA_CRT_HARDENING)
@@ -329,6 +329,9 @@ const char *crypt_build_settings =
 #if defined(LTC_MKAT)
     "   Katja\n"
 #endif
+#if defined(LTC_PK_MAX_RETRIES)
+    "   "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n"
+#endif
 
     "\nMPI (Math):\n"
 #if defined(LTC_MPI)

+ 1 - 1
src/pk/dh/dh_generate_key.c

@@ -46,7 +46,7 @@ int dh_generate_key(prng_state *prng, int wprng, dh_key *key)
 {
    unsigned char *buf;
    unsigned long keysize;
-   int err, max_iterations = PK_MAX_RETRIES;
+   int err, max_iterations = LTC_PK_MAX_RETRIES;
 
    LTC_ARGCHK(key         != NULL);
    LTC_ARGCHK(ltc_mp.name != NULL);

+ 1 - 1
src/pk/ecc/ecc_sign_hash.c

@@ -22,7 +22,7 @@ static int _ecc_sign_hash(const unsigned char *in,  unsigned long inlen,
 {
    ecc_key       pubkey;
    void          *r, *s, *e, *p;
-   int           err, max_iterations = PK_MAX_RETRIES;
+   int           err, max_iterations = LTC_PK_MAX_RETRIES;
    unsigned long pbits, pbytes, i, shift_right;
    unsigned char ch, buf[MAXBLOCKSIZE];