remove {MIN,MAX}_RSA_SIZE

This commit is contained in:
Steffen Jaeckel 2017-09-30 13:29:11 +02:00
parent 40e4a66693
commit 30b3a9a986
6 changed files with 3 additions and 23 deletions

View File

@ -48,7 +48,6 @@ The following list is a small part of the available, but the most often required
| ---- | -------- |
| `LTC_NO_TEST` | Remove all algorithm self-tests from the library |
| `LTC_NO_FILE` | Remove all API functions requiring a pre-defined `FILE` data-type (mostly useful for embedded targets) |
| `MAX_RSA_SIZE` | Per default set to `4096`, if you need support for generating bigger RSA keys, change this at compile-time. |
| `GMP_DESC` | enable [gmp](https://gmplib.org/) as MPI provider *\*1* |
| `LTM_DESC` | enable [libtommath](http://www.libtom.net/) as MPI provider *\*1* |
| `TFM_DESC` | enable [tomsfastmath](http://www.libtom.net/) as MPI provider *\*1* *\*2* |

View File

@ -150,7 +150,7 @@ if SHOW_SELECTED_CONSTANTS:
b'ENDIAN_LITTLE',
b'ENDIAN_64BITWORD',
b'PK_PUBLIC',
b'MAX_RSA_SIZE',
b'LTC_MILLER_RABIN_REPS',
b'CTR_COUNTER_BIG_ENDIAN',
]
for name in names:

View File

@ -425,19 +425,6 @@
#define LTC_ECC_TIMING_RESISTANT
#endif
/* define these PK sizes out of LTC_NO_PK
* to have them always defined
*/
#if defined(LTC_MRSA)
/* Min and Max RSA key sizes (in bits) */
#ifndef MIN_RSA_SIZE
#define MIN_RSA_SIZE 1024
#endif
#ifndef MAX_RSA_SIZE
#define MAX_RSA_SIZE 4096
#endif
#endif
/* PKCS #1 (RSA) and #5 (Password Handling) stuff */
#ifndef LTC_NO_PKCS

View File

@ -77,8 +77,6 @@ static const crypt_constant _crypt_constants[] = {
#ifdef LTC_MRSA
{"LTC_MRSA", 1},
_C_STRINGIFY(MIN_RSA_SIZE),
_C_STRINGIFY(MAX_RSA_SIZE),
#else
{"LTC_MRSA", 0},
#endif

View File

@ -32,10 +32,6 @@ int rsa_make_key(prng_state *prng, int wprng, int size, long e, rsa_key *key)
LTC_ARGCHK(ltc_mp.name != NULL);
LTC_ARGCHK(key != NULL);
if ((size < (MIN_RSA_SIZE/8)) || (size > (MAX_RSA_SIZE/8))) {
return CRYPT_INVALID_KEYSIZE;
}
if ((e < 3) || ((e & 1) == 0)) {
return CRYPT_INVALID_ARG;
}

View File

@ -313,10 +313,10 @@ static int _rsa_key_cmp(const int should_type, const rsa_key *should, const rsa_
static int _rsa_issue_301(int prng_idx)
{
rsa_key key, key_in;
unsigned char buf[MAX_RSA_SIZE];
unsigned char buf[4096];
unsigned long len;
DO(rsa_make_key(&yarrow_prng, prng_idx, MAX_RSA_SIZE/8, 65537, &key));
DO(rsa_make_key(&yarrow_prng, prng_idx, sizeof(buf)/8, 65537, &key));
len = sizeof(buf);
DO(rsa_export(buf, &len, PK_PRIVATE, &key));