Skip to content

Conversation

@rhenium
Copy link
Member

@rhenium rhenium commented Aug 24, 2017

No description provided.

* topic/test-memory-leak:
  Enable OSSL_MDEBUG on CI builds
  Add OpenSSL.print_mem_leaks
  test: prepare test PKey instances on demand
  test: let OpenSSL::TestCase include OpenSSL::TestUtils
  Don't define main() when built with --enable-debug

(cherry picked from commit 5c586ac)

Note that fix for new test cases that use the old constants removed by
this is squashed in.
@rhenium rhenium force-pushed the ky/maint-fix-test-with-tls13 branch 2 times, most recently from fbdcde4 to 58b5c76 Compare August 24, 2017 11:25
rhenium added 14 commits August 24, 2017 21:01
Fix wrong nesting in test/utils.rb. Remove unnecessary requires. Wrap
the code with 'if defined?(OpenSSL::TestUtils) ~ end' and avoid class
definition with modifier if.
Use EnvUtil.suppress_warning instead. We have started to use it already,
and the name 'suppress_warning' expresses what it does more clearly.
Add a method that returns whether the OpenSSL supports TLS 1.2 or not.
This will be useful for test cases that are specific to TLS ~1.2.
The block passed to start_server is invoked with two arguments, the
running thread object for the server and the automatically-selected port
number. The first argument is completely useless and actually is not
used anywhere.
An assumption in OpenSSL::TestSSL#test_get_ephemeral_key is that the
ephemeral key type is always EVP_PKEY_EC when negotiated with an ECDHE
cipher suite. This is not true if X25519 is chosen.

The test is passing because we happen to fix the group to P-256 in
start_server, but let's make it explicit.
Close the socket by server_loop rather than by server_proc. This reduces
code duplication.
start_server can hang if the given block exits before closing sockets
that the block opens. While this is a carelessness of the caller, we
can do a better job.
Add methods that check whether the running OpenSSL is an OpenSSL or a
LibreSSL, and optionally check whether the version is newer or equal to
the given version number.
LibreSSL 2.6.1 removed DSA support from its SSL code. Also, TLS 1.3 will
not support DSA certificates. Use an RSA certificate as the client
certificate in the tests, too.
The very patch that added this test case made the dfree function not
send close_notify alert when an SSLSocket is being GCed.

Anyway, the new OSSL_GC_STRESS option added by 6ee4b28 ("test: run
test cases under GC.stress if OSSL_GC_STRESS is specified", 2016-12-04)
will cover this kind of issues.
Use TLS 1.2 explicitly where needed, since TLS 1.3 will remove session
ID based session resumption.
Fix test cases failing with TLS 1.3-enabled OpenSSL master.
@rhenium rhenium force-pushed the ky/maint-fix-test-with-tls13 branch from 58b5c76 to e3a3050 Compare August 24, 2017 12:02
Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Fixture feature and integrate some methods to TestUtils module are so cool.

@@ -1,9 +1,9 @@
# frozen_string_literal: false
require_relative 'utils'
require 'stringio'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@rhenium rhenium merged commit 4a8e85e into ruby:maint Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants