Merge remote-tracking branch 'public/pr/1783' into development

This commit is contained in:
Simon Butcher 2018-06-28 12:04:19 +01:00
commit bea00bd89c
2 changed files with 10 additions and 8 deletions

View file

@ -10,6 +10,8 @@ Features
Bugfix Bugfix
* Fix the key_app_writer example which was writing a leading zero byte which * Fix the key_app_writer example which was writing a leading zero byte which
was creating an invalid ASN.1 tag. Found by Aryeh R. Fixes #1257. was creating an invalid ASN.1 tag. Found by Aryeh R. Fixes #1257.
* Fix compilation error on C++, because of a variable named new.
Found and fixed by Hirotaka Niisato in #1783.
Changes Changes
* Change the shebang line in Perl scripts to look up perl in the PATH. * Change the shebang line in Perl scripts to look up perl in the PATH.

View file

@ -5995,27 +5995,27 @@ static int ssl_append_key_cert( mbedtls_ssl_key_cert **head,
mbedtls_x509_crt *cert, mbedtls_x509_crt *cert,
mbedtls_pk_context *key ) mbedtls_pk_context *key )
{ {
mbedtls_ssl_key_cert *new; mbedtls_ssl_key_cert *new_cert;
new = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) ); new_cert = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) );
if( new == NULL ) if( new_cert == NULL )
return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
new->cert = cert; new_cert->cert = cert;
new->key = key; new_cert->key = key;
new->next = NULL; new_cert->next = NULL;
/* Update head is the list was null, else add to the end */ /* Update head is the list was null, else add to the end */
if( *head == NULL ) if( *head == NULL )
{ {
*head = new; *head = new_cert;
} }
else else
{ {
mbedtls_ssl_key_cert *cur = *head; mbedtls_ssl_key_cert *cur = *head;
while( cur->next != NULL ) while( cur->next != NULL )
cur = cur->next; cur = cur->next;
cur->next = new; cur->next = new_cert;
} }
return( 0 ); return( 0 );