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

Go to the source code of this file.

Macros

#define NewX509Ext(klass)   TypedData_Wrap_Struct((klass), &ossl_x509ext_type, 0)
 
#define SetX509Ext(obj, ext)
 
#define GetX509Ext(obj, ext)
 
#define SafeGetX509Ext(obj, ext)
 
#define MakeX509ExtFactory(klass, obj, ctx)
 
#define GetX509ExtFactory(obj, ctx)
 

Functions

static void ossl_x509ext_free (void *ptr)
 
VALUE ossl_x509ext_new (X509_EXTENSION *ext)
 
X509_EXTENSION * GetX509ExtPtr (VALUE obj)
 
static void ossl_x509extfactory_free (void *ctx)
 
static VALUE ossl_x509extfactory_alloc (VALUE klass)
 
static VALUE ossl_x509extfactory_set_issuer_cert (VALUE self, VALUE cert)
 
static VALUE ossl_x509extfactory_set_subject_cert (VALUE self, VALUE cert)
 
static VALUE ossl_x509extfactory_set_subject_req (VALUE self, VALUE req)
 
static VALUE ossl_x509extfactory_set_crl (VALUE self, VALUE crl)
 
static VALUE ossl_x509extfactory_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_x509extfactory_create_ext (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_x509ext_alloc (VALUE klass)
 
static VALUE ossl_x509ext_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE ossl_x509ext_initialize_copy (VALUE self, VALUE other)
 
static VALUE ossl_x509ext_set_oid (VALUE self, VALUE oid)
 
static VALUE ossl_x509ext_set_value (VALUE self, VALUE data)
 
static VALUE ossl_x509ext_set_critical (VALUE self, VALUE flag)
 
static VALUE ossl_x509ext_get_oid (VALUE obj)
 
static VALUE ossl_x509ext_get_value (VALUE obj)
 
static VALUE ossl_x509ext_get_critical (VALUE obj)
 
static VALUE ossl_x509ext_to_der (VALUE obj)
 
void Init_ossl_x509ext (void)
 

Variables

VALUE cX509Ext
 
VALUE cX509ExtFactory
 
VALUE eX509ExtError
 
static const rb_data_type_t ossl_x509ext_type
 
static const rb_data_type_t ossl_x509extfactory_type
 

Macro Definition Documentation

◆ GetX509Ext

#define GetX509Ext (   obj,
  ext 
)
Value:
do { \
TypedData_Get_Struct((obj), X509_EXTENSION, &ossl_x509ext_type, (ext)); \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
} while (0)
static const rb_data_type_t ossl_x509ext_type
Definition: ossl_x509ext.c:57
VALUE rb_eRuntimeError
Definition: error.c:761

Definition at line 20 of file ossl_x509ext.c.

Referenced by ossl_x509ext_get_critical(), ossl_x509ext_get_oid(), ossl_x509ext_get_value(), ossl_x509ext_initialize(), ossl_x509ext_initialize_copy(), ossl_x509ext_set_critical(), ossl_x509ext_set_oid(), ossl_x509ext_set_value(), and ossl_x509ext_to_der().

◆ GetX509ExtFactory

#define GetX509ExtFactory (   obj,
  ctx 
)
Value:
do { \
TypedData_Get_Struct((obj), X509V3_CTX, &ossl_x509extfactory_type, (ctx)); \
if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \
} \
} while (0)
VALUE rb_eRuntimeError
Definition: error.c:761
static const rb_data_type_t ossl_x509extfactory_type
Definition: ossl_x509ext.c:110

Definition at line 37 of file ossl_x509ext.c.

Referenced by ossl_x509extfactory_create_ext(), ossl_x509extfactory_set_crl(), ossl_x509extfactory_set_issuer_cert(), ossl_x509extfactory_set_subject_cert(), and ossl_x509extfactory_set_subject_req().

◆ MakeX509ExtFactory

#define MakeX509ExtFactory (   klass,
  obj,
  ctx 
)
Value:
do { \
if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
X509V3_set_ctx((ctx), NULL, NULL, NULL, NULL, 0); \
RTYPEDDATA_DATA(obj) = (ctx); \
} while (0)
#define TypedData_Wrap_Struct(klass, data_type, sval)
Definition: ruby.h:1169
VALUE rb_eRuntimeError
Definition: error.c:761
#define NULL
Definition: _sdbm.c:102
static const rb_data_type_t ossl_x509extfactory_type
Definition: ossl_x509ext.c:110

Definition at line 30 of file ossl_x509ext.c.

Referenced by ossl_x509extfactory_alloc().

◆ NewX509Ext

#define NewX509Ext (   klass)    TypedData_Wrap_Struct((klass), &ossl_x509ext_type, 0)

◆ SafeGetX509Ext

#define SafeGetX509Ext (   obj,
  ext 
)
Value:
do { \
OSSL_Check_Kind((obj), cX509Ext); \
GetX509Ext((obj), (ext)); \
} while (0)
VALUE cX509Ext
Definition: ossl_x509ext.c:47

Definition at line 26 of file ossl_x509ext.c.

Referenced by GetX509ExtPtr(), and ossl_x509ext_initialize_copy().

◆ SetX509Ext

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

Definition at line 14 of file ossl_x509ext.c.

Referenced by ossl_x509ext_alloc(), ossl_x509ext_initialize_copy(), ossl_x509ext_new(), and ossl_x509extfactory_create_ext().

Function Documentation

◆ GetX509ExtPtr()

X509_EXTENSION* GetX509ExtPtr ( VALUE  obj)

◆ Init_ossl_x509ext()

void Init_ossl_x509ext ( void  )

◆ ossl_x509ext_alloc()

static VALUE ossl_x509ext_alloc ( VALUE  klass)
static

Definition at line 250 of file ossl_x509ext.c.

References eX509ExtError, NewX509Ext, NULL, ossl_raise(), and SetX509Ext.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_free()

static void ossl_x509ext_free ( void *  ptr)
static

Definition at line 52 of file ossl_x509ext.c.

◆ ossl_x509ext_get_critical()

static VALUE ossl_x509ext_get_critical ( VALUE  obj)
static

Definition at line 410 of file ossl_x509ext.c.

References GetX509Ext, Qfalse, and Qtrue.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_get_oid()

static VALUE ossl_x509ext_get_oid ( VALUE  obj)
static

Definition at line 370 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, nid, NULL, ossl_membio2str(), ossl_raise(), and rb_str_new2.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_get_value()

static VALUE ossl_x509ext_get_value ( VALUE  obj)
static

Definition at line 393 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, NULL, ossl_membio2str(), and ossl_raise().

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_initialize()

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

◆ ossl_x509ext_initialize_copy()

static VALUE ossl_x509ext_initialize_copy ( VALUE  self,
VALUE  other 
)
static

Definition at line 302 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, ossl_raise(), rb_check_frozen, SafeGetX509Ext, and SetX509Ext.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_new()

VALUE ossl_x509ext_new ( X509_EXTENSION *  ext)

◆ ossl_x509ext_set_critical()

static VALUE ossl_x509ext_set_critical ( VALUE  self,
VALUE  flag 
)
static

Definition at line 359 of file ossl_x509ext.c.

References GetX509Ext, and RTEST.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_set_oid()

static VALUE ossl_x509ext_set_oid ( VALUE  self,
VALUE  oid 
)
static

Definition at line 321 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, ossl_raise(), and StringValueCStr.

Referenced by Init_ossl_x509ext().

◆ ossl_x509ext_set_value()

static VALUE ossl_x509ext_set_value ( VALUE  self,
VALUE  data 
)
static

◆ ossl_x509ext_to_der()

static VALUE ossl_x509ext_to_der ( VALUE  obj)
static

Definition at line 419 of file ossl_x509ext.c.

References eX509ExtError, GetX509Ext, len, NULL, ossl_raise(), ossl_str_adjust, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_x509ext().

◆ ossl_x509extfactory_alloc()

static VALUE ossl_x509extfactory_alloc ( VALUE  klass)
static

Definition at line 119 of file ossl_x509ext.c.

References MakeX509ExtFactory, Qnil, and rb_iv_set().

Referenced by Init_ossl_x509ext().

◆ ossl_x509extfactory_create_ext()

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

◆ ossl_x509extfactory_free()

static void ossl_x509extfactory_free ( void *  ctx)
static

Definition at line 105 of file ossl_x509ext.c.

◆ ossl_x509extfactory_initialize()

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

◆ ossl_x509extfactory_set_crl()

static VALUE ossl_x509extfactory_set_crl ( VALUE  self,
VALUE  crl 
)
static

Definition at line 167 of file ossl_x509ext.c.

References GetX509CRLPtr(), GetX509ExtFactory, and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

◆ ossl_x509extfactory_set_issuer_cert()

static VALUE ossl_x509extfactory_set_issuer_cert ( VALUE  self,
VALUE  cert 
)
static

◆ ossl_x509extfactory_set_subject_cert()

static VALUE ossl_x509extfactory_set_subject_cert ( VALUE  self,
VALUE  cert 
)
static

◆ ossl_x509extfactory_set_subject_req()

static VALUE ossl_x509extfactory_set_subject_req ( VALUE  self,
VALUE  req 
)
static

Definition at line 155 of file ossl_x509ext.c.

References GetX509ExtFactory, GetX509ReqPtr(), and rb_iv_set().

Referenced by Init_ossl_x509ext(), and ossl_x509extfactory_initialize().

Variable Documentation

◆ cX509Ext

VALUE cX509Ext

◆ cX509ExtFactory

VALUE cX509ExtFactory

Definition at line 48 of file ossl_x509ext.c.

Referenced by Init_ossl_x509ext().

◆ eX509ExtError

VALUE eX509ExtError

◆ ossl_x509ext_type

const rb_data_type_t ossl_x509ext_type
static
Initial value:
= {
"OpenSSL/X509/EXTENSION",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_x509ext_free(void *ptr)
Definition: ossl_x509ext.c:52

Definition at line 57 of file ossl_x509ext.c.

◆ ossl_x509extfactory_type

const rb_data_type_t ossl_x509extfactory_type
static
Initial value:
= {
"OpenSSL/X509/EXTENSION/Factory",
{
},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
Definition: ruby.h:1145
static void ossl_x509extfactory_free(void *ctx)
Definition: ossl_x509ext.c:105

Definition at line 110 of file ossl_x509ext.c.