[PATCH] wolfSSL: Add the server bit according to the openssl code

Masashi Honma masashi.honma at gmail.com
Wed Mar 30 16:53:12 PDT 2022


Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 src/crypto/tls_wolfssl.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c
index cf482bfc3..7aadf8322 100644
--- a/src/crypto/tls_wolfssl.c
+++ b/src/crypto/tls_wolfssl.c
@@ -90,6 +90,7 @@ struct tls_connection {
 	unsigned int cert_probe:1;
 	unsigned int server_cert_only:1;
 	unsigned int success_data:1;
+	unsigned int server:1;
 
 	WOLFSSL_X509 *peer_cert;
 	WOLFSSL_X509 *peer_issuer;
@@ -1614,15 +1615,14 @@ int tls_connection_set_verify(void *ssl_ctx, struct tls_connection *conn,
 
 
 static struct wpabuf * wolfssl_handshake(struct tls_connection *conn,
-					 const struct wpabuf *in_data,
-					 int server)
+					 const struct wpabuf *in_data)
 {
 	int res;
 
 	wolfssl_reset_out_data(&conn->output);
 
 	/* Initiate TLS handshake or continue the existing handshake */
-	if (server) {
+	if (conn->server) {
 		wolfSSL_set_accept_state(conn->ssl);
 		res = wolfSSL_accept(conn->ssl);
 		wpa_printf(MSG_DEBUG, "SSL: wolfSSL_accept: %d", res);
@@ -1695,7 +1695,7 @@ static struct wpabuf * wolfssl_get_appl_data(struct tls_connection *conn,
 static struct wpabuf *
 wolfssl_connection_handshake(struct tls_connection *conn,
 			     const struct wpabuf *in_data,
-			     struct wpabuf **appl_data, int server)
+			     struct wpabuf **appl_data)
 {
 	struct wpabuf *out_data;
 
@@ -1704,7 +1704,7 @@ wolfssl_connection_handshake(struct tls_connection *conn,
 	if (appl_data)
 		*appl_data = NULL;
 
-	out_data = wolfssl_handshake(conn, in_data, server);
+	out_data = wolfssl_handshake(conn, in_data);
 	if (!out_data)
 		return NULL;
 
@@ -1726,7 +1726,7 @@ struct wpabuf * tls_connection_handshake(void *tls_ctx,
 					 const struct wpabuf *in_data,
 					 struct wpabuf **appl_data)
 {
-	return wolfssl_connection_handshake(conn, in_data, appl_data, 0);
+	return wolfssl_connection_handshake(conn, in_data, appl_data);
 }
 
 
@@ -1735,7 +1735,8 @@ struct wpabuf * tls_connection_server_handshake(void *tls_ctx,
 						const struct wpabuf *in_data,
 						struct wpabuf **appl_data)
 {
-	return wolfssl_connection_handshake(conn, in_data, appl_data, 1);
+	conn->server = 1;
+	return wolfssl_connection_handshake(conn, in_data, appl_data);
 }
 
 
-- 
2.25.1




More information about the Hostap mailing list