Update for ESP32 RTOS SDK 3.0.0
This commit is contained in:
parent
fbb05a2765
commit
46d41ddcd4
|
@ -28,7 +28,7 @@ bool checkBasicAuthentication(const char * hash, const char * username, const ch
|
||||||
if(username == NULL || password == NULL || hash == NULL)
|
if(username == NULL || password == NULL || hash == NULL)
|
||||||
return false;
|
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);
|
size_t encodedLen = base64_encode_expected_len(toencodeLen);
|
||||||
if(strlen(hash) != encodedLen)
|
if(strlen(hash) != encodedLen)
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,7 +71,11 @@ static bool getMD5(uint8_t * data, uint16_t len, char * output){//33 bytes or mo
|
||||||
}
|
}
|
||||||
|
|
||||||
static String genRandomMD5(){
|
static String genRandomMD5(){
|
||||||
|
#ifdef ESP8266
|
||||||
uint32_t r = RANDOM_REG32;
|
uint32_t r = RANDOM_REG32;
|
||||||
|
#else
|
||||||
|
uint32_t r = rand();
|
||||||
|
#endif
|
||||||
char * out = (char*)malloc(33);
|
char * out = (char*)malloc(33);
|
||||||
if(out == NULL || !getMD5((uint8_t*)(&r), 4, out))
|
if(out == NULL || !getMD5((uint8_t*)(&r), 4, out))
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Reference in New Issue