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

Go to the source code of this file.

Data Structures

struct  dh_blocking_gen_arg
 

Macros

#define GetPKeyDH(obj, pkey)
 
#define GetDH(obj, dh)
 

Functions

static VALUE dh_instance (VALUE klass, DH *dh)
 
VALUE ossl_dh_new (EVP_PKEY *pkey)
 
static void * dh_blocking_gen (void *arg)
 
static DH * dh_generate (int size, int gen)
 
static VALUE ossl_dh_s_generate (int argc, VALUE *argv, VALUE klass)
 
static VALUE ossl_dh_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_dh_initialize_copy (VALUE self, VALUE other)
 
static VALUE ossl_dh_is_public (VALUE self)
 
static VALUE ossl_dh_is_private (VALUE self)
 
static VALUE ossl_dh_export (VALUE self)
 
static VALUE ossl_dh_to_der (VALUE self)
 
static VALUE ossl_dh_get_params (VALUE self)
 
static VALUE ossl_dh_to_text (VALUE self)
 
static VALUE ossl_dh_to_public_key (VALUE self)
 
static VALUE ossl_dh_check_params (VALUE self)
 
static VALUE ossl_dh_generate_key (VALUE self)
 
static VALUE ossl_dh_compute_key (VALUE self, VALUE pub)
 
void Init_ossl_dh (void)
 

Variables

VALUE cDH
 
VALUE eDHError
 

Macro Definition Documentation

◆ GetDH

#define GetDH (   obj,
  dh 
)
Value:
do { \
EVP_PKEY *_pkey; \
GetPKeyDH((obj), _pkey); \
(dh) = EVP_PKEY_get0_DH(_pkey); \
} while (0)

Definition at line 20 of file ossl_pkey_dh.c.

Referenced by ossl_dh_check_params(), ossl_dh_compute_key(), ossl_dh_export(), ossl_dh_generate_key(), ossl_dh_get_params(), ossl_dh_initialize_copy(), ossl_dh_is_private(), ossl_dh_is_public(), ossl_dh_to_der(), ossl_dh_to_public_key(), and ossl_dh_to_text().

◆ GetPKeyDH

#define GetPKeyDH (   obj,
  pkey 
)
Value:
do { \
GetPKey((obj), (pkey)); \
if (EVP_PKEY_base_id(pkey) != EVP_PKEY_DH) { /* PARANOIA? */ \
ossl_raise(rb_eRuntimeError, "THIS IS NOT A DH!") ; \
} \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761
#define EVP_PKEY_base_id(pkey)

Definition at line 14 of file ossl_pkey_dh.c.

Function Documentation

◆ dh_blocking_gen()

static void* dh_blocking_gen ( void *  arg)
static

◆ dh_generate()

static DH* dh_generate ( int  size,
int  gen 
)
static

◆ dh_instance()

static VALUE dh_instance ( VALUE  klass,
DH *  dh 
)
static

Definition at line 36 of file ossl_pkey_dh.c.

References NewPKey, Qfalse, and SetPKey.

Referenced by ossl_dh_new(), ossl_dh_s_generate(), and ossl_dh_to_public_key().

◆ Init_ossl_dh()

void Init_ossl_dh ( void  )

◆ ossl_dh_check_params()

static VALUE ossl_dh_check_params ( VALUE  self)
static

Definition at line 481 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, GetDH, Qfalse, and Qtrue.

Referenced by Init_ossl_dh().

◆ ossl_dh_compute_key()

static VALUE ossl_dh_compute_key ( VALUE  self,
VALUE  pub 
)
static

◆ ossl_dh_export()

static VALUE ossl_dh_export ( VALUE  self)
static

Definition at line 329 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, eDHError, GetDH, NULL, ossl_membio2str(), and ossl_raise().

Referenced by Init_ossl_dh().

◆ ossl_dh_generate_key()

static VALUE ossl_dh_generate_key ( VALUE  self)
static

Definition at line 511 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, eDHError, GetDH, and ossl_raise().

Referenced by Init_ossl_dh().

◆ ossl_dh_get_params()

static VALUE ossl_dh_get_params ( VALUE  self)
static

◆ ossl_dh_initialize()

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

◆ ossl_dh_initialize_copy()

static VALUE ossl_dh_initialize_copy ( VALUE  self,
VALUE  other 
)
static

Definition at line 244 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, eDHError, EVP_PKEY_base_id, GetDH, GetPKey, and ossl_raise().

Referenced by Init_ossl_dh().

◆ ossl_dh_is_private()

static VALUE ossl_dh_is_private ( VALUE  self)
static

Definition at line 303 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, GetDH, NULL, Qfalse, and Qtrue.

Referenced by Init_ossl_dh().

◆ ossl_dh_is_public()

static VALUE ossl_dh_is_public ( VALUE  self)
static

Definition at line 284 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, GetDH, NULL, Qfalse, and Qtrue.

Referenced by Init_ossl_dh().

◆ ossl_dh_new()

VALUE ossl_dh_new ( EVP_PKEY *  pkey)

Definition at line 58 of file ossl_pkey_dh.c.

References cDH, dh_instance(), eDHError, EVP_PKEY_base_id, NewPKey, NULL, ossl_raise(), Qfalse, rb_eTypeError, and SetPKey.

Referenced by pkey_new0().

◆ ossl_dh_s_generate()

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

◆ ossl_dh_to_der()

static VALUE ossl_dh_to_der ( VALUE  self)
static

◆ ossl_dh_to_public_key()

static VALUE ossl_dh_to_public_key ( VALUE  self)
static

Definition at line 456 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, dh_instance(), eDHError, GetDH, NULL, ossl_raise(), Qfalse, and rb_obj_class().

Referenced by Init_ossl_dh().

◆ ossl_dh_to_text()

static VALUE ossl_dh_to_text ( VALUE  self)
static

Definition at line 415 of file ossl_pkey_dh.c.

References dh_blocking_gen_arg::dh, eDHError, GetDH, NULL, ossl_membio2str(), and ossl_raise().

Referenced by Init_ossl_dh().

Variable Documentation

◆ cDH

VALUE cDH

Definition at line 29 of file ossl_pkey_dh.c.

Referenced by Init_ossl_dh(), and ossl_dh_new().

◆ eDHError

VALUE eDHError