mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(esp_http_client): fix incorrect digest calculation for SHA256 auth digest
According to RFC 7616, nonce-prime and cnonce-prime is used for SHA-256-sess only and not for SHA-256.
This commit updates the check and uses nonce only for "-sess" algorithms.
Regression from 66995965e7
This commit is contained in:
@@ -157,8 +157,7 @@ char *http_auth_digest(const char *username, const char *password, esp_http_auth
|
||||
|
||||
ESP_LOGD(TAG, "%s %s %s %s", "Digest", username, auth_data->realm, password);
|
||||
if ((strcasecmp(auth_data->algorithm, "md5-sess") == 0) ||
|
||||
(strcasecmp(auth_data->algorithm, "SHA256") == 0) ||
|
||||
(strcasecmp(auth_data->algorithm, "SHA-256") == 0)) {
|
||||
(strcasecmp(auth_data->algorithm, "SHA-256-sess") == 0)) {
|
||||
if (digest_func(ha1, "%s:%s:%016llx", ha1, auth_data->nonce, auth_data->cnonce) <= 0) {
|
||||
goto _digest_exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user