Merge remote-tracking branch 'public/pr/2095' into development-proposed

This commit is contained in:
Simon Butcher 2018-11-04 18:48:04 +00:00
commit 2705beaeef
4 changed files with 19 additions and 12 deletions

View file

@ -34,6 +34,10 @@ Bugfix
program programs/x509/cert_write. Fixes #1422. program programs/x509/cert_write. Fixes #1422.
* Ignore IV in mbedtls_cipher_set_iv() when the cipher mode is MBEDTLS_MODE_ECB * Ignore IV in mbedtls_cipher_set_iv() when the cipher mode is MBEDTLS_MODE_ECB
Fix for #1091 raised by ezdevelop Fix for #1091 raised by ezdevelop
* Zeroize memory used for buffering or reassembling handshake messages
after use.
* Use `mbedtls_platform_zeroize()` instead of `memset()` for zeroization
of sensitive data in the example programs aescrypt2 and crypt_and_hash.
Changes Changes
* Removed support for Yotta as a build tool. * Removed support for Yotta as a build tool.

View file

@ -8801,6 +8801,7 @@ static void ssl_buffering_free_slot( mbedtls_ssl_context *ssl,
if( hs_buf->is_valid == 1 ) if( hs_buf->is_valid == 1 )
{ {
hs->buffering.total_bytes_buffered -= hs_buf->data_len; hs->buffering.total_bytes_buffered -= hs_buf->data_len;
mbedtls_platform_zeroize( hs_buf->data, hs_buf->data_len );
mbedtls_free( hs_buf->data ); mbedtls_free( hs_buf->data );
memset( hs_buf, 0, sizeof( mbedtls_ssl_hs_buffer ) ); memset( hs_buf, 0, sizeof( mbedtls_ssl_hs_buffer ) );
} }

View file

@ -43,6 +43,7 @@
#include "mbedtls/aes.h" #include "mbedtls/aes.h"
#include "mbedtls/md.h" #include "mbedtls/md.h"
#include "mbedtls/platform_util.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -450,13 +451,13 @@ exit:
the case when the user has missed or reordered some, the case when the user has missed or reordered some,
in which case the key might not be in argv[4]. */ in which case the key might not be in argv[4]. */
for( i = 0; i < (unsigned int) argc; i++ ) for( i = 0; i < (unsigned int) argc; i++ )
memset( argv[i], 0, strlen( argv[i] ) ); mbedtls_platform_zeroize( argv[i], strlen( argv[i] ) );
memset( IV, 0, sizeof( IV ) ); mbedtls_platform_zeroize( IV, sizeof( IV ) );
memset( key, 0, sizeof( key ) ); mbedtls_platform_zeroize( key, sizeof( key ) );
memset( tmp, 0, sizeof( tmp ) ); mbedtls_platform_zeroize( tmp, sizeof( tmp ) );
memset( buffer, 0, sizeof( buffer ) ); mbedtls_platform_zeroize( buffer, sizeof( buffer ) );
memset( digest, 0, sizeof( digest ) ); mbedtls_platform_zeroize( digest, sizeof( digest ) );
mbedtls_aes_free( &aes_ctx ); mbedtls_aes_free( &aes_ctx );
mbedtls_md_free( &sha_ctx ); mbedtls_md_free( &sha_ctx );

View file

@ -46,6 +46,7 @@
defined(MBEDTLS_FS_IO) defined(MBEDTLS_FS_IO)
#include "mbedtls/cipher.h" #include "mbedtls/cipher.h"
#include "mbedtls/md.h" #include "mbedtls/md.h"
#include "mbedtls/platform_util.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -547,13 +548,13 @@ exit:
the case when the user has missed or reordered some, the case when the user has missed or reordered some,
in which case the key might not be in argv[6]. */ in which case the key might not be in argv[6]. */
for( i = 0; i < argc; i++ ) for( i = 0; i < argc; i++ )
memset( argv[i], 0, strlen( argv[i] ) ); mbedtls_platform_zeroize( argv[i], strlen( argv[i] ) );
memset( IV, 0, sizeof( IV ) ); mbedtls_platform_zeroize( IV, sizeof( IV ) );
memset( key, 0, sizeof( key ) ); mbedtls_platform_zeroize( key, sizeof( key ) );
memset( buffer, 0, sizeof( buffer ) ); mbedtls_platform_zeroize( buffer, sizeof( buffer ) );
memset( output, 0, sizeof( output ) ); mbedtls_platform_zeroize( output, sizeof( output ) );
memset( digest, 0, sizeof( digest ) ); mbedtls_platform_zeroize( digest, sizeof( digest ) );
mbedtls_cipher_free( &cipher_ctx ); mbedtls_cipher_free( &cipher_ctx );
mbedtls_md_free( &md_ctx ); mbedtls_md_free( &md_ctx );