Ruby  1.9.3p392(2013-02-22revision39386)
Macros | Functions | Variables
ossl_pkey_dsa.c File Reference
#include "ossl.h"

Go to the source code of this file.

Macros

#define GetPKeyDSA(obj, pkey)
 
#define DSA_HAS_PRIVATE(dsa)   ((dsa)->priv_key)
 
#define DSA_PRIVATE(obj, dsa)   (DSA_HAS_PRIVATE(dsa)||OSSL_PKEY_IS_PRIVATE(obj))
 
#define ossl_dsa_buf_size(pkey)   (DSA_size((pkey)->pkey.dsa)+16)
 

Functions

static VALUE dsa_instance (VALUE klass, DSA *dsa)
 
VALUE ossl_dsa_new (EVP_PKEY *pkey)
 
static DSA * dsa_generate (int size)
 
static VALUE ossl_dsa_s_generate (VALUE klass, VALUE size)
 
static VALUE ossl_dsa_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_dsa_is_public (VALUE self)
 
static VALUE ossl_dsa_is_private (VALUE self)
 
static VALUE ossl_dsa_export (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_dsa_to_der (VALUE self)
 
static VALUE ossl_dsa_get_params (VALUE self)
 
static VALUE ossl_dsa_to_text (VALUE self)
 
static VALUE ossl_dsa_to_public_key (VALUE self)
 
static VALUE ossl_dsa_sign (VALUE self, VALUE data)
 
static VALUE ossl_dsa_verify (VALUE self, VALUE digest, VALUE sig)
 
void Init_ossl_dsa ()
 

Variables

VALUE cDSA
 
VALUE eDSAError
 

Macro Definition Documentation

#define DSA_HAS_PRIVATE (   dsa)    ((dsa)->priv_key)

Definition at line 22 of file ossl_pkey_dsa.c.

Referenced by ossl_dsa_export(), and ossl_dsa_to_der().

#define DSA_PRIVATE (   obj,
  dsa 
)    (DSA_HAS_PRIVATE(dsa)||OSSL_PKEY_IS_PRIVATE(obj))

Definition at line 23 of file ossl_pkey_dsa.c.

Referenced by ossl_dsa_is_private(), and ossl_dsa_sign().

#define GetPKeyDSA (   obj,
  pkey 
)
Value:
do { \
GetPKey((obj), (pkey)); \
if (EVP_PKEY_type((pkey)->type) != EVP_PKEY_DSA) { /* PARANOIA? */ \
ossl_raise(rb_eRuntimeError, "THIS IS NOT A DSA!"); \
} \
} while (0)

Definition at line 15 of file ossl_pkey_dsa.c.

Referenced by ossl_dsa_export(), ossl_dsa_get_params(), ossl_dsa_is_private(), ossl_dsa_is_public(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_dsa_to_public_key(), ossl_dsa_to_text(), and ossl_dsa_verify().

#define ossl_dsa_buf_size (   pkey)    (DSA_size((pkey)->pkey.dsa)+16)

Definition at line 406 of file ossl_pkey_dsa.c.

Referenced by ossl_dsa_sign().

Function Documentation

static DSA* dsa_generate ( int  size)
static

Definition at line 79 of file ossl_pkey_dsa.c.

References NULL, ossl_generate_cb(), and rb_block_given_p().

Referenced by ossl_dsa_initialize(), and ossl_dsa_s_generate().

static VALUE dsa_instance ( VALUE  klass,
DSA *  dsa 
)
static

Definition at line 35 of file ossl_pkey_dsa.c.

References Qfalse, and WrapPKey.

Referenced by ossl_dsa_new(), ossl_dsa_s_generate(), and ossl_dsa_to_public_key().

void Init_ossl_dsa ( void  )
static VALUE ossl_dsa_export ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE ossl_dsa_get_params ( VALUE  self)
static

Definition at line 325 of file ossl_pkey_dsa.c.

References GetPKeyDSA, hash(), ossl_bn_new(), rb_hash_aset(), rb_hash_new(), and rb_str_new2().

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_initialize ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE ossl_dsa_is_private ( VALUE  self)
static

Definition at line 223 of file ossl_pkey_dsa.c.

References DSA_PRIVATE, GetPKeyDSA, Qfalse, and Qtrue.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_is_public ( VALUE  self)
static

Definition at line 206 of file ossl_pkey_dsa.c.

References GetPKeyDSA, Qfalse, and Qtrue.

Referenced by Init_ossl_dsa().

VALUE ossl_dsa_new ( EVP_PKEY *  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().

static VALUE ossl_dsa_s_generate ( VALUE  klass,
VALUE  size 
)
static

Definition at line 114 of file ossl_pkey_dsa.c.

References dsa_generate(), dsa_instance(), eDSAError, NULL, NUM2INT, ossl_raise(), and Qfalse.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_sign ( VALUE  self,
VALUE  data 
)
static
static VALUE ossl_dsa_to_der ( VALUE  self)
static

Definition at line 292 of file ossl_pkey_dsa.c.

References _, DSA_HAS_PRIVATE, eDSAError, GetPKeyDSA, len, NULL, ossl_raise(), ossl_str_adjust, p, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_public_key ( VALUE  self)
static

Definition at line 389 of file ossl_pkey_dsa.c.

References CLASS_OF, dsa_instance(), DSAPublicKey_dup, eDSAError, GetPKeyDSA, NULL, ossl_raise(), and Qfalse.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_text ( VALUE  self)
static

Definition at line 352 of file ossl_pkey_dsa.c.

References eDSAError, GetPKeyDSA, NULL, ossl_membio2str(), and ossl_raise().

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_verify ( VALUE  self,
VALUE  digest,
VALUE  sig 
)
static

Definition at line 470 of file ossl_pkey_dsa.c.

References eDSAError, GetPKeyDSA, NULL, ossl_raise(), Qfalse, Qtrue, RSTRING_LENINT, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_dsa().

Variable Documentation

VALUE cDSA

Definition at line 28 of file ossl_pkey_dsa.c.

Referenced by Init_ossl_dsa(), and ossl_dsa_new().

VALUE eDSAError