mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 00:45:39 +00:00
Merge pull request #3925 from rodrigo-dc/mbedtls-2.16
Backport 2.16: Fix build failure on gcc-11
This commit is contained in:
commit
e98bbbeb06
2
ChangeLog.d/bugfix_3782.txt
Normal file
2
ChangeLog.d/bugfix_3782.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Bugfix
|
||||||
|
* Fix build failures on GCC 11. Fixes #3782.
|
|
@ -450,7 +450,7 @@ exit:
|
||||||
*/
|
*/
|
||||||
int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_length,
|
int mbedtls_aes_cmac_prf_128( const unsigned char *key, size_t key_length,
|
||||||
const unsigned char *input, size_t in_len,
|
const unsigned char *input, size_t in_len,
|
||||||
unsigned char *output )
|
unsigned char output[16] )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
const mbedtls_cipher_info_t *cipher_info;
|
const mbedtls_cipher_info_t *cipher_info;
|
||||||
|
|
|
@ -621,7 +621,7 @@ static void ssl_calc_finished_tls( mbedtls_ssl_context *, unsigned char *, int )
|
||||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
#if defined(MBEDTLS_SHA256_C)
|
#if defined(MBEDTLS_SHA256_C)
|
||||||
static void ssl_update_checksum_sha256( mbedtls_ssl_context *, const unsigned char *, size_t );
|
static void ssl_update_checksum_sha256( mbedtls_ssl_context *, const unsigned char *, size_t );
|
||||||
static void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *,unsigned char * );
|
static void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *, unsigned char * );
|
||||||
static void ssl_calc_finished_tls_sha256( mbedtls_ssl_context *,unsigned char *, int );
|
static void ssl_calc_finished_tls_sha256( mbedtls_ssl_context *,unsigned char *, int );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1142,7 +1142,7 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
||||||
void ssl_calc_verify_ssl( mbedtls_ssl_context *ssl, unsigned char hash[36] )
|
void ssl_calc_verify_ssl( mbedtls_ssl_context *ssl, unsigned char *hash )
|
||||||
{
|
{
|
||||||
mbedtls_md5_context md5;
|
mbedtls_md5_context md5;
|
||||||
mbedtls_sha1_context sha1;
|
mbedtls_sha1_context sha1;
|
||||||
|
@ -1191,7 +1191,7 @@ void ssl_calc_verify_ssl( mbedtls_ssl_context *ssl, unsigned char hash[36] )
|
||||||
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
|
#endif /* MBEDTLS_SSL_PROTO_SSL3 */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1)
|
#if defined(MBEDTLS_SSL_PROTO_TLS1) || defined(MBEDTLS_SSL_PROTO_TLS1_1)
|
||||||
void ssl_calc_verify_tls( mbedtls_ssl_context *ssl, unsigned char hash[36] )
|
void ssl_calc_verify_tls( mbedtls_ssl_context *ssl, unsigned char *hash )
|
||||||
{
|
{
|
||||||
mbedtls_md5_context md5;
|
mbedtls_md5_context md5;
|
||||||
mbedtls_sha1_context sha1;
|
mbedtls_sha1_context sha1;
|
||||||
|
@ -1219,7 +1219,7 @@ void ssl_calc_verify_tls( mbedtls_ssl_context *ssl, unsigned char hash[36] )
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||||
#if defined(MBEDTLS_SHA256_C)
|
#if defined(MBEDTLS_SHA256_C)
|
||||||
void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *ssl, unsigned char hash[32] )
|
void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *ssl, unsigned char *hash )
|
||||||
{
|
{
|
||||||
mbedtls_sha256_context sha256;
|
mbedtls_sha256_context sha256;
|
||||||
|
|
||||||
|
@ -1240,7 +1240,7 @@ void ssl_calc_verify_tls_sha256( mbedtls_ssl_context *ssl, unsigned char hash[32
|
||||||
#endif /* MBEDTLS_SHA256_C */
|
#endif /* MBEDTLS_SHA256_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SHA512_C)
|
#if defined(MBEDTLS_SHA512_C)
|
||||||
void ssl_calc_verify_tls_sha384( mbedtls_ssl_context *ssl, unsigned char hash[48] )
|
void ssl_calc_verify_tls_sha384( mbedtls_ssl_context *ssl, unsigned char *hash )
|
||||||
{
|
{
|
||||||
mbedtls_sha512_context sha512;
|
mbedtls_sha512_context sha512;
|
||||||
|
|
||||||
|
@ -6363,6 +6363,9 @@ static void ssl_calc_finished_tls_sha256(
|
||||||
#endif /* MBEDTLS_SHA256_C */
|
#endif /* MBEDTLS_SHA256_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SHA512_C)
|
#if defined(MBEDTLS_SHA512_C)
|
||||||
|
|
||||||
|
typedef int (*finish_sha384_t)(mbedtls_sha512_context*, unsigned char*);
|
||||||
|
|
||||||
static void ssl_calc_finished_tls_sha384(
|
static void ssl_calc_finished_tls_sha384(
|
||||||
mbedtls_ssl_context *ssl, unsigned char *buf, int from )
|
mbedtls_ssl_context *ssl, unsigned char *buf, int from )
|
||||||
{
|
{
|
||||||
|
@ -6370,6 +6373,12 @@ static void ssl_calc_finished_tls_sha384(
|
||||||
const char *sender;
|
const char *sender;
|
||||||
mbedtls_sha512_context sha512;
|
mbedtls_sha512_context sha512;
|
||||||
unsigned char padbuf[48];
|
unsigned char padbuf[48];
|
||||||
|
/*
|
||||||
|
* For SHA-384, we can save 16 bytes by keeping padbuf 48 bytes long.
|
||||||
|
* However, to avoid stringop-overflow warning in gcc, we have to cast
|
||||||
|
* mbedtls_sha512_finish_ret().
|
||||||
|
*/
|
||||||
|
finish_sha384_t finish_sha384 = (finish_sha384_t)mbedtls_sha512_finish_ret;
|
||||||
|
|
||||||
mbedtls_ssl_session *session = ssl->session_negotiate;
|
mbedtls_ssl_session *session = ssl->session_negotiate;
|
||||||
if( !session )
|
if( !session )
|
||||||
|
@ -6396,7 +6405,7 @@ static void ssl_calc_finished_tls_sha384(
|
||||||
? "client finished"
|
? "client finished"
|
||||||
: "server finished";
|
: "server finished";
|
||||||
|
|
||||||
mbedtls_sha512_finish_ret( &sha512, padbuf );
|
finish_sha384( &sha512, padbuf );
|
||||||
|
|
||||||
ssl->handshake->tls_prf( session->master, 48, sender,
|
ssl->handshake->tls_prf( session->master, 48, sender,
|
||||||
padbuf, 48, buf, len );
|
padbuf, 48, buf, len );
|
||||||
|
|
|
@ -185,7 +185,7 @@ static int calloc_self_test( int verbose )
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
||||||
static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
|
static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char buf[10] = "xxxxxxxxx";
|
char buf[10] = "xxxxxxxxx";
|
||||||
|
|
|
@ -330,7 +330,7 @@ static int convert_params( size_t cnt , char ** params , int * int_params_store
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
__attribute__((__noinline__))
|
__attribute__((__noinline__))
|
||||||
#endif
|
#endif
|
||||||
static int test_snprintf( size_t n, const char ref_buf[10], int ref_ret )
|
static int test_snprintf( size_t n, const char *ref_buf, int ref_ret )
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char buf[10] = "xxxxxxxxx";
|
char buf[10] = "xxxxxxxxx";
|
||||||
|
|
Loading…
Reference in a new issue