Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Functions | Variables
ossl.c File Reference
`#include "ossl.h"`
`#include <stdarg.h>`
`#include <ruby/thread_native.h>`

Go to the source code of this file.

## Data Structures
struct | CRYPTO_dynlock_value
| Stores locks needed for OpenSSL thread safety. More...

## Macros
#define | OSSL_IMPL_ARY2SK(name, type, expected_class, dup)
#define | OSSL_IMPL_SK2ARY(name, type)

## Functions
VALUE | ossl_str_new (const char *ptr, long len, int *pstate)
VALUE | ossl_buf2str (char *buf, int len)
void | ossl_bin2hex (unsigned char *in, char *out, size_t inlen)
VALUE | ossl_pem_passwd_value (VALUE pass)
int | ossl_pem_passwd_cb (char *buf, int max_len, int flag, void *pwd_)
VALUE | ossl_to_der (VALUE obj)
VALUE | ossl_to_der_if_possible (VALUE obj)
void | ossl_raise (VALUE exc, const char *fmt,...)
void | ossl_clear_error (void)
VALUE | ossl_get_errors (VALUE _)
void | ossl_debug (const char *fmt,...)
void | Init_openssl (void)

## Variables
VALUE | mOSSL
VALUE | eOSSLError
VALUE | dOSSL

## Macro Definition Documentation

## ◆ OSSL_IMPL_ARY2SK

#define OSSL_IMPL_ARY2SK | ( |  | name,
|  |  | type,
|  |  | expected_class,
|  |  | dup
| ) |  |

Definition at line 17 of file ossl.c.

## ◆ OSSL_IMPL_SK2ARY

#define OSSL_IMPL_SK2ARY | ( |  | name,
|  |  | type
| ) |  |

Value:
VALUE \
ossl_##name##_sk2ary(const STACK_OF(type) *sk) \
{ \
type *t; \
int i, num; \
VALUE ary; \
\
if (!sk) { \
OSSL_Debug("empty sk!"); \
return Qnil; \
} \
num = sk_##type##_num(sk); \
if (num < 0) { \
OSSL_Debug("items in sk < -1???"); \
return rb_ary_new(); \
} \
ary = rb_ary_new2(num); \
\
for (i=0; i<num; i++) { \
t = sk_##type##_value(sk, i); \
rb_ary_push(ary, ossl_##name##_new(t)); \
} \
return ary; \
}

Definition at line 65 of file ossl.c.

## Function Documentation

## ◆ Init_openssl()

void Init_openssl | ( | void |  | ) |

Definition at line 1100 of file ossl.c.

References INT2NUM, mOSSL, NULL, OSSL_VERSION, Qfalse, Qtrue, rb_define_const(), rb_define_module(), rb_define_module_function(), rb_eRuntimeError, rb_global_variable(), rb_raise(), rb_str_new2, and tzset().

## ◆ ossl_bin2hex()

void ossl_bin2hex | ( | unsigned char * | in,
|  | char * | out,
|  | size_t | inlen
| ) |  |

Definition at line 133 of file ossl.c.

References assert, i, and LONG_MAX.

## ◆ ossl_buf2str()

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

Definition at line 120 of file ossl.c.

References buf, len, ossl_str_new(), rb_jump_tag(), and str.

## ◆ ossl_clear_error()

void ossl_clear_error | ( | void |  | ) |

Definition at line 304 of file ossl.c.

References dOSSL, NULL, Qtrue, and rb_warn().

## ◆ ossl_debug()

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

Definition at line 361 of file ossl.c.

References dOSSL, fmt, fprintf(), Qtrue, stderr, va_end, va_start, and vfprintf().

## ◆ ossl_get_errors()

VALUE ossl_get_errors | ( | VALUE | _ | ) |

Definition at line 341 of file ossl.c.

References NULL, rb_ary_new(), rb_ary_push(), and rb_str_new2.

## ◆ ossl_pem_passwd_cb()

int ossl_pem_passwd_cb | ( | char * | buf,
|  | int | max_len,
|  | int | flag,
|  | void * | pwd_
| ) |  |

Definition at line 177 of file ossl.c.

References buf, len, memcpy(), NULL, OSSL_Debug, Qfalse, Qtrue, rb_block_given_p(), rb_protect(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, RTEST, and T_STRING.

## ◆ ossl_pem_passwd_value()

VALUE ossl_pem_passwd_value | ( | VALUE | pass | ) |

Definition at line 151 of file ossl.c.

References eOSSLError, NIL_P, ossl_raise(), Qnil, RSTRING_LEN, and StringValue().

## ◆ ossl_raise()

void ossl_raise | ( | VALUE | exc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 293 of file ossl.c.

References err, fmt, and va_start.

Referenced by asn1integer_to_num(), asn1time_to_time(), BIGNUM_1c(), DupConfigPtr(), DupX509RevokedPtr(), Init_ossl_bn(), num_to_asn1integer(), ossl_bn_new(), ossl_digest_update(), ossl_evp_get_cipherbyname(), ossl_evp_get_digestbyname(), ossl_obj2bio(), ossl_pem_passwd_value(), ossl_pkey_check_public_key(), ossl_x509_new(), ossl_x509attr_new(), ossl_x509crl_new(), ossl_x509ext_new(), ossl_x509name_new(), and ossl_x509revoked_new().

## ◆ ossl_str_new()

VALUE ossl_str_new | ( | const char * | ptr,
|  | long | len,
|  | int * | pstate
| ) |  |

Definition at line 101 of file ossl.c.

References rb_protect(), and str.

Referenced by ossl_buf2str(), and ossl_membio2str().

## ◆ ossl_to_der()

VALUE ossl_to_der | ( | VALUE | obj | ) |

Definition at line 244 of file ossl.c.

References obj, and rb_funcall.

## ◆ ossl_to_der_if_possible()

VALUE ossl_to_der_if_possible | ( | VALUE | obj | ) |

Definition at line 255 of file ossl.c.

References obj, and rb_respond_to().

## Variable Documentation

## ◆ dOSSL

VALUE dOSSL

Definition at line 357 of file ossl.c.

Referenced by ossl_clear_error(), and ossl_debug().

## ◆ eOSSLError

VALUE eOSSLError

Definition at line 236 of file ossl.c.

Referenced by asn1integer_to_num(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_dh(), Init_ossl_digest(), Init_ossl_dsa(), Init_ossl_ec(), Init_ossl_engine(), Init_ossl_hmac(), Init_ossl_kdf(), Init_ossl_ns_spki(), Init_ossl_ocsp(), Init_ossl_pkcs12(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509req(), Init_ossl_x509revoked(), Init_ossl_x509store(), num_to_asn1integer(), ossl_obj2bio(), and ossl_pem_passwd_value().

## ◆ mOSSL

VALUE mOSSL

Definition at line 231 of file ossl.c.

Referenced by Init_openssl(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_dh(), Init_ossl_digest(), Init_ossl_dsa(), Init_ossl_ec(), Init_ossl_engine(), Init_ossl_hmac(), Init_ossl_kdf(), Init_ossl_ns_spki(), Init_ossl_ocsp(), Init_ossl_pkcs12(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509req(), Init_ossl_x509revoked(), and Init_ossl_x509store().

if
if((ID)(DISPID) nameid !=nameid)
Definition: win32ole.c:357
i
uint32_t i
Definition: rb_mjit_min_header-2.7.0.h:5464
rb_ary_new2
#define rb_ary_new2
Definition: intern.h:103
STACK_OF
STACK_OF(X509) *ossl_x509_ary2sk(VALUE)
rb_ary_new
VALUE rb_ary_new(void)
Definition: array.c:723
Qnil
#define Qnil
Definition: ruby.h:469
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:39
name
const char * name
Definition: nkf.c:208