-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Upgrade to openssl-1.0.2a (Part2: final) #1389
Conversation
Grammar (@bnoordhuis please double check me):
|
So now you are generating asm files during the GYP build? |
LGTM, @bnoordhuis PTAL too. |
"In certain situations" is a little vague. I would write it as e.g.:
|
Left some comments but overall nice work, Shigeki! |
Oh, looks like I forgot to say it... Thank you! |
By the way, I like how you made sure that the assembly files work with older toolchains but I think it's not unreasonable to bump the prerequisites if we have to jump through hoops every time to keep them working. |
74f6663
to
a82def5
Compare
Thanks for all reviewing my big patches. All fixes are made and Ci looks fine in https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/488/ If the updated commits have no problems, I will merge them after releasing v1.6.5. I will also summarize my benchmark results for updating 1.0.2a. After that, rootCA updates and RC4 removal with 1024-bit RSA deprecation will be submitted. |
@bnoordhuis Actually the current support for older toolchains are made to work in the CI of Ubuntu10/12 which have older binutils. And I found that clang in FreeBSD does not have a version banner of llvm so that assembler check was failed in to use obsoleted asm files. We can check them as long as the current CI cluster are used. I think we have to more clarify the build requirements of iojs with not only compiler versions but also assembler together with OS and CPU in order to deprecate asm_obsolete supports. |
LGTM |
a82def5
to
b27a99a
Compare
|
b27a99a
to
763b093
Compare
Happy to discuss this if it's seen as necessary, we could spin up VMs to run 32-bit tests. We're only shipping 64-bit binaries for OSX at the moment, not even universal binaries, and nobody has complained. |
32-bit Mac is not necessary if it is out of our release distributions. |
ah, yes, 64-bit only but we release as 32-bit, I guess we need to figure out how to best shoe-horn 32-bit in there somewhere /cc @iojs/build |
Let's land it? |
wait until post 1.7.0 before landing, today if all's good |
This just replaces all sources in deps/openssl/openssl to originals in https://www.openssl.org/source/openssl-1.0.2a.tar.gz
`x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 .
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32.
This a backport of da084a5ec6cebd67ae27f2463ebe4a50bb840fa5 in https://github.com/openssl/openssl by Matt Caswell <matt@openssl.org> as In certain situations the server provided certificate chain may no longer be valid. However the issuer of the leaf, or some intermediate cert is in fact in the trust store. When building a trust chain if the first attempt fails, then try to see if alternate chains could be constructed that are trusted. deps: backport openssl patch of alt cert chains 2 This a backport of 15dba5be6a4482a9ad7e5b846291f31e97e338ca in https://github.com/openssl/openssl by Matt Caswell <matt@openssl.org> as Add flag to inhibit checking for alternate certificate chains. Setting this behaviour will force behaviour as per previous versions of OpenSSL
Change all openssl/include/openssl/*.h to include resolved symbolic links and openssl/crypto/opensslconf.h to refer config/opensslconf.h
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: #589 PR-URL: #1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: #589 PR-URL: #1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 . Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reapply b910613 . Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 . Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reapply b910613 . Fixes: nodejs#589 PR-URL: nodejs#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: #589 Backport-PR-URL: #28230 PR-URL: #1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 . Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reapply b910613 . Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
`x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 . Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
See https://mta.openssl.org/pipermail/openssl-dev/2015-February/000651.html iojs needs to stop using masm and move to nasm or yasm on Win32. Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reapply b910613 . Fixes: nodejs/node#589 PR-URL: nodejs/node#1389 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This is a final PR for upgrading to openssl-1.0.2a. I'm sorry for this is a really big patch for I could not succeed separating. This PR consist of 4 type of commits. I think we can focus to review 2nd and 3rd part.
1. source updates and private patches
e5624ef deps: upgrade openssl to 1.0.2a
2a01155 deps: fix openssl assembly error on ia32 win32
752636f deps: fixed asm build error of openssl in x86_win32
0e6fad7 deps: backport openssl patch of alt cert chains 1
6b3a7c9 openssl: fix keypress requirement in apps on win32
2. openssconf.h and openssl.gyp/gypi updates
c3e3c4d deps: replace all headers in openssl
b581ae2 deps: add x32 and arm64 support for opensslconf.h
c75888e deps: update opensslconf.h for 1.0.2a
0d19c08 deps: update openssl.gyp/gypi for openssl-1.0.2a
3. asm updates
f2327d0 deps: update asm Makefile for openssl-1.0.2a
208e06a deps, build: add support older asm compiler
e311459 deps: update asm files for openssl-1.0.2a
4. others
2a925d5 build: enable ssl support on arm64
5f532c2 test: fix error message check for openssl-1.0.2a
d4a0c27 deps: add docs to upgrade openssl
Ci is https://jenkins-iojs.nodesource.com/job/iojs+any-pr+multi/486/ and it seems fine . The test failures in armv7 and wins are not related this PR.
Here attached is the file of
deps/openssl/doc/UPGRADING.md
belowI hope this helps to review this PR.
R= @bnoordhuis @indutny
How to upgrade openssl library in io.js
This document is intended to describe the procedure to upgrade openssl
from 1.0.1m to 1.0.2a in io.js.
Build System and Upgrading Overview
The openssl build system is based on the perl script of Configure.
For example, running
Configure linux_x86-64
in the opensslrepository generates
Makefile
andopensslconf.h
for the targetarchitectures of linux_x86_64.
The
Makefile
contains the list of asm files which are generated byperl scripts during build so that we can get the most of use of the
hardware performance according to the type of cpus.
Configure TABLE
shows various build parameters that depend on eachos and arch.
In io.js, build target is defined as
--dest-os
and--dest-cpu
inconfigure options which are different from the one that is defined in
openssl and it's build system is gyp that is based on python,
therefore we cannot use the openssl build system directly.
In order to build openssl with gyp in iojs, files of opensslconf.h and
asm are generated in advance for several supported platforms.
Here is a map table to show conf(opensslconf.h) and asm between
the openssl target and configuration parameters of os and cpu in iojs.
The tested platform in CI are also listed.
longer supported in opnessl. We need to move to use nasm or yasm.
All parameters such as sources, defines, cflags and others generated
in openssl Makefile are wrote down into
deps/openssl/openssl.gypi
.The header file of
deps/openssl/openssl/crypto/opensslconf.h
aregenerated by
Configure
and varies on each os and arch so that wemade a new
deps/openssl/config/opensslconf.h
, where it includes eachconf file from
deps/openssl/config/archs/*/opensslconf.h
by usingpre-defined compiler macros. This procedure can be processed
automatically with
deps/openssl/config/Makefile
Assembler support is one of the key features in openssl, but asm files
are dynamically generated with
deps/openssl/openssl/crypto/*/asm/*.pl
by perl duringbuild. Furthermore, these perl scripts check the version of asm
compiler and generate asm files according to the supported
instructions in each compiler.
Since perl is not a build requirement in iojs, they all should be
generated in advance and statically stored in the repository. We
provide two sets of asm files, one is asm_latest(avx2 and addx
supported) in
deps/openssl/asm
and the other asm_obsolete(withoutavx1/2 and addx) in
deps/openssl/asm_obsolute
, which depends onsupported features in asm compilers. Each directory has a
Makefile
to generate asm files with perl scripts in openssl sources.
configure
and gyp check the version of asm compilers such as gnuas(gas), llvm and Visual Studio.
deps/openssl/openssl.gypi
determines what asm files should be used, in which the asm_latest
needs the version of gas >= 2.23, llvm >= 3.3 or MSVS_VERSION>='2012'
(ml64 >= 12) as defined in
https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129,
otherwise asm_obsolete are used.
The following is the detail instruction steps how to upgrade openssl
version from 1.0.1m to 1.0.2a in iojs.
1. Replace openssl source in
deps/openssl/openssl
Remove old openssl sources in
deps/openssl/openssl
.Get original openssl sources from
https://www.openssl.org/source/openssl-1.0.2a.tar.gz and extract all
files into
deps/openssl/openssl
.2. Apply private patches
There are three kinds of private patches to be applied in openssl-1.0.2a.
supported in openssl. We should move to use nasm or yasm in future
version of iojs.
openssl-cli in win causes timeout failures of several tests.
of 1024bit RSA key length were deprecated in io.js. When a tls
server has a cross root cert, io.js client leads CERT_UNTRUSTED
error because openssl does not find alternate cert chains. This fix
supports its feature but was made the current master which is
openssl-1.1.x. We backported them privately into openssl-1.0.2 on
iojs.
3. Replace openssl header files in
deps/openssl/openssl/include/openssl
all header files in
deps/openssl/openssl/include/openssl/*.h
aresymbolic links in the distributed release tar.gz. They cause issues in
Windows. They are replaced into the files to include a real header
file such as
4. Change
opensslconf.h
so as to fit each platform.The opensslconf.h in each target was created in advance by typing
deps/openssl/openssl/Configure {target}
and copiedinto
deps/openssl/conf/archs/{target}/opensslconf.h
.deps/openssl/conf/openssconf.h
includes each file according to itstarget by checking pre-defined compiler macros. These can be generated
by using
deps/openssl/conf/Makefile
We should remove OPENSSL_CPUID_OBJ define in opensslconf.h because it
causes build error when --openss-no-asm option is specified. Instead,
the OPENSSL_CPUID_OBJ is defined in
deps/openssl/openssl.gypi
according to the configure options.
One fix of opensslconf.h is needed in 64-bit MacOS.
The current openssl release does not use RC4 asm since it explicitly
specified as
$asm=~s/rc4\-[^:]+//;
inhttps://github.com/openssl/openssl/blob/OpenSSL_1_0_1-stable/Configure#L584
But iojs has used RC4 asm on MacOS for long time. Fix type of RC4_INT
into
unsigned int
in opensslconf.h of darwin64-x86_64-cc to work onthe RC4 asm.
5. Update openssl.gyp and openssl.gypi
Sources, cflags and define parameters that depends on each target can
be obtained via
Configure TABLE
. Its list is put in the table ofdefine and cflags changes in openssl-1.0.2a
There is no way to verify all necessary sources automatically. We can
only carefully look at the source list and compiled objects in
Makefile of openssl and compare the compiled objects that stored
stored under `out/Release/obj.target/openssl/deps/openssl/' in iojs.
6. ASM files for openssl
We provide two sets of asm files. One is for the latest asm compiler
and the other is the older one.
6.1. asm files for the latest compiler
This was made in
deps/openssl/asm/Makefile
openssl-1.0.2a.
exist. Followed asm files are to be generated with CC=gcc and
ASM=nasm on Linux. See
deps/openssl/openssl/crypto/sha/asm/sha512-x86_64.pl
to generate asm for use SSE2.
has 512. Added new rules so as not to use stdout for outputs.
void
as defined in opensslConfigure. Changed its target/rule and all directories are moved
from arm-elf-gas to arm-void-gas.
With export environments of CC=gcc and ASM=nasm, then type make
command and check if new asm files are generated.
6.2.asm files for the older compiler
For older asm compiler, the version check of CC and ASM should be
skipped in generating asm file with perl scripts.
Copy files from
deps/openssl/asm
intodeps/openssl/asm/asm_obsolete
and change rules to generate asm filesinto this directories and remove the check of CC and ASM envs.
Without environments of CC and ASM, then type make command and check
if new asm files for older compilers are generated.
This PR fixes #589