Skip to content

Commit

Permalink
digest: only if we have tls lib to do hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Feb 16, 2024
1 parent 1239a2b commit 378ad62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/libwebsockets/lws-genhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ enum lws_genhmac_types {

#define LWS_GENHASH_LARGEST 64

#if defined(LWS_WITH_TLS) && defined(LWS_WITH_GENCRYPTO)

struct lws_genhash_ctx {
uint8_t type;
#if defined(LWS_WITH_MBEDTLS)
Expand Down Expand Up @@ -186,4 +188,6 @@ lws_genhmac_update(struct lws_genhmac_ctx *ctx, const void *in, size_t len);
*/
LWS_VISIBLE LWS_EXTERN int
lws_genhmac_destroy(struct lws_genhmac_ctx *ctx, void *result);

#endif
///@}
4 changes: 2 additions & 2 deletions lib/roles/http/client/client-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ lws_http_client_http_response(struct lws *wsi)
#endif


#if defined(LWS_WITH_HTTP_DIGEST_AUTH)
#if defined(LWS_WITH_HTTP_DIGEST_AUTH) && defined(LWS_WITH_TLS)

static const char *digest_toks[] = {
"Digest", // 1 << 0
Expand Down Expand Up @@ -1047,7 +1047,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)
#endif
n = atoi(p);

#if defined(LWS_WITH_HTTP_DIGEST_AUTH)
#if defined(LWS_WITH_HTTP_DIGEST_AUTH) && defined(LWS_WITH_TLS)
if (n == 401 && lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_WWW_AUTHENTICATE)) {
if (!(wsi->stash && wsi->stash->cis[CIS_USERNAME] &&
wsi->stash->cis[CIS_PASSWORD])) {
Expand Down

0 comments on commit 378ad62

Please sign in to comment.