Skip to content

Commit 342a10c

Browse files
committed
make PK_MAX_RETRIES a config option
1 parent a278f72 commit 342a10c

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/headers/tomcrypt_custom.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,11 @@
500500
#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
501501
/* Include the MPI functionality? (required by the PK algorithms) */
502502
#define LTC_MPI
503+
504+
#ifndef LTC_PK_MAX_RETRIES
505+
/* iterations limit for retry-loops */
506+
#define LTC_PK_MAX_RETRIES 20
507+
#endif
503508
#endif
504509

505510
#ifdef LTC_MRSA

src/headers/tomcrypt_pk.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ enum {
1717
/* Indicates standard output formats that can be read e.g. by OpenSSL or GnuTLS */
1818
#define PK_STD 0x1000
1919

20-
/* iterations limit for retry-loops */
21-
#define PK_MAX_RETRIES 20
22-
2320
int rand_prime(void *N, long len, prng_state *prng, int wprng);
2421

2522
#ifdef LTC_SOURCE

src/misc/crypt/crypt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ const char *crypt_build_settings =
301301
" SOBER128\n"
302302
#endif
303303

304-
"\nPK Algs:\n"
304+
"\nPK Crypto:\n"
305305
#if defined(LTC_MRSA)
306306
" RSA"
307307
#if defined(LTC_RSA_BLINDING) && defined(LTC_RSA_CRT_HARDENING)
@@ -329,6 +329,9 @@ const char *crypt_build_settings =
329329
#if defined(LTC_MKAT)
330330
" Katja\n"
331331
#endif
332+
#if defined(LTC_PK_MAX_RETRIES)
333+
" "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n"
334+
#endif
332335

333336
"\nMPI (Math):\n"
334337
#if defined(LTC_MPI)

src/pk/dh/dh_generate_key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int dh_generate_key(prng_state *prng, int wprng, dh_key *key)
4646
{
4747
unsigned char *buf;
4848
unsigned long keysize;
49-
int err, max_iterations = PK_MAX_RETRIES;
49+
int err, max_iterations = LTC_PK_MAX_RETRIES;
5050

5151
LTC_ARGCHK(key != NULL);
5252
LTC_ARGCHK(ltc_mp.name != NULL);

src/pk/ecc/ecc_sign_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static int _ecc_sign_hash(const unsigned char *in, unsigned long inlen,
2222
{
2323
ecc_key pubkey;
2424
void *r, *s, *e, *p;
25-
int err, max_iterations = PK_MAX_RETRIES;
25+
int err, max_iterations = LTC_PK_MAX_RETRIES;
2626
unsigned long pbits, pbytes, i, shift_right;
2727
unsigned char ch, buf[MAXBLOCKSIZE];
2828

0 commit comments

Comments
 (0)