Skip to content
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

Cherrypick "Add some barebones support for DH in EVP" #1813

Merged
merged 4 commits into from
Aug 30, 2024

Commits on Aug 30, 2024

  1. Remove some unnecessary dependencies on EVP_PKEY_set_type

    EVP_PKEY_set_type needs to pull in every supported EVP_PKEY type, but
    most of our calls within the library already know what type they're
    working with. Have them call evp_pkey_set_method directly.
    
    Bug: 497
    Change-Id: I17cb9a0dff0da55206686bce1d8e1df4773f6f4d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67127
    Reviewed-by: Bob Beck <bbe@google.com>
    Auto-Submit: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    (cherry picked from commit fea4c97491e43455063fda6967e4a2cc4234baf5)
    davidben authored and samuel40791765 committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    23e5c29 View commit details
    Browse the repository at this point in the history
  2. Add some barebones support for DH in EVP

    OpenSSH needs this. Features that have been intentionally omitted for
    now:
    
    - X9.42-style Diffie-Hellman ("DHX"). We continue not to support this.
      Use ECDH or X25519 instead.
    
    - SPKI and PKCS#8 serialization. Use ECDH or X25519 instead. The format
      is a bit ill-defined. Moreover, until we solve the serialization
      aspects of https://crbug.com/boringssl/497, adding them would put this
      legacy algorithm on path for every caller.
    
    - Most of the random options like stapling a KDF, etc. Though I did add
      EVP_PKEY_CTX_set_dh_pad because it's the only way to undo OpenSSL's
      bug where they chop off leading zeros by default.
    
    - Parameter generation. Diffie-Hellman parameters should not be
      generated at runtime.
    
    This means you need to bootstrap with a DH object and then wrap it in an
    EVP_PKEY. This matches the limitations of the EVP API in OpenSSL 1.1.x.
    Unfortunately the OpenSSL 3.x APIs are unsuitable for many, many
    reasons, so I expect when we get further along in
    https://crbug.com/boringssl/535, we'll have established some patterns
    here that we can apply to EVP_PKEY_DH too.
    
    Change-Id: I34b4e8799afb266ea5602a70115cc2146f19c6a7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67207
    Reviewed-by: Theo Buehler <theorbuehler@gmail.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Bob Beck <bbe@google.com>
    (cherry picked from commit e57ab142c0cabf30b6d4e85b8038003cc179716b)
    davidben authored and samuel40791765 committed Aug 30, 2024
    Configuration menu
    Copy the full SHA
    37b6e33 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b547681 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fb59c08 View commit details
    Browse the repository at this point in the history