12 #if !defined(OPENSSL_NO_ENGINE) 14 #define NewEngine(klass) \ 15 TypedData_Wrap_Struct((klass), &ossl_engine_type, 0) 16 #define SetEngine(obj, engine) do { \ 18 ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \ 20 RTYPEDDATA_DATA(obj) = (engine); \ 22 #define GetEngine(obj, engine) do { \ 23 TypedData_Get_Struct((obj), ENGINE, &ossl_engine_type, (engine)); \ 25 ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \ 49 #define OSSL_ENGINE_LOAD_IF_MATCH(x) \ 51 if(!strcmp(#x, RSTRING_PTR(name))){\ 58 ossl_engine_free(
void *engine)
84 #if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES) 91 ENGINE_load_builtin_engines();
95 #ifndef OPENSSL_NO_STATIC_ENGINE 96 #if HAVE_ENGINE_LOAD_DYNAMIC 99 #if HAVE_ENGINE_LOAD_4758CCA 102 #if HAVE_ENGINE_LOAD_AEP 105 #if HAVE_ENGINE_LOAD_ATALLA 108 #if HAVE_ENGINE_LOAD_CHIL 111 #if HAVE_ENGINE_LOAD_CSWIFT 114 #if HAVE_ENGINE_LOAD_NURON 117 #if HAVE_ENGINE_LOAD_SUREWARE 120 #if HAVE_ENGINE_LOAD_UBSEC 123 #if HAVE_ENGINE_LOAD_PADLOCK 126 #if HAVE_ENGINE_LOAD_CAPI 129 #if HAVE_ENGINE_LOAD_GMP 132 #if HAVE_ENGINE_LOAD_GOST 135 #if HAVE_ENGINE_LOAD_CRYPTODEV 138 #if HAVE_ENGINE_LOAD_AESNI 142 #ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO 161 ossl_engine_s_cleanup(
VALUE self)
174 ossl_engine_s_engines(
VALUE klass)
180 for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)){
211 ossl_engine_s_load(1, &
id, klass);
219 ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
238 ossl_engine_get_id(
VALUE self)
258 ossl_engine_get_name(
VALUE self)
274 ossl_engine_finish(
VALUE self)
303 const EVP_CIPHER *ciph, *tmp;
308 nid = EVP_CIPHER_nid(tmp);
310 ciph = ENGINE_get_cipher(e, nid);
335 const EVP_MD *md, *tmp;
340 nid = EVP_MD_nid(tmp);
342 md = ENGINE_get_digest(e, nid);
369 pkey = ENGINE_load_private_key(e, sid,
NULL, sdata);
398 pkey = ENGINE_load_public_key(e, sid,
NULL, sdata);
421 ossl_engine_set_default(
VALUE self,
VALUE flag)
427 ENGINE_set_default(e, f);
457 ossl_engine_cmd_flag_to_name(
int flag)
460 case ENGINE_CMD_FLAG_NUMERIC:
return rb_str_new2(
"NUMERIC");
461 case ENGINE_CMD_FLAG_STRING:
return rb_str_new2(
"STRING");
462 case ENGINE_CMD_FLAG_NO_INPUT:
return rb_str_new2(
"NO_INPUT");
463 case ENGINE_CMD_FLAG_INTERNAL:
return rb_str_new2(
"INTERNAL");
475 ossl_engine_get_cmds(
VALUE self)
478 const ENGINE_CMD_DEFN *defn, *p;
483 if ((defn = ENGINE_get_cmd_defns(e)) !=
NULL){
484 for (p = defn; p->cmd_num > 0; p++){
488 rb_ary_push(tmp, ossl_engine_cmd_flag_to_name(p->cmd_flags));
503 ossl_engine_inspect(
VALUE self)
509 rb_obj_class(
self), ENGINE_get_id(e), ENGINE_get_name(e));
512 #define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x)) 547 #ifdef ENGINE_METHOD_BN_MOD_EXP 550 #ifdef ENGINE_METHOD_BN_MOD_EXP_CRT #define SetEngine(obj, engine)
#define RUBY_TYPED_FREE_IMMEDIATELY
#define GetEngine(obj, engine)
void rb_undef_alloc_func(VALUE)
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
int rb_block_given_p(void)
Determines if the current method is given a block.
void Init_ossl_engine(void)
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
VALUE ossl_pkey_new(EVP_PKEY *pkey)
#define DefEngineConst(x)
VALUE rb_obj_class(VALUE)
call-seq: obj.class -> class
VALUE ossl_cipher_new(const EVP_CIPHER *cipher)
#define OSSL_PKEY_SET_PRIVATE(obj)
void ossl_clear_error(void)
RUBY_EXTERN VALUE rb_cObject
VALUE ossl_digest_new(const EVP_MD *md)
#define OSSL_ENGINE_LOAD_IF_MATCH(x)
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
VALUE rb_sprintf(const char *format,...)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
#define StringValueCStr(v)
void rb_warning(const char *fmt,...)
void ossl_raise(VALUE exc, const char *fmt,...)
VALUE rb_define_module(const char *name)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)