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
return ossl_dh_new(pkey);
#endif
#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
case NID_id_GostR3410_2001:
case EVP_PKEY_EC:
return ossl_ec_new(pkey);
#endif
ext/openssl/ossl_pkey_ec.c
#define GetPKeyEC(obj, pkey) do { \
GetPKey((obj), (pkey)); \
if (EVP_PKEY_type((pkey)->type) != EVP_PKEY_EC) { \
ossl_raise(rb_eRuntimeError, "THIS IS NOT A EC PKEY!"); \
} \
} while (0)
#define SafeGet_ec_group(obj, group) do { \
......
if (!pkey) {
obj = ec_instance(cEC, EC_KEY_new());
} else {
if (EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) {
ossl_raise(rb_eTypeError, "Not a EC key!");
}
WrapPKey(cEC, obj, pkey);
}
if (obj == Qfalse) {
......
if (!NIL_P(group))
rb_funcall(self, rb_intern("group="), 1, arg);
return self;
}
......
rb_define_method(cEC, "public_key", ossl_ec_key_get_public_key, 0);
rb_define_method(cEC, "public_key=", ossl_ec_key_set_public_key, 1);
rb_define_method(cEC, "private_key?", ossl_ec_key_is_private_key, 0);
rb_define_alias (cEC, "private?", "private_key?"); /* Required by OpenSSL::PKey::PKey.sign */
rb_define_method(cEC, "public_key?", ossl_ec_key_is_public_key, 0);
rb_define_alias (cEC, "public?", "public_key?");
/* rb_define_method(cEC, "", ossl_ec_key_get_, 0);
rb_define_method(cEC, "=", ossl_ec_key_set_ 1);
set/get enc_flags
(1-1/6)