Ruby  2.4.2p198(2017-09-14revision59899)
Data Structures | Macros | Functions | Variables
ossl_x509store.c File Reference
#include "ossl.h"
Include dependency graph for ossl_x509store.c:

Go to the source code of this file.

Data Structures

struct  ossl_verify_cb_args
 

Macros

#define NewX509Store(klass)   TypedData_Wrap_Struct((klass), &ossl_x509store_type, 0)
 
#define SetX509Store(obj, st)
 
#define GetX509Store(obj, st)
 
#define SafeGetX509Store(obj, st)
 
#define NewX509StCtx(klass)   TypedData_Wrap_Struct((klass), &ossl_x509stctx_type, 0)
 
#define SetX509StCtx(obj, ctx)
 
#define GetX509StCtx(obj, ctx)
 
#define SafeGetX509StCtx(obj, storep)
 

Functions

static VALUE ossl_x509stctx_new (X509_STORE_CTX *)
 
static VALUE call_verify_cb_proc (struct ossl_verify_cb_args *args)
 
int ossl_verify_cb_call (VALUE proc, int ok, X509_STORE_CTX *ctx)
 
static void ossl_x509store_free (void *ptr)
 
VALUE ossl_x509store_new (X509_STORE *store)
 
X509_STORE * GetX509StorePtr (VALUE obj)
 
X509_STORE * DupX509StorePtr (VALUE obj)
 
static int x509store_verify_cb (int ok, X509_STORE_CTX *ctx)
 
static VALUE ossl_x509store_alloc (VALUE klass)
 
static VALUE ossl_x509store_set_vfy_cb (VALUE self, VALUE cb)
 
static VALUE ossl_x509store_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_x509store_set_flags (VALUE self, VALUE flags)
 
static VALUE ossl_x509store_set_purpose (VALUE self, VALUE purpose)
 
static VALUE ossl_x509store_set_trust (VALUE self, VALUE trust)
 
static VALUE ossl_x509store_set_time (VALUE self, VALUE time)
 
static VALUE ossl_x509store_add_file (VALUE self, VALUE file)
 
static VALUE ossl_x509store_add_path (VALUE self, VALUE dir)
 
static VALUE ossl_x509store_set_default_paths (VALUE self)
 
static VALUE ossl_x509store_add_cert (VALUE self, VALUE arg)
 
static VALUE ossl_x509store_add_crl (VALUE self, VALUE arg)
 
static VALUE ossl_x509stctx_get_err (VALUE)
 
static VALUE ossl_x509stctx_get_err_string (VALUE)
 
static VALUE ossl_x509stctx_get_chain (VALUE)
 
static VALUE ossl_x509store_verify (int argc, VALUE *argv, VALUE self)
 
static void ossl_x509stctx_free (void *)
 
static VALUE ossl_x509stctx_alloc (VALUE klass)
 
static VALUE ossl_x509stctx_set_flags (VALUE, VALUE)
 
static VALUE ossl_x509stctx_set_purpose (VALUE, VALUE)
 
static VALUE ossl_x509stctx_set_trust (VALUE, VALUE)
 
static VALUE ossl_x509stctx_set_time (VALUE, VALUE)
 
static VALUE ossl_x509stctx_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_x509stctx_verify (VALUE self)
 
static VALUE ossl_x509stctx_set_error (VALUE self, VALUE err)
 
static VALUE ossl_x509stctx_get_err_depth (VALUE self)
 
static VALUE ossl_x509stctx_get_curr_cert (VALUE self)
 
static VALUE ossl_x509stctx_get_curr_crl (VALUE self)
 
void Init_ossl_x509store (void)
 

Variables

static int stctx_ex_verify_cb_idx
 
static int store_ex_verify_cb_idx
 
VALUE cX509Store
 
VALUE cX509StoreContext
 
VALUE eX509StoreError
 
static const rb_data_type_t ossl_x509store_type
 
static const rb_data_type_t ossl_x509stctx_type
 

Macro Definition Documentation

◆ GetX509StCtx

#define GetX509StCtx (   obj,
  ctx 
)
Value:
do { \
TypedData_Get_Struct((obj), X509_STORE_CTX, &ossl_x509stctx_type, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "STORE_CTX is out of scope!"); \
} \
} while (0)
static const rb_data_type_t ossl_x509stctx_type
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 39 of file ossl_x509store.c.

Referenced by ossl_x509stctx_get_chain(), ossl_x509stctx_get_curr_cert(), ossl_x509stctx_get_curr_crl(), ossl_x509stctx_get_err(), ossl_x509stctx_get_err_depth(), ossl_x509stctx_get_err_string(), ossl_x509stctx_initialize(), ossl_x509stctx_set_error(), ossl_x509stctx_set_flags(), ossl_x509stctx_set_purpose(), ossl_x509stctx_set_time(), ossl_x509stctx_set_trust(), and ossl_x509stctx_verify().

◆ GetX509Store

#define GetX509Store (   obj,
  st 
)
Value:
do { \
TypedData_Get_Struct((obj), X509_STORE, &ossl_x509store_type, (st)); \
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
} while (0)
static const rb_data_type_t ossl_x509store_type
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 20 of file ossl_x509store.c.

Referenced by ossl_x509store_add_cert(), ossl_x509store_add_crl(), ossl_x509store_add_file(), ossl_x509store_add_path(), ossl_x509store_initialize(), ossl_x509store_set_default_paths(), ossl_x509store_set_flags(), ossl_x509store_set_purpose(), ossl_x509store_set_trust(), and ossl_x509store_set_vfy_cb().

◆ NewX509StCtx

#define NewX509StCtx (   klass)    TypedData_Wrap_Struct((klass), &ossl_x509stctx_type, 0)

Definition at line 31 of file ossl_x509store.c.

Referenced by ossl_x509stctx_alloc(), and ossl_x509stctx_new().

◆ NewX509Store

#define NewX509Store (   klass)    TypedData_Wrap_Struct((klass), &ossl_x509store_type, 0)

Definition at line 12 of file ossl_x509store.c.

Referenced by ossl_x509store_alloc(), and ossl_x509store_new().

◆ SafeGetX509StCtx

#define SafeGetX509StCtx (   obj,
  storep 
)
Value:
do { \
OSSL_Check_Kind((obj), cX509StoreContext); \
GetX509Store((obj), (ctx)); \
} while (0)
VALUE cX509StoreContext

Definition at line 45 of file ossl_x509store.c.

◆ SafeGetX509Store

#define SafeGetX509Store (   obj,
  st 
)
Value:
do { \
OSSL_Check_Kind((obj), cX509Store); \
GetX509Store((obj), (st)); \
} while (0)
VALUE cX509Store

Definition at line 26 of file ossl_x509store.c.

Referenced by DupX509StorePtr(), GetX509StorePtr(), and ossl_x509stctx_initialize().

◆ SetX509StCtx

#define SetX509StCtx (   obj,
  ctx 
)
Value:
do { \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "STORE_CTX wasn't initialized!"); \
} \
RTYPEDDATA_DATA(obj) = (ctx); \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 33 of file ossl_x509store.c.

Referenced by ossl_x509stctx_alloc(), and ossl_x509stctx_new().

◆ SetX509Store

#define SetX509Store (   obj,
  st 
)
Value:
do { \
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
RTYPEDDATA_DATA(obj) = (st); \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 14 of file ossl_x509store.c.

Referenced by ossl_x509store_alloc(), and ossl_x509store_new().

Function Documentation

◆ call_verify_cb_proc()

static VALUE call_verify_cb_proc ( struct ossl_verify_cb_args args)
static

◆ DupX509StorePtr()

X509_STORE* DupX509StorePtr ( VALUE  obj)

Definition at line 155 of file ossl_x509store.c.

References SafeGetX509Store, and X509_STORE_up_ref.

◆ GetX509StorePtr()

X509_STORE* GetX509StorePtr ( VALUE  obj)

◆ Init_ossl_x509store()

void Init_ossl_x509store ( void  )

◆ ossl_verify_cb_call()

int ossl_verify_cb_call ( VALUE  proc,
int  ok,
X509_STORE_CTX *  ctx 
)

◆ ossl_x509stctx_alloc()

static VALUE ossl_x509stctx_alloc ( VALUE  klass)
static

Definition at line 519 of file ossl_x509store.c.

References eX509StoreError, NewX509StCtx, NULL, ossl_raise(), and SetX509StCtx.

Referenced by Init_ossl_x509store().

◆ ossl_x509stctx_free()

static void ossl_x509stctx_free ( void *  ptr)
static

Definition at line 508 of file ossl_x509store.c.

References X509_STORE_CTX_get0_cert, and X509_STORE_CTX_get0_untrusted.

Referenced by ossl_x509store_verify().

◆ ossl_x509stctx_get_chain()

static VALUE ossl_x509stctx_get_chain ( VALUE  self)
static

◆ ossl_x509stctx_get_curr_cert()

static VALUE ossl_x509stctx_get_curr_cert ( VALUE  self)
static

Definition at line 699 of file ossl_x509store.c.

References GetX509StCtx, and ossl_x509_new().

Referenced by Init_ossl_x509store().

◆ ossl_x509stctx_get_curr_crl()

static VALUE ossl_x509stctx_get_curr_crl ( VALUE  self)
static

Definition at line 713 of file ossl_x509store.c.

References GetX509StCtx, ossl_x509crl_new(), Qnil, and X509_STORE_CTX_get0_current_crl.

Referenced by Init_ossl_x509store().

◆ ossl_x509stctx_get_err()

static VALUE ossl_x509stctx_get_err ( VALUE  self)
static

Definition at line 638 of file ossl_x509store.c.

References GetX509StCtx, and INT2NUM.

Referenced by Init_ossl_x509store(), ossl_x509store_add_crl(), and ossl_x509store_verify().

◆ ossl_x509stctx_get_err_depth()

static VALUE ossl_x509stctx_get_err_depth ( VALUE  self)
static

Definition at line 685 of file ossl_x509store.c.

References GetX509StCtx, and INT2NUM.

Referenced by Init_ossl_x509store().

◆ ossl_x509stctx_get_err_string()

static VALUE ossl_x509stctx_get_err_string ( VALUE  self)
static

Definition at line 669 of file ossl_x509store.c.

References err, GetX509StCtx, and rb_str_new2.

Referenced by Init_ossl_x509store(), ossl_x509store_add_crl(), and ossl_x509store_verify().

◆ ossl_x509stctx_initialize()

static VALUE ossl_x509stctx_initialize ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ ossl_x509stctx_new()

static VALUE ossl_x509stctx_new ( X509_STORE_CTX *  ctx)
static

◆ ossl_x509stctx_set_error()

static VALUE ossl_x509stctx_set_error ( VALUE  self,
VALUE  err 
)
static

Definition at line 652 of file ossl_x509store.c.

References err, GetX509StCtx, and NUM2INT.

Referenced by Init_ossl_x509store().

◆ ossl_x509stctx_set_flags()

static VALUE ossl_x509stctx_set_flags ( VALUE  self,
VALUE  flags 
)
static

Definition at line 733 of file ossl_x509store.c.

References f, GetX509StCtx, and NUM2LONG.

Referenced by Init_ossl_x509store(), and ossl_x509stctx_new().

◆ ossl_x509stctx_set_purpose()

static VALUE ossl_x509stctx_set_purpose ( VALUE  self,
VALUE  purpose 
)
static

Definition at line 751 of file ossl_x509store.c.

References GetX509StCtx, and NUM2INT.

Referenced by Init_ossl_x509store(), and ossl_x509stctx_new().

◆ ossl_x509stctx_set_time()

static VALUE ossl_x509stctx_set_time ( VALUE  self,
VALUE  time 
)
static

◆ ossl_x509stctx_set_trust()

static VALUE ossl_x509stctx_set_trust ( VALUE  self,
VALUE  trust 
)
static

Definition at line 767 of file ossl_x509store.c.

References GetX509StCtx, and NUM2INT.

Referenced by Init_ossl_x509store(), and ossl_x509stctx_new().

◆ ossl_x509stctx_verify()

static VALUE ossl_x509stctx_verify ( VALUE  self)
static

◆ ossl_x509store_add_cert()

static VALUE ossl_x509store_add_cert ( VALUE  self,
VALUE  arg 
)
static

Definition at line 416 of file ossl_x509store.c.

References eX509StoreError, GetX509CertPtr(), GetX509Store, NULL, and ossl_raise().

Referenced by Init_ossl_x509store().

◆ ossl_x509store_add_crl()

static VALUE ossl_x509store_add_crl ( VALUE  self,
VALUE  arg 
)
static

◆ ossl_x509store_add_file()

static VALUE ossl_x509store_add_file ( VALUE  self,
VALUE  file 
)
static

◆ ossl_x509store_add_path()

static VALUE ossl_x509store_add_path ( VALUE  self,
VALUE  dir 
)
static

◆ ossl_x509store_alloc()

static VALUE ossl_x509store_alloc ( VALUE  klass)
static

Definition at line 184 of file ossl_x509store.c.

References eX509StoreError, NewX509Store, NULL, ossl_raise(), and SetX509Store.

Referenced by Init_ossl_x509store().

◆ ossl_x509store_free()

static void ossl_x509store_free ( void *  ptr)
static

Definition at line 117 of file ossl_x509store.c.

◆ ossl_x509store_initialize()

static VALUE ossl_x509store_initialize ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ ossl_x509store_new()

VALUE ossl_x509store_new ( X509_STORE *  store)

Definition at line 134 of file ossl_x509store.c.

References cX509Store, NewX509Store, and SetX509Store.

◆ ossl_x509store_set_default_paths()

static VALUE ossl_x509store_set_default_paths ( VALUE  self)
static

Definition at line 397 of file ossl_x509store.c.

References eX509StoreError, GetX509Store, NULL, ossl_raise(), and Qnil.

Referenced by Init_ossl_x509store().

◆ ossl_x509store_set_flags()

static VALUE ossl_x509store_set_flags ( VALUE  self,
VALUE  flags 
)
static

Definition at line 251 of file ossl_x509store.c.

References f, GetX509Store, and NUM2LONG.

Referenced by Init_ossl_x509store().

◆ ossl_x509store_set_purpose()

static VALUE ossl_x509store_set_purpose ( VALUE  self,
VALUE  purpose 
)
static

Definition at line 281 of file ossl_x509store.c.

References GetX509Store, and NUM2INT.

Referenced by Init_ossl_x509store().

◆ ossl_x509store_set_time()

static VALUE ossl_x509store_set_time ( VALUE  self,
VALUE  time 
)
static

Definition at line 315 of file ossl_x509store.c.

References rb_iv_set().

Referenced by Init_ossl_x509store().

◆ ossl_x509store_set_trust()

static VALUE ossl_x509store_set_trust ( VALUE  self,
VALUE  trust 
)
static

Definition at line 297 of file ossl_x509store.c.

References GetX509Store, and NUM2INT.

Referenced by Init_ossl_x509store().

◆ ossl_x509store_set_vfy_cb()

static VALUE ossl_x509store_set_vfy_cb ( VALUE  self,
VALUE  cb 
)
static

◆ ossl_x509store_verify()

static VALUE ossl_x509store_verify ( int  argc,
VALUE argv,
VALUE  self 
)
static

◆ x509store_verify_cb()

static int x509store_verify_cb ( int  ok,
X509_STORE_CTX *  ctx 
)
static

Variable Documentation

◆ cX509Store

VALUE cX509Store

Definition at line 112 of file ossl_x509store.c.

Referenced by Init_ossl_x509store(), and ossl_x509store_new().

◆ cX509StoreContext

VALUE cX509StoreContext

◆ eX509StoreError

VALUE eX509StoreError

◆ ossl_x509stctx_type

const rb_data_type_t ossl_x509stctx_type
static
Initial value:
= {
"OpenSSL/X509/STORE_CTX",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_x509stctx_free(void *)

Definition at line 496 of file ossl_x509store.c.

◆ ossl_x509store_type

const rb_data_type_t ossl_x509store_type
static
Initial value:
= {
"OpenSSL/X509/STORE",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_x509store_free(void *ptr)

Definition at line 122 of file ossl_x509store.c.

◆ stctx_ex_verify_cb_idx

int stctx_ex_verify_cb_idx
static

◆ store_ex_verify_cb_idx

int store_ex_verify_cb_idx
static