Skip to content

Commit 158201f

Browse files
committed
Merge branch 'maint-2.0' into maint
The fix made in 6fcc6c0 ("test/test_ssl: fix test failure with TLS 1.3", 2018-08-06) is applied to the new test cases. * maint-2.0: reduce LibreSSL warnings openssl_missing.h: constified openssl: search winsock search winsock libraries explicitly no ID cache in Init functions test/test_ssl: fix test failure with TLS 1.3 tool/ruby-openssl-docker: update to latest versions pkey: resume key generation after interrupt
2 parents 2d67199 + a1e8aac commit 158201f

File tree

18 files changed

+130
-39
lines changed

18 files changed

+130
-39
lines changed

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ matrix:
1818
fast_finish: true
1919
include:
2020
- env: RUBY_VERSION=ruby-2.3 OPENSSL_VERSION=openssl-1.0.2
21-
- env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=openssl-1.0.1
2221
- env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=openssl-1.0.2
23-
- env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=openssl-1.1.0
24-
- env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=libressl-2.5
25-
- env: RUBY_VERSION=ruby-2.4 OPENSSL_VERSION=libressl-2.6
22+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.0.1
23+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.0.2
24+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.0
25+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.1
26+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.5
27+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.6
28+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=libressl-2.7
2629
- language: ruby
2730
rvm: ruby-head
2831
before_install:
@@ -33,3 +36,4 @@ matrix:
3336
allow_failures:
3437
- language: ruby
3538
rvm: ruby-head
39+
- env: RUBY_VERSION=ruby-2.5 OPENSSL_VERSION=openssl-1.1.1

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM zzak/ruby-openssl-docker:2.0
1+
FROM zzak/ruby-openssl-docker:testing

ext/openssl/extconf.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
Logging::message "=== Checking for system dependent stuff... ===\n"
3434
have_library("nsl", "t_open")
3535
have_library("socket", "socket")
36+
if $mswin || $mingw
37+
have_library("ws2_32")
38+
end
3639

3740
Logging::message "=== Checking for required stuff... ===\n"
3841
result = pkg_config("openssl") && have_header("openssl/ssl.h")
@@ -111,6 +114,10 @@ def find_openssl_library
111114
OpenSSL.check_func_or_macro("ENGINE_load_#{name}", "openssl/engine.h")
112115
}
113116

117+
if ($mswin || $mingw) && have_macro("LIBRESSL_VERSION_NUMBER")
118+
$defs.push("-DNOCRYPT")
119+
end
120+
114121
# added in 1.0.2
115122
have_func("EC_curve_nist2nid")
116123
have_func("X509_REVOKED_dup")

ext/openssl/openssl_missing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, co
149149
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
150150
return pkey->pkey._name; }
151151
#define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \
152-
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
152+
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
153153
if (a1) *a1 = obj->a1; \
154154
if (a2) *a2 = obj->a2; } \
155155
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
@@ -158,7 +158,7 @@ static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
158158
BN_clear_free(obj->a2); obj->a2 = a2; \
159159
return 1; }
160160
#define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \
161-
static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
161+
static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
162162
if (a1) *a1 = obj->a1; \
163163
if (a2) *a2 = obj->a2; \
164164
if (a3) *a3 = obj->a3; } \

ext/openssl/ossl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@ static void Init_ossl_locks(void)
10991099
void
11001100
Init_openssl(void)
11011101
{
1102+
#undef rb_intern
11021103
/*
11031104
* Init timezone info
11041105
*/

ext/openssl/ossl_asn1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ OSSL_ASN1_IMPL_FACTORY_METHOD(EndOfContent)
13601360
void
13611361
Init_ossl_asn1(void)
13621362
{
1363+
#undef rb_intern
13631364
VALUE ary;
13641365
int i;
13651366

ext/openssl/ossl_pkcs12.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ ossl_pkcs12_to_der(VALUE self)
232232
void
233233
Init_ossl_pkcs12(void)
234234
{
235+
#undef rb_intern
235236
#if 0
236237
mOSSL = rb_define_module("OpenSSL");
237238
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);

ext/openssl/ossl_pkcs7.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ ossl_pkcs7ri_get_enc_key(VALUE self)
10421042
void
10431043
Init_ossl_pkcs7(void)
10441044
{
1045+
#undef rb_intern
10451046
#if 0
10461047
mOSSL = rb_define_module("OpenSSL");
10471048
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);

ext/openssl/ossl_pkey.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ static ID id_private_q;
2020
/*
2121
* callback for generating keys
2222
*/
23+
static VALUE
24+
call_check_ints0(VALUE arg)
25+
{
26+
rb_thread_check_ints();
27+
return Qnil;
28+
}
29+
30+
static void *
31+
call_check_ints(void *arg)
32+
{
33+
int state;
34+
rb_protect(call_check_ints0, Qnil, &state);
35+
return (void *)(VALUE)state;
36+
}
37+
2338
int
2439
ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
2540
{
@@ -38,19 +53,26 @@ ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
3853
*/
3954
rb_protect(rb_yield, ary, &state);
4055
if (state) {
41-
arg->stop = 1;
4256
arg->state = state;
57+
return 0;
58+
}
59+
}
60+
if (arg->interrupted) {
61+
arg->interrupted = 0;
62+
state = (int)(VALUE)rb_thread_call_with_gvl(call_check_ints, NULL);
63+
if (state) {
64+
arg->state = state;
65+
return 0;
4366
}
4467
}
45-
if (arg->stop) return 0;
4668
return 1;
4769
}
4870

4971
void
5072
ossl_generate_cb_stop(void *ptr)
5173
{
5274
struct ossl_generate_cb_arg *arg = (struct ossl_generate_cb_arg *)ptr;
53-
arg->stop = 1;
75+
arg->interrupted = 1;
5476
}
5577

5678
static void
@@ -389,6 +411,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
389411
void
390412
Init_ossl_pkey(void)
391413
{
414+
#undef rb_intern
392415
#if 0
393416
mOSSL = rb_define_module("OpenSSL");
394417
eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError);

ext/openssl/ossl_pkey.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern const rb_data_type_t ossl_evp_pkey_type;
3737

3838
struct ossl_generate_cb_arg {
3939
int yield;
40-
int stop;
40+
int interrupted;
4141
int state;
4242
};
4343
int ossl_generate_cb_2(int p, int n, BN_GENCB *cb);

0 commit comments

Comments
 (0)