Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
f2c32f7e
Unverified
Commit
f2c32f7e
authored
Apr 21, 2020
by
Rémi Verschelde
Committed by
GitHub
Apr 21, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #38069 from akien-mga/mbedtls-2.16.6
mbedtls: Update to upstream version 2.16.6
parents
7343ec13
6b00357d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
18 deletions
+93
-18
README.md
thirdparty/README.md
+1
-1
check_config.h
thirdparty/mbedtls/include/mbedtls/check_config.h
+21
-0
version.h
thirdparty/mbedtls/include/mbedtls/version.h
+4
-4
ecp.c
thirdparty/mbedtls/library/ecp.c
+28
-0
ssl_cli.c
thirdparty/mbedtls/library/ssl_cli.c
+14
-2
ssl_tls.c
thirdparty/mbedtls/library/ssl_tls.c
+24
-10
x509.c
thirdparty/mbedtls/library/x509.c
+1
-1
No files found.
thirdparty/README.md
View file @
f2c32f7e
...
@@ -302,7 +302,7 @@ changes are marked with `// -- GODOT --` comments.
...
@@ -302,7 +302,7 @@ changes are marked with `// -- GODOT --` comments.
## mbedtls
## mbedtls
-
Upstream: https://tls.mbed.org/
-
Upstream: https://tls.mbed.org/
-
Version: 2.16.
5
-
Version: 2.16.
6
-
License: Apache 2.0
-
License: Apache 2.0
File extracted from upstream release tarball (
`-apache.tgz`
variant):
File extracted from upstream release tarball (
`-apache.tgz`
variant):
...
...
thirdparty/mbedtls/include/mbedtls/check_config.h
View file @
f2c32f7e
...
@@ -546,6 +546,23 @@
...
@@ -546,6 +546,23 @@
#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
#error "MBEDTLS_SSL_PROTO_TLS1_2 defined, but not all prerequisites"
#endif
#endif
#if (defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
defined(MBEDTLS_SSL_PROTO_TLS1_1) || defined(MBEDTLS_SSL_PROTO_TLS1_2)) && \
!(defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED) || \
defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) )
#error "One or more versions of the TLS protocol are enabled " \
"but no key exchange methods defined with MBEDTLS_KEY_EXCHANGE_xxxx"
#endif
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
#if defined(MBEDTLS_SSL_PROTO_DTLS) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_1) && \
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
!defined(MBEDTLS_SSL_PROTO_TLS1_2)
...
@@ -669,6 +686,10 @@
...
@@ -669,6 +686,10 @@
#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
#error "MBEDTLS_X509_CREATE_C defined, but not all prerequisites"
#endif
#endif
#if defined(MBEDTLS_CERTS_C) && !defined(MBEDTLS_X509_USE_C)
#error "MBEDTLS_CERTS_C defined, but not all prerequisites"
#endif
#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
#if defined(MBEDTLS_X509_CRT_PARSE_C) && ( !defined(MBEDTLS_X509_USE_C) )
#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
#error "MBEDTLS_X509_CRT_PARSE_C defined, but not all prerequisites"
#endif
#endif
...
...
thirdparty/mbedtls/include/mbedtls/version.h
View file @
f2c32f7e
...
@@ -40,16 +40,16 @@
...
@@ -40,16 +40,16 @@
*/
*/
#define MBEDTLS_VERSION_MAJOR 2
#define MBEDTLS_VERSION_MAJOR 2
#define MBEDTLS_VERSION_MINOR 16
#define MBEDTLS_VERSION_MINOR 16
#define MBEDTLS_VERSION_PATCH
5
#define MBEDTLS_VERSION_PATCH
6
/**
/**
* The single version number has the following structure:
* The single version number has the following structure:
* MMNNPP00
* MMNNPP00
* Major version | Minor version | Patch version
* Major version | Minor version | Patch version
*/
*/
#define MBEDTLS_VERSION_NUMBER 0x02100
5
00
#define MBEDTLS_VERSION_NUMBER 0x02100
6
00
#define MBEDTLS_VERSION_STRING "2.16.
5
"
#define MBEDTLS_VERSION_STRING "2.16.
6
"
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.
5
"
#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.16.
6
"
#if defined(MBEDTLS_VERSION_C)
#if defined(MBEDTLS_VERSION_C)
...
...
thirdparty/mbedtls/library/ecp.c
View file @
f2c32f7e
...
@@ -1938,6 +1938,20 @@ static int ecp_mul_comb_after_precomp( const mbedtls_ecp_group *grp,
...
@@ -1938,6 +1938,20 @@ static int ecp_mul_comb_after_precomp( const mbedtls_ecp_group *grp,
final_norm:
final_norm:
#endif
#endif
/*
* Knowledge of the jacobian coordinates may leak the last few bits of the
* scalar [1], and since our MPI implementation isn't constant-flow,
* inversion (used for coordinate normalization) may leak the full value
* of its input via side-channels [2].
*
* [1] https://eprint.iacr.org/2003/191
* [2] https://eprint.iacr.org/2020/055
*
* Avoid the leak by randomizing coordinates before we normalize them.
*/
if
(
f_rng
!=
0
)
MBEDTLS_MPI_CHK
(
ecp_randomize_jac
(
grp
,
RR
,
f_rng
,
p_rng
)
);
MBEDTLS_ECP_BUDGET
(
MBEDTLS_ECP_OPS_INV
);
MBEDTLS_ECP_BUDGET
(
MBEDTLS_ECP_OPS_INV
);
MBEDTLS_MPI_CHK
(
ecp_normalize_jac
(
grp
,
RR
)
);
MBEDTLS_MPI_CHK
(
ecp_normalize_jac
(
grp
,
RR
)
);
...
@@ -2308,6 +2322,20 @@ static int ecp_mul_mxz( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
...
@@ -2308,6 +2322,20 @@ static int ecp_mul_mxz( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
MBEDTLS_MPI_CHK
(
mbedtls_mpi_safe_cond_swap
(
&
R
->
Z
,
&
RP
.
Z
,
b
)
);
MBEDTLS_MPI_CHK
(
mbedtls_mpi_safe_cond_swap
(
&
R
->
Z
,
&
RP
.
Z
,
b
)
);
}
}
/*
* Knowledge of the projective coordinates may leak the last few bits of the
* scalar [1], and since our MPI implementation isn't constant-flow,
* inversion (used for coordinate normalization) may leak the full value
* of its input via side-channels [2].
*
* [1] https://eprint.iacr.org/2003/191
* [2] https://eprint.iacr.org/2020/055
*
* Avoid the leak by randomizing coordinates before we normalize them.
*/
if
(
f_rng
!=
NULL
)
MBEDTLS_MPI_CHK
(
ecp_randomize_mxz
(
grp
,
R
,
f_rng
,
p_rng
)
);
MBEDTLS_MPI_CHK
(
ecp_normalize_mxz
(
grp
,
R
)
);
MBEDTLS_MPI_CHK
(
ecp_normalize_mxz
(
grp
,
R
)
);
cleanup:
cleanup:
...
...
thirdparty/mbedtls/library/ssl_cli.c
View file @
f2c32f7e
...
@@ -1417,6 +1417,19 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
...
@@ -1417,6 +1417,19 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"=> parse hello verify request"
)
);
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"=> parse hello verify request"
)
);
/* Check that there is enough room for:
* - 2 bytes of version
* - 1 byte of cookie_len
*/
if
(
mbedtls_ssl_hs_hdr_len
(
ssl
)
+
3
>
ssl
->
in_msglen
)
{
MBEDTLS_SSL_DEBUG_MSG
(
1
,
(
"incoming HelloVerifyRequest message is too short"
)
);
mbedtls_ssl_send_alert_message
(
ssl
,
MBEDTLS_SSL_ALERT_LEVEL_FATAL
,
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR
);
return
(
MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO
);
}
/*
/*
* struct {
* struct {
* ProtocolVersion server_version;
* ProtocolVersion server_version;
...
@@ -1445,8 +1458,6 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
...
@@ -1445,8 +1458,6 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
}
}
cookie_len
=
*
p
++
;
cookie_len
=
*
p
++
;
MBEDTLS_SSL_DEBUG_BUF
(
3
,
"cookie"
,
p
,
cookie_len
);
if
(
(
ssl
->
in_msg
+
ssl
->
in_msglen
)
-
p
<
cookie_len
)
if
(
(
ssl
->
in_msg
+
ssl
->
in_msglen
)
-
p
<
cookie_len
)
{
{
MBEDTLS_SSL_DEBUG_MSG
(
1
,
MBEDTLS_SSL_DEBUG_MSG
(
1
,
...
@@ -1455,6 +1466,7 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
...
@@ -1455,6 +1466,7 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR
);
MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR
);
return
(
MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO
);
return
(
MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO
);
}
}
MBEDTLS_SSL_DEBUG_BUF
(
3
,
"cookie"
,
p
,
cookie_len
);
mbedtls_free
(
ssl
->
handshake
->
verify_cookie
);
mbedtls_free
(
ssl
->
handshake
->
verify_cookie
);
...
...
thirdparty/mbedtls/library/ssl_tls.c
View file @
f2c32f7e
...
@@ -1004,8 +1004,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
...
@@ -1004,8 +1004,6 @@ int mbedtls_ssl_derive_keys( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
if
(
mbedtls_ssl_hw_record_init
!=
NULL
)
if
(
mbedtls_ssl_hw_record_init
!=
NULL
)
{
{
int
ret
=
0
;
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"going for mbedtls_ssl_hw_record_init()"
)
);
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"going for mbedtls_ssl_hw_record_init()"
)
);
if
(
(
ret
=
mbedtls_ssl_hw_record_init
(
ssl
,
key1
,
key2
,
transform
->
keylen
,
if
(
(
ret
=
mbedtls_ssl_hw_record_init
(
ssl
,
key1
,
key2
,
transform
->
keylen
,
...
@@ -2885,15 +2883,18 @@ static void ssl_dtls_replay_reset( mbedtls_ssl_context *ssl );
...
@@ -2885,15 +2883,18 @@ static void ssl_dtls_replay_reset( mbedtls_ssl_context *ssl );
/*
/*
* Swap transform_out and out_ctr with the alternative ones
* Swap transform_out and out_ctr with the alternative ones
*/
*/
static
void
ssl_swap_epochs
(
mbedtls_ssl_context
*
ssl
)
static
int
ssl_swap_epochs
(
mbedtls_ssl_context
*
ssl
)
{
{
mbedtls_ssl_transform
*
tmp_transform
;
mbedtls_ssl_transform
*
tmp_transform
;
unsigned
char
tmp_out_ctr
[
8
];
unsigned
char
tmp_out_ctr
[
8
];
#if defined(MBEDTLS_SSL_HW_RECORD_ACCEL)
int
ret
;
#endif
/* MBEDTLS_SSL_HW_RECORD_ACCEL */
if
(
ssl
->
transform_out
==
ssl
->
handshake
->
alt_transform_out
)
if
(
ssl
->
transform_out
==
ssl
->
handshake
->
alt_transform_out
)
{
{
MBEDTLS_SSL_DEBUG_MSG
(
3
,
(
"skip swap epochs"
)
);
MBEDTLS_SSL_DEBUG_MSG
(
3
,
(
"skip swap epochs"
)
);
return
;
return
(
0
)
;
}
}
MBEDTLS_SSL_DEBUG_MSG
(
3
,
(
"swap epochs"
)
);
MBEDTLS_SSL_DEBUG_MSG
(
3
,
(
"swap epochs"
)
);
...
@@ -2920,7 +2921,9 @@ static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
...
@@ -2920,7 +2921,9 @@ static void ssl_swap_epochs( mbedtls_ssl_context *ssl )
return
(
MBEDTLS_ERR_SSL_HW_ACCEL_FAILED
);
return
(
MBEDTLS_ERR_SSL_HW_ACCEL_FAILED
);
}
}
}
}
#endif
#endif
/* MBEDTLS_SSL_HW_RECORD_ACCEL */
return
(
0
);
}
}
/*
/*
...
@@ -2957,7 +2960,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
...
@@ -2957,7 +2960,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
ssl
->
handshake
->
cur_msg
=
ssl
->
handshake
->
flight
;
ssl
->
handshake
->
cur_msg
=
ssl
->
handshake
->
flight
;
ssl
->
handshake
->
cur_msg_p
=
ssl
->
handshake
->
flight
->
p
+
12
;
ssl
->
handshake
->
cur_msg_p
=
ssl
->
handshake
->
flight
->
p
+
12
;
ssl_swap_epochs
(
ssl
);
if
(
(
ret
=
ssl_swap_epochs
(
ssl
)
)
!=
0
)
return
(
ret
);
ssl
->
handshake
->
retransmit_state
=
MBEDTLS_SSL_RETRANS_SENDING
;
ssl
->
handshake
->
retransmit_state
=
MBEDTLS_SSL_RETRANS_SENDING
;
}
}
...
@@ -2980,7 +2984,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
...
@@ -2980,7 +2984,8 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
if
(
is_finished
&&
ssl
->
handshake
->
cur_msg_p
==
(
cur
->
p
+
12
)
)
if
(
is_finished
&&
ssl
->
handshake
->
cur_msg_p
==
(
cur
->
p
+
12
)
)
{
{
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"swap epochs to send finished message"
)
);
MBEDTLS_SSL_DEBUG_MSG
(
2
,
(
"swap epochs to send finished message"
)
);
ssl_swap_epochs
(
ssl
);
if
(
(
ret
=
ssl_swap_epochs
(
ssl
)
)
!=
0
)
return
(
ret
);
}
}
ret
=
ssl_get_remaining_payload_in_datagram
(
ssl
);
ret
=
ssl_get_remaining_payload_in_datagram
(
ssl
);
...
@@ -3017,7 +3022,10 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
...
@@ -3017,7 +3022,10 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
if
(
(
max_frag_len
<
12
)
||
(
max_frag_len
==
12
&&
hs_len
!=
0
)
)
if
(
(
max_frag_len
<
12
)
||
(
max_frag_len
==
12
&&
hs_len
!=
0
)
)
{
{
if
(
is_finished
)
if
(
is_finished
)
ssl_swap_epochs
(
ssl
);
{
if
(
(
ret
=
ssl_swap_epochs
(
ssl
)
)
!=
0
)
return
(
ret
);
}
if
(
(
ret
=
mbedtls_ssl_flush_output
(
ssl
)
)
!=
0
)
if
(
(
ret
=
mbedtls_ssl_flush_output
(
ssl
)
)
!=
0
)
return
(
ret
);
return
(
ret
);
...
@@ -3997,17 +4005,23 @@ static int ssl_handle_possible_reconnect( mbedtls_ssl_context *ssl )
...
@@ -3997,17 +4005,23 @@ static int ssl_handle_possible_reconnect( mbedtls_ssl_context *ssl )
if
(
ret
==
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
)
if
(
ret
==
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
)
{
{
int
send_ret
;
MBEDTLS_SSL_DEBUG_MSG
(
1
,
(
"sending HelloVerifyRequest"
)
);
MBEDTLS_SSL_DEBUG_BUF
(
4
,
"output record sent to network"
,
ssl
->
out_buf
,
len
);
/* Don't check write errors as we can't do anything here.
/* Don't check write errors as we can't do anything here.
* If the error is permanent we'll catch it later,
* If the error is permanent we'll catch it later,
* if it's not, then hopefully it'll work next time. */
* if it's not, then hopefully it'll work next time. */
(
void
)
ssl
->
f_send
(
ssl
->
p_bio
,
ssl
->
out_buf
,
len
);
send_ret
=
ssl
->
f_send
(
ssl
->
p_bio
,
ssl
->
out_buf
,
len
);
MBEDTLS_SSL_DEBUG_RET
(
2
,
"ssl->f_send"
,
send_ret
);
(
void
)
send_ret
;
return
(
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
);
return
(
MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED
);
}
}
if
(
ret
==
0
)
if
(
ret
==
0
)
{
{
/* Got a valid cookie, partially reset context */
MBEDTLS_SSL_DEBUG_MSG
(
1
,
(
"cookie is valid, resetting context"
)
);
if
(
(
ret
=
ssl_session_reset_int
(
ssl
,
1
)
)
!=
0
)
if
(
(
ret
=
ssl_session_reset_int
(
ssl
,
1
)
)
!=
0
)
{
{
MBEDTLS_SSL_DEBUG_RET
(
1
,
"reset"
,
ret
);
MBEDTLS_SSL_DEBUG_RET
(
1
,
"reset"
,
ret
);
...
...
thirdparty/mbedtls/library/x509.c
View file @
f2c32f7e
...
@@ -1063,7 +1063,7 @@ cleanup:
...
@@ -1063,7 +1063,7 @@ cleanup:
mbedtls_x509_crt_free
(
&
clicert
);
mbedtls_x509_crt_free
(
&
clicert
);
#else
#else
((
void
)
verbose
);
((
void
)
verbose
);
#endif
/* MBEDTLS_CERTS_C && MBEDTLS_SHA
1
_C */
#endif
/* MBEDTLS_CERTS_C && MBEDTLS_SHA
256
_C */
return
(
ret
);
return
(
ret
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment