Ruby  2.1.10p492(2016-04-01revision54464)
Macros | Functions | Variables
ossl_pkey.h File Reference

Go to the source code of this file.

Macros

#define OSSL_PKEY_SET_PRIVATE(obj)   rb_iv_set((obj), "private", Qtrue)
 
#define OSSL_PKEY_SET_PUBLIC(obj)   rb_iv_set((obj), "private", Qfalse)
 
#define OSSL_PKEY_IS_PRIVATE(obj)   (rb_iv_get((obj), "private") == Qtrue)
 
#define WrapPKey(klass, obj, pkey)
 
#define GetPKey(obj, pkey)
 
#define SafeGetPKey(obj, pkey)
 
#define HAVE_BN_GENCB   defined(HAVE_RSA_GENERATE_KEY_EX) || defined(HAVE_DH_GENERATE_PARAMETERS_EX) || defined(HAVE_DSA_GENERATE_PARAMETERS_EX)
 
#define OSSL_PKEY_BN(keytype, name)
 
#define DEF_OSSL_PKEY_BN(class, keytype, name)
 

Functions

void ossl_generate_cb (int, int, void *)
 
VALUE ossl_pkey_new (EVP_PKEY *)
 
VALUE ossl_pkey_new_from_file (VALUE)
 
EVP_PKEY * GetPKeyPtr (VALUE)
 
EVP_PKEY * DupPKeyPtr (VALUE)
 
EVP_PKEY * GetPrivPKeyPtr (VALUE)
 
EVP_PKEY * DupPrivPKeyPtr (VALUE)
 
void Init_ossl_pkey (void)
 
VALUE ossl_rsa_new (EVP_PKEY *)
 
void Init_ossl_rsa (void)
 
VALUE ossl_dsa_new (EVP_PKEY *)
 
void Init_ossl_dsa (void)
 
VALUE ossl_dh_new (EVP_PKEY *)
 
void Init_ossl_dh (void)
 
VALUE ossl_ec_new (EVP_PKEY *)
 
void Init_ossl_ec (void)
 

Variables

VALUE mPKey
 
VALUE cPKey
 
VALUE ePKeyError
 
ID id_private_q
 
VALUE cRSA
 
VALUE eRSAError
 
VALUE cDSA
 
VALUE eDSAError
 
VALUE cDH
 
VALUE eDHError
 
DH * OSSL_DEFAULT_DH_512
 
DH * OSSL_DEFAULT_DH_1024
 
VALUE cEC
 
VALUE eECError
 
VALUE cEC_GROUP
 
VALUE eEC_GROUP
 
VALUE cEC_POINT
 
VALUE eEC_POINT
 

Macro Definition Documentation

◆ DEF_OSSL_PKEY_BN

#define DEF_OSSL_PKEY_BN (   class,
  keytype,
  name 
)
Value:
do { \
rb_define_method((class), #name, ossl_##keytype##_get_##name, 0); \
rb_define_method((class), #name "=", ossl_##keytype##_set_##name, 1);\
} while (0)
const char * name
Definition: nkf.c:208

Definition at line 145 of file ossl_pkey.h.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), and Init_ossl_rsa().

◆ GetPKey

#define GetPKey (   obj,
  pkey 
)
Value:
do {\
Data_Get_Struct((obj), EVP_PKEY, (pkey));\
if (!(pkey)) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!");\
} \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:547

Definition at line 30 of file ossl_pkey.h.

Referenced by ossl_dh_initialize(), ossl_dsa_initialize(), ossl_pkey_sign(), ossl_pkey_verify(), and ossl_rsa_initialize().

◆ HAVE_BN_GENCB

#define HAVE_BN_GENCB   defined(HAVE_RSA_GENERATE_KEY_EX) || defined(HAVE_DH_GENERATE_PARAMETERS_EX) || defined(HAVE_DSA_GENERATE_PARAMETERS_EX)

Definition at line 42 of file ossl_pkey.h.

◆ OSSL_PKEY_BN

#define OSSL_PKEY_BN (   keytype,
  name 
)

Definition at line 103 of file ossl_pkey.h.

◆ OSSL_PKEY_IS_PRIVATE

#define OSSL_PKEY_IS_PRIVATE (   obj)    (rb_iv_get((obj), "private") == Qtrue)

Definition at line 21 of file ossl_pkey.h.

◆ OSSL_PKEY_SET_PRIVATE

#define OSSL_PKEY_SET_PRIVATE (   obj)    rb_iv_set((obj), "private", Qtrue)

Definition at line 19 of file ossl_pkey.h.

◆ OSSL_PKEY_SET_PUBLIC

#define OSSL_PKEY_SET_PUBLIC (   obj)    rb_iv_set((obj), "private", Qfalse)

Definition at line 20 of file ossl_pkey.h.

◆ SafeGetPKey

#define SafeGetPKey (   obj,
  pkey 
)
Value:
do { \
OSSL_Check_Kind((obj), cPKey); \
GetPKey((obj), (pkey)); \
} while (0)
VALUE cPKey
Definition: ossl_pkey.c:17

Definition at line 36 of file ossl_pkey.h.

Referenced by DupPKeyPtr(), DupPrivPKeyPtr(), GetPKeyPtr(), and GetPrivPKeyPtr().

◆ WrapPKey

#define WrapPKey (   klass,
  obj,
  pkey 
)
Value:
do { \
if (!(pkey)) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
} \
(obj) = Data_Wrap_Struct((klass), 0, EVP_PKEY_free, (pkey)); \
OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)
#define Data_Wrap_Struct(klass, mark, free, sval)
Definition: ruby.h:1018
VALUE rb_eRuntimeError
Definition: error.c:547

Definition at line 23 of file ossl_pkey.h.

Referenced by dh_instance(), dsa_instance(), ossl_dh_new(), ossl_dsa_new(), ossl_pkey_alloc(), ossl_rsa_new(), and rsa_instance().

Function Documentation

◆ DupPKeyPtr()

EVP_PKEY* DupPKeyPtr ( VALUE  )

Definition at line 197 of file ossl_pkey.c.

References SafeGetPKey.

Referenced by ossl_client_cert_cb().

◆ DupPrivPKeyPtr()

EVP_PKEY* DupPrivPKeyPtr ( VALUE  )

Definition at line 208 of file ossl_pkey.c.

References id_private_q, NULL, ossl_raise(), Qtrue, rb_eArgError, rb_funcall(), and SafeGetPKey.

◆ GetPKeyPtr()

EVP_PKEY* GetPKeyPtr ( VALUE  )

◆ GetPrivPKeyPtr()

EVP_PKEY* GetPrivPKeyPtr ( VALUE  )

◆ Init_ossl_dh()

void Init_ossl_dh ( void  )

◆ Init_ossl_dsa()

void Init_ossl_dsa ( void  )

◆ Init_ossl_ec()

void Init_ossl_ec ( void  )

Definition at line 1680 of file ossl_pkey_ec.c.

Referenced by Init_ossl_pkey().

◆ Init_ossl_pkey()

void Init_ossl_pkey ( void  )

◆ Init_ossl_rsa()

void Init_ossl_rsa ( void  )

◆ ossl_dh_new()

VALUE ossl_dh_new ( EVP_PKEY *  )

Definition at line 62 of file ossl_pkey_dh.c.

References cDH, dh_instance(), eDHError, NULL, ossl_raise(), Qfalse, rb_eTypeError, and WrapPKey.

Referenced by ossl_pkey_new().

◆ ossl_dsa_new()

VALUE ossl_dsa_new ( EVP_PKEY *  )

Definition at line 56 of file ossl_pkey_dsa.c.

References cDSA, dsa_instance(), eDSAError, NULL, ossl_raise(), Qfalse, rb_eTypeError, and WrapPKey.

Referenced by ossl_pkey_new().

◆ ossl_ec_new()

VALUE ossl_ec_new ( EVP_PKEY *  )

Referenced by ossl_pkey_new().

◆ ossl_generate_cb()

void ossl_generate_cb ( int  ,
int  ,
void *   
)

Definition at line 25 of file ossl_pkey.c.

References INT2NUM, rb_ary_new2, rb_ary_store(), and rb_yield().

Referenced by dh_generate(), dsa_generate(), and rsa_generate().

◆ ossl_pkey_new()

VALUE ossl_pkey_new ( EVP_PKEY *  )

◆ ossl_pkey_new_from_file()

VALUE ossl_pkey_new_from_file ( VALUE  )

◆ ossl_rsa_new()

VALUE ossl_rsa_new ( EVP_PKEY *  )

Definition at line 56 of file ossl_pkey_rsa.c.

References cRSA, eRSAError, NULL, ossl_raise(), Qfalse, rb_eTypeError, rsa_instance(), and WrapPKey.

Referenced by ossl_pkey_new().

Variable Documentation

◆ cDH

VALUE cDH

Definition at line 34 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_dh_new().

◆ cDSA

VALUE cDSA

Definition at line 28 of file ossl_pkey_dsa.c.

Referenced by Init_ossl_dsa(), and ossl_dsa_new().

◆ cEC

VALUE cEC

◆ cEC_GROUP

VALUE cEC_GROUP

◆ cEC_POINT

VALUE cEC_POINT

◆ cPKey

VALUE cPKey

◆ cRSA

VALUE cRSA

Definition at line 28 of file ossl_pkey_rsa.c.

Referenced by Init_ossl_rsa(), and ossl_rsa_new().

◆ eDHError

VALUE eDHError

◆ eDSAError

VALUE eDSAError

◆ eEC_GROUP

VALUE eEC_GROUP

◆ eEC_POINT

VALUE eEC_POINT

◆ eECError

VALUE eECError

◆ ePKeyError

VALUE ePKeyError

◆ eRSAError

VALUE eRSAError

◆ id_private_q

ID id_private_q

Definition at line 19 of file ossl_pkey.c.

Referenced by DupPrivPKeyPtr(), GetPrivPKeyPtr(), Init_ossl_pkey(), and ossl_pkey_sign().

◆ mPKey

VALUE mPKey

Definition at line 16 of file ossl_pkey.c.

Referenced by Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_pkey(), and Init_ossl_rsa().

◆ OSSL_DEFAULT_DH_1024

DH* OSSL_DEFAULT_DH_1024

Definition at line 569 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_default_tmp_dh_callback().

◆ OSSL_DEFAULT_DH_512

DH* OSSL_DEFAULT_DH_512

Definition at line 541 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_default_tmp_dh_callback().