Skip to content

Instantly share code, notes, and snippets.

@shingonoide
Last active July 26, 2016 20:10
Show Gist options
  • Save shingonoide/4829adebbb6387036f27723ddd44bb3b to your computer and use it in GitHub Desktop.
Save shingonoide/4829adebbb6387036f27723ddd44bb3b to your computer and use it in GitHub Desktop.
Patch for ruby-1.9.3-(p551) compile

Patch for apply ruby version 1.9.3

rbenv

curl -fsSL https://gist.githubusercontent.com/shingonoide/4829adebbb6387036f27723ddd44bb3b/raw/ruby_openssl_1.9.3.patch | rbenv install --patch 1.9.3-p551

diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 2206fca..069e04b 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -104,6 +104,9 @@ have_func("OPENSSL_cleanse")
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
+have_func("SSLv3_method")
+have_func("SSLv3_server_method")
+have_func("SSLv3_client_method")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
end
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index e437e7e..be8e656 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -113,9 +113,12 @@ struct {
OSSL_SSL_METHOD_ENTRY(SSLv2_server),
OSSL_SSL_METHOD_ENTRY(SSLv2_client),
#endif
+#if defined(HAVE_SSLV3_METHOD) && defined(HAVE_SSLV3_SERVER_METHOD) && \
+ defined(HAVE_SSLV3_CLIENT_METHOD)
OSSL_SSL_METHOD_ENTRY(SSLv3),
OSSL_SSL_METHOD_ENTRY(SSLv3_server),
OSSL_SSL_METHOD_ENTRY(SSLv3_client),
+#endif
OSSL_SSL_METHOD_ENTRY(SSLv23),
OSSL_SSL_METHOD_ENTRY(SSLv23_server),
OSSL_SSL_METHOD_ENTRY(SSLv23_client),
@@ -132,7 +135,7 @@ static void
ossl_sslctx_free(SSL_CTX *ctx)
{
if(ctx && SSL_CTX_get_ex_data(ctx, ossl_ssl_ex_store_p)== (void*)1)
- ctx->cert_store = NULL;
+ ctx->cert_store = NULL;
SSL_CTX_free(ctx);
}
@@ -170,9 +173,9 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
SSL_CTX *ctx;
if(TYPE(ssl_method) == T_SYMBOL)
- s = rb_id2name(SYM2ID(ssl_method));
+ s = rb_id2name(SYM2ID(ssl_method));
else
- s = StringValuePtr(ssl_method);
+ s = StringValuePtr(ssl_method);
for (i = 0; i < numberof(ossl_ssl_method_tab); i++) {
if (strcmp(ossl_ssl_method_tab[i].name, s) == 0) {
method = ossl_ssl_method_tab[i].func();
@@ -205,9 +208,9 @@ ossl_sslctx_initialize(int argc, VALUE *argv, VALUE self)
int i;
for(i = 0; i < numberof(ossl_sslctx_attrs); i++){
- char buf[32];
- snprintf(buf, sizeof(buf), "@%s", ossl_sslctx_attrs[i]);
- rb_iv_set(self, buf, Qnil);
+ char buf[32];
+ snprintf(buf, sizeof(buf), "@%s", ossl_sslctx_attrs[i]);
+ rb_iv_set(self, buf, Qnil);
}
if (rb_scan_args(argc, argv, "01", &ssl_method) == 0){
return self;
@@ -292,9 +295,9 @@ ossl_default_tmp_dh_callback(SSL *ssl, int is_export, int keylength)
switch(keylength){
case 512:
- return OSSL_DEFAULT_DH_512;
+ return OSSL_DEFAULT_DH_512;
case 1024:
- return OSSL_DEFAULT_DH_1024;
+ return OSSL_DEFAULT_DH_1024;
}
return NULL;
}
@@ -339,7 +342,7 @@ ossl_sslctx_session_get_cb(SSL *ssl, unsigned char *buf, int len, int *copy)
OSSL_Debug("SSL SESSION get callback entered");
if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
- return NULL;
+ return NULL;
ssl_obj = (VALUE)ptr;
ary = rb_ary_new2(2);
rb_ary_push(ary, ssl_obj);
@@ -386,7 +389,7 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
OSSL_Debug("SSL SESSION new callback entered");
if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
- return 1;
+ return 1;
ssl_obj = (VALUE)ptr;
sess_obj = rb_obj_alloc(cSSLSession);
CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
@@ -435,7 +438,7 @@ ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
OSSL_Debug("SSL SESSION remove callback entered");
if ((ptr = SSL_CTX_get_ex_data(ctx, ossl_ssl_ex_ptr_idx)) == NULL)
- return;
+ return;
sslctx_obj = (VALUE)ptr;
sess_obj = rb_obj_alloc(cSSLSession);
CRYPTO_add(&sess->references, 1, CRYPTO_LOCK_SSL_SESSION);
@@ -464,7 +467,7 @@ ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg)
Data_Get_Struct(arg, SSL_CTX, ctx);
x509 = DupX509CertPtr(i);
if(!SSL_CTX_add_extra_chain_cert(ctx, x509)){
- ossl_raise(eSSLError, NULL);
+ ossl_raise(eSSLError, NULL);
}
return i;
@@ -514,7 +517,7 @@ ssl_servername_cb(SSL *ssl, int *ad, void *arg)
return SSL_TLSEXT_ERR_OK;
if ((ptr = SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)) == NULL)
- return SSL_TLSEXT_ERR_ALERT_FATAL;
+ return SSL_TLSEXT_ERR_ALERT_FATAL;
ssl_obj = (VALUE)ptr;
ary = rb_ary_new2(2);
rb_ary_push(ary, ssl_obj);
@@ -555,22 +558,22 @@ ossl_sslctx_setup(VALUE self)
#if !defined(OPENSSL_NO_DH)
if (RTEST(ossl_sslctx_get_tmp_dh_cb(self))){
- SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
+ SSL_CTX_set_tmp_dh_callback(ctx, ossl_tmp_dh_callback);
}
else{
- SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
+ SSL_CTX_set_tmp_dh_callback(ctx, ossl_default_tmp_dh_callback);
}
#endif
SSL_CTX_set_ex_data(ctx, ossl_ssl_ex_ptr_idx, (void*)self);
val = ossl_sslctx_get_cert_store(self);
if(!NIL_P(val)){
- /*
+ /*
* WORKAROUND:
- * X509_STORE can count references, but
- * X509_STORE_free() doesn't care it.
- * So we won't increment it but mark it by ex_data.
- */
+ * X509_STORE can count references, but
+ * X509_STORE_free() doesn't care it.
+ * So we won't increment it but mark it by ex_data.
+ */
store = GetX509StorePtr(val); /* NO NEED TO DUP */
SSL_CTX_set_cert_store(ctx, store);
SSL_CTX_set_ex_data(ctx, ossl_ssl_ex_store_p, (void*)1);
@@ -578,7 +581,7 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_extra_cert(self);
if(!NIL_P(val)){
- rb_block_call(val, rb_intern("each"), 0, 0, ossl_sslctx_add_extra_chain_cert_i, self);
+ rb_block_call(val, rb_intern("each"), 0, 0, ossl_sslctx_add_extra_chain_cert_i, self);
}
/* private key may be bundled in certificate file. */
@@ -602,22 +605,22 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_client_ca(self);
if(!NIL_P(val)){
- if(TYPE(val) == T_ARRAY){
- for(i = 0; i < RARRAY_LEN(val); i++){
- client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]);
- if (!SSL_CTX_add_client_CA(ctx, client_ca)){
- /* Copies X509_NAME => FREE it. */
- ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
- }
- }
+ if(TYPE(val) == T_ARRAY){
+ for(i = 0; i < RARRAY_LEN(val); i++){
+ client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]);
+ if (!SSL_CTX_add_client_CA(ctx, client_ca)){
+ /* Copies X509_NAME => FREE it. */
+ ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
+ }
+ }
}
- else{
- client_ca = GetX509CertPtr(val); /* NO DUP NEEDED. */
+ else{
+ client_ca = GetX509CertPtr(val); /* NO DUP NEEDED. */
if (!SSL_CTX_add_client_CA(ctx, client_ca)){
- /* Copies X509_NAME => FREE it. */
- ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
+ /* Copies X509_NAME => FREE it. */
+ ossl_raise(eSSLError, "SSL_CTX_add_client_CA");
}
- }
+ }
}
val = ossl_sslctx_get_ca_file(self);
@@ -625,15 +628,15 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_ca_path(self);
ca_path = NIL_P(val) ? NULL : StringValuePtr(val);
if(ca_file || ca_path){
- if (!SSL_CTX_load_verify_locations(ctx, ca_file, ca_path))
- rb_warning("can't set verify locations");
+ if (!SSL_CTX_load_verify_locations(ctx, ca_file, ca_path))
+ rb_warning("can't set verify locations");
}
val = ossl_sslctx_get_verify_mode(self);
verify_mode = NIL_P(val) ? SSL_VERIFY_NONE : NUM2INT(val);
SSL_CTX_set_verify(ctx, verify_mode, ossl_ssl_verify_callback);
if (RTEST(ossl_sslctx_get_client_cert_cb(self)))
- SSL_CTX_set_client_cert_cb(ctx, ossl_client_cert_cb);
+ SSL_CTX_set_client_cert_cb(ctx, ossl_client_cert_cb);
val = ossl_sslctx_get_timeout(self);
if(!NIL_P(val)) SSL_CTX_set_timeout(ctx, NUM2LONG(val));
@@ -643,40 +646,40 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_options(self);
if(!NIL_P(val)) {
- SSL_CTX_set_options(ctx, NUM2LONG(val));
+ SSL_CTX_set_options(ctx, NUM2LONG(val));
}
else {
- SSL_CTX_set_options(ctx, SSL_OP_ALL);
+ SSL_CTX_set_options(ctx, SSL_OP_ALL);
}
rb_obj_freeze(self);
val = ossl_sslctx_get_sess_id_ctx(self);
if (!NIL_P(val)){
- StringValue(val);
- if (!SSL_CTX_set_session_id_context(ctx, (unsigned char *)RSTRING_PTR(val),
- RSTRING_LENINT(val))){
- ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
- }
+ StringValue(val);
+ if (!SSL_CTX_set_session_id_context(ctx, (unsigned char *)RSTRING_PTR(val),
+ RSTRING_LENINT(val))){
+ ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
+ }
}
if (RTEST(rb_iv_get(self, "@session_get_cb"))) {
- SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb);
- OSSL_Debug("SSL SESSION get callback added");
+ SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb);
+ OSSL_Debug("SSL SESSION get callback added");
}
if (RTEST(rb_iv_get(self, "@session_new_cb"))) {
- SSL_CTX_sess_set_new_cb(ctx, ossl_sslctx_session_new_cb);
- OSSL_Debug("SSL SESSION new callback added");
+ SSL_CTX_sess_set_new_cb(ctx, ossl_sslctx_session_new_cb);
+ OSSL_Debug("SSL SESSION new callback added");
}
if (RTEST(rb_iv_get(self, "@session_remove_cb"))) {
- SSL_CTX_sess_set_remove_cb(ctx, ossl_sslctx_session_remove_cb);
- OSSL_Debug("SSL SESSION remove callback added");
+ SSL_CTX_sess_set_remove_cb(ctx, ossl_sslctx_session_remove_cb);
+ OSSL_Debug("SSL SESSION remove callback added");
}
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
val = rb_iv_get(self, "@servername_cb");
if (!NIL_P(val)) {
SSL_CTX_set_tlsext_servername_callback(ctx, ssl_servername_cb);
- OSSL_Debug("SSL TLSEXT servername callback added");
+ OSSL_Debug("SSL TLSEXT servername callback added");
}
#endif
@@ -754,7 +757,7 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
rb_check_frozen(self);
if (NIL_P(v))
- return v;
+ return v;
else if (TYPE(v) == T_ARRAY) {
str = rb_str_new(0, 0);
for (i = 0; i < RARRAY_LEN(v); i++) {
@@ -977,18 +980,18 @@ ossl_ssl_shutdown(SSL *ssl)
int i, rc;
if (ssl) {
- /* 4 is from SSL_smart_shutdown() of mod_ssl.c (v2.2.19) */
- /* It says max 2x pending + 2x data = 4 */
- for (i = 0; i < 4; ++i) {
- /*
- * Ignore the case SSL_shutdown returns -1. Empty handshake_func
- * must not happen.
- */
- if (rc = SSL_shutdown(ssl))
- break;
- }
- ERR_clear_error();
- SSL_clear(ssl);
+ /* 4 is from SSL_smart_shutdown() of mod_ssl.c (v2.2.19) */
+ /* It says max 2x pending + 2x data = 4 */
+ for (i = 0; i < 4; ++i) {
+ /*
+ * Ignore the case SSL_shutdown returns -1. Empty handshake_func
+ * must not happen.
+ */
+ if (rc = SSL_shutdown(ssl))
+ break;
+ }
+ ERR_clear_error();
+ SSL_clear(ssl);
}
}
@@ -1053,7 +1056,7 @@ ossl_ssl_setup(VALUE self)
Data_Get_Struct(self, SSL, ssl);
if(!ssl){
#ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
- VALUE hostname = rb_iv_get(self, "@hostname");
+ VALUE hostname = rb_iv_get(self, "@hostname");
#endif
v_ctx = ossl_ssl_get_ctx(self);
@@ -1076,13 +1079,13 @@ ossl_ssl_setup(VALUE self)
rb_io_check_readable(fptr);
rb_io_check_writable(fptr);
SSL_set_fd(ssl, TO_SOCKET(FPTR_TO_FD(fptr)));
- SSL_set_ex_data(ssl, ossl_ssl_ex_ptr_idx, (void*)self);
- cb = ossl_sslctx_get_verify_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void*)cb);
- cb = ossl_sslctx_get_client_cert_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
- cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
- SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_ptr_idx, (void*)self);
+ cb = ossl_sslctx_get_verify_cb(v_ctx);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void*)cb);
+ cb = ossl_sslctx_get_client_cert_cb(v_ctx);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_client_cert_cb_idx, (void*)cb);
+ cb = ossl_sslctx_get_tmp_dh_cb(v_ctx);
+ SSL_set_ex_data(ssl, ossl_ssl_ex_tmp_dh_callback_idx, (void*)cb);
}
return Qtrue;
@@ -1127,30 +1130,30 @@ ossl_start_ssl(VALUE self, int (*func)(), const char *funcname, int nonblock)
Data_Get_Struct(self, SSL, ssl);
GetOpenFile(ossl_ssl_get_io(self), fptr);
for(;;){
- ret = func(ssl);
+ ret = func(ssl);
cb_state = rb_ivar_get(self, ID_callback_state);
if (!NIL_P(cb_state))
rb_jump_tag(NUM2INT(cb_state));
- if (ret > 0)
- break;
+ if (ret > 0)
+ break;
- switch((ret2 = ssl_get_error(ssl, ret))){
- case SSL_ERROR_WANT_WRITE:
+ switch((ret2 = ssl_get_error(ssl, ret))){
+ case SSL_ERROR_WANT_WRITE:
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
- case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_READ:
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
- case SSL_ERROR_SYSCALL:
- if (errno) rb_sys_fail(funcname);
- ossl_raise(eSSLError, "%s SYSCALL returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
- default:
- ossl_raise(eSSLError, "%s returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
- }
+ case SSL_ERROR_SYSCALL:
+ if (errno) rb_sys_fail(funcname);
+ ossl_raise(eSSLError, "%s SYSCALL returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
+ default:
+ ossl_raise(eSSLError, "%s returned=%d errno=%d state=%s", funcname, ret2, errno, SSL_state_string_long(ssl));
+ }
}
return self;
@@ -1255,29 +1258,29 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock)
Data_Get_Struct(self, SSL, ssl);
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
- if(!nonblock && SSL_pending(ssl) <= 0)
- rb_thread_wait_fd(FPTR_TO_FD(fptr));
- for (;;){
- nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
- switch(ssl_get_error(ssl, nread)){
- case SSL_ERROR_NONE:
- goto end;
- case SSL_ERROR_ZERO_RETURN:
- rb_eof_error();
- case SSL_ERROR_WANT_WRITE:
+ if(!nonblock && SSL_pending(ssl) <= 0)
+ rb_thread_wait_fd(FPTR_TO_FD(fptr));
+ for (;;){
+ nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
+ switch(ssl_get_error(ssl, nread)){
+ case SSL_ERROR_NONE:
+ goto end;
+ case SSL_ERROR_ZERO_RETURN:
+ rb_eof_error();
+ case SSL_ERROR_WANT_WRITE:
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
- case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_READ:
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
- continue;
- case SSL_ERROR_SYSCALL:
- if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
- rb_sys_fail(0);
- default:
- ossl_raise(eSSLError, "SSL_read:");
- }
+ continue;
+ case SSL_ERROR_SYSCALL:
+ if(ERR_peek_error() == 0 && nread == 0) rb_eof_error();
+ rb_sys_fail(0);
+ default:
+ ossl_raise(eSSLError, "SSL_read:");
+ }
}
}
else {
@@ -1337,30 +1340,30 @@ ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock)
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
- for (;;){
- nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
- switch(ssl_get_error(ssl, nwrite)){
- case SSL_ERROR_NONE:
- goto end;
- case SSL_ERROR_WANT_WRITE:
+ for (;;){
+ nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
+ switch(ssl_get_error(ssl, nwrite)){
+ case SSL_ERROR_NONE:
+ goto end;
+ case SSL_ERROR_WANT_WRITE:
write_would_block(nonblock);
rb_io_wait_writable(FPTR_TO_FD(fptr));
continue;
- case SSL_ERROR_WANT_READ:
+ case SSL_ERROR_WANT_READ:
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
- case SSL_ERROR_SYSCALL:
- if (errno) rb_sys_fail(0);
- default:
- ossl_raise(eSSLError, "SSL_write:");
- }
+ case SSL_ERROR_SYSCALL:
+ if (errno) rb_sys_fail(0);
+ default:
+ ossl_raise(eSSLError, "SSL_write:");
+ }
}
}
else {
ID id_syswrite = rb_intern("syswrite");
rb_warning("SSL session is not started yet.");
- return rb_funcall(ossl_ssl_get_io(self), id_syswrite, 1, str);
+ return rb_funcall(ossl_ssl_get_io(self), id_syswrite, 1, str);
}
end:
@@ -1405,14 +1408,14 @@ ossl_ssl_close(VALUE self)
Data_Get_Struct(self, SSL, ssl);
if (ssl) {
- VALUE io = ossl_ssl_get_io(self);
- if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
- ossl_ssl_shutdown(ssl);
- SSL_free(ssl);
- DATA_PTR(self) = NULL;
- if (RTEST(ossl_ssl_get_sync_close(self)))
- rb_funcall(io, rb_intern("close"), 0);
- }
+ VALUE io = ossl_ssl_get_io(self);
+ if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
+ ossl_ssl_shutdown(ssl);
+ SSL_free(ssl);
+ DATA_PTR(self) = NULL;
+ if (RTEST(ossl_ssl_get_sync_close(self)))
+ rb_funcall(io, rb_intern("close"), 0);
+ }
}
return Qnil;
@@ -1496,16 +1499,16 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
Data_Get_Struct(self, SSL, ssl);
if(!ssl){
- rb_warning("SSL session is not started yet.");
- return Qnil;
+ rb_warning("SSL session is not started yet.");
+ return Qnil;
}
chain = SSL_get_peer_cert_chain(ssl);
if(!chain) return Qnil;
num = sk_X509_num(chain);
ary = rb_ary_new2(num);
for (i = 0; i < num; i++){
- cert = sk_X509_value(chain, i);
- rb_ary_push(ary, ossl_x509_new(cert));
+ cert = sk_X509_value(chain, i);
+ rb_ary_push(ary, ossl_x509_new(cert));
}
return ary;
@@ -1673,8 +1676,8 @@ ossl_ssl_get_client_ca_list(VALUE self)
Data_Get_Struct(self, SSL, ssl);
if (!ssl) {
- rb_warning("SSL session is not started yet.");
- return Qnil;
+ rb_warning("SSL session is not started yet.");
+ return Qnil;
}
ca = SSL_get_client_CA_list(ssl);
@@ -1697,9 +1700,9 @@ Init_ossl_ssl()
ossl_ssl_ex_store_p = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_store_p",0,0,0);
ossl_ssl_ex_ptr_idx = SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_ptr_idx",0,0,0);
ossl_ssl_ex_client_cert_cb_idx =
- SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0);
+ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_client_cert_cb_idx",0,0,0);
ossl_ssl_ex_tmp_dh_callback_idx =
- SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
+ SSL_get_ex_new_index(0,(void *)"ossl_ssl_ex_tmp_dh_callback_idx",0,0,0);
mSSL = rb_define_module_under(mOSSL, "SSL");
eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment