Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Functions | Variables
ossl.h File Reference
`#include <ruby.h>`
`#include <ruby/io.h>`
`#include <ruby/thread.h>`
`#include <openssl/opensslv.h>`
`#include <errno.h>`
`#include <openssl/err.h>`
`#include <openssl/asn1_mac.h>`
`#include <openssl/x509v3.h>`
`#include <openssl/ssl.h>`
`#include <openssl/pkcs12.h>`
`#include <openssl/pkcs7.h>`
`#include <openssl/hmac.h>`
`#include <openssl/rand.h>`
`#include <openssl/conf.h>`
`#include <openssl/conf_api.h>`
`#include "openssl_missing.h"`
`#include "ruby_missing.h"`
`#include "ossl_asn1.h"`
`#include "ossl_bio.h"`
`#include "ossl_bn.h"`
`#include "ossl_cipher.h"`
`#include "ossl_config.h"`
`#include "ossl_digest.h"`
`#include "ossl_hmac.h"`
`#include "ossl_ns_spki.h"`
`#include "ossl_ocsp.h"`
`#include "ossl_pkcs12.h"`
`#include "ossl_pkcs7.h"`
`#include "ossl_pkcs5.h"`
`#include "ossl_pkey.h"`
`#include "ossl_rand.h"`
`#include "ossl_ssl.h"`
`#include "ossl_version.h"`
`#include "ossl_x509.h"`
`#include "ossl_engine.h"`
Include dependency graph for ossl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | ossl_verify_cb_args

## Macros
#define | assert(condition)
#define | OSSL_MIN_PWD_LEN 4
#define | OSSL_Check_Kind(obj, klass)
#define | OSSL_Check_Instance(obj, klass)
#define | OSSL_Check_Same_Class(obj1, obj2)
#define | ossl_str_adjust(str, p)
#define | OSSL_BIO_reset(bio)
#define | OSSL_ErrMsg() ERR_reason_error_string(ERR_get_error())
#define | OSSL_Debug ossl_debug
#define | OSSL_Warning rb_warning
#define | OSSL_Warn rb_warn

## Functions
int | string2hex (const unsigned char *, int, char **, int *)
| STACK_OF (X509)*ossl_x509_ary2sk0(VALUE)
int *VALUE | ossl_x509_sk2ary (STACK_OF(X509)*certs)
VALUE | ossl_x509crl_sk2ary (STACK_OF(X509_CRL)*crl)
VALUE | ossl_x509name_sk2ary (STACK_OF(X509_NAME)*names)
VALUE | ossl_buf2str (char *buf, int len)
int | ossl_pem_passwd_cb (char *, int, int, void *)
| NORETURN (void ossl_raise(VALUE, const char *,...))
VALUE | ossl_exc_new (VALUE, const char *,...)
VALUE | ossl_call_verify_cb_proc (struct ossl_verify_cb_args *)
int | ossl_verify_cb (int, X509_STORE_CTX *)
VALUE | ossl_to_der (VALUE)
VALUE | ossl_to_der_if_possible (VALUE)
void | ossl_debug (const char *,...)
void | Init_openssl (void)

## Variables
VALUE | mOSSL
VALUE | eOSSLError
int | ossl_verify_cb_idx
ID | ossl_s_to_der
VALUE | dOSSL

## Macro Definition Documentation

#define assert | ( |  | condition | ) |

Definition at line 45 of file ossl.h.

Referenced by aligned_malloc(), ary_make_partial(), ary_make_shared(), ary_resize_capa(), assign_heap_slot(), bigadd_core(), bigadd_int(), biglsh_bang(), bigmul0(), bigmul1_balance(), bigmul1_toom3(), bigrsh_bang(), bigsub_core(), c_gregorian_last_day_of_month(), c_gregorian_to_yday(), c_julian_last_day_of_month(), c_julian_to_yday(), canonicalize_c_jd(), canonicalize_s_jd(), d_complex_new_internal(), d_simple_new_internal(), decode_jd(), f_complex_new1(), f_complex_new2(), f_complex_new_bang1(), f_complex_new_bang2(), f_complex_polar(), f_rational_new1(), f_rational_new2(), f_rational_new_bang2(), f_rational_new_no_reduce1(), f_rational_new_no_reduce2(), get_c_civil(), get_c_df(), get_c_jd(), get_c_time(), get_s_civil(), get_s_jd(), guess_style(), Init_Complex(), Init_date_core(), Init_Rational(), local_df(), local_jd(), m_core_hash_from_ary(), m_core_hash_merge_ary(), nkf_buf_at(), nkf_buf_pop(), ossl_asn1prim_to_der(), ossl_cipher_final(), ossl_cipher_update(), ossl_pkey_sign(), pop_mark_stack_chunk(), push_mark_stack_chunk(), rb_ary_shift(), rb_ary_sort_bang(), rb_objspace_call_finalizer(), rb_str_new_frozen(), RUBY_ALIAS_FUNCTION(), set_of(), SHA256_End(), SHA256_Final(), SHA256_Update(), SHA384_End(), SHA384_Final(), SHA512_End(), SHA512_Final(), SHA512_Update(), slot_sweep(), str_replace(), VpCopy(), yaml_alias_event_initialize(), yaml_document_add_mapping(), yaml_document_add_scalar(), yaml_document_add_sequence(), yaml_document_append_mapping_pair(), yaml_document_append_sequence_item(), yaml_document_delete(), yaml_document_end_event_initialize(), yaml_document_get_node(), yaml_document_get_root_node(), yaml_document_initialize(), yaml_document_start_event_initialize(), yaml_emitter_close(), yaml_emitter_delete(), yaml_emitter_dump(), yaml_emitter_dump_node(), yaml_emitter_flush(), yaml_emitter_initialize(), yaml_emitter_open(), yaml_emitter_process_scalar(), yaml_emitter_set_break(), yaml_emitter_set_canonical(), yaml_emitter_set_encoding(), yaml_emitter_set_indent(), yaml_emitter_set_output(), yaml_emitter_set_output_file(), yaml_emitter_set_output_string(), yaml_emitter_set_unicode(), yaml_emitter_set_width(), yaml_emitter_state_machine(), yaml_event_delete(), yaml_mapping_end_event_initialize(), yaml_mapping_start_event_initialize(), yaml_parser_delete(), yaml_parser_initialize(), yaml_parser_load(), yaml_parser_load_document(), yaml_parser_load_node(), yaml_parser_parse(), yaml_parser_save_simple_key(), yaml_parser_scan(), yaml_parser_set_encoding(), yaml_parser_set_input(), yaml_parser_set_input_file(), yaml_parser_set_input_string(), yaml_parser_state_machine(), yaml_parser_update_buffer(), yaml_scalar_event_initialize(), yaml_sequence_end_event_initialize(), yaml_sequence_start_event_initialize(), yaml_stream_end_event_initialize(), yaml_stream_start_event_initialize(), and yaml_token_delete().

#define OSSL_BIO_reset | ( |  | bio | ) |

Value:
(void)BIO_reset((bio)); \
ERR_clear_error();
void
VP_EXPORT void
Definition: bigdecimal.c:5083

Definition at line 155 of file ossl.h.

Referenced by ossl_dh_initialize(), ossl_dsa_initialize(), ossl_pkcs7_initialize(), ossl_pkey_new_from_data(), ossl_rsa_initialize(), ossl_ssl_session_initialize(), ossl_x509_initialize(), ossl_x509crl_initialize(), and ossl_x509req_initialize().

#define OSSL_Check_Instance | ( |  | obj,
|  |  | klass
| ) |  |

Value:
do {\
if (!rb_obj_is_instance_of((obj), (klass))) {\
ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected instance of %s)",\
rb_obj_classname(obj), rb_class2name(klass));\
}\
} while (0)
rb_obj_classname
const char * rb_obj_classname(VALUE)
Definition: variable.c:396
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:511
rb_obj_is_instance_of
VALUE rb_obj_is_instance_of(VALUE, VALUE)
Definition: object.c:545
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
rb_class2name
const char * rb_class2name(VALUE)
Definition: variable.c:389
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
klass
klass
Definition: tcltklib.c:3504
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

Definition at line 103 of file ossl.h.

#define OSSL_Check_Kind | ( |  | obj,
|  |  | klass
| ) |  |

Value:
do {\
if (!rb_obj_is_kind_of((obj), (klass))) {\
ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected kind of %s)",\
rb_obj_classname(obj), rb_class2name(klass));\
}\
} while (0)
rb_obj_classname
const char * rb_obj_classname(VALUE)
Definition: variable.c:396
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:511
obj
static VALUE VALUE obj
Definition: tcltklib.c:3158
rb_class2name
const char * rb_class2name(VALUE)
Definition: variable.c:389
rb_obj_is_kind_of
VALUE rb_obj_is_kind_of(VALUE, VALUE)
Definition: object.c:582
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
klass
klass
Definition: tcltklib.c:3504
ossl_raise
void ossl_raise(VALUE exc, const char *fmt,...)
Definition: ossl.c:328

Definition at line 96 of file ossl.h.

Referenced by GetConfigPtr(), ossl_ssl_initialize(), ossl_x509_set_extensions(), ossl_x509crl_set_extensions(), ossl_x509crl_set_revoked(), ossl_x509req_set_attributes(), ossl_x509revoked_set_extensions(), and ossl_x509stctx_clear_ptr().

#define OSSL_Check_Same_Class | ( |  | obj1,
|  |  | obj2
| ) |  |

Value:
do {\
if (!rb_obj_is_instance_of((obj1), rb_obj_class(obj2))) {\
ossl_raise(rb_eTypeError, "wrong argument type");\
}\
} while (0)
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:511
rb_obj_class
VALUE rb_obj_class(VALUE)
Definition: object.c:194
rb_obj_is_instance_of
VALUE rb_obj_is_instance_of(VALUE, VALUE)
Definition: object.c:545
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 110 of file ossl.h.

#define OSSL_Debug ossl_debug

Definition at line 211 of file ossl.h.

Referenced by hmac_final(), ossl_pkcs7_get_signer(), ossl_spki_get_challenge(), ossl_sslctx_session_get_cb(), ossl_sslctx_session_new_cb(), ossl_sslctx_session_remove_cb(), ossl_sslctx_setup(), ossl_x509crl_get_extensions(), ossl_x509crl_get_revoked(), ossl_x509name_to_a(), ossl_x509req_get_attributes(), ossl_x509revoked_get_extensions(), and ossl_x509stctx_get_chain().

#define OSSL_ErrMsg | ( |  | ) | ERR_reason_error_string(ERR_get_error())

Definition at line 161 of file ossl.h.

Referenced by ossl_x509_check_private_key().

#define OSSL_MIN_PWD_LEN 4

Definition at line 81 of file ossl.h.

Referenced by ossl_dsa_export(), and ossl_rsa_export().

#define ossl_str_adjust | ( |  | str,
|  |  | p
| ) |  |

Value:
do{\
int len = RSTRING_LENINT(str);\
int newlen = rb_long2int((p) - (unsigned char*)RSTRING_PTR(str));\
assert(newlen <= len);\
rb_str_set_len((str), newlen);\
}while(0)
int
VP_EXPORT int
Definition: bigdecimal.c:5050
p
Win32OLEIDispatch * p
Definition: win32ole.c:786
RSTRING_PTR
#define RSTRING_PTR(str)
str
static VALUE char * str
Definition: tcltklib.c:3547
rb_long2int
#define rb_long2int(n)
RSTRING_LENINT
#define RSTRING_LENINT(str)
assert
#define assert(condition)
Definition: ossl.h:45
len
size_t len
Definition: tcltklib.c:3568
rb_str_set_len
void rb_str_set_len(VALUE, long)
Definition: string.c:1837

Definition at line 138 of file ossl.h.

Referenced by ossl_asn1cons_to_der(), ossl_asn1data_to_der(), ossl_dh_to_der(), ossl_dsa_to_der(), ossl_pkcs12_to_der(), ossl_pkcs7_to_der(), ossl_rsa_to_der(), ossl_spki_to_der(), ossl_ssl_session_to_der(), ossl_x509_to_der(), ossl_x509attr_get_value(), ossl_x509ext_to_der(), ossl_x509name_to_der(), and ossl_x509req_to_der().

#define OSSL_Warn rb_warn

Definition at line 213 of file ossl.h.

#define OSSL_Warning rb_warning

Definition at line 212 of file ossl.h.

Referenced by ossl_x509_check_private_key().

## Function Documentation

void Init_openssl | ( | void |  | ) |

Definition at line 943 of file ossl.c.

References Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_digest(), Init_ossl_engine(), Init_ossl_hmac(), Init_ossl_ns_spki(), Init_ossl_ocsp(), Init_ossl_pkcs12(), Init_ossl_pkcs5(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_ssl(), Init_ossl_x509(), INT2NUM, ossl_debug_get(), ossl_debug_set(), ossl_fips_mode_set(), ossl_get_errors(), ossl_raise(), OSSL_VERSION, Qfalse, Qtrue, rb_define_class_under(), rb_define_const(), rb_define_module(), rb_define_module_function(), rb_eStandardError, rb_intern, and rb_str_new2.

NORETURN | ( | void | ossl_raiseVALUE, const char *,... | ) |

VALUE ossl_buf2str | ( | char * | buf,
|  | int | len
| ) |  |

Definition at line 134 of file ossl.c.

References _, memcpy(), NIL_P(), ossl_str_new(), rb_jump_tag(), rb_protect(), RSTRING_PTR, status, and str.

Referenced by ossl_asn1prim_to_der(), ossl_bn_to_s(), ossl_hmac_digest(), ossl_hmac_hexdigest(), ossl_hmac_s_hexdigest(), and ossl_spki_to_pem().

VALUE ossl_call_verify_cb_proc | ( | struct ossl_verify_cb_args * |  | ) |

Definition at line 204 of file ossl.c.

References ossl_verify_cb_args::preverify_ok, ossl_verify_cb_args::proc, rb_funcall(), rb_intern, and ossl_verify_cb_args::store_ctx.

Referenced by ossl_verify_cb().

void ossl_debug | ( | const char * | ,
|  |  | ...
| ) |  |

Definition at line 378 of file ossl.c.

References args, Qtrue, and va_end().

VALUE ossl_exc_new | ( | VALUE | ,
|  | const char * | ,
|  |  | ...
| ) |  |

Definition at line 339 of file ossl.c.

References args, err, ossl_make_error(), and va_end().

Referenced by read_would_block(), and write_would_block().

int ossl_pem_passwd_cb | ( | char * | ,
|  | int | ,
|  | int | ,
|  | void * |
| ) |  |

Definition at line 162 of file ossl.c.

References len, memcpy(), ossl_pem_passwd_cb0(), PEM_def_callback(), Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_protect(), rb_set_errinfo(), rb_warning(), RSTRING_LENINT, RSTRING_PTR, and status.

Referenced by ossl_dsa_export(), ossl_dsa_initialize(), ossl_pkey_new_from_data(), ossl_pkey_new_from_file(), ossl_rsa_export(), and ossl_rsa_initialize().

VALUE ossl_to_der | ( | VALUE |  | ) |

Definition at line 272 of file ossl.c.

References rb_funcall(), StringValue, and tmp.

Referenced by obj_to_asn1derstr(), and ossl_to_der_if_possible().

VALUE ossl_to_der_if_possible | ( | VALUE |  | ) |

Definition at line 283 of file ossl.c.

References obj, ossl_to_der(), and rb_respond_to().

Referenced by join_der_i(), ossl_asn1_decode(), ossl_asn1_decode_all(), ossl_asn1_traverse(), ossl_dh_initialize(), ossl_dsa_initialize(), ossl_pkcs7_initialize(), ossl_rsa_initialize(), ossl_x509_initialize(), ossl_x509attr_initialize(), ossl_x509crl_initialize(), ossl_x509ext_initialize(), ossl_x509ext_set_value(), ossl_x509name_initialize(), and ossl_x509req_initialize().

int ossl_verify_cb | ( | int | ,
|  | X509_STORE_CTX * |
| ) |  |

Definition at line 211 of file ossl.c.

References NIL_P(), ossl_call_verify_cb_proc(), ossl_x509stctx_clear_ptr(), ossl_x509stctx_new(), ossl_verify_cb_args::preverify_ok, ossl_verify_cb_args::proc, proc, Qfalse, Qnil, Qtrue, rb_protect(), rb_set_errinfo(), rb_warn(), ret, state, ossl_verify_cb_args::store_ctx, and X509_STORE_get_ex_data().

Referenced by ossl_ssl_verify_callback(), and ossl_x509store_initialize().

int* VALUE ossl_x509_sk2ary | ( | STACK_OF(X509)* | certs | ) |

Referenced by ossl_pkcs12_initialize(), and ossl_pkcs7_get_certificates().

VALUE ossl_x509crl_sk2ary | ( | STACK_OF(X509_CRL)* | crl | ) |

Referenced by ossl_pkcs7_get_crls().

VALUE ossl_x509name_sk2ary | ( | STACK_OF(X509_NAME)* | names | ) |

Referenced by ossl_ssl_get_client_ca_list().

STACK_OF | ( | X509 |  | ) |

Referenced by ossl_pkcs12_initialize(), ossl_pkcs12_s_create(), ossl_pkcs7_get_recipient(), ossl_pkcs7_get_signer(), ossl_pkcs7_s_encrypt(), ossl_pkcs7_s_sign(), ossl_pkcs7_set_certificates(), ossl_pkcs7_set_crls(), ossl_pkcs7_verify(), ossl_ssl_get_client_ca_list(), ossl_ssl_get_peer_cert_chain(), ossl_sslctx_get_ciphers(), ossl_x509stctx_get_chain(), ossl_x509stctx_initialize(), and STACK_OF().

int string2hex | ( | const unsigned char * | ,
|  | int | ,
|  | char ** | ,
|  | int * |
| ) |  |

Definition at line 18 of file ossl.c.

References i, and len.

Referenced by ossl_hmac_hexdigest(), and ossl_hmac_s_hexdigest().

## Variable Documentation

VALUE dOSSL

Definition at line 374 of file ossl.c.

Referenced by ossl_debug_get(), ossl_debug_set(), and ossl_make_error().

VALUE eOSSLError

Definition at line 264 of file ossl.c.

Referenced by asn1integer_to_num(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_digest(), Init_ossl_hmac(), Init_ossl_ns_spki(), Init_ossl_pkcs12(), Init_ossl_pkcs5(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509name(), Init_ossl_x509req(), Init_ossl_x509revoked(), Init_ossl_x509store(), num_to_asn1integer(), ossl_dsa_export(), ossl_obj2bio(), and ossl_rsa_export().

VALUE mOSSL

Definition at line 259 of file ossl.c.

Referenced by Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_dh(), Init_ossl_digest(), Init_ossl_dsa(), Init_ossl_hmac(), Init_ossl_ns_spki(), Init_ossl_pkcs12(), Init_ossl_pkcs5(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509(), Init_ossl_x509cert(), and Init_ossl_x509store().

ID ossl_s_to_der

Definition at line 269 of file ossl.c.

int ossl_verify_cb_idx

Definition at line 201 of file ossl.c.

Referenced by ossl_ssl_verify_callback(), ossl_x509stctx_verify(), and ossl_x509store_set_vfy_cb().