commit | 1ae051409f69d0db7c492fa59b57bc8755c71109 | [log] [tgz] |
---|---|---|
author | Gilles Peskine <Gilles.Peskine@arm.com> | Sat Jun 30 17:46:59 2018 +0200 |
committer | itayzafrir <itay.zafrir@arm.com> | Wed Sep 12 16:41:11 2018 +0300 |
tree | b9cce14fdf4acc223dc0b87b1ac3407a57a25440 | |
parent | 46f1fd7afd4f17062883ebd6c0dbf915602212f5 [diff] [blame] |
Fix memory leak when importing an RSA key that is too large
diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 19db5a9..1d5337b 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c
@@ -514,7 +514,10 @@ mbedtls_rsa_context *rsa = mbedtls_pk_rsa( pk ); size_t bits = mbedtls_rsa_get_bitlen( rsa ); if( bits > PSA_VENDOR_RSA_MAX_KEY_BITS ) - return( PSA_ERROR_NOT_SUPPORTED ); + { + status = PSA_ERROR_NOT_SUPPORTED; + break; + } slot->data.rsa = rsa; } else