Skip to content

Commit

Permalink
Libwebsockets: temp fix for mbedtls 3.6+
Browse files Browse the repository at this point in the history
3.6 removed mbedtls_x509_get_cert into private header, redefined it in resonable place to temperatly fix it, and make it not depend on mbedtls_version_C. everything is upstreamed so won't need when upstrea release 4.3.4

Signed-off-by: Seo Suchan <tjtncks@gmail.com>
  • Loading branch information
orangepizza committed May 8, 2024
1 parent 7157d5a commit 4040362
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/libwebsockets/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ endef
define Package/libwebsockets-mbedtls
$(call Package/$(PKG_NAME)/Default)
TITLE += (mbedTLS)
DEPENDS += +libmbedtls @MBEDTLS_VERSION_C
DEPENDS += +libmbedtls
VARIANT:=mbedtls
PROVIDES:=libwebsockets
CONFLICTS:=libwebsockets-openssl
Expand Down
28 changes: 28 additions & 0 deletions libs/libwebsockets/patches/100-removed-mbedtlsverc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--- a/lib/core/context.c
+++ b/lib/core/context.c
@@ -386,9 +386,6 @@ lws_create_context(const struct lws_cont
#if defined(LWS_WITH_CACHE_NSCOOKIEJAR) && defined(LWS_WITH_CLIENT)
struct lws_cache_creation_info ci;
#endif
-#if defined(LWS_WITH_MBEDTLS)
- char mbedtls_version[32];
-#endif

#if defined(__ANDROID__)
struct rlimit rt;
@@ -788,10 +785,12 @@ lws_create_context(const struct lws_cont
#endif /* network */

#if defined(LWS_WITH_MBEDTLS)
- mbedtls_version_get_string(mbedtls_version);
+ char mbedtls_version[32];
+#if defined(MBEDTLS_VERSION_C)
+ mbedtls_version_get_string(mbedtls_version);
+#else
+ lws_snprintf(mbedtls_version, sizeof(mbedtls_version), "%s", MBEDTLS_VERSION_STRING);
#endif
-
-#if defined(LWS_WITH_MBEDTLS)
lwsl_cx_notice(context, "LWS: %s, MbedTLS-%s %s%s", library_version, mbedtls_version, opts_str, s);
#else
lwsl_cx_notice(context, "LWS: %s, %s%s", library_version, opts_str, s);
11 changes: 11 additions & 0 deletions libs/libwebsockets/patches/110-mbedtls36_compilefix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/lib/tls/mbedtls/private-lib-tls-mbedtls.h
+++ b/lib/tls/mbedtls/private-lib-tls-mbedtls.h
@@ -57,3 +57,8 @@ lws_tls_mbedtls_cert_info(mbedtls_x509_c
int
lws_x509_get_crt_ext(mbedtls_x509_crt *crt, mbedtls_x509_buf *skid,
lws_mbedtls_x509_authority *akid);
+
+/* redefine hidden mbedtls internal functions*/
+int
+mbedtls_x509_get_name(unsigned char **p, const unsigned char *end,
+ mbedtls_x509_name *cur);

0 comments on commit 4040362

Please sign in to comment.