Skip to content

Commit bd3508d

Browse files
authored
Merge pull request #398 from rhenium/ky/pkey-remove-ec-group-from-raw-method
pkey/ec: remove OpenSSL::PKey::EC::Group.new(ec_method) form
2 parents 0313e1b + df4bec8 commit bd3508d

File tree

1 file changed

+2
-42
lines changed

1 file changed

+2
-42
lines changed

ext/openssl/ossl_pkey_ec.c

+2-42
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ VALUE eEC_GROUP;
4747
VALUE cEC_POINT;
4848
VALUE eEC_POINT;
4949

50-
static ID s_GFp;
51-
static ID s_GFp_simple;
52-
static ID s_GFp_mont;
53-
static ID s_GFp_nist;
54-
static ID s_GF2m;
55-
static ID s_GF2m_simple;
50+
static ID s_GFp, s_GF2m;
5651

5752
static ID ID_uncompressed;
5853
static ID ID_compressed;
@@ -580,20 +575,11 @@ ec_group_new(const EC_GROUP *group)
580575
* call-seq:
581576
* OpenSSL::PKey::EC::Group.new(ec_group)
582577
* OpenSSL::PKey::EC::Group.new(pem_or_der_encoded)
583-
* OpenSSL::PKey::EC::Group.new(ec_method)
584578
* OpenSSL::PKey::EC::Group.new(:GFp, bignum_p, bignum_a, bignum_b)
585579
* OpenSSL::PKey::EC::Group.new(:GF2m, bignum_p, bignum_a, bignum_b)
586580
*
587581
* Creates a new EC::Group object.
588582
*
589-
* _ec_method_ is a symbol that represents an EC_METHOD. Currently the following
590-
* are supported:
591-
*
592-
* * :GFp_simple
593-
* * :GFp_mont
594-
* * :GFp_nist
595-
* * :GF2m_simple
596-
*
597583
* If the first argument is :GFp or :GF2m, creates a new curve with given
598584
* parameters.
599585
*/
@@ -608,29 +594,7 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
608594

609595
switch (rb_scan_args(argc, argv, "13", &arg1, &arg2, &arg3, &arg4)) {
610596
case 1:
611-
if (SYMBOL_P(arg1)) {
612-
const EC_METHOD *method = NULL;
613-
ID id = SYM2ID(arg1);
614-
615-
if (id == s_GFp_simple) {
616-
method = EC_GFp_simple_method();
617-
} else if (id == s_GFp_mont) {
618-
method = EC_GFp_mont_method();
619-
} else if (id == s_GFp_nist) {
620-
method = EC_GFp_nist_method();
621-
#if !defined(OPENSSL_NO_EC2M)
622-
} else if (id == s_GF2m_simple) {
623-
method = EC_GF2m_simple_method();
624-
#endif
625-
}
626-
627-
if (method) {
628-
if ((group = EC_GROUP_new(method)) == NULL)
629-
ossl_raise(eEC_GROUP, "EC_GROUP_new");
630-
} else {
631-
ossl_raise(rb_eArgError, "unknown symbol, must be :GFp_simple, :GFp_mont, :GFp_nist or :GF2m_simple");
632-
}
633-
} else if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
597+
if (rb_obj_is_kind_of(arg1, cEC_GROUP)) {
634598
const EC_GROUP *arg1_group;
635599

636600
GetECGroup(arg1, arg1_group);
@@ -1592,10 +1556,6 @@ void Init_ossl_ec(void)
15921556

15931557
s_GFp = rb_intern("GFp");
15941558
s_GF2m = rb_intern("GF2m");
1595-
s_GFp_simple = rb_intern("GFp_simple");
1596-
s_GFp_mont = rb_intern("GFp_mont");
1597-
s_GFp_nist = rb_intern("GFp_nist");
1598-
s_GF2m_simple = rb_intern("GF2m_simple");
15991559

16001560
ID_uncompressed = rb_intern("uncompressed");
16011561
ID_compressed = rb_intern("compressed");

0 commit comments

Comments
 (0)