Skip to content

Commit b0bf8b9

Browse files
committed
MDEV-40445 TLS 1.3 early data (wolfssl)
Compiles with WolfSSL but hits protocol errors. Disable 0-RTT for WolfSSL for now - compile it off, simply setting SSL_CTX_set_max_early_data(ssl, 0) is not enough.
1 parent 07e0852 commit b0bf8b9

5 files changed

Lines changed: 76 additions & 1 deletion

File tree

extra/wolfssl/user_settings.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#define WC_RSA_PSS
6060
#define HAVE_SESSION_TICKET
6161
#define KEEP_PEER_CERT
62+
/*#define WOLFSSL_EARLY_DATA*/
6263
/* End of TLSv1.3 defines */
6364

6465
/* Features we exclude */

include/ssl_compat.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,42 @@
6868

6969
#ifdef HAVE_WOLFSSL
7070
#define EVP_MD_CTX_SIZE sizeof(wc_Md5)
71+
#define SSL_READ_EARLY_DATA_SUCCESS 0
72+
#define early_data_size_t int
73+
/**** WolfSSL stub: will go away when WOLFSSL_EARLY_DATA is enabled ****/
74+
static inline
75+
int wolfSSL_write_early_data(void* ssl __attribute__((unused)),
76+
const void* data __attribute__((unused)),
77+
int sz __attribute__((unused)),
78+
int* outSz)
79+
{
80+
return 1;
81+
}
82+
static inline
83+
int wolfSSL_read_early_data(void* ssl __attribute__((unused)),
84+
void* data __attribute__((unused)),
85+
int sz __attribute__((unused)),
86+
int* outSz __attribute__((unused)))
87+
{
88+
*outSz= 0;
89+
return SSL_READ_EARLY_DATA_SUCCESS;
90+
}
91+
static inline
92+
int SSL_CTX_set_max_early_data(void* ctx __attribute__((unused)),
93+
unsigned int sz __attribute__((unused)))
94+
{
95+
return 1;
96+
}
97+
static inline
98+
int SSL_get_early_data_status(const void* ssl __attribute__((unused)))
99+
{
100+
return 1;
101+
}
102+
#define SSL_EARLY_DATA_ACCEPTED 0
103+
#define SSL_EARLY_DATA_REJECTED 1
104+
/**** End of WolfSSL stub **********************************************/
105+
#else
106+
#define early_data_size_t size_t
71107
#endif
72108

73109
#ifndef HAVE_OPENSSL11
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--- a/mysql-test/main/ssl_early_data.result
2+
+++ b/mysql-test/main/ssl_early_data.result
3+
@@ -7,7 +7,7 @@ connect ssl1,localhost,u1,pw,,,,SSL;
4+
show status like 'ssl_early_data%';
5+
Variable_name Value
6+
Ssl_early_data_accepted 0
7+
-Ssl_early_data_rejected 0
8+
+Ssl_early_data_rejected 1
9+
Ssl_early_data_replies 0
10+
show status like 'ssl_sessions_reused';
11+
Variable_name Value
12+
@@ -16,9 +16,9 @@ disconnect ssl1;
13+
connect ssl2,localhost,u1,pw,,,,SSL;
14+
show status like 'ssl_early_data%';
15+
Variable_name Value
16+
-Ssl_early_data_accepted 1
17+
-Ssl_early_data_rejected 0
18+
-Ssl_early_data_replies 1
19+
+Ssl_early_data_accepted 0
20+
+Ssl_early_data_rejected 2
21+
+Ssl_early_data_replies 0
22+
show status like 'ssl_sessions_reused';
23+
Variable_name Value
24+
Ssl_sessions_reused 1
25+
@@ -26,9 +26,9 @@ disconnect ssl2;
26+
connect ssl3,localhost,u1,pw,,,,SSL;
27+
show status like 'ssl_early_data%';
28+
Variable_name Value
29+
-Ssl_early_data_accepted 2
30+
-Ssl_early_data_rejected 0
31+
-Ssl_early_data_replies 2
32+
+Ssl_early_data_accepted 0
33+
+Ssl_early_data_rejected 3
34+
+Ssl_early_data_replies 0
35+
show status like 'ssl_sessions_reused';
36+
Variable_name Value
37+
Ssl_sessions_reused 1

mysql-test/main/ssl_early_data.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--echo #
44

55
--source include/not_embedded.inc
6+
--source include/ssl_library.inc
67

78
--echo try without a password or with unsecure plugin
89

vio/viossl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ ulong sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *
425425
set_if_smaller(bufsize, MAX_EARLY_DATA);
426426
for (;;)
427427
{
428-
size_t nread;
428+
early_data_size_t nread;
429429
int ret= SSL_read_early_data(ssl, buf, bufsize, &nread);
430430
if (ret >= SSL_READ_EARLY_DATA_SUCCESS)
431431
{

0 commit comments

Comments
 (0)