13#include RUBY_EXTCONF_H
20#include <openssl/opensslv.h>
21#include <openssl/err.h>
22#include <openssl/asn1.h>
23#include <openssl/x509v3.h>
24#include <openssl/ssl.h>
25#include <openssl/pkcs12.h>
26#include <openssl/pkcs7.h>
27#include <openssl/hmac.h>
28#include <openssl/rand.h>
29#include <openssl/conf.h>
30#include <openssl/conf_api.h>
31#include <openssl/crypto.h>
32#if !defined(OPENSSL_NO_ENGINE)
33# include <openssl/engine.h>
35#if !defined(OPENSSL_NO_OCSP)
36# include <openssl/ocsp.h>
38#include <openssl/bn.h>
39#include <openssl/rsa.h>
40#include <openssl/dsa.h>
41#include <openssl/evp.h>
42#include <openssl/dh.h>
57#define OSSL_Check_Kind(obj, klass) do {\
58 if (!rb_obj_is_kind_of((obj), (klass))) {\
59 ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
60 rb_obj_class(obj), (klass));\
67#if !defined(NUM2UINT64T)
69# define NUM2UINT64T(x) ((uint64_t)NUM2ULONG(x))
70# elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
71# define NUM2UINT64T(x) ((uint64_t)NUM2ULL(x))
73# error "unknown platform; no 64-bit width integer"
87#define ossl_str_adjust(str, p) \
89 long len = RSTRING_LEN(str);\
90 long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
91 assert(newlen <= len);\
92 rb_str_set_len((str), newlen);\
115#define OSSL_BIO_reset(bio) do { \
116 (void)BIO_reset((bio)); \
117 ossl_clear_error(); \
138#if defined(HAVE_VA_ARGS_MACRO)
139#define OSSL_Debug(...) do { \
140 if (dOSSL == Qtrue) { \
141 fprintf(stderr, "OSSL_DEBUG: "); \
142 fprintf(stderr, __VA_ARGS__); \
143 fprintf(stderr, " [%s:%d]\n", __FILE__, __LINE__); \
149#define OSSL_Debug ossl_debug
unsigned char buf[MIME_BUF_SIZE]
void ossl_raise(VALUE exc, const char *fmt,...)
void ossl_bin2hex(unsigned char *in, char *out, size_t len)
VALUE ossl_to_der_if_possible(VALUE)
void ossl_debug(const char *,...)
VALUE ossl_pem_passwd_value(VALUE)
NORETURN(void ossl_raise(VALUE, const char *,...))
VALUE ossl_str_new(const char *, long, int *)
int *VALUE ossl_x509_sk2ary(const STACK_OF(X509) *certs)
VALUE ossl_buf2str(char *buf, int len)
VALUE ossl_x509name_sk2ary(const STACK_OF(X509_NAME) *names)
int ossl_pem_passwd_cb(char *, int, int, void *)
void ossl_clear_error(void)
STACK_OF(X509) *ossl_x509_ary2sk(VALUE)
VALUE ossl_x509crl_sk2ary(const STACK_OF(X509_CRL) *crl)