diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd2c683da7c422..c7fc83819273eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,7 +27,8 @@ release.
-8.9.0
+8.9.1
+8.9.0
8.8.1
8.8.0
8.7.0
diff --git a/deps/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s b/deps/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s
index 7eac91326f6dd5..963fa3efda5ea9 100644
--- a/deps/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s
+++ b/deps/openssl/asm/x64-elf-gas/bn/x86_64-mont5.s
@@ -3075,11 +3075,19 @@ __bn_sqrx8x_internal:
.align 32
.Lsqrx8x_break:
- subq 16+8(%rsp),%r8
+ xorq %rbp,%rbp
+ subq 16+8(%rsp),%rbx
+ adcxq %rbp,%r8
movq 24+8(%rsp),%rcx
+ adcxq %rbp,%r9
movq 0(%rsi),%rdx
- xorl %ebp,%ebp
+ adcq $0,%r10
movq %r8,0(%rdi)
+ adcq $0,%r11
+ adcq $0,%r12
+ adcq $0,%r13
+ adcq $0,%r14
+ adcq $0,%r15
cmpq %rcx,%rdi
je .Lsqrx8x_outer_loop
diff --git a/deps/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s b/deps/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s
index 23188cda6e935a..027be89d1e446d 100644
--- a/deps/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s
+++ b/deps/openssl/asm/x64-elf-gas/ec/ecp_nistz256-x86_64.s
@@ -1036,19 +1036,18 @@ __ecp_nistz256_sqr_montx:
adoxq %rbp,%r13
.byte 0x67,0x67
mulxq %rdx,%rcx,%rax
- movq %r8,%rdx
+ movq .Lpoly+24(%rip),%rdx
adoxq %rcx,%r14
shlxq %rsi,%r8,%rcx
adoxq %rax,%r15
shrxq %rsi,%r8,%rax
- movq .Lpoly+24(%rip),%rbp
+ movq %rdx,%rbp
addq %rcx,%r9
adcq %rax,%r10
- mulxq %rbp,%rcx,%r8
- movq %r9,%rdx
+ mulxq %r8,%rcx,%r8
adcq %rcx,%r11
shlxq %rsi,%r9,%rcx
adcq $0,%r8
@@ -1058,8 +1057,7 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r10
adcq %rax,%r11
- mulxq %rbp,%rcx,%r9
- movq %r10,%rdx
+ mulxq %r9,%rcx,%r9
adcq %rcx,%r8
shlxq %rsi,%r10,%rcx
adcq $0,%r9
@@ -1069,8 +1067,7 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r11
adcq %rax,%r8
- mulxq %rbp,%rcx,%r10
- movq %r11,%rdx
+ mulxq %r10,%rcx,%r10
adcq %rcx,%r9
shlxq %rsi,%r11,%rcx
adcq $0,%r10
@@ -1080,12 +1077,12 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r8
adcq %rax,%r9
- mulxq %rbp,%rcx,%r11
+ mulxq %r11,%rcx,%r11
adcq %rcx,%r10
adcq $0,%r11
xorq %rdx,%rdx
- adcq %r8,%r12
+ addq %r8,%r12
movq .Lpoly+8(%rip),%rsi
adcq %r9,%r13
movq %r12,%r8
@@ -1094,8 +1091,7 @@ __ecp_nistz256_sqr_montx:
movq %r13,%r9
adcq $0,%rdx
- xorl %eax,%eax
- sbbq $-1,%r12
+ subq $-1,%r12
movq %r14,%r10
sbbq %rsi,%r13
sbbq $0,%r14
diff --git a/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s b/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
index 06d11dc9c8e95e..86c780b1c5f4b6 100644
--- a/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
+++ b/deps/openssl/asm/x64-elf-gas/x86_64cpuid.s
@@ -116,8 +116,19 @@ OPENSSL_ia32_cpuid:
orl $0x40000000,%edx
andb $15,%ah
cmpb $15,%ah
- jne .Lnotintel
+ jne .LnotP4
orl $0x00100000,%edx
+.LnotP4:
+ cmpb $6,%ah
+ jne .Lnotintel
+ andl $0x0fff0ff0,%eax
+ cmpl $0x00050670,%eax
+ je .Lknights
+ cmpl $0x00080650,%eax
+ jne .Lnotintel
+.Lknights:
+ andl $0xfbffffff,%ecx
+
.Lnotintel:
btl $28,%edx
jnc .Lgeneric
@@ -142,6 +153,10 @@ OPENSSL_ia32_cpuid:
movl $7,%eax
xorl %ecx,%ecx
cpuid
+ btl $26,%r9d
+ jc .Lnotknights
+ andl $0xfff7ffff,%ebx
+.Lnotknights:
movl %ebx,8(%rdi)
.Lno_extended_info:
diff --git a/deps/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s b/deps/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s
index 21416b6f5d720c..0cdcd14f1a493c 100644
--- a/deps/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s
+++ b/deps/openssl/asm/x64-macosx-gas/bn/x86_64-mont5.s
@@ -3075,11 +3075,19 @@ L$sqrx8x_loop:
.p2align 5
L$sqrx8x_break:
- subq 16+8(%rsp),%r8
+ xorq %rbp,%rbp
+ subq 16+8(%rsp),%rbx
+ adcxq %rbp,%r8
movq 24+8(%rsp),%rcx
+ adcxq %rbp,%r9
movq 0(%rsi),%rdx
- xorl %ebp,%ebp
+ adcq $0,%r10
movq %r8,0(%rdi)
+ adcq $0,%r11
+ adcq $0,%r12
+ adcq $0,%r13
+ adcq $0,%r14
+ adcq $0,%r15
cmpq %rcx,%rdi
je L$sqrx8x_outer_loop
diff --git a/deps/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s b/deps/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s
index 05b6d5be2c885b..19df69f08afeb9 100644
--- a/deps/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s
+++ b/deps/openssl/asm/x64-macosx-gas/ec/ecp_nistz256-x86_64.s
@@ -1036,19 +1036,18 @@ __ecp_nistz256_sqr_montx:
adoxq %rbp,%r13
.byte 0x67,0x67
mulxq %rdx,%rcx,%rax
- movq %r8,%rdx
+ movq L$poly+24(%rip),%rdx
adoxq %rcx,%r14
shlxq %rsi,%r8,%rcx
adoxq %rax,%r15
shrxq %rsi,%r8,%rax
- movq L$poly+24(%rip),%rbp
+ movq %rdx,%rbp
addq %rcx,%r9
adcq %rax,%r10
- mulxq %rbp,%rcx,%r8
- movq %r9,%rdx
+ mulxq %r8,%rcx,%r8
adcq %rcx,%r11
shlxq %rsi,%r9,%rcx
adcq $0,%r8
@@ -1058,8 +1057,7 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r10
adcq %rax,%r11
- mulxq %rbp,%rcx,%r9
- movq %r10,%rdx
+ mulxq %r9,%rcx,%r9
adcq %rcx,%r8
shlxq %rsi,%r10,%rcx
adcq $0,%r9
@@ -1069,8 +1067,7 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r11
adcq %rax,%r8
- mulxq %rbp,%rcx,%r10
- movq %r11,%rdx
+ mulxq %r10,%rcx,%r10
adcq %rcx,%r9
shlxq %rsi,%r11,%rcx
adcq $0,%r10
@@ -1080,12 +1077,12 @@ __ecp_nistz256_sqr_montx:
addq %rcx,%r8
adcq %rax,%r9
- mulxq %rbp,%rcx,%r11
+ mulxq %r11,%rcx,%r11
adcq %rcx,%r10
adcq $0,%r11
xorq %rdx,%rdx
- adcq %r8,%r12
+ addq %r8,%r12
movq L$poly+8(%rip),%rsi
adcq %r9,%r13
movq %r12,%r8
@@ -1094,8 +1091,7 @@ __ecp_nistz256_sqr_montx:
movq %r13,%r9
adcq $0,%rdx
- xorl %eax,%eax
- sbbq $-1,%r12
+ subq $-1,%r12
movq %r14,%r10
sbbq %rsi,%r13
sbbq $0,%r14
diff --git a/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s b/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
index 909270ecae312b..7075cf80d3015b 100644
--- a/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
+++ b/deps/openssl/asm/x64-macosx-gas/x86_64cpuid.s
@@ -117,8 +117,19 @@ L$nocacheinfo:
orl $0x40000000,%edx
andb $15,%ah
cmpb $15,%ah
- jne L$notintel
+ jne L$notP4
orl $0x00100000,%edx
+L$notP4:
+ cmpb $6,%ah
+ jne L$notintel
+ andl $0x0fff0ff0,%eax
+ cmpl $0x00050670,%eax
+ je L$knights
+ cmpl $0x00080650,%eax
+ jne L$notintel
+L$knights:
+ andl $0xfbffffff,%ecx
+
L$notintel:
btl $28,%edx
jnc L$generic
@@ -143,6 +154,10 @@ L$generic:
movl $7,%eax
xorl %ecx,%ecx
cpuid
+ btl $26,%r9d
+ jc L$notknights
+ andl $0xfff7ffff,%ebx
+L$notknights:
movl %ebx,8(%rdi)
L$no_extended_info:
diff --git a/deps/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm b/deps/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm
index 837b0bcedcd0c6..fb9aaaeabe2a90 100644
--- a/deps/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm
+++ b/deps/openssl/asm/x64-win32-masm/bn/x86_64-mont5.asm
@@ -3166,11 +3166,19 @@ DB 067h
ALIGN 32
$L$sqrx8x_break::
- sub r8,QWORD PTR[((16+8))+rsp]
+ xor rbp,rbp
+ sub rbx,QWORD PTR[((16+8))+rsp]
+ adcx r8,rbp
mov rcx,QWORD PTR[((24+8))+rsp]
+ adcx r9,rbp
mov rdx,QWORD PTR[rsi]
- xor ebp,ebp
+ adc r10,0
mov QWORD PTR[rdi],r8
+ adc r11,0
+ adc r12,0
+ adc r13,0
+ adc r14,0
+ adc r15,0
cmp rdi,rcx
je $L$sqrx8x_outer_loop
diff --git a/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm b/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
index 87338aa6f0edae..da36a1c048642e 100644
--- a/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
+++ b/deps/openssl/asm/x64-win32-masm/ec/ecp_nistz256-x86_64.asm
@@ -1137,19 +1137,18 @@ DB 067h
adox r13,rbp
DB 067h,067h
mulx rax,rcx,rdx
- mov rdx,r8
+ mov rdx,QWORD PTR[(($L$poly+24))]
adox r14,rcx
shlx rcx,r8,rsi
adox r15,rax
shrx rax,r8,rsi
- mov rbp,QWORD PTR[(($L$poly+24))]
+ mov rbp,rdx
add r9,rcx
adc r10,rax
- mulx r8,rcx,rbp
- mov rdx,r9
+ mulx r8,rcx,r8
adc r11,rcx
shlx rcx,r9,rsi
adc r8,0
@@ -1159,8 +1158,7 @@ DB 067h,067h
add r10,rcx
adc r11,rax
- mulx r9,rcx,rbp
- mov rdx,r10
+ mulx r9,rcx,r9
adc r8,rcx
shlx rcx,r10,rsi
adc r9,0
@@ -1170,8 +1168,7 @@ DB 067h,067h
add r11,rcx
adc r8,rax
- mulx r10,rcx,rbp
- mov rdx,r11
+ mulx r10,rcx,r10
adc r9,rcx
shlx rcx,r11,rsi
adc r10,0
@@ -1181,12 +1178,12 @@ DB 067h,067h
add r8,rcx
adc r9,rax
- mulx r11,rcx,rbp
+ mulx r11,rcx,r11
adc r10,rcx
adc r11,0
xor rdx,rdx
- adc r12,r8
+ add r12,r8
mov rsi,QWORD PTR[(($L$poly+8))]
adc r13,r9
mov r8,r12
@@ -1195,8 +1192,7 @@ DB 067h,067h
mov r9,r13
adc rdx,0
- xor eax,eax
- sbb r12,-1
+ sub r12,-1
mov r10,r14
sbb r13,rsi
sbb r14,0
diff --git a/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm b/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
index 6cb8077b9da0a5..69532e09fbece5 100644
--- a/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
+++ b/deps/openssl/asm/x64-win32-masm/x86_64cpuid.asm
@@ -127,8 +127,19 @@ $L$nocacheinfo::
or edx,040000000h
and ah,15
cmp ah,15
- jne $L$notintel
+ jne $L$notP4
or edx,000100000h
+$L$notP4::
+ cmp ah,6
+ jne $L$notintel
+ and eax,00fff0ff0h
+ cmp eax,000050670h
+ je $L$knights
+ cmp eax,000080650h
+ jne $L$notintel
+$L$knights::
+ and ecx,0fbffffffh
+
$L$notintel::
bt edx,28
jnc $L$generic
@@ -153,6 +164,10 @@ $L$generic::
mov eax,7
xor ecx,ecx
cpuid
+ bt r9d,26
+ jc $L$notknights
+ and ebx,0fff7ffffh
+$L$notknights::
mov DWORD PTR[8+rdi],ebx
$L$no_extended_info::
diff --git a/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s b/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
index 06d11dc9c8e95e..86c780b1c5f4b6 100644
--- a/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
+++ b/deps/openssl/asm_obsolete/x64-elf-gas/x86_64cpuid.s
@@ -116,8 +116,19 @@ OPENSSL_ia32_cpuid:
orl $0x40000000,%edx
andb $15,%ah
cmpb $15,%ah
- jne .Lnotintel
+ jne .LnotP4
orl $0x00100000,%edx
+.LnotP4:
+ cmpb $6,%ah
+ jne .Lnotintel
+ andl $0x0fff0ff0,%eax
+ cmpl $0x00050670,%eax
+ je .Lknights
+ cmpl $0x00080650,%eax
+ jne .Lnotintel
+.Lknights:
+ andl $0xfbffffff,%ecx
+
.Lnotintel:
btl $28,%edx
jnc .Lgeneric
@@ -142,6 +153,10 @@ OPENSSL_ia32_cpuid:
movl $7,%eax
xorl %ecx,%ecx
cpuid
+ btl $26,%r9d
+ jc .Lnotknights
+ andl $0xfff7ffff,%ebx
+.Lnotknights:
movl %ebx,8(%rdi)
.Lno_extended_info:
diff --git a/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s b/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
index 909270ecae312b..7075cf80d3015b 100644
--- a/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
+++ b/deps/openssl/asm_obsolete/x64-macosx-gas/x86_64cpuid.s
@@ -117,8 +117,19 @@ L$nocacheinfo:
orl $0x40000000,%edx
andb $15,%ah
cmpb $15,%ah
- jne L$notintel
+ jne L$notP4
orl $0x00100000,%edx
+L$notP4:
+ cmpb $6,%ah
+ jne L$notintel
+ andl $0x0fff0ff0,%eax
+ cmpl $0x00050670,%eax
+ je L$knights
+ cmpl $0x00080650,%eax
+ jne L$notintel
+L$knights:
+ andl $0xfbffffff,%ecx
+
L$notintel:
btl $28,%edx
jnc L$generic
@@ -143,6 +154,10 @@ L$generic:
movl $7,%eax
xorl %ecx,%ecx
cpuid
+ btl $26,%r9d
+ jc L$notknights
+ andl $0xfff7ffff,%ebx
+L$notknights:
movl %ebx,8(%rdi)
L$no_extended_info:
diff --git a/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm b/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
index 6cb8077b9da0a5..69532e09fbece5 100644
--- a/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
+++ b/deps/openssl/asm_obsolete/x64-win32-masm/x86_64cpuid.asm
@@ -127,8 +127,19 @@ $L$nocacheinfo::
or edx,040000000h
and ah,15
cmp ah,15
- jne $L$notintel
+ jne $L$notP4
or edx,000100000h
+$L$notP4::
+ cmp ah,6
+ jne $L$notintel
+ and eax,00fff0ff0h
+ cmp eax,000050670h
+ je $L$knights
+ cmp eax,000080650h
+ jne $L$notintel
+$L$knights::
+ and ecx,0fbffffffh
+
$L$notintel::
bt edx,28
jnc $L$generic
@@ -153,6 +164,10 @@ $L$generic::
mov eax,7
xor ecx,ecx
cpuid
+ bt r9d,26
+ jc $L$notknights
+ and ebx,0fff7ffffh
+$L$notknights::
mov DWORD PTR[8+rdi],ebx
$L$no_extended_info::
diff --git a/deps/openssl/openssl/CHANGES b/deps/openssl/openssl/CHANGES
index 307b2ed5e31287..e3d57b328c58e3 100644
--- a/deps/openssl/openssl/CHANGES
+++ b/deps/openssl/openssl/CHANGES
@@ -2,6 +2,44 @@
OpenSSL CHANGES
_______________
+ This is a high-level summary of the most important changes.
+ For a full list of changes, see the git commit log; for example,
+ https://github.com/openssl/openssl/commits/ and pick the appropriate
+ release branch.
+
+ Changes between 1.0.2l and 1.0.2m [2 Nov 2017]
+
+ *) bn_sqrx8x_internal carry bug on x86_64
+
+ There is a carry propagating bug in the x86_64 Montgomery squaring
+ procedure. No EC algorithms are affected. Analysis suggests that attacks
+ against RSA and DSA as a result of this defect would be very difficult to
+ perform and are not believed likely. Attacks against DH are considered just
+ feasible (although very difficult) because most of the work necessary to
+ deduce information about a private key may be performed offline. The amount
+ of resources required for such an attack would be very significant and
+ likely only accessible to a limited number of attackers. An attacker would
+ additionally need online access to an unpatched system using the target
+ private key in a scenario with persistent DH parameters and a private
+ key that is shared between multiple clients.
+
+ This only affects processors that support the BMI1, BMI2 and ADX extensions
+ like Intel Broadwell (5th generation) and later or AMD Ryzen.
+
+ This issue was reported to OpenSSL by the OSS-Fuzz project.
+ (CVE-2017-3736)
+ [Andy Polyakov]
+
+ *) Malformed X.509 IPAddressFamily could cause OOB read
+
+ If an X.509 certificate has a malformed IPAddressFamily extension,
+ OpenSSL could do a one-byte buffer overread. The most likely result
+ would be an erroneous display of the certificate in text format.
+
+ This issue was reported to OpenSSL by the OSS-Fuzz project.
+ (CVE-2017-3735)
+ [Rich Salz]
+
Changes between 1.0.2k and 1.0.2l [25 May 2017]
*) Have 'config' recognise 64-bit mingw and choose 'mingw64' as the target
diff --git a/deps/openssl/openssl/INSTALL b/deps/openssl/openssl/INSTALL
index aa7e35fa79fea0..fcdbfc0a6ee00b 100644
--- a/deps/openssl/openssl/INSTALL
+++ b/deps/openssl/openssl/INSTALL
@@ -190,10 +190,8 @@
the failure that isn't a problem in OpenSSL itself (like a missing
or malfunctioning bc). If it is a problem with OpenSSL itself,
try removing any compiler optimization flags from the CFLAG line
- in Makefile.ssl and run "make clean; make". Please send a bug
- report to , including the output of
- "make report" in order to be added to the request tracker at
- http://www.openssl.org/support/rt.html.
+ in Makefile.ssl and run "make clean; make". To report a bug please open an
+ issue on GitHub, at https://github.com/openssl/openssl/issues.
4. If everything tests ok, install OpenSSL with
diff --git a/deps/openssl/openssl/Makefile b/deps/openssl/openssl/Makefile
index a3d30318f9178d..484f2f45f77667 100644
--- a/deps/openssl/openssl/Makefile
+++ b/deps/openssl/openssl/Makefile
@@ -4,7 +4,7 @@
## Makefile for OpenSSL
##
-VERSION=1.0.2l
+VERSION=1.0.2m
MAJOR=1
MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0
diff --git a/deps/openssl/openssl/Makefile.bak b/deps/openssl/openssl/Makefile.bak
index ea0d92e4d7db50..b545261eaeee19 100644
--- a/deps/openssl/openssl/Makefile.bak
+++ b/deps/openssl/openssl/Makefile.bak
@@ -4,7 +4,7 @@
## Makefile for OpenSSL
##
-VERSION=1.0.2l
+VERSION=1.0.2m
MAJOR=1
MINOR=0.2
SHLIB_VERSION_NUMBER=1.0.0
diff --git a/deps/openssl/openssl/NEWS b/deps/openssl/openssl/NEWS
index fd49cedeba4c5c..1b72013ad18624 100644
--- a/deps/openssl/openssl/NEWS
+++ b/deps/openssl/openssl/NEWS
@@ -5,6 +5,11 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
+ Major changes between OpenSSL 1.0.2l and OpenSSL 1.0.2m [2 Nov 2017]
+
+ o bn_sqrx8x_internal carry bug on x86_64 (CVE-2017-3736)
+ o Malformed X.509 IPAddressFamily could cause OOB read (CVE-2017-3735)
+
Major changes between OpenSSL 1.0.2k and OpenSSL 1.0.2l [25 May 2017]
o config now recognises 64-bit mingw and chooses mingw64 instead of mingw
diff --git a/deps/openssl/openssl/README b/deps/openssl/openssl/README
index 4c357d9a836d08..b5aae6260ce889 100644
--- a/deps/openssl/openssl/README
+++ b/deps/openssl/openssl/README
@@ -1,5 +1,5 @@
- OpenSSL 1.0.2l 25 May 2017
+ OpenSSL 1.0.2m 2 Nov 2017
Copyright (c) 1998-2015 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
diff --git a/deps/openssl/openssl/apps/ca.c b/deps/openssl/openssl/apps/ca.c
index f90f033baed375..9a839969a204bb 100644
--- a/deps/openssl/openssl/apps/ca.c
+++ b/deps/openssl/openssl/apps/ca.c
@@ -1985,10 +1985,6 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* Lets add the extensions, if there are any */
if (ext_sect) {
X509V3_CTX ctx;
- if (ci->version == NULL)
- if ((ci->version = ASN1_INTEGER_new()) == NULL)
- goto err;
- ASN1_INTEGER_set(ci->version, 2); /* version 3 certificate */
/*
* Free the current entries if any, there should not be any I believe
@@ -2051,6 +2047,15 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
goto err;
}
+ {
+ STACK_OF(X509_EXTENSION) *exts = ci->extensions;
+
+ if (exts != NULL && sk_X509_EXTENSION_num(exts) > 0)
+ /* Make it an X509 v3 certificate. */
+ if (!X509_set_version(ret, 2))
+ goto err;
+ }
+
/* Set the right value for the noemailDN option */
if (email_dn == 0) {
if (!X509_set_subject_name(ret, dn_subject))
diff --git a/deps/openssl/openssl/apps/s_client.c b/deps/openssl/openssl/apps/s_client.c
index ffb8ffc5af20c7..19914a19dae818 100644
--- a/deps/openssl/openssl/apps/s_client.c
+++ b/deps/openssl/openssl/apps/s_client.c
@@ -1683,6 +1683,8 @@ int MAIN(int argc, char **argv)
if (strstr(mbuf, "/stream:features>"))
goto shut;
seen = BIO_read(sbio, mbuf, BUFSIZZ);
+ if (seen <= 0)
+ goto shut;
mbuf[seen] = 0;
}
BIO_printf(sbio,
diff --git a/deps/openssl/openssl/apps/s_server.c b/deps/openssl/openssl/apps/s_server.c
index d75871386928f5..98ffc09314a302 100644
--- a/deps/openssl/openssl/apps/s_server.c
+++ b/deps/openssl/openssl/apps/s_server.c
@@ -3017,7 +3017,7 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
PEM_write_bio_X509(io, peer);
} else
BIO_puts(io, "no client certificate available\n");
- BIO_puts(io, " |