Skip to content

Commit 99eb744

Browse files
committed
deps: add gyp, header and Makefile for openssl110
This commit has a new binding scheme in builing OpenSSL-1.1.0 library with Node. OpenSSL-1.1.0 uses a new build system with perl for various supported platforms. See `Configurations/README` and `Configurations/README.design` in the OpenSSL source for details. In order to build OpenSSL library without perl in the build of Node for various supported platforms, platform dependent files (e.g. asm and header files ) are pre-generated and stored into the `config/arch` directory. - Makefile and generate_gypi.pl Makefile has supported platform list and generates and copies platform dependent files (e.g. asm files) into arch directory with generate_gypi.pl. Platform dependent gypi files also created obtaining build information from `configdata.pm` that is generated with `Configure` in the OpenSSL build system. For Windows, `Configure` generates makefile that is only available to nmake command. Since nmake is not supported in Linux, `Makefile_VC-WIN32` and `Makefile_VC-WIN64A` are made created by hand for the use of GNU make. If make rules or targets are changed in the version up of OpenSSL, they should be also updated. The following files are used in upgrading openssl-1.1.0. - gyp and gypi files openssl.gyp has two targets of openssl and openssl-cli referred from node.gyp. They includes asm and no_asm gypi files with arch dependent gypi according to its build options and platforms . The gyp data which is common with asm and no_asm are stored in openssl_common.gypi. - header files bn_conf.h, dso_conf.h and opensslconf.h are platform dependent in the OpenSSL sources. They are replaced with *.h.tmpl files to include the file in the `../../../config/` and referred to each arch files that depends on asm and no-asm option. Fixes: #4270 PR-URL: #19794 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 1bcb6c0 commit 99eb744

30 files changed

+3955
-342
lines changed

deps/openssl/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
This has a new binding scheme in building OpenSSL-1.1.0 library with
2+
Node.js. OpenSSL-1.1.0 uses a new build system with `Perl` for various
3+
supported platforms. See `openssl/Configurations/README` and
4+
`openssl/Configurations/README.design` in the OpenSSL source for
5+
details.
6+
7+
In order to build OpenSSL library without `Perl` in the build of Node.js
8+
for various supported platforms, platform dependent files (e.g. asm
9+
and header files ) are pre-generated and stored into the
10+
`config/archs` directory.
11+
12+
- `config/Makefile` and `config/generate_gypi.pl`
13+
14+
Makefile has supported platform list and generates and copies
15+
platform dependent files (e.g. asm files) into arch directory with
16+
`generate_gypi.pl`. Platform dependent gypi files also created
17+
obtaining build information from `configdata.pm` that is generated
18+
with `Configure` in the OpenSSL build system.
19+
20+
For Windows, `Configure` generates `makefile` that is only available
21+
to `nmake` command. `config/Makefile_VC-WIN32` and
22+
`config/Makefile_VC-WIN64A` are made by hand for the use of GNU
23+
make. If `makefile` rules or targets are changed in the version up
24+
of OpenSSL, they should be also updated.
25+
26+
- gyp and gypi files (`openssl*.{gyp,gypi}`)
27+
28+
`openssl.gyp` has two targets of openssl and openssl-cli referred
29+
from `node.gyp`. They include asm and no_asm gypi files with arch
30+
dependent gypi according to its build options and platforms. The
31+
gyp data which is common with asm and no_asm are stored in
32+
`openssl_common.gypi`.
33+
34+
- header files (`config/*.{h,h.tmpl}`)
35+
36+
`bn_conf.h`, `dso_conf.h` and `opensslconf.h` are platform dependent
37+
in the OpenSSL sources. They are replaced with `config/*.h.tmpl`
38+
files to include the file in the `../../../config/` and referred to
39+
each arch file that depends on asm and no-asm option.
40+
41+
### Supported architectures for use of ASM
42+
43+
Here is a list of supported architectures for use of ASM in OpenSSL.
44+
45+
| --dest-os | --dest-cpu | OpenSSL target arch | CI |
46+
| --------- | ---------- | -------------------- | --- |
47+
| aix | ppc | aix-gcc | o |
48+
| aix | ppc64 | aix64-gcc | o |
49+
| linux | ia32 | linux-elf | o |
50+
| linux | x32 | linux-x32 | - |
51+
| linux | x64 | linux-x86_64 | o |
52+
| linux | arm | linux-armv4 | o |
53+
| linux | arm64 | linux-aarch64 | o |
54+
| linux | ppc | linux-ppc | o |
55+
| linux | ppc64 | linux-ppc64 | o |
56+
| linux | ppc64(*1) | linux-ppc64le | o |
57+
| linux | s390 | linux32-s390x | o |
58+
| linux | s390x | linux64-s390x | o |
59+
| mac | ia32 | darwin-i386-cc | - |
60+
| mac | x64 | darwin64-x86-cc | o |
61+
| win | ia32 | VC-WIN32 | - |
62+
| win | x64 | VC-WIN64A | o |
63+
| solaris | ia32 | solaris-x86-gcc | o |
64+
| solaris | x64 | solaris64-x86_64-gcc | o |
65+
| freebsd | ia32 | BSD-x86 | - |
66+
| freebsd | x64 | BSD-x86_64 | o |
67+
| openbsd | ia32 | BSD-x86 | - |
68+
| openbsd | x64 | BSD-x86_64 | - |
69+
| others | others | linux-elf | - |
70+
71+
(*1: This needs to be configured with the variable of node_byteorder:
72+
little)
73+
74+
These are listed in [config/Makefile](config/Makefile).
75+
Please refer [config/opensslconf_asm.h](config/opensslconf_asm.h) for details.
76+
77+
### Upgrading OpenSSL
78+
79+
Please refer [config/README.md](config/README.md).

deps/openssl/config/Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# This Makefile is confirmed to be run only on Linux (CentOS and
2+
# Ubuntu). perl5 and gas(>=2.26) are needed.
3+
4+
UNAME_S := $(shell uname -s)
5+
ifneq ($(UNAME_S),Linux)
6+
$(error This can be run only on Linux)
7+
endif
8+
9+
PERL = perl
10+
11+
# Supported architecture list
12+
ARCHS = aix-gcc aix64-gcc BSD-x86_64 \
13+
darwin64-x86_64-cc darwin-i386-cc linux-aarch64 \
14+
linux-armv4 linux-elf linux-x32 linux-x86_64 linux-ppc \
15+
linux-ppc64 linux-ppc64le linux32-s390x linux64-s390x \
16+
solaris-x86-gcc solaris64-x86_64-gcc VC-WIN64A VC-WIN32
17+
18+
CONFIGURE = ./Configure
19+
# no-comp: against CRIME attack
20+
# no-shared: openssl-cli needs static link
21+
# no-afalgeng: old Linux kernel < 4.0 does not support it
22+
COPTS = no-comp no-shared no-afalgeng
23+
24+
# disable platform check in Configure
25+
NO_WARN_ENV = CONFIGURE_CHECKER_WARN=1
26+
27+
GITIGNORE = $(OPSSL_SRC)/.gitignore
28+
GENERATE = ./generate_gypi.pl
29+
30+
OPSSL_SRC = ../openssl
31+
32+
# Header files generated with Configure
33+
CFG = opensslconf.h
34+
SRC_CFG = $(OPSSL_SRC)/include/openssl/$(CFG)
35+
INT_CFGS = bn_conf.h dso_conf.h
36+
INT_CFG_DIR = $(OPSSL_SRC)/crypto/include/internal
37+
38+
PHONY = all clean replace
39+
.PHONY: $(PHONY)
40+
41+
all: $(ARCHS) replace
42+
43+
# Configure and generate openssl asm files for each archs
44+
$(ARCHS):
45+
# Remove openssl .gitignore to follow nodejs .gitignore
46+
if [ -e $(GITIGNORE) ]; then rm $(GITIGNORE); fi
47+
# Confgure asm and generate asm sources
48+
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) $@;
49+
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) asm $@
50+
# Confgure no-asm and generate no-asm sources
51+
cd $(OPSSL_SRC); $(NO_WARN_ENV) $(PERL) $(CONFIGURE) $(COPTS) \
52+
no-asm $@;
53+
$(PERL) -w -I$(OPSSL_SRC) $(GENERATE) no-asm $@
54+
55+
# Replace and copy arch dependent headers
56+
replace:
57+
cp ./$(CFG).tmpl $(SRC_CFG)
58+
@for c in $(INT_CFGS); do \
59+
cp ./$$c.tmpl $(INT_CFG_DIR)/$$c; \
60+
done
61+
62+
clean:
63+
find archs \( -name \*.S -o -name \*.s -o -name \*.asm -o \
64+
-name \*.gypi -o -name \*.h -o -name \*.pm \) -exec rm "{}" \;

0 commit comments

Comments
 (0)