diff mbox series

wolfSSL: Add the server bit according to the openssl code

Message ID 20220330235312.100758-1-masashi.honma@gmail.com
State Changes Requested
Headers show
Series wolfSSL: Add the server bit according to the openssl code | expand

Commit Message

Masashi Honma March 30, 2022, 11:53 p.m. UTC
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 src/crypto/tls_wolfssl.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Jouni Malinen March 31, 2022, 7:24 a.m. UTC | #1
On Thu, Mar 31, 2022 at 08:53:12AM +0900, Masashi Honma wrote:
> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
> ---

It would be nice if the commit message were to provide some
justification for why this modification would be done. It is not obvious
what there changes would gain on their own.
Masashi Honma March 31, 2022, 7:28 a.m. UTC | #2
> It would be nice if the commit message were to provide some
> justification for why this modification would be done. It is not obvious
> what there changes would gain on their own.

This is just a preparation for trailing patches.
So I will drop this and resubmit when I will send trailing patches.

2022年3月31日(木) 16:24 Jouni Malinen <j@w1.fi>:
>
> On Thu, Mar 31, 2022 at 08:53:12AM +0900, Masashi Honma wrote:
> > Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
> > ---
>
> It would be nice if the commit message were to provide some
> justification for why this modification would be done. It is not obvious
> what there changes would gain on their own.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
diff mbox series

Patch

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);
 }