make PK_MAX_RETRIES a config option

This commit is contained in:
Steffen Jaeckel 2017-09-21 13:52:17 +02:00
parent a278f72659
commit 342a10cc14
5 changed files with 11 additions and 6 deletions

View File

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

View File

@ -17,9 +17,6 @@ enum {
/* Indicates standard output formats that can be read e.g. by OpenSSL or GnuTLS */ /* Indicates standard output formats that can be read e.g. by OpenSSL or GnuTLS */
#define PK_STD 0x1000 #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); int rand_prime(void *N, long len, prng_state *prng, int wprng);
#ifdef LTC_SOURCE #ifdef LTC_SOURCE

View File

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

View File

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

View File

@ -22,7 +22,7 @@ static int _ecc_sign_hash(const unsigned char *in, unsigned long inlen,
{ {
ecc_key pubkey; ecc_key pubkey;
void *r, *s, *e, *p; 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 long pbits, pbytes, i, shift_right;
unsigned char ch, buf[MAXBLOCKSIZE]; unsigned char ch, buf[MAXBLOCKSIZE];