-
Notifications
You must be signed in to change notification settings - Fork 107
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
[ssl] Migrate to mbedtls 3 #290
Conversation
This means that mbedtls 3 is supported for dynamic builds
13cc88d
to
e73664b
Compare
Use MBEDTLS_USER_CONFIG_FILE instead of patching the sources.
In mbedtls 3.6 TLS 1.3 support is turned on by default which uses PSA crypto See HaxeFoundation/hashlink#681
Xenial went EoL in 2021, and we cannot build new mbedtls versions on it.
e73664b
to
47d72ff
Compare
@@ -1,3 +1,4 @@ | |||
#define WIN32_LEAN_AND_MEAN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I thought this define was to exclude some things. How does this "fix" anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later on after including threading_alt.h
, mbedtls files go on to include other headers (presumably winsock2.h
). But since the full windows.h
has already been included, this results in re-definitions and compilation errors. By setting WIN32_LEAN_AND_MEAN
, a lot of the unnecessary definitions are excluded from windows.h
which avoids these conflicts later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I mean this is a good define to make regardless, I just find it strange that it's strictly necessary for compilation. But then again it probably won't matter. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just about the order of includes. Including windows.h
in threading_alt.h
like we do results in this ordering, which breaks compilation:
#include <windows.h> // threading_alt.h
// ...
#include <winsock2.h> // mbedtls sources
Since at the time when windows.h
is included we haven't included winsock2.h
yet, windows.h
includes winsock.h
instead which contains conflicting definitions. Then when winsock2.h
is included we get redefinition errors.
If WIN32_LEAN_AND_MEAN
is defined, then winsock.h
is excluded from windows.h
so we don't end up with these redefinition errors when including winsock2.h
.
More details here: https://stackoverflow.com/questions/21399650/cannot-include-both-files-winsock2-windows-h
Closes #252
Adapted from HaxeFoundation/hashlink#648