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

make OpenSSL::PKey::EC::{Group,Point} directly wrap EC_{GROUP,POINT} object #71

Merged
merged 3 commits into from
Sep 7, 2016

Commits on Sep 7, 2016

  1. pkey: make ossl_pkey_ec.c follow the common macro naming

    Make ossl_pkey_ec.c follow the general convension on macro names. Prefer
    CamelCase to Snake_Case and unify Require_*() and Get_*() macros into
    Get*() macros. There is nothing wrong with the style itself but it's
    hard to read if two different styles are mixed.
    rhenium committed Sep 7, 2016
    Configuration menu
    Copy the full SHA
    e3dd3ea View commit details
    Browse the repository at this point in the history
  2. pkey: make OpenSSL::PKey::EC::Point wrap an EC_POINT directly

    Currently an OpenSSL::PKey::EC::Point wraps an ossl_ec_point struct
    which has a pointer for EC_POINT. This commit make EC::Point wrap an
    EC_POINT directly in order to simplify the source code. There should be
    no changes on behavior seen from Ruby.
    rhenium committed Sep 7, 2016
    Configuration menu
    Copy the full SHA
    4076581 View commit details
    Browse the repository at this point in the history
  3. pkey: make OpenSSL::PKey::EC::Group wrap an EC_GROUP directly

    As done for EC::Point, remove ossl_ec_group struct. This contains a
    breaking change. Modifications to an EC::Group returned by EC#group
    no longer affects the EC object unless set to the key explicitly using
    EC#group=. This is the common behavior in Ruby/OpenSSL, including other
    getter methods of EC such as EC#public_key.
    
    EC#group currently returns a EC::Group linked with the key, i.e. the
    EC::Group object holds a reference to an EC_GROUP that the EC_KEY owns.
    We use some ugly workaround - the ossl_ec_group struct has a flag
    'dont_free' that indicates we must not free the EC_GROUP. But it is
    still not possible to control OpenSSL of free'ing the EC_GROUP, so,
    for example, the following code behaves strangely:
    
      ec = OpenSSL::PKey::EC.generate("prime256v1")
      group = ec.group
      p group.curve_name #=> "prime256v1"
      ec.group = OpenSSL::PKey::EC::Group.new("prime256v1")
      p group.curve_name #=> nil
    rhenium committed Sep 7, 2016
    Configuration menu
    Copy the full SHA
    9435c8b View commit details
    Browse the repository at this point in the history