Project

General

Profile

Feature #9830 ยป gost_keys_support_draft.patch

Patch illustrating this issue - Envek (Andrey Novikov), 05/11/2014 08:27 PM

View differences:

ext/openssl/ossl_pkey.c
92 92
	return ossl_dh_new(pkey);
93 93
#endif
94 94
#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
95
    case NID_id_GostR3410_2001:
95 96
    case EVP_PKEY_EC:
96 97
	return ossl_ec_new(pkey);
97 98
#endif
ext/openssl/ossl_pkey_ec.c
23 23

  
24 24
#define GetPKeyEC(obj, pkey) do { \
25 25
    GetPKey((obj), (pkey)); \
26
    if (EVP_PKEY_type((pkey)->type) != EVP_PKEY_EC) { \
27
	ossl_raise(rb_eRuntimeError, "THIS IS NOT A EC PKEY!"); \
28
    } \
29 26
} while (0)
30 27

  
31 28
#define SafeGet_ec_group(obj, group) do { \
......
133 130
    if (!pkey) {
134 131
	obj = ec_instance(cEC, EC_KEY_new());
135 132
    } else {
136
	if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) {
137
	    ossl_raise(rb_eTypeError, "Not a EC key!");
138
	}
139 133
	WrapPKey(cEC, obj, pkey);
140 134
    }
141 135
    if (obj == Qfalse) {
......
234 228

  
235 229
    if (!NIL_P(group))
236 230
        rb_funcall(self, rb_intern("group="), 1, arg);
237

  
238 231
    return self;
239 232
}
240 233

  
......
1598 1591
    rb_define_method(cEC, "public_key", ossl_ec_key_get_public_key, 0);
1599 1592
    rb_define_method(cEC, "public_key=", ossl_ec_key_set_public_key, 1);
1600 1593
    rb_define_method(cEC, "private_key?", ossl_ec_key_is_private_key, 0);
1594
    rb_define_alias (cEC, "private?", "private_key?"); /* Required by OpenSSL::PKey::PKey.sign */
1601 1595
    rb_define_method(cEC, "public_key?", ossl_ec_key_is_public_key, 0);
1596
    rb_define_alias (cEC, "public?", "public_key?");
1602 1597
/*  rb_define_method(cEC, "", ossl_ec_key_get_, 0);
1603 1598
    rb_define_method(cEC, "=", ossl_ec_key_set_ 1);
1604 1599
    set/get enc_flags