Ruby  2.4.2p198(2017-09-14revision59899)
Macros | Functions | Variables
ossl_engine.c File Reference
#include "ossl.h"
Include dependency graph for ossl_engine.c:

Go to the source code of this file.

Macros

#define NewEngine(klass)   TypedData_Wrap_Struct((klass), &ossl_engine_type, 0)
 
#define SetEngine(obj, engine)
 
#define GetEngine(obj, engine)
 
#define SafeGetEngine(obj, engine)
 
#define OSSL_ENGINE_LOAD_IF_MATCH(x)
 
#define DefEngineConst(x)   rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
 

Functions

static void ossl_engine_free (void *engine)
 
static VALUE ossl_engine_s_load (int argc, VALUE *argv, VALUE klass)
 
static VALUE ossl_engine_s_cleanup (VALUE self)
 
static VALUE ossl_engine_s_engines (VALUE klass)
 
static VALUE ossl_engine_s_by_id (VALUE klass, VALUE id)
 
static VALUE ossl_engine_get_id (VALUE self)
 
static VALUE ossl_engine_get_name (VALUE self)
 
static VALUE ossl_engine_finish (VALUE self)
 
static VALUE ossl_engine_get_cipher (VALUE self, VALUE name)
 
static VALUE ossl_engine_get_digest (VALUE self, VALUE name)
 
static VALUE ossl_engine_load_privkey (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_engine_load_pubkey (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_engine_set_default (VALUE self, VALUE flag)
 
static VALUE ossl_engine_ctrl_cmd (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_engine_cmd_flag_to_name (int flag)
 
static VALUE ossl_engine_get_cmds (VALUE self)
 
static VALUE ossl_engine_inspect (VALUE self)
 
void Init_ossl_engine (void)
 

Variables

VALUE cEngine
 
VALUE eEngineError
 
static const rb_data_type_t ossl_engine_type
 

Macro Definition Documentation

◆ DefEngineConst

#define DefEngineConst (   x)    rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))

Definition at line 512 of file ossl_engine.c.

Referenced by Init_ossl_engine().

◆ GetEngine

#define GetEngine (   obj,
  engine 
)
Value:
do { \
TypedData_Get_Struct((obj), ENGINE, &ossl_engine_type, (engine)); \
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761
static const rb_data_type_t ossl_engine_type
Definition: ossl_engine.c:67

Definition at line 22 of file ossl_engine.c.

Referenced by ossl_engine_ctrl_cmd(), ossl_engine_finish(), ossl_engine_get_cipher(), ossl_engine_get_cmds(), ossl_engine_get_digest(), ossl_engine_get_id(), ossl_engine_get_name(), ossl_engine_inspect(), ossl_engine_load_privkey(), ossl_engine_load_pubkey(), and ossl_engine_set_default().

◆ NewEngine

#define NewEngine (   klass)    TypedData_Wrap_Struct((klass), &ossl_engine_type, 0)

Definition at line 14 of file ossl_engine.c.

Referenced by ossl_engine_s_by_id(), and ossl_engine_s_engines().

◆ OSSL_ENGINE_LOAD_IF_MATCH

#define OSSL_ENGINE_LOAD_IF_MATCH (   x)
Value:
do{\
if(!strcmp(#x, RSTRING_PTR(name))){\
ENGINE_load_##x();\
return Qtrue;\
}\
}while(0)
#define Qtrue
Definition: ruby.h:437
#define RSTRING_PTR(str)
Definition: ruby.h:982
const char * name
Definition: nkf.c:208

Definition at line 53 of file ossl_engine.c.

Referenced by ossl_engine_s_load().

◆ SafeGetEngine

#define SafeGetEngine (   obj,
  engine 
)
Value:
do { \
OSSL_Check_Kind((obj), cEngine); \
GetPKCS7((obj), (engine)); \
} while (0)
VALUE cEngine
Definition: ossl_engine.c:43

Definition at line 28 of file ossl_engine.c.

◆ SetEngine

#define SetEngine (   obj,
  engine 
)
Value:
do { \
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
RTYPEDDATA_DATA(obj) = (engine); \
} while(0)
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 16 of file ossl_engine.c.

Referenced by ossl_engine_s_by_id(), and ossl_engine_s_engines().

Function Documentation

◆ Init_ossl_engine()

void Init_ossl_engine ( void  )

◆ ossl_engine_cmd_flag_to_name()

static VALUE ossl_engine_cmd_flag_to_name ( int  flag)
static

Definition at line 461 of file ossl_engine.c.

References rb_str_new2.

Referenced by ossl_engine_get_cmds().

◆ ossl_engine_ctrl_cmd()

static VALUE ossl_engine_ctrl_cmd ( int  argc,
VALUE argv,
VALUE  self 
)
static

Definition at line 445 of file ossl_engine.c.

References eEngineError, GetEngine, NIL_P, NULL, ossl_raise(), rb_scan_args(), StringValueCStr, and val.

Referenced by Init_ossl_engine().

◆ ossl_engine_finish()

static VALUE ossl_engine_finish ( VALUE  self)
static

Definition at line 272 of file ossl_engine.c.

References eEngineError, GetEngine, NULL, ossl_raise(), and Qnil.

Referenced by Init_ossl_engine().

◆ ossl_engine_free()

static void ossl_engine_free ( void *  engine)
static

Definition at line 62 of file ossl_engine.c.

◆ ossl_engine_get_cipher()

static VALUE ossl_engine_get_cipher ( VALUE  self,
VALUE  name 
)
static

Definition at line 299 of file ossl_engine.c.

References eEngineError, GetEngine, nid, NULL, ossl_cipher_new(), ossl_raise(), PRIsVALUE, and StringValueCStr.

Referenced by Init_ossl_engine().

◆ ossl_engine_get_cmds()

static VALUE ossl_engine_get_cmds ( VALUE  self)
static

◆ ossl_engine_get_digest()

static VALUE ossl_engine_get_digest ( VALUE  self,
VALUE  name 
)
static

Definition at line 332 of file ossl_engine.c.

References eEngineError, GetEngine, nid, NULL, ossl_digest_new(), ossl_raise(), PRIsVALUE, and StringValueCStr.

Referenced by Init_ossl_engine().

◆ ossl_engine_get_id()

static VALUE ossl_engine_get_id ( VALUE  self)
static

Definition at line 240 of file ossl_engine.c.

References GetEngine, and rb_str_new2.

Referenced by Init_ossl_engine().

◆ ossl_engine_get_name()

static VALUE ossl_engine_get_name ( VALUE  self)
static

Definition at line 258 of file ossl_engine.c.

References GetEngine, and rb_str_new2.

Referenced by Init_ossl_engine().

◆ ossl_engine_inspect()

static VALUE ossl_engine_inspect ( VALUE  self)
static

Definition at line 503 of file ossl_engine.c.

References GetEngine, PRIsVALUE, rb_obj_class(), and rb_sprintf().

Referenced by Init_ossl_engine().

◆ ossl_engine_load_privkey()

static VALUE ossl_engine_load_privkey ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ ossl_engine_load_pubkey()

static VALUE ossl_engine_load_pubkey ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ ossl_engine_s_by_id()

static VALUE ossl_engine_s_by_id ( VALUE  klass,
VALUE  id 
)
static

◆ ossl_engine_s_cleanup()

static VALUE ossl_engine_s_cleanup ( VALUE  self)
static

Definition at line 166 of file ossl_engine.c.

References Qnil.

Referenced by Init_ossl_engine().

◆ ossl_engine_s_engines()

static VALUE ossl_engine_s_engines ( VALUE  klass)
static

Definition at line 177 of file ossl_engine.c.

References NewEngine, rb_ary_new(), rb_ary_push(), and SetEngine.

Referenced by Init_ossl_engine().

◆ ossl_engine_s_load()

static VALUE ossl_engine_s_load ( int  argc,
VALUE argv,
VALUE  klass 
)
static

◆ ossl_engine_set_default()

static VALUE ossl_engine_set_default ( VALUE  self,
VALUE  flag 
)
static

Definition at line 424 of file ossl_engine.c.

References f, GetEngine, NUM2INT, and Qtrue.

Referenced by Init_ossl_engine().

Variable Documentation

◆ cEngine

VALUE cEngine

Definition at line 43 of file ossl_engine.c.

Referenced by Init_ossl_engine().

◆ eEngineError

VALUE eEngineError

◆ ossl_engine_type

const rb_data_type_t ossl_engine_type
static
Initial value:
= {
"OpenSSL/Engine",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_engine_free(void *engine)
Definition: ossl_engine.c:62

Definition at line 67 of file ossl_engine.c.