From b84bcc48ae31c385fe480c08c05d95212ef7fcdc Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 9 Sep 2017 06:13:06 -0700 Subject: [PATCH] bpo-31392: Update SSL build for 1.1.0 (#3448) --- .../2017-09-07-20-09-04.bpo-31392.h92bWF.rst | 1 + PCbuild/get_externals.bat | 4 +- PCbuild/openssl.props | 14 ++-- PCbuild/openssl.vcxproj | 60 ++++++++++------ PCbuild/prepare_ssl.bat | 10 +++ PCbuild/python.props | 4 +- Tools/msi/lib/lib_files.wxs | 16 ++--- Tools/msi/make_zip.py | 2 - Tools/msi/msi.props | 4 +- Tools/nuget/pythondaily.symbols.nuspec | 4 +- Tools/ssl/sslspeed.vcxproj | 70 ------------------- 11 files changed, 74 insertions(+), 115 deletions(-) create mode 100644 Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst delete mode 100644 Tools/ssl/sslspeed.vcxproj diff --git a/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst b/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst new file mode 100644 index 00000000000..cc1cb787e55 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2017-09-07-20-09-04.bpo-31392.h92bWF.rst @@ -0,0 +1 @@ +Update Windows build to use OpenSSL 1.1.0f diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat index 0bbd2ad2329..1830726919d 100644 --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -49,7 +49,7 @@ echo.Fetching external libraries... set libraries= set libraries=%libraries% bzip2-1.0.6 -if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.0.2k +if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.0f set libraries=%libraries% sqlite-3.14.2.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.6.0 if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.6.0 @@ -72,7 +72,7 @@ for %%e in (%libraries%) do ( echo.Fetching external binaries... set binaries= -if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.0.2k +if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.0f if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.6.0 if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06 diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props index 9ebe8a645f6..257cc857d0e 100644 --- a/PCbuild/openssl.props +++ b/PCbuild/openssl.props @@ -6,14 +6,18 @@ $(opensslOutDir);%(AdditionalLibraryDirectories) - ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies) + ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies) + + <_DLLSuffix>-1_1 + <_DLLSuffix Condition="$(Platform) == 'x64'">$(_DLLSuffix)-x64 + - <_SSLDLL Include="$(opensslOutDir)\libeay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" /> - <_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" /> + <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" /> diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 2d42b126818..1a36d08ec06 100644 --- a/PCbuild/openssl.vcxproj +++ b/PCbuild/openssl.vcxproj @@ -47,52 +47,68 @@ 64 x86 amd64 + VC-WIN32 + VC-WIN64A true - - - - - $(opensslDir)\tmp$(Bitness)dll - $(opensslDir)\out$(Bitness)dll - ms\ntdll$(Bitness).mak - LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl + $(opensslOutDir) setlocal -set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';') set VCINSTALLDIR=$(VCInstallDir) -cd /D "$(opensslDir.TrimEnd(`\`))" if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))" -if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))" -if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))" -$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName) -nmake -f $(MakeFile) $(NMakeOptions) headers lib -copy /y LICENSE "$(opensslOutDir)\LICENSE" +cd /D "$(IntDir.TrimEnd('\'))" +$(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm +nmake - - + + + $(opensslDir)\ms\uplink.c + ((h = GetModuleHandle(NULL)) == NULL) + ((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/) + + + + <_Original>$([System.IO.File]::ReadAllText($(Uplink))) + <_Patched>$(_Original.Replace($(BeforePatch), $(AfterPatch))) + false + true + + + + - + - - + <_Built Include="$(opensslDir)\LICENSE" /> + <_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" /> + <_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" /> + <_AppLink Include="$(opensslDir)\ms\applink.c" /> + <_Include Include="$(opensslDir)\Include\openssl\*.h" /> + <_Include Include="$(IntDir)\include\openssl\*.h" /> - + + + + - + diff --git a/PCbuild/prepare_ssl.bat b/PCbuild/prepare_ssl.bat index 1df5b8d9f52..5a3de2d8ac8 100644 --- a/PCbuild/prepare_ssl.bat +++ b/PCbuild/prepare_ssl.bat @@ -23,6 +23,8 @@ setlocal if "%PCBUILD%"=="" (set PCBUILD=%~dp0) if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals) +set OUT= +set SRC= set ORG_SETTING= :CheckOpts @@ -30,12 +32,19 @@ if "%~1"=="-h" shift & goto Usage if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts +if "%~1"=="-i" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--in" (SET SRC=$~2) && shift && shift && goto CheckOpts +if "%~1"=="-o" (set OUT=$~2) && shift && shift && goto CheckOpts +if "%~1"=="--out" (set OUT=$~2) && shift && shift && goto CheckOpts if "%~1"=="" goto Build echo Unrecognized option: %1 goto Usage :Build +if not defined SRC (echo --in directory is required & exit /b 1) +if not defined OUT (echo --out directory is required & exit /b 1) + call "%PCBUILD%find_msbuild.bat" %MSBUILD% if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2) @@ -51,3 +60,4 @@ if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exi if errorlevel 1 exit /b %MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=x64 if errorlevel 1 exit /b + diff --git a/PCbuild/python.props b/PCbuild/python.props index 3bfbb77ab24..ebb16315e1a 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -47,8 +47,8 @@ $(ExternalsDir)sqlite-3.14.2.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.2.2\ - $(ExternalsDir)openssl-1.0.2k\ - $(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\ + $(ExternalsDir)openssl-1.1.0f\ + $(ExternalsDir)openssl-bin-1.1.0f\$(ArchName)\ $(opensslOutDir)include $(ExternalsDir)\nasm-2.11.06\ $(ExternalsDir)\zlib-1.2.11\ diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs index 0b8a3ee89d9..fa0da3ab43f 100644 --- a/Tools/msi/lib/lib_files.wxs +++ b/Tools/msi/lib/lib_files.wxs @@ -14,11 +14,11 @@ - - + + - - + + @@ -36,11 +36,11 @@ - - + + - - + + diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py index 8e35bdc5679..58f3b15ef85 100644 --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -47,8 +47,6 @@ EXCLUDE_FILE_FROM_LIBRARY = { EXCLUDE_FILE_FROM_LIBS = { 'liblzma', - 'ssleay', - 'libeay', 'python3stub', } diff --git a/Tools/msi/msi.props b/Tools/msi/msi.props index 60abba1f7be..2318d484d11 100644 --- a/Tools/msi/msi.props +++ b/Tools/msi/msi.props @@ -92,10 +92,10 @@ $(DefineConstants);CRTRedist=$(CRTRedist); - $(DefineConstants);Suffix32=-32; + $(DefineConstants);Suffix32=-32;ssltag=-1_1; - $(DefineConstants);Suffix32=; + $(DefineConstants);Suffix32=;ssltag=-1_1-x64; diff --git a/Tools/nuget/pythondaily.symbols.nuspec b/Tools/nuget/pythondaily.symbols.nuspec index 77792b8c24d..b89717a1afe 100644 --- a/Tools/nuget/pythondaily.symbols.nuspec +++ b/Tools/nuget/pythondaily.symbols.nuspec @@ -18,7 +18,7 @@ - - + + diff --git a/Tools/ssl/sslspeed.vcxproj b/Tools/ssl/sslspeed.vcxproj deleted file mode 100644 index 8ec410681ef..00000000000 --- a/Tools/ssl/sslspeed.vcxproj +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - - {F068BCCF-C0D6-478D-A2C5-26BA3237C992} - sslspeed - - - - - - - - $(OutDir) - $(MSBuildProjectDirectory)\$(ArchName)\ - $(MSBuildProjectDirectory)\$(ArchName)\obj\ - Application - MultiByte - - - - - - - - - - - - _CONSOLE;%(PreprocessorDefinitions) - $(opensslIncDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;crypt32.lib;libeay$(PyDebugExt).lib;ssleay$(PyDebugExt).lib;%(AdditionalDependencies) - $(OriginalOutDir);%(AdditionalLibraryDirectories) - Console - - - - - - {10615b24-73bf-4efa-93aa-236916321317} - false - - - {e5b04cc0-eb4c-42ab-b4dc-18ef95f864b0} - false - - - - - \ No newline at end of file