aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/ossl.h')
-rw-r--r--ext/openssl/ossl.h34
1 files changed, 13 insertions, 21 deletions
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 3be01b0cb6..ea9f3be50d 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -97,21 +97,8 @@ extern VALUE eOSSLError;
*/
#define OSSL_Check_Kind(obj, klass) 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)
-
-#define OSSL_Check_Instance(obj, klass) do {\
- if (!rb_obj_is_instance_of((obj), (klass))) {\
- ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\
- rb_obj_class(obj), (klass));\
- }\
-} while (0)
-
-#define OSSL_Check_Same_Class(obj1, obj2) do {\
- if (!rb_obj_is_instance_of((obj1), rb_obj_class(obj2))) {\
- ossl_raise(rb_eTypeError, "wrong argument type");\
+ rb_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
+ rb_obj_class(obj), (klass));\
}\
} while (0)
@@ -130,13 +117,19 @@ int string2hex(const unsigned char *, int, char **, int *);
/*
* Data Conversion
*/
-STACK_OF(X509) *ossl_x509_ary2sk0(VALUE);
+/* Convert STACK_OF(xx) <-> Array */
STACK_OF(X509) *ossl_x509_ary2sk(VALUE);
STACK_OF(X509) *ossl_protect_x509_ary2sk(VALUE,int*);
VALUE ossl_x509_sk2ary(STACK_OF(X509) *certs);
VALUE ossl_x509crl_sk2ary(STACK_OF(X509_CRL) *crl);
VALUE ossl_x509name_sk2ary(STACK_OF(X509_NAME) *names);
+/* Create a new String and copy buf into it. buf will be freed. */
VALUE ossl_buf2str(char *buf, int len);
+/* Adjust String length. We call OpenSSL's i2d_ functions with NULL buffer first
+ * to estimate the length, and we allocate a String and then call these
+ * functions with pointer of +p+. However the estimated length can be inaccurate.
+ * OpenSSL increments +p+ to point just after the data written. See the manpage
+ * of i2d_X509 for details */
#define ossl_str_adjust(str, p) \
do{\
long len = RSTRING_LEN(str);\
@@ -154,8 +147,10 @@ int ossl_pem_passwd_cb(char *, int, int, void *);
* Clear BIO* with this in PEM/DER fallback scenarios to avoid decoding
* errors piling up in OpenSSL::Errors
*/
-#define OSSL_BIO_reset(bio) (void)BIO_reset((bio)); \
- ERR_clear_error();
+#define OSSL_BIO_reset(bio) do { \
+ (void)BIO_reset((bio)); \
+ ERR_clear_error(); \
+} while (0)
/*
* ERRor messages
@@ -175,7 +170,6 @@ struct ossl_verify_cb_args {
VALUE store_ctx;
};
-VALUE ossl_call_verify_cb_proc(struct ossl_verify_cb_args *);
int ossl_verify_cb(int, X509_STORE_CTX *);
/*
@@ -239,8 +233,6 @@ void ossl_debug(const char *, ...);
#include "ossl_x509.h"
#include "ossl_engine.h"
-void Init_openssl(void);
-
#if defined(__cplusplus)
}
#endif