mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-09-27 06:40:56 +02:00
Fix build when using WebSockets
This commit is contained in:
@@ -24,18 +24,7 @@
|
|||||||
#include <libb64/cencode.h>
|
#include <libb64/cencode.h>
|
||||||
|
|
||||||
#ifndef ESP8266
|
#ifndef ESP8266
|
||||||
extern "C" {
|
#include "mbedtls/sha1.h"
|
||||||
typedef struct {
|
|
||||||
uint32_t state[5];
|
|
||||||
uint32_t count[2];
|
|
||||||
unsigned char buffer[64];
|
|
||||||
} SHA1_CTX;
|
|
||||||
|
|
||||||
void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]);
|
|
||||||
void SHA1Init(SHA1_CTX* context);
|
|
||||||
void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len);
|
|
||||||
void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#include <Hash.h>
|
#include <Hash.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -1268,10 +1257,12 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String& key, AsyncWebSocket
|
|||||||
sha1(key + WS_STR_UUID, hash);
|
sha1(key + WS_STR_UUID, hash);
|
||||||
#else
|
#else
|
||||||
(String&)key += WS_STR_UUID;
|
(String&)key += WS_STR_UUID;
|
||||||
SHA1_CTX ctx;
|
mbedtls_sha1_context ctx;
|
||||||
SHA1Init(&ctx);
|
mbedtls_sha1_init(&ctx);
|
||||||
SHA1Update(&ctx, (const unsigned char*)key.c_str(), key.length());
|
mbedtls_sha1_starts_ret(&ctx);
|
||||||
SHA1Final(hash, &ctx);
|
mbedtls_sha1_update_ret(&ctx, (const unsigned char*)key.c_str(), key.length());
|
||||||
|
mbedtls_sha1_finish_ret(&ctx, hash);
|
||||||
|
mbedtls_sha1_free(&ctx);
|
||||||
#endif
|
#endif
|
||||||
base64_encodestate _state;
|
base64_encodestate _state;
|
||||||
base64_init_encodestate(&_state);
|
base64_init_encodestate(&_state);
|
||||||
|
Reference in New Issue
Block a user