Skip to content

Instantly share code, notes, and snippets.

@taf2
Created December 30, 2009 14:50
Show Gist options
  • Save taf2/266097 to your computer and use it in GitHub Desktop.
Save taf2/266097 to your computer and use it in GitHub Desktop.
diff -u ext/openssl/ossl.c ext/openssl/ossl.c
--- ext/openssl/ossl.c 2009-12-30 09:43:44.000000000 -0500
+++ ext/openssl/ossl.c 2009-12-30 09:42:12.000000000 -0500
@@ -92,7 +92,7 @@
#define OSSL_IMPL_SK2ARY(name, type) \
VALUE \
-ossl_##name##_sk2ary(STACK *sk) \
+ossl_##name##_sk2ary(STACK_OF(type) *sk) \
{ \
type *t; \
int i, num; \
@@ -102,7 +102,7 @@
OSSL_Debug("empty sk!"); \
return Qnil; \
} \
- num = sk_num(sk); \
+ num = sk_##type##_num(sk); \
if (num < 0) { \
OSSL_Debug("items in sk < -1???"); \
return rb_ary_new(); \
@@ -110,7 +110,7 @@
ary = rb_ary_new2(num); \
\
for (i=0; i<num; i++) { \
- t = (type *)sk_value(sk, i); \
+ t = (type *)sk_##type##_value(sk, i); \
rb_ary_push(ary, ossl_##name##_new(t)); \
} \
return ary; \
diff -u ext/openssl/ossl_pkcs7.c ext/openssl/ossl_pkcs7.c
--- ext/openssl/ossl_pkcs7.c 2009-12-30 09:43:44.000000000 -0500
+++ ext/openssl/ossl_pkcs7.c 2009-12-30 09:42:12.000000000 -0500
@@ -570,7 +570,7 @@
return self;
}
-static STACK *
+static STACK_OF(X509) *
pkcs7_get_certs_or_crls(VALUE self, int want_certs)
{
PKCS7 *pkcs7;
diff -u ext/openssl/ossl_ssl.c ext/openssl/ossl_ssl.c
--- ext/openssl/ossl_ssl.c 2009-12-30 09:43:44.000000000 -0500
+++ ext/openssl/ossl_ssl.c 2009-12-30 09:42:12.000000000 -0500
@@ -88,6 +88,13 @@
static const char *ossl_ssl_attr_readers[] = { "io", "context", };
static const char *ossl_ssl_attrs[] = { "sync_close", };
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#define OSSL_MORE_CONST const
+#define STACK _STACK
+#else
+#define OSSL_MORE_CONST
+#endif
+
ID ID_callback_state;
/*
@@ -95,7 +102,7 @@
*/
struct {
const char *name;
- SSL_METHOD *(*func)(void);
+ OSSL_MORE_CONST SSL_METHOD *(*func)(void);
} ossl_ssl_method_tab[] = {
#define OSSL_SSL_METHOD_ENTRY(name) { #name, name##_method }
OSSL_SSL_METHOD_ENTRY(TLSv1),
@@ -144,7 +151,7 @@
static VALUE
ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
{
- SSL_METHOD *method = NULL;
+ OSSL_MORE_CONST SSL_METHOD *method = NULL;
const char *s;
int i;
@@ -585,7 +592,7 @@
}
static VALUE
-ossl_ssl_cipher_to_ary(SSL_CIPHER *cipher)
+ossl_ssl_cipher_to_ary(OSSL_MORE_CONST SSL_CIPHER *cipher)
{
VALUE ary;
int bits, alg_bits;
@@ -609,7 +616,7 @@
{
SSL_CTX *ctx;
STACK_OF(SSL_CIPHER) *ciphers;
- SSL_CIPHER *cipher;
+ OSSL_MORE_CONST SSL_CIPHER *cipher;
VALUE ary;
int i, num;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment