Skip to content

Commit

Permalink
Fix: LibreSSL PSK error (closes merbanan#1569)
Browse files Browse the repository at this point in the history
Fixes "Invalid PSK settings" error using LibreSSL when no PSK is used
  • Loading branch information
zuckschwerdt authored and andrewjw committed Sep 29, 2023
1 parent bca352e commit bcac45e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -5042,8 +5042,7 @@ static enum mg_ssl_if_result mg_ssl_if_ossl_set_psk(struct mg_ssl_if_ctx *ctx,
const char *identity,
const char *key_str) {
(void) ctx;
(void) identity;
(void) key_str;
if (identity == NULL && key_str == NULL) return MG_SSL_OK;
/* Krypton / LibreSSL does not support PSK. */
return MG_SSL_ERROR;
}
Expand Down
14 changes: 14 additions & 0 deletions src/mongoose_libressl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/mongoose.c b/src/mongoose.c
index d3d2ef99..c9c40863 100644
--- a/src/mongoose.c
+++ b/src/mongoose.c
@@ -5042,8 +5042,7 @@ static enum mg_ssl_if_result mg_ssl_if_ossl_set_psk(struct mg_ssl_if_ctx *ctx,
const char *identity,
const char *key_str) {
(void) ctx;
- (void) identity;
- (void) key_str;
+ if (identity == NULL && key_str == NULL) return MG_SSL_OK;
/* Krypton / LibreSSL does not support PSK. */
return MG_SSL_ERROR;
}

0 comments on commit bcac45e

Please sign in to comment.