From 46d41ddcd4aa709571e19a685699b8c3ed990566 Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Tue, 2 Aug 2016 14:28:17 +0300 Subject: [PATCH] Update for ESP32 RTOS SDK 3.0.0 --- src/WebAuthentication.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/WebAuthentication.cpp b/src/WebAuthentication.cpp index cb261b2..ab15e4a 100644 --- a/src/WebAuthentication.cpp +++ b/src/WebAuthentication.cpp @@ -28,7 +28,7 @@ bool checkBasicAuthentication(const char * hash, const char * username, const ch if(username == NULL || password == NULL || hash == NULL) return false; - size_t toencodeLen = os_strlen(username)+os_strlen(password)+1; + size_t toencodeLen = strlen(username)+strlen(password)+1; size_t encodedLen = base64_encode_expected_len(toencodeLen); if(strlen(hash) != encodedLen) return false; @@ -71,7 +71,11 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo } static String genRandomMD5(){ +#ifdef ESP8266 uint32_t r = RANDOM_REG32; +#else + uint32_t r = rand(); +#endif char * out = (char*)malloc(33); if(out == NULL || !getMD5((uint8_t*)(&r), 4, out)) return "";