From ab02d2e450451ed6178f65e4e9a90bc3c8a415fe Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Fri, 29 Sep 2017 18:18:35 +0200 Subject: [PATCH] fix rsa_import() of MAX_RSA_SIZE'ed keys The ASN1 encoded RSA key contains two MPI's therefore MAX_RSA_SIZE / 8 isn't enough. --- src/pk/rsa/rsa_import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pk/rsa/rsa_import.c b/src/pk/rsa/rsa_import.c index 4602904..84cd6f6 100644 --- a/src/pk/rsa/rsa_import.c +++ b/src/pk/rsa/rsa_import.c @@ -40,7 +40,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key) } /* see if the OpenSSL DER format RSA public key will work */ - tmpbuf_len = MAX_RSA_SIZE / 8; + tmpbuf_len = inlen; tmpbuf = XCALLOC(1, tmpbuf_len); if (tmpbuf == NULL) { err = CRYPT_MEM;