From 9cfbaa83a36268763601c7bb737448f0df3684b8 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 29 Sep 2017 18:21:17 +0200 Subject: [PATCH] mostly remove MAX_RSA_SIZE --- src/headers/tomcrypt_custom.h | 11 ----------- src/misc/crypt/crypt.c | 3 --- src/misc/crypt/crypt_constants.c | 3 --- src/pk/dsa/dsa_import.c | 2 +- src/pk/rsa/rsa_import_x509.c | 2 +- 5 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/headers/tomcrypt_custom.h b/src/headers/tomcrypt_custom.h index e1de248..66c6afc 100644 --- a/src/headers/tomcrypt_custom.h +++ b/src/headers/tomcrypt_custom.h @@ -438,17 +438,6 @@ #endif #endif -/* in cases where you want ASN.1/DER functionality, but no - * RSA, you can define this externally if 1024 is not enough - */ -#if defined(LTC_MRSA) -#define LTC_DER_MAX_PUBKEY_SIZE MAX_RSA_SIZE -#elif !defined(LTC_DER_MAX_PUBKEY_SIZE) -/* this includes DSA */ -#define LTC_DER_MAX_PUBKEY_SIZE 1024 -#endif - - /* PKCS #1 (RSA) and #5 (Password Handling) stuff */ #ifndef LTC_NO_PKCS diff --git a/src/misc/crypt/crypt.c b/src/misc/crypt/crypt.c index 4ab6275..8cecb32 100644 --- a/src/misc/crypt/crypt.c +++ b/src/misc/crypt/crypt.c @@ -399,9 +399,6 @@ const char *crypt_build_settings = #if defined(LTC_DER) " DER " #endif -#if defined(LTC_DER_MAX_PUBKEY_SIZE) - " " NAME_VALUE(LTC_DER_MAX_PUBKEY_SIZE) " " -#endif #if defined(LTC_PKCS_1) " PKCS#1 " #endif diff --git a/src/misc/crypt/crypt_constants.c b/src/misc/crypt/crypt_constants.c index c63d3f8..496d257 100644 --- a/src/misc/crypt/crypt_constants.c +++ b/src/misc/crypt/crypt_constants.c @@ -107,9 +107,6 @@ static const crypt_constant _crypt_constants[] = { {"LTC_MDSA", 0}, #endif -#ifdef LTC_DER_MAX_PUBKEY_SIZE - _C_STRINGIFY(LTC_DER_MAX_PUBKEY_SIZE), -#endif #ifdef LTC_MILLER_RABIN_REPS _C_STRINGIFY(LTC_MILLER_RABIN_REPS), #endif diff --git a/src/pk/dsa/dsa_import.c b/src/pk/dsa/dsa_import.c index f1f0633..e6a7560 100644 --- a/src/pk/dsa/dsa_import.c +++ b/src/pk/dsa/dsa_import.c @@ -90,7 +90,7 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) key->type = PK_PRIVATE; } else { /* public */ ltc_asn1_list params[3]; - unsigned long tmpbuf_len = LTC_DER_MAX_PUBKEY_SIZE*8; + unsigned long tmpbuf_len = inlen; LTC_SET_ASN1(params, 0, LTC_ASN1_INTEGER, key->p, 1UL); LTC_SET_ASN1(params, 1, LTC_ASN1_INTEGER, key->q, 1UL); diff --git a/src/pk/rsa/rsa_import_x509.c b/src/pk/rsa/rsa_import_x509.c index c57d6ea..0f2d5f1 100644 --- a/src/pk/rsa/rsa_import_x509.c +++ b/src/pk/rsa/rsa_import_x509.c @@ -39,7 +39,7 @@ int rsa_import_x509(const unsigned char *in, unsigned long inlen, rsa_key *key) return err; } - tmpbuf_len = MAX_RSA_SIZE * 8; + tmpbuf_len = inlen; tmpbuf = XCALLOC(1, tmpbuf_len); if (tmpbuf == NULL) { err = CRYPT_MEM;