Skip to content

cmake: allow building against BoringSSL - #48160

Closed
cbodley wants to merge 6 commits into
ceph:mainfrom
cbodley:wip-boringssl
Closed

cbodley wants to merge 6 commits into
ceph:mainfrom
cbodley:wip-boringssl

Conversation

@cbodley

@cbodley cbodley commented Sep 18, 2022

Copy link
Copy Markdown
Contributor

OpenSSL doesn't support quic, so many quic libraries depend on BoringSSL. to start experimenting with quic integration, we need the ability to build in this configuration

this doesn't add BoringSSL as a ceph dependency, it only works around some build/link failures when our find_package(OpenSSL) is pointed at a boringssl build. this was tested against the master branch of https://github.com/google/boringssl:

cmake -DOPENSSL_SSL_LIBRARY=~/boringssl/ssl/libssl.so
-DOPENSSL_CRYPTO_LIBRARY=~/boringssl/crypto/libcrypto.so
-DOPENSSL_INCLUDE_DIR=~/boringssl/include

these were several compilation failures due to api differences:

  • common/ceph_crypto.h: HMAC_CTX_get_md() not found in openssl/hmac.h with older boringssl versions (added very recently in google/boringssl@d45d893)
  • common/ceph_crypto.cc: OPENSSL_cleanse() not found in openssl/crypto.h, boringssl has it in openssl/mem.h
  • common/openssl_opts_handler.cc: CONF_modules_load() not found in openssl/conf.h, boringssl only has CONF_modules_load_file()
  • rgw/rgw_kmip_client_impl.cc: BIO_new_ssl_connect() not found in openssl/ssl.h

there were also linker errors because some sources were still including the default /usr/include/openssl headers. all sources that depend on openssl need to use our overridden include directory, so OPENSSL_INCLUDE_DIR was made a PUBLIC part of the common-common-objs target

we're still using the system libcurl library which links against openssl, so rgw's RGWHTTPManager crashes on startup in curl_easy_init()

the boost::asio::ssl wrappers used by rbd and rgw already support boringssl

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@cbodley

cbodley commented Sep 21, 2022

Copy link
Copy Markdown
Contributor Author

it might also be possible to link both openssl and boringssl into the same ceph binaries: https://boringssl.googlesource.com/boringssl/+/HEAD/BUILDING.md#building-with-prefixed-symbols

@cbodley

cbodley commented Sep 21, 2022

Copy link
Copy Markdown
Contributor Author

discussed this with @mdw-at-linuxbox, and he suggested that we could make rgw's frontends pluggable so that the h3 frontend's boringssl dependency could be hidden from the rest of ceph and rgw

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

rgw_kmip_client_impl.cc uses BIO_new_ssl_connect() which isn't present
in boringssl

allow compiling without kmip support as a workaround

Signed-off-by: Casey Bodley <[email protected]>
boringssl didn't have HMAC_CTX_get_md() until very recently in
google/boringssl@d45d893

Signed-off-by: Casey Bodley <[email protected]>
this way all dependent targets will use the same openssl include dir,
which may be overridden for windows or boringssl

Signed-off-by: Casey Bodley <[email protected]>
this way the sources in libosd.a will use our customized openssl headers

Signed-off-by: Casey Bodley <[email protected]>
@github-actions

github-actions Bot commented Oct 4, 2022

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cbodley

cbodley commented Jan 18, 2023

Copy link
Copy Markdown
Contributor Author

this won't work in practice. ceph-mgr requires ceph's ssl library to match python's:

    if(NOT (OPENSSL_SOVERSION VERSION_EQUAL PYSSL_SOVERSION))
      message(FATAL_ERROR "Python and Ceph link to different OpenSSL versions: ${PYSSL_VER} vs ${OPENSSL_VERSION}")

@cbodley cbodley closed this Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant