Skip to content

Commit b84bcc4

Browse files
authored
bpo-31392: Update SSL build for 1.1.0 (#3448)
1 parent efb1d0a commit b84bcc4

File tree

11 files changed

+74
-115
lines changed

11 files changed

+74
-115
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update Windows build to use OpenSSL 1.1.0f

‎PCbuild/get_externals.bat‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ echo.Fetching external libraries...
4949

5050
set libraries=
5151
set libraries=%libraries% bzip2-1.0.6
52-
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.0.2k
52+
if NOT "%IncludeSSLSrc%"=="false" set libraries=%libraries% openssl-1.1.0f
5353
set libraries=%libraries% sqlite-3.14.2.0
5454
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tcl-core-8.6.6.0
5555
if NOT "%IncludeTkinterSrc%"=="false" set libraries=%libraries% tk-8.6.6.0
@@ -72,7 +72,7 @@ for %%e in (%libraries%) do (
7272
echo.Fetching external binaries...
7373

7474
set binaries=
75-
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.0.2k
75+
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-1.1.0f
7676
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.6.0
7777
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
7878

‎PCbuild/openssl.props‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@
66
</ClCompile>
77
<Link>
88
<AdditionalLibraryDirectories>$(opensslOutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
9-
<AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
9+
<AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
1010
</Link>
1111
</ItemDefinitionGroup>
12+
<PropertyGroup>
13+
<_DLLSuffix>-1_1</_DLLSuffix>
14+
<_DLLSuffix Condition="$(Platform) == 'x64'">$(_DLLSuffix)-x64</_DLLSuffix>
15+
</PropertyGroup>
1216
<ItemGroup>
13-
<_SSLDLL Include="$(opensslOutDir)\libeay32.dll" />
14-
<_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" />
15-
<_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" />
16-
<_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" />
17+
<_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
18+
<_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" />
19+
<_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" />
20+
<_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" />
1721
</ItemGroup>
1822
<Target Name="_CopySSLDLL" Inputs="@(_SSLDLL)" Outputs="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build">
1923
<Copy SourceFiles="@(_SSLDLL)" DestinationFolder="$(OutDir)" />

‎PCbuild/openssl.vcxproj‎

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,52 +47,68 @@
4747
<Bitness Condition="$(Platform) == 'x64'">64</Bitness>
4848
<ArchName>x86</ArchName>
4949
<ArchName Condition="$(Platform) == 'x64'">amd64</ArchName>
50+
<OpenSSLPlatform>VC-WIN32</OpenSSLPlatform>
51+
<OpenSSLPlatform Condition="$(Platform) == 'x64'">VC-WIN64A</OpenSSLPlatform>
5052
<SupportSigning>true</SupportSigning>
5153
</PropertyGroup>
5254

53-
<ItemGroup>
54-
<PrepareSSL Include="prepare_ssl.py" />
55-
<Perl Include="$(Perl)" />
56-
</ItemGroup>
57-
5855
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
5956
<Import Project="pyproject.props" />
6057

6158
<PropertyGroup>
6259
<IntDir>$(opensslDir)\tmp$(Bitness)dll</IntDir>
63-
<OutDir>$(opensslDir)\out$(Bitness)dll</OutDir>
64-
<MakeFile>ms\ntdll$(Bitness).mak</MakeFile>
65-
<NMakeOptions>LIB_D="$(opensslOutDir.TrimEnd(`\`))" OUT_D=out$(Bitness)dll TMP_D=tmp$(Bitness)dll INC_D=inc$(Bitness) INCO_D=inc$(Bitness)\openssl</NMakeOptions>
60+
<OutDir>$(opensslOutDir)</OutDir>
6661
<NMakeBuildCommandLine>setlocal
67-
set PATH=%PATH%;$(nasmDir);@(Perl->'%(RootDir)%(Directory)',';')
6862
set VCINSTALLDIR=$(VCInstallDir)
69-
cd /D "$(opensslDir.TrimEnd(`\`))"
7063
if not exist "$(IntDir.TrimEnd('\'))" mkdir "$(IntDir.TrimEnd('\'))"
71-
if not exist "$(OutDir.TrimEnd('\'))" mkdir "$(OutDir.TrimEnd('\'))"
72-
if not exist "$(opensslOutDir.TrimEnd(`\`))" mkdir "$(opensslOutDir.TrimEnd(`\`))"
73-
$(PYTHON) "@(PrepareSSL->'%(FullPath)')" "$(opensslDir.TrimEnd(`\`))" $(ArchName)
74-
nmake -f $(MakeFile) $(NMakeOptions) headers lib
75-
copy /y LICENSE "$(opensslOutDir)\LICENSE"
64+
cd /D "$(IntDir.TrimEnd('\'))"
65+
$(Perl) "$(opensslDir)\configure" $(OpenSSLPlatform) no-asm
66+
nmake
7667
</NMakeBuildCommandLine>
7768
</PropertyGroup>
7869

7970
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
8071

81-
<Target Name="SuppressOriginalBuildinfH" Condition="Exists('$(opensslDir)crypto\buildinf.h')" BeforeTargets="CreateBuildinfH">
82-
<Move SourceFiles="$(opensslDir)crypto\buildinf.h" DestinationFiles="$(opensslDir)crypto\buildinf.h.orig" />
72+
<Target Name="_PatchUplink" BeforeTargets="Build">
73+
<PropertyGroup>
74+
<Uplink>$(opensslDir)\ms\uplink.c</Uplink>
75+
<BeforePatch>((h = GetModuleHandle(NULL)) == NULL)</BeforePatch>
76+
<AfterPatch>((h = GetModuleHandleA("_ssl.pyd")) == NULL) if ((h = GetModuleHandleA("_ssl_d.pyd")) == NULL) if ((h = GetModuleHandle(NULL)) == NULL /*patched*/)</AfterPatch>
77+
</PropertyGroup>
78+
<Error Text="Cannot find $(Uplink)" Condition="!Exists($(Uplink))" />
79+
<PropertyGroup>
80+
<_Original>$([System.IO.File]::ReadAllText($(Uplink)))</_Original>
81+
<_Patched>$(_Original.Replace($(BeforePatch), $(AfterPatch)))</_Patched>
82+
<IsPatched>false</IsPatched>
83+
<IsPatched Condition="$(_Patched) == $(_Original)">true</IsPatched>
84+
</PropertyGroup>
85+
<Message Text="$(Uplink) is already patched" Importance="normal" Condition="$(IsPatched)" />
86+
<Message Text="Patching $(Uplink)" Importance="high" Condition="!$(IsPatched)" />
87+
<WriteLinesToFile File="$(Uplink)"
88+
Lines="$(_Patched)"
89+
Overwrite="true"
90+
Encoding="ASCII"
91+
Condition="!$(IsPatched)" />
8392
</Target>
8493

85-
<Target Name="_CopyIncludes" AfterTargets="Build">
94+
<Target Name="_CopyToOutput" AfterTargets="Build">
8695
<ItemGroup>
87-
<Sources Include="$(opensslDir)inc$(Bitness)\**\*.h" />
88-
<Sources Include="$(opensslDir)ms\applink.c" />
96+
<_Built Include="$(opensslDir)\LICENSE" />
97+
<_Built Include="$(IntDir)\libcrypto.lib;$(IntDir)\libcrypto-*.dll;$(IntDir)\libcrypto-*.pdb" />
98+
<_Built Include="$(IntDir)\libssl.lib;$(IntDir)\libssl-*.dll;$(IntDir)\libssl-*.pdb" />
99+
<_AppLink Include="$(opensslDir)\ms\applink.c" />
100+
<_Include Include="$(opensslDir)\Include\openssl\*.h" />
101+
<_Include Include="$(IntDir)\include\openssl\*.h" />
89102
</ItemGroup>
90-
<Copy SourceFiles="%(Sources.FullPath)" DestinationFiles="$(opensslOutDir)\include\%(Sources.RecursiveDir)\%(Sources.Filename)%(Sources.Extension)" />
103+
<MakeDir Directories="$(opensslOutDir)\include\openssl" />
104+
<Copy SourceFiles="@(_Built)" DestinationFolder="$(opensslOutDir)" />
105+
<Copy SourceFiles="@(_AppLink)" DestinationFolder="$(opensslOutDir)\include" />
106+
<Copy SourceFiles="@(_Include)" DestinationFolder="$(opensslOutDir)\include\openssl" />
91107
</Target>
92108

93109
<Target Name="SignFiles" AfterTargets="Build" Condition="$(_SignCommand) != ''">
94110
<ItemGroup>
95-
<FilesToSign Include="$(opensslOutDir)\libeay32.dll;$(opensslOutDir)\ssleay32.dll" />
111+
<FilesToSign Include="$(opensslOutDir)\lib*.dll" />
96112
</ItemGroup>
97113
<Exec Command="$(_SignCommand) %(FilesToSign.FullPath)" ContinueOnError="true" />
98114
</Target>

‎PCbuild/prepare_ssl.bat‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,28 @@ setlocal
2323
if "%PCBUILD%"=="" (set PCBUILD=%~dp0)
2424
if "%EXTERNALS_DIR%"=="" (set EXTERNALS_DIR=%PCBUILD%\..\externals)
2525

26+
set OUT=
27+
set SRC=
2628
set ORG_SETTING=
2729

2830
:CheckOpts
2931
if "%~1"=="-h" shift & goto Usage
3032
if "%~1"=="--certificate" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts
3133
if "%~1"=="-c" (set SigningCertificate=%~2) && shift && shift & goto CheckOpts
3234
if "%~1"=="--organization" (set ORG_SETTING=--organization "%~2") && shift && shift && goto CheckOpts
35+
if "%~1"=="-i" (SET SRC=$~2) && shift && shift && goto CheckOpts
36+
if "%~1"=="--in" (SET SRC=$~2) && shift && shift && goto CheckOpts
37+
if "%~1"=="-o" (set OUT=$~2) && shift && shift && goto CheckOpts
38+
if "%~1"=="--out" (set OUT=$~2) && shift && shift && goto CheckOpts
3339

3440
if "%~1"=="" goto Build
3541
echo Unrecognized option: %1
3642
goto Usage
3743

3844
:Build
45+
if not defined SRC (echo --in directory is required & exit /b 1)
46+
if not defined OUT (echo --out directory is required & exit /b 1)
47+
3948
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
4049
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
4150

@@ -51,3 +60,4 @@ if "%PERL%" == "" (echo Cannot locate perl.exe on PATH or as PERL variable & exi
5160
if errorlevel 1 exit /b
5261
%MSBUILD% "%PCBUILD%openssl.vcxproj" /p:Configuration=Release /p:Platform=x64
5362
if errorlevel 1 exit /b
63+

‎PCbuild/python.props‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
<sqlite3Dir>$(ExternalsDir)sqlite-3.14.2.0\</sqlite3Dir>
4848
<bz2Dir>$(ExternalsDir)bzip2-1.0.6\</bz2Dir>
4949
<lzmaDir>$(ExternalsDir)xz-5.2.2\</lzmaDir>
50-
<opensslDir>$(ExternalsDir)openssl-1.0.2k\</opensslDir>
51-
<opensslOutDir>$(ExternalsDir)openssl-bin-1.0.2k\$(ArchName)\</opensslOutDir>
50+
<opensslDir>$(ExternalsDir)openssl-1.1.0f\</opensslDir>
51+
<opensslOutDir>$(ExternalsDir)openssl-bin-1.1.0f\$(ArchName)\</opensslOutDir>
5252
<opensslIncludeDir>$(opensslOutDir)include</opensslIncludeDir>
5353
<nasmDir>$(ExternalsDir)\nasm-2.11.06\</nasmDir>
5454
<zlibDir>$(ExternalsDir)\zlib-1.2.11\</zlibDir>

‎Tools/msi/lib/lib_files.wxs‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
<Component Id="sqlite3.dll" Directory="DLLs" Guid="*">
1515
<File Name="sqlite3.dll" KeyPath="yes" />
1616
</Component>
17-
<Component Id="libeay32.dll" Directory="DLLs" Guid="*">
18-
<File Name="libeay32.dll" KeyPath="yes" />
17+
<Component Id="libcrypto.dll" Directory="DLLs" Guid="*">
18+
<File Name="libcrypto$(var.ssltag).dll" KeyPath="yes" />
1919
</Component>
20-
<Component Id="ssleay32.dll" Directory="DLLs" Guid="*">
21-
<File Name="ssleay32.dll" KeyPath="yes" />
20+
<Component Id="libssl.dll" Directory="DLLs" Guid="*">
21+
<File Name="libssl$(var.ssltag).dll" KeyPath="yes" />
2222
</Component>
2323
</ComponentGroup>
2424
</Fragment>
@@ -36,11 +36,11 @@
3636
<Component Id="sqlite3.pdb" Directory="DLLs" Guid="*">
3737
<File Name="sqlite3.pdb" />
3838
</Component>
39-
<Component Id="libeay32.pdb" Directory="DLLs" Guid="*">
40-
<File Name="libeay32.pdb" KeyPath="yes" />
39+
<Component Id="libcrypto.pdb" Directory="DLLs" Guid="*">
40+
<File Name="libcrypto$(var.ssltag).pdb" KeyPath="yes" />
4141
</Component>
42-
<Component Id="ssleay32.pdb" Directory="DLLs" Guid="*">
43-
<File Name="ssleay32.pdb" KeyPath="yes" />
42+
<Component Id="libssl.pdb" Directory="DLLs" Guid="*">
43+
<File Name="libssl$(var.ssltag).pdb" KeyPath="yes" />
4444
</Component>
4545
</ComponentGroup>
4646
</Fragment>

‎Tools/msi/make_zip.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747

4848
EXCLUDE_FILE_FROM_LIBS = {
4949
'liblzma',
50-
'ssleay',
51-
'libeay',
5250
'python3stub',
5351
}
5452

‎Tools/msi/msi.props‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@
9292
$(DefineConstants);CRTRedist=$(CRTRedist);
9393
</DefineConstants>
9494
<DefineConstants Condition="$(Platform) != 'x64'">
95-
$(DefineConstants);Suffix32=-32;
95+
$(DefineConstants);Suffix32=-32;ssltag=-1_1;
9696
</DefineConstants>
9797
<DefineConstants Condition="$(Platform) == 'x64'">
98-
$(DefineConstants);Suffix32=;
98+
$(DefineConstants);Suffix32=;ssltag=-1_1-x64;
9999
</DefineConstants>
100100
</PropertyGroup>
101101

‎Tools/nuget/pythondaily.symbols.nuspec‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<file src="python*.pdb" target="tools" exclude="*_d*" />
1919
<file src="*.pdb" target="tools\DLLs" exclude="python*;*_test*;xx*;_freeze*;*_d*;py.*;pyw.*;pyshellext.*" />
2020
<file src="*.pyd" target="tools\DLLs" exclude="python*;*_test*;xx*;_freeze*;*_d*;py.*;pyw.*;pyshellext.*" />
21-
<file src="libeay32.dll;ssleay32.dll;sqlite3.dll" target="tools\DLLs" />
22-
<file src="libeay32.pdb;ssleay32.pdb;sqlite3.pdb" target="tools\DLLs" />
21+
<file src="libcrypto*.dll;libssl*.dll;sqlite3.dll" target="tools\DLLs" />
22+
<file src="libcrypto*.pdb;libssl*.pdb;sqlite3.pdb" target="tools\DLLs" />
2323
</files>
2424
</package>

0 commit comments

Comments
 (0)