Skip to content

Commit 1c8eb30

Browse files
committed
Merge branch 'maint-2.0' into maint
* maint-2.0: Ruby/OpenSSL 2.0.9 needs openssl/opensslv.h x509name: fix OpenSSL::X509::Name#{cmp,<=>}
2 parents ce4022d + 1b7e5e4 commit 1c8eb30

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

History.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,29 @@ Notable changes
5555
[[GitHub #177]](https://github.com/ruby/openssl/pull/177)
5656

5757

58+
Version 2.0.9
59+
=============
60+
61+
Security fixes
62+
--------------
63+
64+
* OpenSSL::X509::Name#<=> could incorrectly return 0 (= equal) for non-equal
65+
objects. CVE-2018-16395 is assigned for this issue.
66+
https://hackerone.com/reports/387250
67+
68+
Bug fixes
69+
---------
70+
71+
* Fixed OpenSSL::PKey::*.{new,generate} immediately aborting if the thread is
72+
interrupted.
73+
[[Bug #14882]](https://bugs.ruby-lang.org/issues/14882)
74+
[[GitHub #205]](https://github.com/ruby/openssl/pull/205)
75+
* Fixed OpenSSL::X509::Name#to_s failing with OpenSSL::X509::NameError if
76+
called against an empty instance.
77+
[[GitHub #200]](https://github.com/ruby/openssl/issues/200)
78+
[[GitHub #211]](https://github.com/ruby/openssl/pull/211)
79+
80+
5881
Version 2.0.8
5982
=============
6083

ext/openssl/extconf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def find_openssl_library
114114
OpenSSL.check_func_or_macro("ENGINE_load_#{name}", "openssl/engine.h")
115115
}
116116

117-
if ($mswin || $mingw) && have_macro("LIBRESSL_VERSION_NUMBER")
117+
if ($mswin || $mingw) && have_macro("LIBRESSL_VERSION_NUMBER", "openssl/opensslv.h")
118118
$defs.push("-DNOCRYPT")
119119
end
120120

ext/openssl/ossl_x509name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ ossl_x509name_cmp(VALUE self, VALUE other)
400400

401401
result = ossl_x509name_cmp0(self, other);
402402
if (result < 0) return INT2FIX(-1);
403-
if (result > 1) return INT2FIX(1);
403+
if (result > 0) return INT2FIX(1);
404404

405405
return INT2FIX(0);
406406
}

test/test_x509name.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,16 @@ def test_equals2
405405
end
406406

407407
def test_spaceship
408-
n1 = OpenSSL::X509::Name.parse_rfc2253 'CN=a'
409-
n2 = OpenSSL::X509::Name.parse_rfc2253 'CN=b'
410-
411-
assert_equal(-1, n1 <=> n2)
408+
n1 = OpenSSL::X509::Name.new([["CN", "a"]])
409+
n2 = OpenSSL::X509::Name.new([["CN", "a"]])
410+
n3 = OpenSSL::X509::Name.new([["CN", "ab"]])
411+
412+
assert_equal 0, n1 <=> n2
413+
assert_equal -1, n1 <=> n3
414+
assert_equal 0, n2 <=> n1
415+
assert_equal -1, n2 <=> n3
416+
assert_equal 1, n3 <=> n1
417+
assert_equal 1, n3 <=> n2
412418
end
413419

414420
def name_hash(name)

0 commit comments

Comments
 (0)