diff mbox series

crypto/wolfssl: fix build

Message ID 20180428190626.GA29778@makrotopia.org
State Not Applicable
Headers show
Series crypto/wolfssl: fix build | expand

Commit Message

Daniel Golle April 28, 2018, 7:06 p.m. UTC
Replace non-existing config-symbol and fix variable-name typo which
caused the build to fail with CONFIG_TLS=wolfssl.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 src/crypto/crypto_wolfssl.c | 4 ++--
 src/crypto/tls_wolfssl.c    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Jouni Malinen May 2, 2018, 3:04 p.m. UTC | #1
On Sat, Apr 28, 2018 at 09:06:32PM +0200, Daniel Golle wrote:
> Replace non-existing config-symbol and fix variable-name typo which
> caused the build to fail with CONFIG_TLS=wolfssl.

> diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c

> -#ifdef CONFIG_DES
> +#ifndef CONFIG_INTERNAL_DES
>  int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
>  {
>  	Des des;
> @@ -312,7 +312,7 @@ int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
>  
>  	return 0;
>  }
> -#endif /* CONFIG_DES */
> +#endif /* !CONFIG_INTERNAL_DES */

CONFIG_DES does actually exist (wpa_supplicant/Makefile and
hostapd/Makefile define this for the C pre-processor)..
CONFIG_INTERNAL_DES on the other hand is used only within make and is
not exposed to the C pre-processor. As such, I don't see how this
changes would be appropriate. Do you really need this to fix the build?
If so, it would imply that either there are some other issues in
des_encrypt() is needed without CONFIG_DES getting defined or your build
configuration is invalid (e.g., trying to use CONFIG_FIPS=y with
functionality that needs DES).

> diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c
> @@ -2037,14 +2037,14 @@ static int tls_sess_sec_cb(WOLFSSL *s, void *secret, int *secret_len, void *arg)

> -	    wolfSSL_get_SessionTicket(s, conn->session_ticket, &ticketLen) != 1)
> +	    wolfSSL_get_SessionTicket(s, conn->session_ticket, &ticket_len) != 1)

> -				      conn->session_ticket, ticketLen,
> +				      conn->session_ticket, ticket_len,

These were already covered by the earlier patches from Sean.
diff mbox series

Patch

diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c
index 90163c4f2..758bdbe1b 100644
--- a/src/crypto/crypto_wolfssl.c
+++ b/src/crypto/crypto_wolfssl.c
@@ -291,7 +291,7 @@  int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
 }
 
 
-#ifdef CONFIG_DES
+#ifndef CONFIG_INTERNAL_DES
 int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
 {
 	Des des;
@@ -312,7 +312,7 @@  int des_encrypt(const u8 *clear, const u8 *key, u8 *cypher)
 
 	return 0;
 }
-#endif /* CONFIG_DES */
+#endif /* !CONFIG_INTERNAL_DES */
 
 
 void * aes_encrypt_init(const u8 *key, size_t len)
diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c
index b7c452ec5..beda728a6 100644
--- a/src/crypto/tls_wolfssl.c
+++ b/src/crypto/tls_wolfssl.c
@@ -2037,14 +2037,14 @@  static int tls_sess_sec_cb(WOLFSSL *s, void *secret, int *secret_len, void *arg)
 				      sizeof(client_random)) == 0 ||
 	    wolfSSL_get_server_random(s, server_random,
 				      sizeof(server_random)) == 0 ||
-	    wolfSSL_get_SessionTicket(s, conn->session_ticket, &ticketLen) != 1)
+	    wolfSSL_get_SessionTicket(s, conn->session_ticket, &ticket_len) != 1)
 		return 1;
 
 	if (ticket_len == 0)
 		return 0;
 
 	ret = conn->session_ticket_cb(conn->session_ticket_cb_ctx,
-				      conn->session_ticket, ticketLen,
+				      conn->session_ticket, ticket_len,
 				      client_random, server_random, secret);
 	if (ret <= 0)
 		return 1;