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 #if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000 
   50 #define OSSL_ENGINE_LOAD_IF_MATCH(engine_name, x) \ 
   52   if(!strcmp(#engine_name, RSTRING_PTR(name))){\ 
   53     if (OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_##x, NULL))\ 
   56       ossl_raise(eEngineError, "OPENSSL_init_crypto"); \ 
   60 #define OSSL_ENGINE_LOAD_IF_MATCH(engine_name, x)  \ 
   62   if(!strcmp(#engine_name, RSTRING_PTR(name))){\ 
   63     ENGINE_load_##engine_name();\ 
   70 ossl_engine_free(
void *engine)
 
  100         ENGINE_load_builtin_engines();
 
  104 #ifdef HAVE_ENGINE_LOAD_DYNAMIC 
  107 #ifndef OPENSSL_NO_STATIC_ENGINE 
  108 #ifdef HAVE_ENGINE_LOAD_4758CCA 
  111 #ifdef HAVE_ENGINE_LOAD_AEP 
  114 #ifdef HAVE_ENGINE_LOAD_ATALLA 
  117 #ifdef HAVE_ENGINE_LOAD_CHIL 
  120 #ifdef HAVE_ENGINE_LOAD_CSWIFT 
  123 #ifdef HAVE_ENGINE_LOAD_NURON 
  126 #ifdef HAVE_ENGINE_LOAD_SUREWARE 
  129 #ifdef HAVE_ENGINE_LOAD_UBSEC 
  132 #ifdef HAVE_ENGINE_LOAD_PADLOCK 
  135 #ifdef HAVE_ENGINE_LOAD_CAPI 
  138 #ifdef HAVE_ENGINE_LOAD_GMP 
  141 #ifdef HAVE_ENGINE_LOAD_GOST 
  145 #ifdef HAVE_ENGINE_LOAD_CRYPTODEV 
  163 ossl_engine_s_cleanup(
VALUE self)
 
  165 #if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x10100000 
  178 ossl_engine_s_engines(
VALUE klass)
 
  184     for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)){
 
  215     ossl_engine_s_load(1, &
id, klass);
 
  223     ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
 
  242 ossl_engine_get_id(
VALUE self)
 
  262 ossl_engine_get_name(
VALUE self)
 
  278 ossl_engine_finish(
VALUE self)
 
  307     const EVP_CIPHER *ciph, *tmp;
 
  312     nid = EVP_CIPHER_nid(tmp);
 
  314     ciph = ENGINE_get_cipher(e, nid);
 
  339     const EVP_MD *md, *tmp;
 
  344     nid = EVP_MD_nid(tmp);
 
  346     md = ENGINE_get_digest(e, nid);
 
  373     pkey = ENGINE_load_private_key(e, sid, 
NULL, sdata);
 
  402     pkey = ENGINE_load_public_key(e, sid, 
NULL, sdata);
 
  425 ossl_engine_set_default(
VALUE self, 
VALUE flag)
 
  431     ENGINE_set_default(e, 
f);
 
  461 ossl_engine_cmd_flag_to_name(
int flag)
 
  464     case ENGINE_CMD_FLAG_NUMERIC:  
return rb_str_new2(
"NUMERIC");
 
  465     case ENGINE_CMD_FLAG_STRING:   
return rb_str_new2(
"STRING");
 
  466     case ENGINE_CMD_FLAG_NO_INPUT: 
return rb_str_new2(
"NO_INPUT");
 
  467     case ENGINE_CMD_FLAG_INTERNAL: 
return rb_str_new2(
"INTERNAL");
 
  479 ossl_engine_get_cmds(
VALUE self)
 
  482     const ENGINE_CMD_DEFN *defn, *p;
 
  487     if ((defn = ENGINE_get_cmd_defns(e)) != 
NULL){
 
  488         for (p = defn; p->cmd_num > 0; p++){
 
  492             rb_ary_push(tmp, ossl_engine_cmd_flag_to_name(p->cmd_flags));
 
  507 ossl_engine_inspect(
VALUE self)
 
  513                       rb_obj_class(
self), ENGINE_get_id(e), ENGINE_get_name(e));
 
  516 #define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x)) 
  551 #ifdef ENGINE_METHOD_BN_MOD_EXP 
  554 #ifdef ENGINE_METHOD_BN_MOD_EXP_CRT