Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

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

Go to the source code of this file.

## Macros
#define | GetDigest(obj, ctx)
#define | SafeGetDigest(obj, ctx)

## Functions
static VALUE | ossl_digest_alloc (VALUE klass)
const EVP_MD * | GetDigestPtr (VALUE obj)
VALUE | ossl_digest_new (const EVP_MD *md)
VALUE | ossl_digest_update (VALUE, VALUE)
static VALUE | ossl_digest_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_digest_copy (VALUE self, VALUE other)
static VALUE | ossl_digest_reset (VALUE self)
static VALUE | ossl_digest_finish (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_digest_name (VALUE self)
static VALUE | ossl_digest_size (VALUE self)
static VALUE | ossl_digest_block_length (VALUE self)
void | Init_ossl_digest ()

## Variables
VALUE | cDigest
VALUE | eDigestError

## Macro Definition Documentation

#define GetDigest | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
Data_Get_Struct((obj), EVP_MD_CTX, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "Digest CTX wasn't initialized!"); \
} \
} while (0)
rb_eRuntimeError
VALUE rb_eRuntimeError
Definition: error.c:510
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
Data_Get_Struct
#define Data_Get_Struct(obj, type, sval)
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

Definition at line 13 of file ossl_digest.c.

Referenced by ossl_digest_block_length(), ossl_digest_copy(), ossl_digest_finish(), ossl_digest_initialize(), ossl_digest_name(), ossl_digest_new(), ossl_digest_reset(), ossl_digest_size(), and ossl_digest_update().

#define SafeGetDigest | ( |  | obj,
|  |  | ctx
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cDigest); \
GetDigest((obj), (ctx)); \
} while (0)
cDigest
VALUE cDigest
Definition: ossl_digest.c:27
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
OSSL_Check_Kind
#define OSSL_Check_Kind(obj, klass)
Definition: ossl.h:96
GetDigest
#define GetDigest(obj, ctx)
Definition: ossl_digest.c:13

Definition at line 19 of file ossl_digest.c.

Referenced by GetDigestPtr(), and ossl_digest_copy().

## Function Documentation

const EVP_MD* GetDigestPtr | ( | VALUE | obj | ) |

Definition at line 36 of file ossl_digest.c.

References name, NULL, ossl_raise(), rb_eRuntimeError, SafeGetDigest, StringValueCStr, T_STRING, and TYPE.

Referenced by ossl_cipher_pkcs5_keyivgen(), ossl_digest_initialize(), ossl_hmac_initialize(), ossl_hmac_s_digest(), ossl_hmac_s_hexdigest(), ossl_pkcs7si_initialize(), ossl_pkey_sign(), ossl_pkey_verify(), ossl_spki_sign(), ossl_x509_sign(), ossl_x509crl_sign(), and ossl_x509req_sign().

void Init_ossl_digest | ( | void |  | ) |

Definition at line 297 of file ossl_digest.c.

References cDigest, eDigestError, eOSSLError, mOSSL, ossl_digest_alloc(), ossl_digest_block_length(), ossl_digest_copy(), ossl_digest_finish(), ossl_digest_initialize(), ossl_digest_name(), ossl_digest_reset(), ossl_digest_size(), ossl_digest_update(), rb_define_alias(), rb_define_alloc_func(), rb_define_class_under(), rb_define_copy_func, rb_define_method(), rb_define_module(), rb_define_private_method(), rb_path2class(), and rb_require().

Referenced by Init_openssl().

static VALUE ossl_digest_alloc | ( | VALUE | klass | ) |
| static

Definition at line 82 of file ossl_digest.c.

References Data_Wrap_Struct(), EVP_MD_CTX_create(), EVP_MD_CTX_destroy(), NULL, obj, ossl_raise(), and rb_eRuntimeError.

Referenced by Init_ossl_digest(), and ossl_digest_new().

static VALUE ossl_digest_block_length | ( | VALUE | self | ) |
| static

Definition at line 284 of file ossl_digest.c.

References GetDigest, and INT2NUM.

Referenced by Init_ossl_digest().

static VALUE ossl_digest_copy | ( | VALUE | self,
|  | VALUE | other
| ) |  |
| static

Definition at line 136 of file ossl_digest.c.

References eDigestError, GetDigest, NULL, ossl_raise(), rb_check_frozen, and SafeGetDigest.

Referenced by Init_ossl_digest().

static VALUE ossl_digest_finish | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 206 of file ossl_digest.c.

References EVP_DigestFinal_ex, GetDigest, NIL_P(), NULL, rb_scan_args(), rb_str_new(), rb_str_resize(), RSTRING_PTR, str, and StringValue.

Referenced by Init_ossl_digest().

static VALUE ossl_digest_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |
| static

Definition at line 116 of file ossl_digest.c.

References data, eDigestError, EVP_DigestInit_ex, GetDigest, GetDigestPtr(), NIL_P(), NULL, ossl_digest_update(), ossl_raise(), rb_scan_args(), StringValue, and type.

Referenced by Init_ossl_digest().

static VALUE ossl_digest_name | ( | VALUE | self | ) |
| static

Definition at line 239 of file ossl_digest.c.

References EVP_MD_name, GetDigest, and rb_str_new2.

Referenced by Init_ossl_digest().

VALUE ossl_digest_new | ( | const EVP_MD * | md | ) |

Definition at line 64 of file ossl_digest.c.

References cDigest, eDigestError, EVP_DigestInit_ex, GetDigest, NULL, ossl_digest_alloc(), ossl_raise(), and ret.

static VALUE ossl_digest_reset | ( | VALUE | self | ) |
| static

Definition at line 161 of file ossl_digest.c.

References eDigestError, EVP_DigestInit_ex, GetDigest, NULL, and ossl_raise().

Referenced by Init_ossl_digest().

static VALUE ossl_digest_size | ( | VALUE | self | ) |
| static

Definition at line 261 of file ossl_digest.c.

References GetDigest, and INT2NUM.

Referenced by Init_ossl_digest().

VALUE ossl_digest_update | ( | VALUE | self,
|  | VALUE | data
| ) |  |

Definition at line 189 of file ossl_digest.c.

References GetDigest, RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_digest(), and ossl_digest_initialize().

## Variable Documentation

VALUE cDigest

Definition at line 27 of file ossl_digest.c.

Referenced by Init_ossl_digest(), and ossl_digest_new().

VALUE eDigestError

Definition at line 28 of file ossl_digest.c.

Referenced by Init_ossl_digest(), ossl_digest_copy(), ossl_digest_initialize(), ossl_digest_new(), and ossl_digest_reset().