diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2018-08-08 17:27:09 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2018-08-08 17:33:31 +0900 |
commit | 158201f9b66607f380513708e3ab65f1e27694e6 (patch) | |
tree | c3bdc4b52e3eb5f83a49a496d0ffca3eb6a3d13c /ext/openssl | |
parent | 2d6719910020d00444329161a5ff8a01fbdad2e6 (diff) | |
parent | a1e8aacaef3cc9f95ccbdba653a82e1a334cdeb4 (diff) | |
download | ruby-openssl-158201f9b66607f380513708e3ab65f1e27694e6.tar.gz |
Merge branch 'maint-2.0' into maint
The fix made in 6fcc6c0efc42 ("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
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/extconf.rb | 7 | ||||
-rw-r--r-- | ext/openssl/openssl_missing.h | 4 | ||||
-rw-r--r-- | ext/openssl/ossl.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_asn1.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_pkcs12.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_pkcs7.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey.c | 29 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey.h | 2 | ||||
-rw-r--r-- | ext/openssl/ossl_pkey_ec.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_x509ext.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_x509name.c | 1 | ||||
-rw-r--r-- | ext/openssl/ossl_x509store.c | 1 |
12 files changed, 44 insertions, 6 deletions
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index 4242f044..cefa295a 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -33,6 +33,9 @@ end Logging::message "=== Checking for system dependent stuff... ===\n" have_library("nsl", "t_open") have_library("socket", "socket") +if $mswin || $mingw + have_library("ws2_32") +end Logging::message "=== Checking for required stuff... ===\n" result = pkg_config("openssl") && have_header("openssl/ssl.h") @@ -111,6 +114,10 @@ engines.each { |name| OpenSSL.check_func_or_macro("ENGINE_load_#{name}", "openssl/engine.h") } +if ($mswin || $mingw) && have_macro("LIBRESSL_VERSION_NUMBER") + $defs.push("-DNOCRYPT") +end + # added in 1.0.2 have_func("EC_curve_nist2nid") have_func("X509_REVOKED_dup") diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h index debd25ad..69a7df71 100644 --- a/ext/openssl/openssl_missing.h +++ b/ext/openssl/openssl_missing.h @@ -149,7 +149,7 @@ void ossl_X509_REQ_get0_signature(const X509_REQ *, const ASN1_BIT_STRING **, co static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \ return pkey->pkey._name; } #define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \ -static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \ +static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2) { \ if (a1) *a1 = obj->a1; \ if (a2) *a2 = obj->a2; } \ 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) { \ BN_clear_free(obj->a2); obj->a2 = a2; \ return 1; } #define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \ -static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \ +static inline void _type##_get0_##_group(const _type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \ if (a1) *a1 = obj->a1; \ if (a2) *a2 = obj->a2; \ if (a3) *a3 = obj->a3; } \ diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 245385e7..38e650e1 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -1099,6 +1099,7 @@ static void Init_ossl_locks(void) void Init_openssl(void) { +#undef rb_intern /* * Init timezone info */ diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index fb05e038..7b6c9738 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -1360,6 +1360,7 @@ OSSL_ASN1_IMPL_FACTORY_METHOD(EndOfContent) void Init_ossl_asn1(void) { +#undef rb_intern VALUE ary; int i; diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c index ddb7d939..45663344 100644 --- a/ext/openssl/ossl_pkcs12.c +++ b/ext/openssl/ossl_pkcs12.c @@ -232,6 +232,7 @@ ossl_pkcs12_to_der(VALUE self) void Init_ossl_pkcs12(void) { +#undef rb_intern #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index 6395fa6f..79ba0bdf 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -1042,6 +1042,7 @@ ossl_pkcs7ri_get_enc_key(VALUE self) void Init_ossl_pkcs7(void) { +#undef rb_intern #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 2b96ece5..e1fffb24 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -20,6 +20,21 @@ static ID id_private_q; /* * callback for generating keys */ +static VALUE +call_check_ints0(VALUE arg) +{ + rb_thread_check_ints(); + return Qnil; +} + +static void * +call_check_ints(void *arg) +{ + int state; + rb_protect(call_check_ints0, Qnil, &state); + return (void *)(VALUE)state; +} + int ossl_generate_cb_2(int p, int n, BN_GENCB *cb) { @@ -38,11 +53,18 @@ ossl_generate_cb_2(int p, int n, BN_GENCB *cb) */ rb_protect(rb_yield, ary, &state); if (state) { - arg->stop = 1; arg->state = state; + return 0; + } + } + if (arg->interrupted) { + arg->interrupted = 0; + state = (int)(VALUE)rb_thread_call_with_gvl(call_check_ints, NULL); + if (state) { + arg->state = state; + return 0; } } - if (arg->stop) return 0; return 1; } @@ -50,7 +72,7 @@ void ossl_generate_cb_stop(void *ptr) { struct ossl_generate_cb_arg *arg = (struct ossl_generate_cb_arg *)ptr; - arg->stop = 1; + arg->interrupted = 1; } static void @@ -389,6 +411,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data) void Init_ossl_pkey(void) { +#undef rb_intern #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h index 2b17bf53..a2a9fc0d 100644 --- a/ext/openssl/ossl_pkey.h +++ b/ext/openssl/ossl_pkey.h @@ -37,7 +37,7 @@ extern const rb_data_type_t ossl_evp_pkey_type; struct ossl_generate_cb_arg { int yield; - int stop; + int interrupted; int state; }; int ossl_generate_cb_2(int p, int n, BN_GENCB *cb); diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index fbc71a6f..8bb61124 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -1649,6 +1649,7 @@ static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self) void Init_ossl_ec(void) { +#undef rb_intern #if 0 mPKey = rb_define_module_under(mOSSL, "PKey"); cPKey = rb_define_class_under(mPKey, "PKey", rb_cObject); diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index 2d9a7a31..30ec09d7 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -437,6 +437,7 @@ ossl_x509ext_to_der(VALUE obj) void Init_ossl_x509ext(void) { +#undef rb_intern #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index c900bcbe..0f16736c 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -502,6 +502,7 @@ ossl_x509name_to_der(VALUE self) void Init_ossl_x509name(void) { +#undef rb_intern VALUE utf8str, ptrstr, ia5str, hash; #if 0 diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index c6cf67ad..2909eeda 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -771,6 +771,7 @@ ossl_x509stctx_set_time(VALUE self, VALUE time) void Init_ossl_x509store(void) { +#undef rb_intern #if 0 mOSSL = rb_define_module("OpenSSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); |