Skip to content

Commit b312b79

Browse files
Myles Borinsrvagg
Myles Borins
authored andcommitted
deps: upgrade openssl sources to 1.0.2f
This replaces all sources of openssl-1.0.2f.tar.gz into deps/openssl/openssl Fix: #4857 PR-URL: #4961 Reviewed-By: Shigeki Ohtsu <[email protected]> deps: copy openssl header files to include dir All symlink files in deps/openssl/openssl/include/openssl/ are removed and replaced with real header files to avoid issues on Windows. Two files of opensslconf.h in crypto and include dir are replaced to refer config/opensslconf.h. Fix: #4857 PR-URL: #4961 Reviewed-By: Shigeki Ohtsu <[email protected]> deps: fix openssl assembly error on ia32 win32 `x86masm.pl` was mistakenly using .486 instruction set, why `cpuid` (and perhaps others) are requiring .686 . Fixes: #589 PR-URL: #1389 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Shigeki Ohtsu <[email protected]> deps: fix asm build error of openssl in x86_win32 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 <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> openssl: fix keypress requirement in apps on win32 Reapply b910613 . Fixes: #589 PR-URL: #1389 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> docs: update openssl UPDATING guide the guide is now current with the steps taken to update openssl to v1.0.2f PR-URL: #4961 Reviewed-By: Myles Borins <[email protected]>
1 parent bafc86f commit b312b79

File tree

199 files changed

+1216
-564
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+1216
-564
lines changed

deps/openssl/doc/UPGRADING.md

+213-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## How to upgrade openssl library in Node.js
22

3-
This document describes the procedure to upgrade openssl from 1.0.2a
4-
to 1.0.2c in Node.js.
5-
3+
This document describes the procedure to upgrade openssl from 1.0.2e
4+
to 1.0.2f in Node.js. This procedure might be applied to upgrading
5+
any versions in 1.0.2.
66

77
### Build System and Upgrading Overview
88
The openssl build system is based on the `Configure` perl script in
@@ -31,6 +31,8 @@ The tested platform in CI are also listed.
3131

3232
| --dest-os | --dest-cpu | conf | asm | openssl target | CI |
3333
|---------- |----------- |----- |----- |------------------- |--- |
34+
| aix | ppc | o | x(*2)| aix-gcc | o |
35+
| aix | ppc64 | o | x(*2)| aix64-gcc | o |
3436
| linux | ia32 | o | o |linux-elf | o |
3537
| linux | x32 | o | x(*2)|linux-x32 | x |
3638
| linux | x64 | o | o |linux-x86_64 | o |
@@ -91,48 +93,197 @@ https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha5
9193
otherwise asm_obsolete are used.
9294

9395
The following is the detail instruction steps how to upgrade openssl
94-
version from 1.0.2a to 1.0.2c in node.
96+
version from 1.0.2e to 1.0.2f in node.
97+
98+
*This needs to run Linux
99+
enviroment.*
95100

96101
### 1. Replace openssl source in `deps/openssl/openssl`
97102
Remove old openssl sources in `deps/openssl/openssl` .
98103
Get original openssl sources from
99-
https://www.openssl.org/source/openssl-1.0.2c.tar.gz and extract all
104+
https://www.openssl.org/source/openssl-1.0.2f.tar.gz and extract all
100105
files into `deps/openssl/openssl` .
101106

102-
### 2. Apply private patches
103-
There are three kinds of private patches to be applied in openssl-1.0.2c.
104-
105-
- The two fixes of assembly error on ia32 win32. masm is no longer
106-
supported in openssl. We should move to use nasm or yasm in future
107-
version of node.
108-
109-
- The fix of openssl-cli built on win. Key press requirement of
110-
openssl-cli in win causes timeout failures of several tests.
107+
```sh
108+
ohtsu@ubuntu:~/github/node$ cd deps/openssl/
109+
ohtsu@ubuntu:~/github/node/deps/openssl$ rm -rf openssl
110+
ohtsu@ubuntu:~/github/node/deps/openssl$ tar zxf ~/tmp/openssl-1.0.2f.tar.gz
111+
ohtsu@ubuntu:~/github/node/deps/openssl$ mv openssl-1.0.2f openssl
112+
ohtsu@ubuntu:~/github/node/deps/openssl$ git add --all openssl
113+
ohtsu@ubuntu:~/github/node/deps/openssl$ git commit openssl
114+
````
115+
The commit message can be
111116

112-
- A new `-no_rand_screen` option to openssl s_client. This makes test
113-
time of test-tls-server-verify be much faster.
117+
>deps: upgrade openssl sources to 1.0.2f
118+
>
119+
>This replaces all sources of openssl-1.0.2f.tar.gz into
120+
>deps/openssl/openssl
114121

115-
### 3. Replace openssl header files in `deps/openssl/openssl/include/openssl`
122+
### 2. Replace openssl header files in `deps/openssl/openssl/include/openssl`
116123
all header files in `deps/openssl/openssl/include/openssl/*.h` are
117124
symbolic links in the distributed release tar.gz. They cause issues in
118125
Windows. They are copied from the real files of symlink origin into
119126
the include directory. During installation, they also copied into
120127
`PREFIX/node/include` by tools/install.py.
128+
`deps/openssl/openssl/include/openssl/opensslconf.h` and
129+
`deps/openssl/openssl/crypto/opensslconf.h` needs to be changed so as
130+
to refer the platform independent file of `deps/openssl/config/opensslconf.h`
131+
132+
The following shell script (copy_symlink.sh) is my tool for working
133+
this procedures to invoke it in the `deps/openssl/openssl/include/openssl/`.
134+
135+
```sh
136+
#!/bin/bash
137+
for var in "$@"
138+
do
139+
if [ -L $var ]; then
140+
origin=`readlink $var`
141+
rm $var
142+
cp $origin $var
143+
fi
144+
done
145+
rm opensslconf.h
146+
echo '#include "../../crypto/opensslconf.h"' > opensslconf.h
147+
rm ../../crypto/opensslconf.h
148+
echo '#include "../../config/opensslconf.h"' > ../../crypto/opensslconf.h
149+
````
150+
151+
This step somehow gets troublesome since openssl-1.0.2f because
152+
symlink headers are removed in tar.gz file and we have to execute
153+
./config script to generate them. The config script also generate
154+
unnecessary platform dependent files in the repository so that we have
155+
to clean up them after committing header files.
156+
157+
```sh
158+
ohtsu@ubuntu:~/github/node/deps/openssl$ cd openssl/
159+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ ./config
160+
161+
make[1]: Leaving directory `/home/ohtsu/github/node/deps/openssl/openssl/test'
162+
163+
Configured for linux-x86_64.
164+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ cd include/openssl/
165+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl/include/openssl$ ~/copy_symlink.sh *.h
166+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl/include/openssl$ cd ../..
167+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git add include
168+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git commit include/ crypto/opensslconf.h
169+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git clean -f
170+
ohtsu@ubuntu:~/github/node/deps/openssl/openssl$ git checkout Makefile Makefile.bak
171+
````
172+
The commit message can be
173+
174+
>deps: copy all openssl header files to include dir
175+
>
176+
>All symlink files in `deps/openssl/openssl/include/openssl/`
177+
>are removed and replaced with real header files to avoid
178+
>issues on Windows. Two files of opensslconf.h in crypto and
179+
>include dir are replaced to refer config/opensslconf.h.
180+
181+
### 3. Apply floating patches
182+
At the time of writing, there are four floating patches to be applied
183+
to openssl.
184+
185+
- Two fixes for assembly errors on ia32 win32.
186+
187+
- One fix for openssl-cli built on win. Key press requirement of
188+
openssl-cli in win causes timeout failures of several tests.
189+
190+
- Adding a new `-no_rand_screen` option to openssl s_client. This
191+
makes test time of test-tls-server-verify be much faster.
192+
193+
These fixes can be applied via cherry-pick. The first three will merge without conflict.
194+
The last commit can be landed using a recursive strategy that prefers newer changes.
195+
196+
```sh
197+
git cherry-pick c66c3d9fa3f5bab0bdfe363dd947136cf8a3907f
198+
git cherry-pick 42a8de2ac66b6953cbc731fdb0b128b8019643b2
199+
git cherry-pick 2eb170874aa5e84e71b62caab7ac9792fd59c10f
200+
git cherry-pick --strategy=recursive -X theirs 664a659
201+
```
202+
203+
If you attempted to cherry-pick the last commit you would have the following conflict
204+
205+
```
206+
# do not do this
207+
git cherry-pick 664a6596960655e214fef25e74d3285097703e95
208+
error: could not apply 664a659... deps: add -no_rand_screen to openssl s_client
209+
hint: after resolving the conflicts, mark the corrected paths
210+
hint: with 'git add <paths>' or 'git rm <paths>'
211+
hint: and commit the result with 'git commit'
212+
git cherry-pi
213+
```
214+
215+
the conflict is in `deps/openssl/openssl/apps/app_rand.c` as below.
216+
217+
```sh
218+
ohtsu@omb:openssl$ git diff
219+
diff --cc deps/openssl/openssl/apps/app_rand.c
220+
index 7f40bba,b6fe294..0000000
221+
--- a/deps/openssl/openssl/apps/app_rand.c
222+
+++ b/deps/openssl/openssl/apps/app_rand.c
223+
@@@ -124,7 -124,16 +124,20 @@@ int app_RAND_load_file(const char *file
224+
char buffer[200];
225+
226+
#ifdef OPENSSL_SYS_WINDOWS
227+
++<<<<<<< HEAD
228+
+ RAND_screen();
229+
++=======
230+
+ /*
231+
+ * allocate 2 to dont_warn not to use RAND_screen() via
232+
+ * -no_rand_screen option in s_client
233+
+ */
234+
+ if (dont_warn != 2) {
235+
+ BIO_printf(bio_e, "Loading 'screen' into random state -");
236+
+ BIO_flush(bio_e);
237+
+ RAND_screen();
238+
+ BIO_printf(bio_e, " done\n");
239+
+ }
240+
++>>>>>>> 664a659... deps: add -no_rand_screen to openssl s_client
241+
#endif
242+
243+
if (file == NULL)
244+
````
245+
246+
We want to opt for the changes from 664a659 instead of the changes present on HEAD.
247+
`git cherry-pick --strategy=recursive -X theirs` will do just that!
121248
122249
### 4. Change `opensslconf.h` so as to fit each platform.
123-
No change.
250+
opensslconf.h includes defines and macros which are platform
251+
dependent. Each files can be generated via `deps/openssl/config/Makefile`
252+
We can regenerate them and commit them if any diffs exist.
253+
254+
```sh
255+
ohtsu@ubuntu:~/github/node/deps/openssl$ cd config
256+
ohtsu@ubuntu:~/github/node/deps/openssl/config$ make clean
257+
find archs -name opensslconf.h -exec rm "{}" \;
258+
ohtsu@ubuntu:~/github/node/deps/openssl/config$ make
259+
cd ../openssl; perl ./Configure no-shared no-symlinks aix-gcc > /dev/null
260+
ohtsu@ubuntu:~/github/node/deps/openssl/config$ git diff
261+
ohtsu@ubuntu:~/github/node/deps/openssl/config$ git commit .
262+
````
263+
The commit message can be
264+
265+
>deps: update openssl config files
266+
>
267+
>Regenerate config files for supported platforms with Makefile.
124268
125269
### 5. Update openssl.gyp and openssl.gypi
126-
No change.
270+
This process is needed when source files are removed, renamed and added.
271+
It seldom happen in the minor bug fix release. Build errors would be
272+
thrown if it happens. In case of build errors, we need to check source
273+
files in Makefiles of its platform and change openssl.gyp or
274+
openssl.gypi according to the changes of source files. Please contact
275+
@shigeki if it is needed.
127276
128277
### 6. ASM files for openssl
129278
We provide two sets of asm files. One is for the latest assembler
130-
and the other is the older one.
279+
and the other is the older one. sections 6.1 and 6.2 describe the two
280+
types of files. Section 6.3 explains the steps to update the files.
281+
In the case of upgrading 1.0.2f there were no changes to the asm files.
131282
132283
### 6.1. asm files for the latest compiler
133284
This was made in `deps/openssl/asm/Makefile`
134285
- Updated asm files for each platforms which are required in
135-
openssl-1.0.2c.
286+
openssl-1.0.2f.
136287
- Some perl files need CC and ASM envs. Added a check if these envs
137288
exist. Followed asm files are to be generated with CC=gcc and
138289
ASM=nasm on Linux. See
@@ -148,8 +299,9 @@ This was made in `deps/openssl/asm/Makefile`
148299
149300
With export environments of CC=gcc and ASM=nasm, then type make
150301
command and check if new asm files are generated.
302+
If you don't have nasm please install it such as `apt-get install nasm`.
151303
152-
### 6.2.asm files for the older compiler
304+
### 6.2. asm files for the older compiler
153305
For older assembler, the version check of CC and ASM should be
154306
skipped in generating asm file with perl scripts.
155307
Copy files from `deps/openssl/asm` into
@@ -158,3 +310,42 @@ into this directories and remove the check of CC and ASM envs.
158310
159311
Without environments of CC and ASM, then type make command and check
160312
if new asm files for older compilers are generated.
313+
314+
The following steps includes version check of gcc and nasm.
315+
316+
### 6.3 steps
317+
318+
```sh
319+
ohtsu@ubuntu:~/github/node/deps/openssl/config$ cd ../asm
320+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ gcc --version
321+
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
322+
Copyright (C) 2013 Free Software Foundation, Inc.
323+
This is free software; see the source for copying conditions. There is NO
324+
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
325+
326+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ nasm -v
327+
NASM version 2.10.09 compiled on Dec 29 2013
328+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ export CC=gcc
329+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ export ASM=nasm
330+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ make clean
331+
find . -iname '*.asm' -exec rm "{}" \;
332+
find . -iname '*.s' -exec rm "{}" \;
333+
find . -iname '*.S' -exec rm "{}" \;
334+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ make
335+
ohtsu@ubuntu:~/github/node/deps/openssl/asm$ cd ../asm_obsolete/
336+
ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ unset CC
337+
ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ unset ASM
338+
ohtsu@ubuntu:~/github/node/deps/openssl/asm_obsolete$ make clean
339+
find . -iname '*.asm' -exec rm "{}" \;
340+
find . -iname '*.s' -exec rm "{}" \;
341+
find . -iname '*.S' -exec rm "{}" \;
342+
ohtsu@ubuntu:~/github/node/deps/openssl$ git status
343+
ohtsu@ubuntu:~/github/node/deps/openssl$ git commit asm asm_obsolete
344+
````
345+
The commit message can be
346+
347+
>deps: update openssl asm and asm_obsolete files
348+
>
349+
>Regenerate asm files with Makefile and CC=gcc and ASM=gcc where
350+
>gcc-4.8.4. Also asm files in asm_obsolete dir to support old compiler
351+
>and assembler are regenerated without CC and ASM envs.

deps/openssl/openssl/ACKNOWLEDGMENTS

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,2 @@
1-
The OpenSSL project depends on volunteer efforts and financial support from
2-
the end user community. That support comes in the form of donations and paid
3-
sponsorships, software support contracts, paid consulting services
4-
and commissioned software development.
5-
6-
Since all these activities support the continued development and improvement
7-
of OpenSSL we consider all these clients and customers as sponsors of the
8-
OpenSSL project.
9-
10-
We would like to identify and thank the following such sponsors for their past
11-
or current significant support of the OpenSSL project:
12-
13-
Major support:
14-
15-
Qualys http://www.qualys.com/
16-
17-
Very significant support:
18-
19-
OpenGear: http://www.opengear.com/
20-
21-
Significant support:
22-
23-
PSW Group: http://www.psw.net/
24-
Acano Ltd. http://acano.com/
25-
26-
Please note that we ask permission to identify sponsors and that some sponsors
27-
we consider eligible for inclusion here have requested to remain anonymous.
28-
29-
Additional sponsorship or financial support is always welcome: for more
30-
information please contact the OpenSSL Software Foundation.
1+
Please https://www.openssl.org/community/thanks.html for the current
2+
acknowledgements.

deps/openssl/openssl/CHANGES

+48
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,54 @@
22
OpenSSL CHANGES
33
_______________
44

5+
Changes between 1.0.2e and 1.0.2f [28 Jan 2016]
6+
7+
*) DH small subgroups
8+
9+
Historically OpenSSL only ever generated DH parameters based on "safe"
10+
primes. More recently (in version 1.0.2) support was provided for
11+
generating X9.42 style parameter files such as those required for RFC 5114
12+
support. The primes used in such files may not be "safe". Where an
13+
application is using DH configured with parameters based on primes that are
14+
not "safe" then an attacker could use this fact to find a peer's private
15+
DH exponent. This attack requires that the attacker complete multiple
16+
handshakes in which the peer uses the same private DH exponent. For example
17+
this could be used to discover a TLS server's private DH exponent if it's
18+
reusing the private DH exponent or it's using a static DH ciphersuite.
19+
20+
OpenSSL provides the option SSL_OP_SINGLE_DH_USE for ephemeral DH (DHE) in
21+
TLS. It is not on by default. If the option is not set then the server
22+
reuses the same private DH exponent for the life of the server process and
23+
would be vulnerable to this attack. It is believed that many popular
24+
applications do set this option and would therefore not be at risk.
25+
26+
The fix for this issue adds an additional check where a "q" parameter is
27+
available (as is the case in X9.42 based parameters). This detects the
28+
only known attack, and is the only possible defense for static DH
29+
ciphersuites. This could have some performance impact.
30+
31+
Additionally the SSL_OP_SINGLE_DH_USE option has been switched on by
32+
default and cannot be disabled. This could have some performance impact.
33+
34+
This issue was reported to OpenSSL by Antonio Sanso (Adobe).
35+
(CVE-2016-0701)
36+
[Matt Caswell]
37+
38+
*) SSLv2 doesn't block disabled ciphers
39+
40+
A malicious client can negotiate SSLv2 ciphers that have been disabled on
41+
the server and complete SSLv2 handshakes even if all SSLv2 ciphers have
42+
been disabled, provided that the SSLv2 protocol was not also disabled via
43+
SSL_OP_NO_SSLv2.
44+
45+
This issue was reported to OpenSSL on 26th December 2015 by Nimrod Aviram
46+
and Sebastian Schinzel.
47+
(CVE-2015-3197)
48+
[Viktor Dukhovni]
49+
50+
*) Reject DH handshakes with parameters shorter than 1024 bits.
51+
[Kurt Roeckx]
52+
553
Changes between 1.0.2d and 1.0.2e [3 Dec 2015]
654

755
*) BN_mod_exp may produce incorrect results on x86_64

0 commit comments

Comments
 (0)