Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Data Structures | Macros | Functions | Variables
ossl.c File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "ossl.h"
#include <stdarg.h>
#include <ruby/thread_native.h>
Include dependency graph for ossl.c:

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 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 23 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 71 of file ossl.c.

Function Documentation

◆ Init_openssl()

void Init_openssl ( void  )

◆ ossl_bin2hex()

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

Definition at line 139 of file ossl.c.

References assert, and LONG_MAX.

◆ ossl_buf2str()

VALUE ossl_buf2str ( char *  buf,
int  len 
)

Definition at line 126 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 310 of file ossl.c.

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

◆ ossl_get_errors()

VALUE ossl_get_errors ( VALUE  _)

Definition at line 347 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 183 of file ossl.c.

References len, and RTEST.

Referenced by ossl_pkey_export_traditional(), and ossl_pkey_read_generic().

◆ ossl_pem_passwd_value()

VALUE ossl_pem_passwd_value ( VALUE  pass)

Definition at line 157 of file ossl.c.

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

Referenced by ossl_pkey_export_traditional().

◆ ossl_raise()

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

◆ ossl_str_new()

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

Definition at line 107 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 250 of file ossl.c.

References rb_funcall().

◆ ossl_to_der_if_possible()

VALUE ossl_to_der_if_possible ( VALUE  obj)

Definition at line 261 of file ossl.c.

References rb_respond_to().

Variable Documentation

◆ dOSSL

VALUE dOSSL

Definition at line 363 of file ossl.c.

Referenced by ossl_clear_error().

◆ eOSSLError

VALUE eOSSLError

◆ mOSSL

VALUE mOSSL
if
if((ID)(DISPID) nameid !=nameid)
Definition: win32ole.c:357
Qnil
#define Qnil
Definition: special_consts.h:51
rb_ary_new2
#define rb_ary_new2
Definition: array.h:72
STACK_OF
STACK_OF(X509) *ossl_x509_ary2sk(VALUE)
t
#define t
Definition: symbol.c:253
rb_ary_new
VALUE rb_ary_new(void)
Definition: array.c:754
ruby::backward::cxxanyargs::type
VALUE type(ANYARGS)
ANYARGS-ed function type.
Definition: cxxanyargs.hpp:56
name
const char * name
Definition: nkf.c:208