Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.2.0 #367

Merged
merged 5 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ jobs:
- openssl-1.0.1u # EOL
- openssl-1.0.2u # EOL
- openssl-1.1.0l # EOL
- openssl-1.1.1d
- openssl-1.1.1g
# - libressl-2.3.7 # EOL
# - libressl-2.4.5 # EOL
# - libressl-2.5.5 # EOL
# - libressl-2.6.5 # EOL
- libressl-2.7.5 # EOL
- libressl-2.8.3 # EOL
- libressl-2.9.2
# - libressl-2.7.5 # EOL
# - libressl-2.8.3 # EOL
- libressl-2.9.2 # EOL
- libressl-3.0.2
- libressl-3.1.1
steps:
- name: repo checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Version 2.2.0 (not yet released)
Version 2.2.0
=============

Compatibility notes
Expand Down
3 changes: 1 addition & 2 deletions ext/openssl/ossl.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ VALUE ossl_buf2str(char *buf, int len);
VALUE ossl_str_new(const char *, long, int *);
#define ossl_str_adjust(str, p) \
do{\
long len = RSTRING_LEN(str);\
long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
assert(newlen <= len);\
assert(newlen <= RSTRING_LEN(str));\
rb_str_set_len((str), newlen);\
}while(0)
/*
Expand Down
18 changes: 1 addition & 17 deletions ext/openssl/ossl_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1329,21 +1329,6 @@ ossl_sslctx_add_certificate(int argc, VALUE *argv, VALUE self)
return self;
}

static VALUE
ossl_sslctx_add_certificate_chain_file(VALUE self, VALUE path)
{
SSL_CTX *ctx;
int ret;

GetSSLCTX(self, ctx);
StringValueCStr(path);
ret = SSL_CTX_use_certificate_chain_file(ctx, RSTRING_PTR(path));
if (ret != 1)
ossl_raise(eSSLError, "SSL_CTX_use_certificate_chain_file");

return Qtrue;
}

/*
* call-seq:
* ctx.session_add(session) -> true | false
Expand Down Expand Up @@ -2324,7 +2309,7 @@ ossl_ssl_get_verify_result(VALUE self)

GetSSL(self, ssl);

return INT2NUM(SSL_get_verify_result(ssl));
return LONG2NUM(SSL_get_verify_result(ssl));
}

/*
Expand Down Expand Up @@ -2795,7 +2780,6 @@ Init_ossl_ssl(void)
rb_define_method(cSSLContext, "enable_fallback_scsv", ossl_sslctx_enable_fallback_scsv, 0);
#endif
rb_define_method(cSSLContext, "add_certificate", ossl_sslctx_add_certificate, -1);
rb_define_method(cSSLContext, "add_certificate_chain_file", ossl_sslctx_add_certificate_chain_file, 1);

rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
rb_define_alias(cSSLContext, "freeze", "setup");
Expand Down
28 changes: 0 additions & 28 deletions test/openssl/test_ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,34 +189,6 @@ def test_add_certificate_multiple_certs
end
end

def test_add_certificate_chain_file
# Create chain certificates file
certs = Tempfile.open { |f| f << @svr_cert.to_pem << @ca_cert.to_pem; f }
pkey = Tempfile.open { |f| f << @svr_key.to_pem; f }

ctx_proc = -> ctx {
# FIXME: This is a temporary test case written just to match the current
# state. ctx.add_certificate_chain_file should take two arguments.
ctx.add_certificate_chain_file(certs.path)
# # Unset values set by start_server
# ctx.cert = ctx.key = ctx.extra_chain_cert = nil
# assert_nothing_raised { ctx.add_certificate_chain_file(certs.path, pkey.path) }
}

start_server(ctx_proc: ctx_proc) { |port|
server_connect(port) { |ssl|
assert_equal @svr_cert.subject, ssl.peer_cert.subject
assert_equal [@svr_cert.subject, @ca_cert.subject],
ssl.peer_cert_chain.map(&:subject)

ssl.puts "abc"; assert_equal "abc\n", ssl.gets
}
}
ensure
certs&.unlink
pkey&.unlink
end

def test_sysread_and_syswrite
start_server { |port|
server_connect(port) { |ssl|
Expand Down