Merge pull request #5309 from gilles-peskine-arm/pkparse-pkcs8-unencrypted-no-alloc
mbedtls_pk_parse_key: don't allocate if not needed
This commit is contained in:
commit
b032685543
2 changed files with 4 additions and 0 deletions
3
ChangeLog.d/pkparse-pkcs8-unencrypted-no-alloc.txt
Normal file
3
ChangeLog.d/pkparse-pkcs8-unencrypted-no-alloc.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
Changes
|
||||
* In mbedtls_pk_parse_key(), if no password is provided, don't allocate a
|
||||
temporary variable on the heap. Suggested by Sergey Kanatov in #5304.
|
|
@ -1343,6 +1343,7 @@ int mbedtls_pk_parse_key( mbedtls_pk_context *pk,
|
|||
* error
|
||||
*/
|
||||
#if defined(MBEDTLS_PKCS12_C) || defined(MBEDTLS_PKCS5_C)
|
||||
if( pwdlen != 0 )
|
||||
{
|
||||
unsigned char *key_copy;
|
||||
|
||||
|
|
Loading…
Reference in a new issue