Repository navigation
Conversation
zooba
reviewed
Oct 8, 2026
| if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" | ||
| cd /D "$(IntDir.TrimEnd('\'))" | ||
| $(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm no-uplink | ||
| $(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm no-uplink "LDFLAGS=/nologo /debug /DELAYLOAD:user32.dll" LDLIBS=delayimp.lib |
Member
There was a problem hiding this comment.
We don't use this file to build releases anymore, it's only really still here to avoid breaking people who may have integrated it into their own builds. This change won't have any effect - it needs to go upstream first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_hashliband_ssllinklibcrypto-3.dll. Its import table names threeuser32.dllfunctions:GetProcessWindowStationandGetUserObjectInformationW, used byOPENSSL_isservice();MessageBoxW, used byOPENSSL_showfatal().Both are only reached from
OPENSSL_die(), i.e. when OpenSSL aborts on an internal error. Theimport is still resolved at load time, so
import hashlib(andhmac,secrets,ssl,asyncio,urllib.request,http.client...) mapsuser32.dll,gdi32.dll,gdi32full.dll,win32u.dllandimm32.dllinto the process. A plainpython.exedoes not load any of them.Since gh-155435,
_ctypesno longer does either.This links libcrypto with
/DELAYLOAD:user32.dll. The three functions are then bound on firstcall, on the abort path. The change is one line in
PCbuild/openssl.vcxproj, so it takes effectthe next time the OpenSSL binaries in cpython-bin-deps are built with
prepare_ssl.bat.LDFLAGSreplaces the VC targets' default/nologo /debug, which is unchanged from 3.0 to 3.5.LDLIBS=delayimp.libadds the delay-load helper; Configure still links the target's ownex_libs(ws2_32, gdi32, advapi32, crypt32, user32).libsslgets the same flag but imports nothing from user32. It links with LNK4199, a"/DELAYLOAD:user32.dll ignored" warning, and no other change.
Built with this branch's
openssl.vcxproj: OpenSSL 3.5.9, x64, Release;msbuild PCbuild\openssl.vcxprojasprepare_ssl.batruns it, once without and once with the change.dumpbin /dependents: USER32.dll moves to the delay-load table, and nothing else changes.import hashlibloads no user32/GDI DLL;test_hashlib test_hmac test_ssl test_httplib test_urllib2_localnet test_asyncio.test_ssl test_asyncio.test_sslprotopass: 679 tests, 44 skipped.OPENSSL_isservice()(exported), called from a small console program, still works: user32 isabsent before the call and loaded by it, and the result (0) is the same as with the stock DLL.
Timing (one machine, i9-14900K, Windows 11; three copies of 3.15.0rc3 embeddable that differ
only in libcrypto/libssl; 20 interleaved passes, fresh process each; medians, paired
bootstrap 95% CIs):
import _hashlib, in-processpython -c "import hashlib", start to exit_hashlib.pydimport sslafter_hashlibpython -c pass(control)On a 3.14.4 PGO build with OpenSSL 3.0.19, the same change measured −2.05 ms [−2.16, −1.95] for
import _hashlib.import hashlibloads user32.dll and the GDI DLLs through libcrypto; delay-load user32 #159008