ossl_x509attr.c File Reference
`#include "ossl.h"`

Go to the source code of this file.

## Macros

#define | WrapX509Attr(klass, obj, attr)
#define | GetX509Attr(obj, attr)
#define | SafeGetX509Attr(obj, attr)
#define | OSSL_X509ATTR_IS_SINGLE(attr) (!(attr)->set)
#define | OSSL_X509ATTR_SET_SINGLE(attr) ((attr)->set = 0)

## Functions

VALUE | ossl_x509attr_new (X509_ATTRIBUTE *attr)
X509_ATTRIBUTE * | DupX509AttrPtr (VALUE obj)
static VALUE | ossl_x509attr_alloc (VALUE klass)
static VALUE | ossl_x509attr_initialize (int argc, VALUE *argv, VALUE self)
static VALUE | ossl_x509attr_set_oid (VALUE self, VALUE oid)
static VALUE | ossl_x509attr_get_oid (VALUE self)
static VALUE | ossl_x509attr_set_value (VALUE self, VALUE value)
static VALUE | ossl_x509attr_get_value (VALUE self)
static VALUE | ossl_x509attr_to_der (VALUE self)
void | Init_ossl_x509attr ()

## Variables

VALUE | cX509Attr
VALUE | eX509AttrError

## Macro Definition Documentation

#define GetX509Attr | ( |  | obj,
|  |  | attr
| ) |  |

Value:
do { \
Data_Get_Struct((obj), X509_ATTRIBUTE, (attr)); \
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
} while (0)

Definition at line 19 of file ossl_x509attr.c.

Referenced by ossl_x509attr_get_oid(), ossl_x509attr_get_value(), ossl_x509attr_initialize(), ossl_x509attr_set_oid(), ossl_x509attr_set_value(), and ossl_x509attr_to_der().

#define OSSL_X509ATTR_IS_SINGLE | ( |  | attr | ) | (!(attr)->set)

Definition at line 168 of file ossl_x509attr.c.

Referenced by ossl_x509attr_get_value(), and ossl_x509attr_set_value().

#define OSSL_X509ATTR_SET_SINGLE | ( |  | attr | ) | ((attr)->set = 0)

Definition at line 169 of file ossl_x509attr.c.

Referenced by ossl_x509attr_set_value().

#define SafeGetX509Attr | ( |  | obj,
|  |  | attr
| ) |  |

Value:
do { \
OSSL_Check_Kind((obj), cX509Attr); \
GetX509Attr((obj), (attr)); \
} while (0)

Definition at line 25 of file ossl_x509attr.c.

Referenced by DupX509AttrPtr().

#define WrapX509Attr | ( |  | klass,
|  |  | obj,
|  |  | attr
| ) |  |

Value:
do { \
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
(obj) = Data_Wrap_Struct((klass), 0, X509_ATTRIBUTE_free, (attr)); \
} while (0)

Definition at line 13 of file ossl_x509attr.c.

Referenced by ossl_x509attr_alloc(), and ossl_x509attr_new().

## Function Documentation

X509_ATTRIBUTE* DupX509AttrPtr | ( | VALUE | obj | ) |

Definition at line 59 of file ossl_x509attr.c.

References eX509AttrError, NULL, ossl_raise(), and SafeGetX509Attr.

Referenced by ossl_x509req_add_attribute(), and ossl_x509req_set_attributes().

void Init_ossl_x509attr | ( | void |  | ) |

Definition at line 263 of file ossl_x509attr.c.

References cX509Attr, eOSSLError, eX509AttrError, mX509, ossl_x509attr_alloc(), ossl_x509attr_get_oid(), ossl_x509attr_get_value(), ossl_x509attr_initialize(), ossl_x509attr_set_oid(), ossl_x509attr_set_value(), ossl_x509attr_to_der(), rb_cObject, rb_define_alloc_func(), rb_define_class_under(), and rb_define_method().

Referenced by Init_ossl_x509().

static VALUE ossl_x509attr_alloc | ( | VALUE | klass | ) |

static

Definition at line 75 of file ossl_x509attr.c.

References eX509AttrError, NULL, ossl_raise(), and WrapX509Attr.

Referenced by Init_ossl_x509attr().

static VALUE ossl_x509attr_get_oid | ( | VALUE | self | ) |

static

Definition at line 142 of file ossl_x509attr.c.

References eX509AttrError, GetX509Attr, NULL, ossl_membio2str(), ossl_raise(), and rb_str_new2().

Referenced by Init_ossl_x509attr().

static VALUE ossl_x509attr_get_value | ( | VALUE | self | ) |

static

Definition at line 204 of file ossl_x509attr.c.

References GetX509Attr, mASN1, NULL, ossl_str_adjust, OSSL_X509ATTR_IS_SINGLE, p, Qnil, rb_funcall(), rb_intern, rb_str_new(), and RSTRING_PTR.

Referenced by Init_ossl_x509attr().

static VALUE ossl_x509attr_initialize | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 92 of file ossl_x509attr.c.

References DATA_PTR, eX509AttrError, GetX509Attr, NULL, ossl_raise(), ossl_to_der_if_possible(), p, rb_funcall(), rb_intern, rb_scan_args(), RSTRING_LEN, RSTRING_PTR, and StringValue.

Referenced by Init_ossl_x509attr().

VALUE ossl_x509attr_new | ( | X509_ATTRIBUTE * | attr | ) |

Definition at line 40 of file ossl_x509attr.c.

References cX509Attr, eX509AttrError, NULL, ossl_raise(), and WrapX509Attr.

Referenced by ossl_x509req_get_attributes().

static VALUE ossl_x509attr_set_oid | ( | VALUE | self,
|  | VALUE | oid
| ) |  |

static

Definition at line 121 of file ossl_x509attr.c.

References eX509AttrError, GetX509Attr, NULL, ossl_raise(), and StringValuePtr.

Referenced by Init_ossl_x509attr().

static VALUE ossl_x509attr_set_value | ( | VALUE | self,
|  | VALUE | value
| ) |  |

static

Definition at line 177 of file ossl_x509attr.c.

References eASN1Error, GetX509Attr, ossl_asn1_get_asn1type(), ossl_raise(), OSSL_X509ATTR_IS_SINGLE, and OSSL_X509ATTR_SET_SINGLE.

Referenced by Init_ossl_x509attr().

static VALUE ossl_x509attr_to_der | ( | VALUE | self | ) |

static

Definition at line 240 of file ossl_x509attr.c.

References eX509AttrError, GetX509Attr, len, NULL, ossl_raise(), p, rb_str_new(), rb_str_set_len, and RSTRING_PTR.

Referenced by Init_ossl_x509attr().

## Variable Documentation

VALUE cX509Attr

Definition at line 33 of file ossl_x509attr.c.

Referenced by Init_ossl_x509attr(), ossl_x509attr_new(), and ossl_x509req_set_attributes().

VALUE eX509AttrError

Definition at line 34 of file ossl_x509attr.c.

Referenced by DupX509AttrPtr(), Init_ossl_x509attr(), ossl_x509attr_alloc(), ossl_x509attr_get_oid(), ossl_x509attr_initialize(), ossl_x509attr_new(), ossl_x509attr_set_oid(), and ossl_x509attr_to_der().