-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SSL issues #2788
Fix SSL issues #2788
Conversation
I don't have good answers for the SSL certificate generation, help appreciated! NB. Does this deserve an issue? |
The HttpClient acts like a |
69978f9
to
a4e9337
Compare
Thank you! Knew I'd missed something. |
Implementation also needs to call mc_malloc, not malloc.
Picked up by valgrind.
Checked on esp8266, rp2040, esp32s2, host.
No nothing so complicated as this. The thing that tripped me up was that with |
If one wants a fast SSL validation of a SSL certificate then fingerprint validation can be one of the few options without compromising security too much. A proper validation will require a correct time to be set on the device before validation. This will make also Axtls work as expected but the overall process will be slower. |
To clarify, when attempting to fetch an https resource without setting
So from what you are saying this behaviour with Bearssl is not desirable as it could compromise security. I'll see if there's a way to get Bearssl to return |
2ce2ed6
to
5f25bfc
Compare
@mikee47 can you look at the Codacy issue: https://app.codacy.com/gh/SmingHub/Sming/pull-requests/2788/issues#issue-7a3d400681ced80723f87a41cc604ff2 |
This PR aims to address some issues encountered whilst trying to use SSL for a basic
HttpClient
download session.Fix malloc_count link error 'undefined reference to __wrap_strdup`
Implementation also needs to call mc_malloc, not malloc.
AxCertificate destructor accesses ssl after it's been destroyed
Picked up by valgrind.
Provide time implementations in RTC.cpp, add test
Library code requires libc implementations for
gettimeofday
andtime_t
.On Esp8266 typically get
please start sntp first !
message.This should be synced with
SystemClock
so removed thetime replacement
code from AXTLS and use that.Test added to HostTests to ensure SystemClock and
time()
are synced. Checked on esp8266, rp2040, esp32s2, host.Replace automatic SSL certificate generation with
generate-cert
build targetThese don't need to be auto-generated as they're not always required.
There are also multiple ways to get this information into an application.
Several samples don't make use of these files, so removed.
NOTE: The
make_certs.sh
script no longer appears to work, at least with openssl 3.2.1 (Jan 2024).The headers are generated but Axtls fails to load the certificate with -269 (SSL_ERROR_INVALID_KEY).
Put generated SSL certificate information into PROGMEM
Bit wasteful of RAM.
Enforce consistent 'verifyLater' behaviour with Bearssl
When attempting to fetch an https resource (using HttpClient) without setting request
onSslInit
we get this behaviour:X509_VFY_ERROR_NO_TRUSTED_CERT
This behaviour with Bearssl is not desirable as it could inadvertently compromise security.
Add a check on
verifyLater
and fail withX509_NOT_TRUSTED
as appropriate.Notes
setSslInitHandler
method to HttpClient? NO !Use request->onSslInit