Skip to content
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

[v11.x backport] Update openssl to 1.1.1a #25688

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
19 changes: 14 additions & 5 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,29 @@ Depending on the host platform, the selection of toolchains may vary.

#### OpenSSL asm support

OpenSSL-1.1.0 requires the following assembler version for use of asm
OpenSSL-1.1.1 requires the following assembler version for use of asm
support on x86_64 and ia32.

For use of AVX-512,

* gas (GNU assembler) version 2.26 or higher
* nasm version 2.11.8 or higher in Windows

Note that AVX-512 is disabled for Skylake-X by OpenSSL-1.1.1.

For use of AVX2,

* gas (GNU assembler) version 2.23 or higher
* Xcode version 5.0 or higher
* llvm version 3.3 or higher
* nasm version 2.10 or higher in Windows

If compiling without one of the above, use `configure` with the
`--openssl-no-asm` flag. Otherwise, `configure` will fail.

The forthcoming OpenSSL-1.1.1 will have different requirements. Please refer to
Please refer to
https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html for details.

If compiling without one of the above, use `configure` with the
`--openssl-no-asm` flag. Otherwise, `configure` will fail.

## Building Node.js on supported platforms

The [bootstrapping guide](https://github.com/nodejs/node/blob/master/tools/bootstrap/README.md)
Expand Down
12 changes: 9 additions & 3 deletions deps/openssl/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ linux-armv4 linux-elf linux-x32 linux-x86_64 linux-ppc \
linux-ppc64 linux-ppc64le linux32-s390x linux64-s390x \
solaris-x86-gcc solaris64-x86_64-gcc VC-WIN64A VC-WIN32

CC = gcc
FAKE_GCC = ../config/fake_gcc.pl

CONFIGURE = ./Configure
# no-comp: against CRIME attack
# no-shared: openssl-cli needs static link
Expand Down Expand Up @@ -44,9 +47,12 @@ all: $(ARCHS) replace
$(ARCHS):
# Remove openssl .gitignore to follow nodejs .gitignore
if [ -e $(GITIGNORE) ]; then rm $(GITIGNORE); fi
# Confgure asm and generate asm sources
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) $@;
cd $(OPSSL_SRC); $(NO_WARN_ENV) CC=$(CC) $(PERL) $(CONFIGURE) $(COPTS) $@;
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm $@
# Confgure asm_avx2 and generate upto avx2 support
cd $(OPSSL_SRC); $(NO_WARN_ENV) CC=$(FAKE_GCC) $(PERL) $(CONFIGURE) \
$(COPTS) $@;
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm_avx2 $@
# Confgure no-asm and generate no-asm sources
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) \
no-asm $@;
Expand All @@ -61,4 +67,4 @@ replace:

clean:
find archs \( -name \*.S -o -name \*.s -o -name \*.asm -o \
-name \*.gypi -o -name \*.h -o -name \*.pm \) -exec rm "{}" \;
-name \*.gypi -o -name \*.h -o -name \*.pm -o -name \*.rc \) -exec rm "{}" \;
6,870 changes: 5,609 additions & 1,261 deletions deps/openssl/config/Makefile_VC-WIN32

Large diffs are not rendered by default.

4,213 changes: 2,902 additions & 1,311 deletions deps/openssl/config/Makefile_VC-WIN64A

Large diffs are not rendered by default.

4,185 changes: 3,837 additions & 348 deletions deps/openssl/config/archs/BSD-x86_64/asm/configdata.pm

Large diffs are not rendered by default.

145 changes: 124 additions & 21 deletions deps/openssl/config/archs/BSD-x86_64/asm/crypto/aes/aes-x86_64.s
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,23 @@ _x86_64_AES_encrypt_compact:
.hidden asm_AES_encrypt
asm_AES_encrypt:
AES_encrypt:
.cfi_startproc
movq %rsp,%rax
.cfi_def_cfa_register %rax
pushq %rbx
.cfi_offset %rbx,-16
pushq %rbp
.cfi_offset %rbp,-24
pushq %r12
.cfi_offset %r12,-32
pushq %r13
.cfi_offset %r13,-40
pushq %r14
.cfi_offset %r14,-48
pushq %r15
.cfi_offset %r15,-56


movq %rsp,%r10
leaq -63(%rdx),%rcx
andq $-64,%rsp
subq %rsp,%rcx
Expand All @@ -350,7 +358,8 @@ AES_encrypt:
subq $32,%rsp

movq %rsi,16(%rsp)
movq %r10,24(%rsp)
movq %rax,24(%rsp)
.cfi_escape 0x0f,0x05,0x77,0x18,0x06,0x23,0x08
.Lenc_prologue:

movq %rdx,%r15
Expand All @@ -377,20 +386,29 @@ AES_encrypt:

movq 16(%rsp),%r9
movq 24(%rsp),%rsi
.cfi_def_cfa %rsi,8
movl %eax,0(%r9)
movl %ebx,4(%r9)
movl %ecx,8(%r9)
movl %edx,12(%r9)

movq (%rsi),%r15
movq 8(%rsi),%r14
movq 16(%rsi),%r13
movq 24(%rsi),%r12
movq 32(%rsi),%rbp
movq 40(%rsi),%rbx
leaq 48(%rsi),%rsp
movq -48(%rsi),%r15
.cfi_restore %r15
movq -40(%rsi),%r14
.cfi_restore %r14
movq -32(%rsi),%r13
.cfi_restore %r13
movq -24(%rsi),%r12
.cfi_restore %r12
movq -16(%rsi),%rbp
.cfi_restore %rbp
movq -8(%rsi),%rbx
.cfi_restore %rbx
leaq (%rsi),%rsp
.cfi_def_cfa_register %rsp
.Lenc_epilogue:
.byte 0xf3,0xc3
.cfi_endproc
.size AES_encrypt,.-AES_encrypt
.type _x86_64_AES_decrypt,@function
.align 16
Expand Down Expand Up @@ -779,15 +797,23 @@ _x86_64_AES_decrypt_compact:
.hidden asm_AES_decrypt
asm_AES_decrypt:
AES_decrypt:
.cfi_startproc
movq %rsp,%rax
.cfi_def_cfa_register %rax
pushq %rbx
.cfi_offset %rbx,-16
pushq %rbp
.cfi_offset %rbp,-24
pushq %r12
.cfi_offset %r12,-32
pushq %r13
.cfi_offset %r13,-40
pushq %r14
.cfi_offset %r14,-48
pushq %r15
.cfi_offset %r15,-56


movq %rsp,%r10
leaq -63(%rdx),%rcx
andq $-64,%rsp
subq %rsp,%rcx
Expand All @@ -797,7 +823,8 @@ AES_decrypt:
subq $32,%rsp

movq %rsi,16(%rsp)
movq %r10,24(%rsp)
movq %rax,24(%rsp)
.cfi_escape 0x0f,0x05,0x77,0x18,0x06,0x23,0x08
.Ldec_prologue:

movq %rdx,%r15
Expand Down Expand Up @@ -826,41 +853,68 @@ AES_decrypt:

movq 16(%rsp),%r9
movq 24(%rsp),%rsi
.cfi_def_cfa %rsi,8
movl %eax,0(%r9)
movl %ebx,4(%r9)
movl %ecx,8(%r9)
movl %edx,12(%r9)

movq (%rsi),%r15
movq 8(%rsi),%r14
movq 16(%rsi),%r13
movq 24(%rsi),%r12
movq 32(%rsi),%rbp
movq 40(%rsi),%rbx
leaq 48(%rsi),%rsp
movq -48(%rsi),%r15
.cfi_restore %r15
movq -40(%rsi),%r14
.cfi_restore %r14
movq -32(%rsi),%r13
.cfi_restore %r13
movq -24(%rsi),%r12
.cfi_restore %r12
movq -16(%rsi),%rbp
.cfi_restore %rbp
movq -8(%rsi),%rbx
.cfi_restore %rbx
leaq (%rsi),%rsp
.cfi_def_cfa_register %rsp
.Ldec_epilogue:
.byte 0xf3,0xc3
.cfi_endproc
.size AES_decrypt,.-AES_decrypt
.globl AES_set_encrypt_key
.type AES_set_encrypt_key,@function
.align 16
AES_set_encrypt_key:
.cfi_startproc
pushq %rbx
.cfi_adjust_cfa_offset 8
.cfi_offset %rbx,-16
pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp,-24
pushq %r12
.cfi_adjust_cfa_offset 8
.cfi_offset %r12,-32
pushq %r13
.cfi_adjust_cfa_offset 8
.cfi_offset %r13,-40
pushq %r14
.cfi_adjust_cfa_offset 8
.cfi_offset %r14,-48
pushq %r15
.cfi_adjust_cfa_offset 8
.cfi_offset %r15,-56
subq $8,%rsp
.cfi_adjust_cfa_offset 8
.Lenc_key_prologue:

call _x86_64_AES_set_encrypt_key

movq 40(%rsp),%rbp
.cfi_restore %rbp
movq 48(%rsp),%rbx
.cfi_restore %rbx
addq $56,%rsp
.cfi_adjust_cfa_offset -56
.Lenc_key_epilogue:
.byte 0xf3,0xc3
.cfi_endproc
.size AES_set_encrypt_key,.-AES_set_encrypt_key

.type _x86_64_AES_set_encrypt_key,@function
Expand Down Expand Up @@ -1106,13 +1160,27 @@ _x86_64_AES_set_encrypt_key:
.type AES_set_decrypt_key,@function
.align 16
AES_set_decrypt_key:
.cfi_startproc
pushq %rbx
.cfi_adjust_cfa_offset 8
.cfi_offset %rbx,-16
pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp,-24
pushq %r12
.cfi_adjust_cfa_offset 8
.cfi_offset %r12,-32
pushq %r13
.cfi_adjust_cfa_offset 8
.cfi_offset %r13,-40
pushq %r14
.cfi_adjust_cfa_offset 8
.cfi_offset %r14,-48
pushq %r15
.cfi_adjust_cfa_offset 8
.cfi_offset %r15,-56
pushq %rdx
.cfi_adjust_cfa_offset 8
.Ldec_key_prologue:

call _x86_64_AES_set_encrypt_key
Expand Down Expand Up @@ -1280,14 +1348,22 @@ AES_set_decrypt_key:
xorq %rax,%rax
.Labort:
movq 8(%rsp),%r15
.cfi_restore %r15
movq 16(%rsp),%r14
.cfi_restore %r14
movq 24(%rsp),%r13
.cfi_restore %r13
movq 32(%rsp),%r12
.cfi_restore %r12
movq 40(%rsp),%rbp
.cfi_restore %rbp
movq 48(%rsp),%rbx
.cfi_restore %rbx
addq $56,%rsp
.cfi_adjust_cfa_offset -56
.Ldec_key_epilogue:
.byte 0xf3,0xc3
.cfi_endproc
.size AES_set_decrypt_key,.-AES_set_decrypt_key
.globl AES_cbc_encrypt
.type AES_cbc_encrypt,@function
Expand All @@ -1297,25 +1373,39 @@ AES_set_decrypt_key:
.hidden asm_AES_cbc_encrypt
asm_AES_cbc_encrypt:
AES_cbc_encrypt:
.cfi_startproc
cmpq $0,%rdx
je .Lcbc_epilogue
pushfq
.cfi_adjust_cfa_offset 8
.cfi_offset 49,-16
pushq %rbx
.cfi_adjust_cfa_offset 8
.cfi_offset %rbx,-24
pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp,-32
pushq %r12
.cfi_adjust_cfa_offset 8
.cfi_offset %r12,-40
pushq %r13
.cfi_adjust_cfa_offset 8
.cfi_offset %r13,-48
pushq %r14
.cfi_adjust_cfa_offset 8
.cfi_offset %r14,-56
pushq %r15
.cfi_adjust_cfa_offset 8
.cfi_offset %r15,-64
.Lcbc_prologue:

cld
movl %r9d,%r9d

leaq .LAES_Te(%rip),%r14
leaq .LAES_Td(%rip),%r10
cmpq $0,%r9
jne .Lcbc_picked_te
leaq .LAES_Td(%rip),%r14
.Lcbc_picked_te:
cmoveq %r10,%r14

movl OPENSSL_ia32cap_P(%rip),%r10d
cmpq $512,%rdx
Expand Down Expand Up @@ -1351,8 +1441,10 @@ AES_cbc_encrypt:
.Lcbc_te_ok:

xchgq %rsp,%r15
.cfi_def_cfa_register %r15

movq %r15,16(%rsp)
.cfi_escape 0x0f,0x05,0x77,0x10,0x06,0x23,0x40
.Lcbc_fast_body:
movq %rdi,24(%rsp)
movq %rsi,32(%rsp)
Expand Down Expand Up @@ -1734,17 +1826,28 @@ AES_cbc_encrypt:
.align 16
.Lcbc_exit:
movq 16(%rsp),%rsi
.cfi_def_cfa %rsi,64
movq (%rsi),%r15
.cfi_restore %r15
movq 8(%rsi),%r14
.cfi_restore %r14
movq 16(%rsi),%r13
.cfi_restore %r13
movq 24(%rsi),%r12
.cfi_restore %r12
movq 32(%rsi),%rbp
.cfi_restore %rbp
movq 40(%rsi),%rbx
.cfi_restore %rbx
leaq 48(%rsi),%rsp
.cfi_def_cfa %rsp,16
.Lcbc_popfq:
popfq
.cfi_adjust_cfa_offset -8
.cfi_restore 49
.Lcbc_epilogue:
.byte 0xf3,0xc3
.cfi_endproc
.size AES_cbc_encrypt,.-AES_cbc_encrypt
.align 64
.LAES_Te:
Expand Down
Loading