Skip to content

Always use OpenSSL backend when goexperiment=opensslcrypto #641

@qmuntal

Description

@qmuntal

We are currently only using the OpenSSL backend if goexperiment=opensslcrypto and FIPS mode is requested, either via GOFIPS=1 or system-wide setting. In all other situations we fallback to Go crypto.

We inherited this approach from RedHat fork and I initially though it would be good to keep it for the following reasons:

  • We don't have to support using OpenSSL in non-FIPS mode.
  • An application would still work in case it could not load the OpenSSL libraries, either because the system doesn't have them or because it is using an unsupported version, unless GOFIPS=1.

On the other hand, there are some downsides:

  • boring.Enabled is no longer constant, because the OpenSSL backend can be disabled at runtime in some situations. This hurts the Go reachability, inlining and escape analyses, because it can't eliminate non-OpenSSL code paths even when goexperiment=opensslcrypto.
  • We diverge from the Boring approach, where goexperiment=boringcrypto always uses the boring backend.

The OpenSSL backend is now more robust, better tested and has a smarter OpenSSL library loading strategy, so I'm leaning towards always using the OpenSSL backend so that boring.Enabled can be made constant and we diverge less from the Boring approach.

If we do this change, applications running with GOFIPS=1 would still panic if OpenSSL can't be load or FIPS can't be configured.

@dagood @jaredpar @chsienki thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions