Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Macros | Functions | Variables
ossl_pkey_dsa.c File Reference
`#include "ossl.h"`
Include dependency graph for ossl_pkey_dsa.c:

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)
GetPKey
#define GetPKey(obj, pkey)
Definition: ossl_pkey.h:30
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:510
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
type
int type
Definition: tcltklib.c:111
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

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 469 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 memset(), NULL, ossl_generate_cb(), rb_block_given_p(), rb_jump_tag(), rb_thread_call_without_gvl(), and size.

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 obj, Qfalse, 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 564 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(), p, q, 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 308 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(), out, rb_scan_args(), RSTRING_LENINT, RSTRING_PTR, str, and StringValue.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_get_params | ( | VALUE | self | ) |
| static

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

Definition at line 206 of file ossl_pkey_dsa.c.

References arg, dsa_generate(), eDSAError, FIX2INT, FIXNUM_P, GetPKey, in, 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(), and StringValuePtr.

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, obj, 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 174 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

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

Definition at line 491 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, str, and StringValue.

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_der | ( | VALUE | self | ) |
| static

Definition at line 355 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_public_key | ( | VALUE | self | ) |
| static

Definition at line 452 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

static VALUE ossl_dsa_to_text | ( | VALUE | self | ) |
| static

Definition at line 415 of file ossl_pkey_dsa.c.

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

Referenced by Init_ossl_dsa().

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

Definition at line 533 of file ossl_pkey_dsa.c.

References eDSAError, GetPKeyDSA, NULL, ossl_raise(), Qfalse, Qtrue, ret, 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().