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."); \ 28 #define SafeGetEngine(obj, engine) do { \ 29 OSSL_Check_Kind((obj), cEngine); \ 30 GetPKCS7((obj), (engine)); \ 53 #define OSSL_ENGINE_LOAD_IF_MATCH(x) \ 55 if(!strcmp(#x, RSTRING_PTR(name))){\ 89 #if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES) 96 ENGINE_load_builtin_engines();
100 #ifndef OPENSSL_NO_STATIC_ENGINE 101 #if HAVE_ENGINE_LOAD_DYNAMIC 104 #if HAVE_ENGINE_LOAD_4758CCA 107 #if HAVE_ENGINE_LOAD_AEP 110 #if HAVE_ENGINE_LOAD_ATALLA 113 #if HAVE_ENGINE_LOAD_CHIL 116 #if HAVE_ENGINE_LOAD_CSWIFT 119 #if HAVE_ENGINE_LOAD_NURON 122 #if HAVE_ENGINE_LOAD_SUREWARE 125 #if HAVE_ENGINE_LOAD_UBSEC 128 #if HAVE_ENGINE_LOAD_PADLOCK 131 #if HAVE_ENGINE_LOAD_CAPI 134 #if HAVE_ENGINE_LOAD_GMP 137 #if HAVE_ENGINE_LOAD_GOST 140 #if HAVE_ENGINE_LOAD_CRYPTODEV 143 #if HAVE_ENGINE_LOAD_AESNI 147 #ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO 183 for(e = ENGINE_get_first(); e; e = ENGINE_get_next(e)){
223 ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
302 const EVP_CIPHER *ciph, *tmp;
307 nid = EVP_CIPHER_nid(tmp);
309 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);
370 pkey = ENGINE_load_private_key(e, sid,
NULL, sdata);
400 pkey = ENGINE_load_public_key(e, sid,
NULL, sdata);
430 ENGINE_set_default(e, f);
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");
480 const ENGINE_CMD_DEFN *defn, *p;
485 if ((defn = ENGINE_get_cmd_defns(e)) !=
NULL){
486 for (p = defn; p->cmd_num > 0; p++){
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 static VALUE ossl_engine_get_digest(VALUE self, VALUE name)
#define SetEngine(obj, engine)
static VALUE ossl_engine_get_id(VALUE self)
static VALUE ossl_engine_s_cleanup(VALUE self)
#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.
static VALUE ossl_engine_cmd_flag_to_name(int flag)
void Init_ossl_engine(void)
VALUE rb_ary_push(VALUE ary, VALUE item)
static VALUE ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
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)
static VALUE ossl_engine_finish(VALUE self)
#define DefEngineConst(x)
VALUE ossl_cipher_new(const EVP_CIPHER *cipher)
#define OSSL_PKEY_SET_PRIVATE(obj)
void ossl_clear_error(void)
int rb_block_given_p(void)
static VALUE ossl_engine_get_cmds(VALUE self)
RUBY_EXTERN VALUE rb_cObject
VALUE ossl_digest_new(const EVP_MD *md)
static VALUE ossl_engine_s_engines(VALUE klass)
static VALUE ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
#define OSSL_ENGINE_LOAD_IF_MATCH(x)
static const rb_data_type_t ossl_engine_type
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
VALUE rb_sprintf(const char *format,...)
static VALUE ossl_engine_inspect(VALUE self)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
static VALUE ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
static VALUE ossl_engine_get_name(VALUE self)
#define StringValueCStr(v)
static VALUE ossl_engine_get_cipher(VALUE self, VALUE name)
static VALUE ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
void ossl_raise(VALUE exc, const char *fmt,...)
void rb_warning(const char *fmt,...)
VALUE rb_define_module(const char *name)
static VALUE ossl_engine_set_default(VALUE self, VALUE flag)
static VALUE ossl_engine_s_by_id(VALUE klass, VALUE id)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
static void ossl_engine_free(void *engine)
VALUE rb_obj_class(VALUE)