-
Notifications
You must be signed in to change notification settings - Fork 145
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
Package Themis Core with BoringSSL #683
Conversation
Strictly speaking, libthemis depends on the OpenSSL library, not the "openssl" binary. The "openssl" package installs the entire binary along with its man pages, etc. Instead, it is sufficient to depend only on the library. The library package is typically called "libssl1.1", with an ABI suffix. The default OpenSSL library version differs between distros so we cannot write it in Makefile, but we should depend on the OpenSSL library from the particular distribution. If we were using debhelper, this would have been resolved for us automagically, but we are using FPM. Therefore we will use the dependencies of "libssl-dev" package as a proxy for the current default OpenSSL library name. This should be good enough.
Similar to Debian/Ubuntu situation, the "openssl" package on RHEL/CentOS installs the "openssl" binary. The package with libraries only is called "openssl-libs", we should depend on that instead. RPM packages typically do not include ABI infromation in the name, though the distros here typically do not ship multiple ABIs of a library either so it's fine.
If we are building Themis with embedded BoringSSL, produce packages with "-boringssl" suffix in their names: - libthemis-boringssl - libthemis-boringssl-dev - libthemis-boringssl-devel Note that this affects only Themis Core packages. Other packages do not depend on the choice of the cryptographic backend and keep their names: - libthemispp-dev - libthemispp-devel - libthemis-jni - libphpthemis
If Themis Core package is built with embedded BoringSSL, it does not depend on the system OpenSSL anymore. Do not include OpenSSL library and development packages in dependencies of "libthemis-boringssl" and "libthemis-boringssl-dev" packages.
Since both flavors of Themis Core install effectively the same files, make them conflicting: - libthemis conflicts with libthemis-boringssl - libthemis-dev conflicts with libthemis-boringssl-dev This prevents simultaneous installation. The implementation is not the most beatiful one, but we need to make it symmetric as either package conflicts with the other one.
Both OpenSSL and BoringSSL flavors of Themis Core provide the same ABI and can be used interchangeably. Make sure that both can satisfy dependencies of libthemispp, libthemis-jni, and libphpthemis packages. Note, however, that libthemis-boringssl cannot be used with libthemis-dev and vice versa. Also note that in this case we need to keep the version specs in parentheses because --depends value is directly substituted into DEB's "Depends:" field. FPM will not add parthenses for us this time.
Previously PHPThemis did not include in its dependencies at all. Make sure it depends on either OpenSSL or BoringSSL flavor of it, similar to the "libthemis-jni" package.
endif | ||
PHP_DEPENDENCIES += --depends "$(PACKAGE_NAME) (>= $(VERSION)+$(OS_CODENAME)) | $(OTHER_PACKAGE_NAME) (>= $(VERSION)+$(OS_CODENAME))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic 🧙♂️
@@ -604,23 +604,44 @@ endif | |||
# Packaging Themis Core: Linux distributions | |||
# | |||
|
|||
ifeq ($(ENGINE),boringssl) | |||
ifeq ($(CRYPTO_ENGINE_LIB_PATH),) | |||
PACKAGE_EMBEDDED_BORINGSSL := yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, if engine is boringssl, we'll pack boringssl as embedded library by default, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ENGINE=boringssl
and ENGINE_LIB_PATH
is not set. That is, if the user has requested a build with BoringSSL from Themis submodule, not with some user-provided BoringSSL build from user-specified location.
Makefile
Outdated
# If we were using native Debian packaging, dpkg-shlibdeps could supply us with | ||
# accurate dependency information. However, we build packages manually, so we | ||
# use dependencies of "libssl-dev" as a proxy. Typically this is "libssl1.1". | ||
DEB_DEPENDENCIES += --depends $(shell apt-cache depends libssl-dev | grep 'Depends:' | cut -d: -f 2-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEB_DEPENDENCIES += --depends $(shell apt-cache depends libssl-dev | grep 'Depends:' | cut -d: -f 2-) | |
DEB_DEPENDENCIES += --depends $(shell apt-cache depends libssl-dev | grep 'Depends:' | cut -d: -f 2- | tr -d ' ') |
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be adjusted like this after #682 is merged 👌
Dependencies have been merged, I've synced up this branch and resolved merge conflicts. If you want to make another review pass over the clean diff, this is the time. I'll merge it today if CI passes. (Let's hope GHA will work this time.) |
Well, GHA is stuck ¯\_(ツ)_/¯ |
This PR teaches
make deb
,make deb_php
,make rpm
to build packages of Themis Core using embedded BoringSSL instead of system OpenSSL. This is useful in cases like #619, #657.When
ENGINE=boringssl
is set, produced Themis Core packages will get a suffix:libthemis-boringssl
libthemis-boringssl-dev
orlibthemis-boringssl-devel
This is an alternative flavor of Themis Core which includes embedded BoringSSL instead of depending on system OpenSSL.
The BoringSSL and OpenSSL flavors provide the same ABI and install the same files. As such, they are mutually exclusive and conflict with each other to prevent simultaneous installation.
Other packages (
libthemispp-dev
,libthemis-jni
,libphpthemis
) now depend on either OpenSSL or BoringSSL flavor. That is, any flavor can be installed to satisfy the dependency.How to build new packages
In short, running
will build and package BoringSSL flavor of Themis. This will also compile and package other packages which are identical to the OpenSSL version.
It's better to build OpenSSL and BoringSSL flavors in separate build directories right now. The build system does not expect incremental rebuilds with different configuration.
Dependency summary
The dependencies are as follows:
libthemis
libsslX.Y
(of any version)libthemis-boringssl
of any version (new!)libthemis-boringssl
(new!)libthemis
of any versionlibthemis-dev
libssl-dev
libthemis
of exactly the same versionlibthemis-boringssl-dev
of any version (new!)libthemis-boringssl-dev
(new!)libthemis-boringssl
of exactly the same versionlibthemis-dev
of any versionlibthemispp-dev
libthemis-dev
orlibthemis-boringssl-dev
of exactly the same version (changed)libthemis-jni
libthemis
orlibthemis-boringssl
of at least the same version (changed)libphpthemis-php*
libthemis
orlibthemis-boringssl
of at least the same version (new!)Ditto for RPM, with
s/dev/devel/g
, etc.Checklist
Change is covered by automated tests(not really, only Builtbot)This PR depends on the previous ones: