Skip to content

common,rgw: remove pre-OpenSSL-1.1 relic code - #70125

Merged
adamemerson merged 2 commits into
ceph:mainfrom
MarkAtwood:wip-openssl-pre11-cleanup
Aug 4, 2026
Merged

adamemerson merged 2 commits into
ceph:mainfrom
MarkAtwood:wip-openssl-pre11-cleanup

Conversation

@MarkAtwood

@MarkAtwood MarkAtwood commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

This removes two blocks of dead pre-OpenSSL-1.1.0 lifecycle code:

  • src/common/ceph_crypto.cc: the refcounted init/shutdown machinery
    (OpenSSL_add_all_algorithms, ERR_load_crypto_strings, locking/id
    callbacks, OPENSSL_config, and the matching cleanup calls). All of it
    is fenced OPENSSL_VERSION_NUMBER < 0x10100000L; OpenSSL >= 1.1.0
    initializes and deinitializes itself (OPENSSL_init_crypto(3)). The
    public ceph::crypto::init()/shutdown() entry points stay as empty
    functions, so the existing callers (ceph_context.cc, test/crypto.cc)
    are untouched.

  • src/rgw/rgw_http_client_curl.cc: the libcurl locking-callback shim.
    Its version fence is broken — it tests OPENSSL_API_COMPAT < 0x10100000L, but Ceph never defines OPENSSL_API_COMPAT, so the
    undefined token evaluates to 0 and the shim compiles on every OpenSSL
    version. Since 1.1.0 the CRYPTO_set_locking_callback family expands
    to no-op macros, so the code does nothing at runtime; this deletes it
    outright rather than fixing the fence.

Per-line no-op justification and the OpenSSL man-page citations are in
the commit messages. The -Wdeprecated-declarations pragmas in
ceph_crypto.cc are intentionally left in place: they still suppress
real warnings from the HMAC wrapper on OpenSSL 3 builds, which a
follow-up addresses.

This is the first installment of a tree-wide audit of deprecated and
obsolete OpenSSL API use in Ceph. The motivation is provider-based
FIPS configurations (OpenSSL's fips provider or any third-party
provider): legacy call shapes either bypass or half-bypass provider
dispatch. These two cleanups are behavior-neutral on every supported
build; follow-ups fix sites where the legacy shape is an actual
correctness problem. The same audit also flagged src/cls_crypto.cc and
src/cls_acl.cc, already removed on main by 43cf7eb.

Testing: these deletions were carried in a downstream 20.2.2-based
package build (full build clean; radosgw brought up and serving, with
no behavior delta observed on the touched paths). The rebase onto main
is textually identical apart from editor modelines. Deletion-only
otherwise; no functional change intended on any supported OpenSSL.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

All deleted logic in ceph_crypto.cc sat inside an
OPENSSL_VERSION_NUMBER < 0x10100000L fence: the include block for
conf.h/engine.h/err.h, the lock container and locking/thread-id
callbacks, and the bodies of the file-local ssl::init() and
ssl::shutdown(). The unfenced remnants deleted alongside it -- the
include lines, the empty static init()/shutdown() shells, and their
calls from the public wrappers -- are behavior-free on any
OpenSSL >= 1.1.0 build: empty static functions and includes with no
remaining consumer.

Explicit initialisation and cleanup have been unnecessary since
OpenSSL 1.1.0. OPENSSL_init_crypto(3):

  As of version 1.1.0 OpenSSL will automatically allocate all
  resources that it needs so no explicit initialisation is required.
  Similarly it will also automatically deinitialise as required.

The individual calls the deleted code made were all deprecated in
1.1.0 in favour of that automatic lifecycle:

  The OpenSSL_add_all_algorithms(), OpenSSL_add_all_ciphers(),
  OpenSSL_add_all_digests(), and EVP_cleanup(), functions
  were deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto() and should
  not be used.
    -- OpenSSL_add_all_algorithms(3)

  The ERR_load_crypto_strings(), SSL_load_error_strings(), and
  ERR_free_strings() functions were deprecated in OpenSSL 1.1.0 by
  OPENSSL_init_crypto() and OPENSSL_init_ssl() and should not be used.
    -- ERR_load_crypto_strings(3)

  The OPENSSL_no_config() and OPENSSL_config() functions were
  deprecated in OpenSSL 1.1.0 by OPENSSL_init_crypto().
    -- OPENSSL_config(3)

  ENGINE_cleanup() was deprecated in OpenSSL 1.1.0 by the automatic
  cleanup done by OPENSSL_cleanup()
  and should not be used.
    -- ENGINE_add(3)

For the locking-callback registration, OpenSSL 3.0's
<openssl/crypto.h> states in the comment above the no-op
compatibility macros: "the locking callbacks are no longer used.
Consequently, the callback management functions can be safely
replaced with no-op macros."

The public ceph::crypto::init() and ceph::crypto::shutdown() are kept
with unchanged signatures as empty functions; they are called from
ceph_context.cc and test/crypto.cc.

The -Wdeprecated-declarations pragmas are intentionally retained to
keep this commit purely mechanical; they are removed later in the
series once the digest API rework lands (see the SetFlags relic
commit).

Signed-off-by: Mark Atwood <[email protected]>
Delete RGWSSLSetup, the rgw_ssl_locking_callback and
rgw_ssl_thread_id_callback callbacks, both init_ssl() wrappers,
fe_inits_ssl(), and the guards fencing them, plus the includes and
dout defines that only they used. rgw_common.h stays: it declares
rgw_setup_saved_curl_handles()/rgw_release_all_curl_handles().
setup_curl() keeps its public signature; the now-unused parameter is
marked [[maybe_unused]].

The version fence was broken. The guard tested
OPENSSL_API_COMPAT < 0x10100000L, but Ceph never defines
OPENSSL_API_COMPAT anywhere, so the undefined token evaluated to 0
and the condition was true on every OpenSSL version - the shim was
always compiled in (when WITH_CURL_OPENSSL), never actually
version-gated.

Compiled in, it still did nothing on any supported OpenSSL. Since
1.1.0 the callback registration calls are no-op compatibility macros;
OpenSSL 3.0's <openssl/crypto.h> defines them under
OPENSSL_NO_DEPRECATED_1_1_0 with this comment: "the locking callbacks
are no longer used. Consequently, the callback management functions
can be safely replaced with no-op macros."

  #  define CRYPTO_num_locks()            (1)
  #  define CRYPTO_set_locking_callback(func)

and CRYPTO_set_id_callback is likewise a no-op macro:

  #   define CRYPTO_set_id_callback(func)

fe_inits_ssl() existed only to strip CURL_GLOBAL_SSL from the
curl_global_init() flags when the beast frontend had a certificate
configured. CURL_GLOBAL_SSL has been a documented no-op since curl
7.57.0 - the deleted code's own comment said "TODO this flag is no op
for curl > 7.57" - so passing CURL_GLOBAL_ALL unconditionally is
behavior-identical on every supported platform.

Signed-off-by: Mark Atwood <[email protected]>
@MarkAtwood
MarkAtwood requested a review from a team as a code owner July 10, 2026 19:11
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

16 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@adamemerson adamemerson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved for RGW, but this should not merge without Sage's ack.

@adamemerson

Copy link
Copy Markdown
Contributor

ok to test

@MarkAtwood

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@MarkAtwood

Copy link
Copy Markdown
Contributor Author

@adamemerson Thanks for the review! Two CI items need org-member powers: (1) the checklist Verify re-run is awaiting workflow approval — https://github.com/ceph/ceph/actions/runs/29305439425 — the description now matches the current template; (2) could you re-issue jenkins test make check arm64? The 99568 failure was an infra kill in run-rbd-unit-tests-0.sh (output truncated mid-line, no test assertions failed), and my own retest comment doesn't trigger Jenkins.

@anrao19

anrao19 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-07-17-06:18.

@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@adamemerson

Copy link
Copy Markdown
Contributor

Don't merge this until the other review, I want to get our security engineer's ack.

@anrao19

anrao19 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-07-17-06:18.

pr testing completed and approved by @ivancich

@mctaggatart mctaggatart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short version: Looks good to me.
Reviewed with Claude Fable and summarized with IBM Project Bob with a manual review of the code as well. Full findings shared with Adam Emerson and available upon request.

Overall risk level: Low (with important caveats for FIPS deployments)
Short summary: This deletion-only PR removes pre-OpenSSL-1.1.0 initialization and locking code that is dead/no-op on modern OpenSSL. The change is behavior-neutral and improves security posture by eliminating complex legacy code with documented memory leaks and a broken version fence. However, the empty init() function creates latent FIPS misconfiguration risk by relying on implicit initialization instead of explicit, deterministic config loading.
Most important issues:
Medium: Empty init() function prevents deterministic FIPS provider activation (critical for compliance)
Low: No compile-time enforcement that OpenSSL >= 1.1.0 is used (thread-safety depends on this)
Informational: Broken OPENSSL_API_COMPAT fence pattern may exist elsewhere in codebase

@anrao19 anrao19 removed the DNM label Aug 3, 2026
@anrao19

anrao19 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Don't merge this until the other review, I want to get our security engineer's ack.

@adamemerson , feel free to merge the pr upon ack.
pr testing is complete

@adamemerson
adamemerson merged commit fcaedc7 into ceph:main Aug 4, 2026
14 of 16 checks passed
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.

6 participants