You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IDF version: c1fdd45 * (HEAD detached at v3.1-beta1)
Problem Description
Using basic http auth can fail if the password is too long.
The reason is that in http_auth_basic() in esp_http_client/lib/http_auth.c the buffer is allocated with
char *digest = calloc(1, MD5_MAX_LEN + 7);
But the function is not making a hash with constant length, it just does a base64 conversion with a length proportional to the password length. This makes mbedtls_base64_encode() return the error MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL if the password is too long.
Expected Behavior
The buffer length is calculated using the formula from mbedtls_base64_encode()
I really like the new http library.
This worked (almost) out of the box: HTTPS connect to IPV6 only host with certificate pinning, http authentification and streaming the data to the over-the-air update service. Nice and thanks 👍
The text was updated successfully, but these errors were encountered:
FayeY
changed the title
esp_http_client with basic auth fails if password is too long.
[TW#24590] esp_http_client with basic auth fails if password is too long.
Jul 26, 2018
Environment
Problem Description
Using basic http auth can fail if the password is too long.
The reason is that in
http_auth_basic()
inesp_http_client/lib/http_auth.c
the buffer is allocated withBut the function is not making a hash with constant length, it just does a base64 conversion with a length proportional to the password length. This makes
mbedtls_base64_encode()
return the errorMBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL
if the password is too long.Expected Behavior
The buffer length is calculated using the formula from
mbedtls_base64_encode()
My corrected version:
Congrats
I really like the new http library.
This worked (almost) out of the box: HTTPS connect to IPV6 only host with certificate pinning, http authentification and streaming the data to the over-the-air update service. Nice and thanks 👍
The text was updated successfully, but these errors were encountered: