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>
31 #include <openssl/ts.h>
33#include <openssl/crypto.h>
34#if !defined(OPENSSL_NO_ENGINE)
35# include <openssl/engine.h>
37#if !defined(OPENSSL_NO_OCSP)
38# include <openssl/ocsp.h>
40#include <openssl/bn.h>
41#include <openssl/rsa.h>
42#include <openssl/dsa.h>
43#include <openssl/evp.h>
44#include <openssl/dh.h>
59#define OSSL_Check_Kind(obj, klass) do {\
60 if (!rb_obj_is_kind_of((obj), (klass))) {\
61 ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
62 rb_obj_class(obj), (klass));\
69#if !defined(NUM2UINT64T)
71# define NUM2UINT64T(x) ((uint64_t)NUM2ULONG(x))
72# elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8
73# define NUM2UINT64T(x) ((uint64_t)NUM2ULL(x))
75# error "unknown platform; no 64-bit width integer"
89#define ossl_str_adjust(str, p) \
91 long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
92 assert(newlen <= RSTRING_LEN(str));\
93 rb_str_set_len((str), newlen);\
116#define OSSL_BIO_reset(bio) do { \
117 (void)BIO_reset((bio)); \
118 ossl_clear_error(); \
139#if defined(HAVE_VA_ARGS_MACRO)
140#define OSSL_Debug(...) do { \
141 if (dOSSL == Qtrue) { \
142 fprintf(stderr, "OSSL_DEBUG: "); \
143 fprintf(stderr, __VA_ARGS__); \
144 fprintf(stderr, " [%s:%d]\n", __FILE__, __LINE__); \
149void ossl_debug(
const char *, ...);
150#define OSSL_Debug ossl_debug
unsigned in(void *in_desc, z_const unsigned char **buf)
void ossl_bin2hex(unsigned char *in, char *out, size_t len)
VALUE ossl_to_der_if_possible(VALUE)
VALUE ossl_pem_passwd_value(VALUE)
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)
void ossl_raise(VALUE, const char *,...)
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)