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

pkey: avoid creating multiple wrapper objects for single EVP_PKEY #817

Closed
wants to merge 2 commits into from

Commits on Nov 15, 2024

  1. pkey: rename ossl_pkey_new() to ossl_pkey_wrap()

    Among the functions named ossl_*_new(), ossl_pkey_new() is the only one
    that takes the ownership of the passed OpenSSL object. Let's rename it
    to avoid confusion.
    rhenium committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    62261f9 View commit details
    Browse the repository at this point in the history
  2. pkey: avoid creating multiple wrapper objects for single EVP_PKEY

    Currently, it is possible to create multiple OpenSSL::PKey::PKey
    instances that wrap the same EVP_PKEY object through ossl_pkey_wrap().
    This behavior was not intentional and doesn't offer any useful
    functionality.
    
    As a result, the frozen state of an OpenSSL::PKey::PKey instance is
    meaningless. An upcoming change to make OpenSSL classes shareable
    between ractors relies on the assumption that frozen objects are
    thread-safe without the GVL.
    
    Let's keep track of the wrapper Ruby object associated with EVP_PKEY to
    ensure that only one Ruby object wraps a given EVP_PKEY.
    
    While other OpenSSL types have reference counters, EVP_PKEY is the only
    type in ruby/openssl where duplicate wrapper objects can be created.
    rhenium committed Nov 15, 2024
    Configuration menu
    Copy the full SHA
    2f90c71 View commit details
    Browse the repository at this point in the history