ext/openssl/ossl_pkey_dsa.c File Reference

#include "ossl.h"

Go to the source code of this file.

Defines

#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


Define 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 471 of file ossl_pkey_dsa.c.

Referenced by ossl_dsa_sign().


Function Documentation

static DSA* dsa_generate ( int  size  )  [static]

Definition at line 100 of file ossl_pkey_dsa.c.

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

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, VALUE, and WrapPKey.

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

void Init_ossl_dsa ( void   ) 

Definition at line 566 of file ossl_pkey_dsa.c.

References cDSA, cPKey, DEF_OSSL_PKEY_BN, eDSAError, ePKeyError, mOSSL, mPKey, ossl_dsa_export(), ossl_dsa_get_params(), ossl_dsa_initialize(), ossl_dsa_is_private(), ossl_dsa_is_public(), ossl_dsa_s_generate(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_dsa_to_public_key(), ossl_dsa_to_text(), ossl_dsa_verify(), rb_define_alias(), rb_define_class_under(), rb_define_method(), rb_define_module(), rb_define_module_under(), and rb_define_singleton_method().

Referenced by Init_ossl_pkey().

static VALUE ossl_dsa_export ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 310 of file ossl_pkey_dsa.c.

References DSA_HAS_PRIVATE, eDSAError, eOSSLError, GetCipherPtr(), GetPKeyDSA, NIL_P, NULL, ossl_membio2str(), OSSL_MIN_PWD_LEN, ossl_pem_passwd_cb(), ossl_raise(), rb_scan_args(), RSTRING_LENINT, RSTRING_PTR, StringValue, and VALUE.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_get_params ( VALUE  self  )  [static]

Definition at line 390 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_initialize ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 206 of file ossl_pkey_dsa.c.

References dsa_generate(), eDSAError, FIX2INT, FIXNUM_P, GetPKey, NIL_P, NULL, OSSL_BIO_reset, ossl_obj2bio(), ossl_pem_passwd_cb(), ossl_raise(), ossl_to_der_if_possible(), PEM_read_bio_DSAPublicKey, rb_scan_args(), StringValuePtr, and VALUE.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_is_private ( VALUE  self  )  [static]

Definition at line 283 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 266 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, VALUE, and WrapPKey.

Referenced by ossl_pkey_new().

static VALUE ossl_dsa_s_generate ( VALUE  klass,
VALUE  size 
) [static]

Definition at line 174 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_sign ( VALUE  self,
VALUE  data 
) [static]

Definition at line 493 of file ossl_pkey_dsa.c.

References DSA_PRIVATE, eDSAError, GetPKeyDSA, NULL, ossl_dsa_buf_size, ossl_raise(), rb_str_new(), rb_str_set_len(), RSTRING_LENINT, RSTRING_PTR, StringValue, and VALUE.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_der ( VALUE  self  )  [static]

Definition at line 357 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_public_key ( VALUE  self  )  [static]

Definition at line 454 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_text ( VALUE  self  )  [static]

Definition at line 417 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

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

Definition at line 535 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

Definition at line 29 of file ossl_pkey_dsa.c.

Referenced by Init_ossl_dsa(), ossl_dsa_export(), ossl_dsa_initialize(), ossl_dsa_new(), ossl_dsa_s_generate(), ossl_dsa_sign(), ossl_dsa_to_der(), ossl_dsa_to_public_key(), ossl_dsa_to_text(), and ossl_dsa_verify().


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7