Ruby: ext/openssl/ossl.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions | Variables
ossl.h File Reference
`#include <RUBY_EXTCONF_H>`
`#include <assert.h>`
`#include <ruby.h>`
`#include <errno.h>`
`#include <ruby/io.h>`
`#include <ruby/thread.h>`
`#include <openssl/opensslv.h>`
`#include <openssl/err.h>`
`#include <openssl/asn1.h>`
`#include <openssl/x509v3.h>`
`#include <openssl/ssl.h>`
`#include <openssl/pkcs12.h>`
`#include <openssl/pkcs7.h>`
`#include <openssl/hmac.h>`
`#include <openssl/rand.h>`
`#include <openssl/conf.h>`
`#include <openssl/ts.h>`
`#include <openssl/crypto.h>`
`#include <openssl/engine.h>`
`#include <openssl/ocsp.h>`
`#include <openssl/bn.h>`
`#include <openssl/rsa.h>`
`#include <openssl/dsa.h>`
`#include <openssl/evp.h>`
`#include <openssl/dh.h>`
`#include "openssl_missing.h"`
`#include "ruby_missing.h"`
`#include "ossl_asn1.h"`
`#include "ossl_bio.h"`
`#include "ossl_bn.h"`
`#include "ossl_cipher.h"`
`#include "ossl_config.h"`
`#include "ossl_digest.h"`
`#include "ossl_hmac.h"`
`#include "ossl_ns_spki.h"`
`#include "ossl_ocsp.h"`
`#include "ossl_pkcs12.h"`
`#include "ossl_pkcs7.h"`
`#include "ossl_pkey.h"`
`#include "ossl_rand.h"`
`#include "ossl_ssl.h"`
`#include "ossl_ts.h"`
`#include "ossl_x509.h"`
`#include "ossl_engine.h"`
`#include "ossl_kdf.h"`

Go to the source code of this file.

## Macros
#define | OSSL_Check_Kind(obj, klass)
#define | ossl_str_adjust(str, p)
#define | OSSL_BIO_reset(bio)
#define | OSSL_Debug(...)

## Functions
| STACK_OF (X509) *ossl_x509_ary2sk(VALUE)
int *VALUE | ossl_x509_sk2ary (const STACK_OF(X509) *certs)
VALUE | ossl_x509crl_sk2ary (const STACK_OF(X509_CRL) *crl)
VALUE | ossl_x509name_sk2ary (const STACK_OF(X509_NAME) *names)
VALUE | ossl_buf2str (char *buf, int len)
VALUE | ossl_str_new (const char *, long, int *)
void | ossl_bin2hex (unsigned char *in, char *out, size_t len)
VALUE | ossl_pem_passwd_value (VALUE)
int | ossl_pem_passwd_cb (char *, int, int, void *)
void | ossl_raise (VALUE, const char *,...)
void | ossl_clear_error (void)
VALUE | ossl_to_der (VALUE)
VALUE | ossl_to_der_if_possible (VALUE)
void | Init_openssl (void)

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

## Macro Definition Documentation

## ◆ OSSL_BIO_reset

#define OSSL_BIO_reset | ( |  | bio | ) |

Value:
do { \
(void)BIO_reset((bio)); \
ossl_clear_error(); \
} while (0)

Definition at line 116 of file ossl.h.

## ◆ OSSL_Check_Kind

#define OSSL_Check_Kind | ( |  | obj,
|  |  | klass
| ) |  |

Value:
do {\
if (!rb_obj_is_kind_of((obj), (klass))) {\
ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
rb_obj_class(obj), (klass));\
}\
} while (0)
PRIsVALUE
#define PRIsVALUE
Definition: function.c:10
rb_eTypeError
VALUE rb_eTypeError
Definition: error.c:1057
rb_obj_class
VALUE rb_obj_class(VALUE)
Definition: object.c:245
rb_obj_is_kind_of
VALUE rb_obj_is_kind_of(VALUE, VALUE)
Determines if obj is a kind of c.
Definition: object.c:724

Definition at line 59 of file ossl.h.

## ◆ OSSL_Debug

#define OSSL_Debug | ( |  | ... | ) |

Value:
do { \
if (dOSSL == Qtrue) { \
fprintf(stderr, "OSSL_DEBUG: "); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, " [%s:%d]\n", __FILE__, __LINE__); \
} \
} while (0)
dOSSL
VALUE dOSSL
Definition: ossl.c:357
Qtrue
#define Qtrue
Definition: special_consts.h:52

Definition at line 140 of file ossl.h.

## ◆ ossl_str_adjust

#define ossl_str_adjust | ( |  | str,
|  |  | p
| ) |  |

Value:
do{\
long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
assert(newlen <= RSTRING_LEN(str));\
rb_str_set_len((str), newlen);\
}while(0)
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
RSTRING_LEN
#define RSTRING_LEN(string)
Definition: fbuffer.h:22
RSTRING_PTR
#define RSTRING_PTR(string)
Definition: fbuffer.h:19
long
typedef long(ZCALLBACK *tell_file_func) OF((voidpf opaque

Definition at line 89 of file ossl.h.

## Function Documentation

## ◆ Init_openssl()

void Init_openssl | ( | void |  | ) |

Definition at line 1130 of file ossl.c.

References dOSSL, eOSSLError, Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_digest(), 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_ssl(), Init_ossl_ts(), Init_ossl_x509(), INT2NUM, mOSSL, NULL, ossl_get_errors(), Qfalse, Qtrue, rb_define_class_under(), rb_define_const(), rb_define_module(), rb_define_module_function, rb_define_singleton_method, rb_eRuntimeError, rb_eStandardError, rb_ext_ractor_safe(), rb_intern(), rb_raise(), and rb_str_new2.

## ◆ ossl_bin2hex()

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

Definition at line 133 of file ossl.c.

References assert, in(), LONG_MAX, and out.

## ◆ ossl_buf2str()

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

Definition at line 120 of file ossl.c.

References 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_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 len, memcpy, NIL_P, NULL, OSSL_Debug, Qfalse, Qnil, Qtrue, rb_block_given_p(), rb_protect(), rb_set_errinfo(), rb_warning(), 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, and rb_exc_raise().

Referenced by asn1integer_to_num(), asn1time_to_time(), BIGNUM_1c(), DupConfigPtr(), DupX509RevokedPtr(), GetPrivPKeyPtr(), Init_ossl_ssl(), Init_ossl_x509store(), num_to_asn1integer(), ossl_asn1_get_asn1type(), ossl_bn_ctx_get(), ossl_bn_new(), ossl_bn_value_ptr(), ossl_cipher_new(), ossl_dh_new(), ossl_digest_new(), ossl_digest_update(), ossl_dsa_new(), ossl_ec_new(), ossl_evp_get_cipherbyname(), ossl_evp_get_digestbyname(), ossl_obj2bio(), ossl_pem_passwd_value(), ossl_pkey_check_public_key(), ossl_rsa_new(), 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 len, memcpy, ptr, Qnil, rb_protect(), rb_set_errinfo(), RSTRING_PTR, 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 rb_funcall(), and StringValue.

Referenced by ossl_to_der_if_possible().

## ◆ ossl_to_der_if_possible()

VALUE ossl_to_der_if_possible | ( | VALUE | obj | ) |

Definition at line 255 of file ossl.c.

References ossl_to_der(), and rb_respond_to().

## ◆ ossl_x509_sk2ary()

int *VALUE ossl_x509_sk2ary | ( | const STACK_OF(X509) * | certs | ) |

## ◆ ossl_x509crl_sk2ary()

VALUE ossl_x509crl_sk2ary | ( | const STACK_OF(X509_CRL) * | crl | ) |

## ◆ ossl_x509name_sk2ary()

VALUE ossl_x509name_sk2ary | ( | const STACK_OF(X509_NAME) * | names | ) |

## ◆ STACK_OF()

STACK_OF | ( | X509 |  | ) |

## Variable Documentation

## ◆ dOSSL

VALUE dOSSL
| extern

Definition at line 357 of file ossl.c.

Referenced by Init_openssl(), and ossl_clear_error().

## ◆ eOSSLError

VALUE eOSSLError
| extern

Definition at line 236 of file ossl.c.

Referenced by asn1integer_to_num(), 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_ts(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509name(), Init_ossl_x509req(), Init_ossl_x509revoked(), Init_ossl_x509store(), num_to_asn1integer(), ossl_obj2bio(), and ossl_pem_passwd_value().

## ◆ mOSSL

VALUE mOSSL
| extern

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_ts(), Init_ossl_x509(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509name(), Init_ossl_x509req(), Init_ossl_x509revoked(), and Init_ossl_x509store().