Issue #4961 has been reported by Martin Bosslet.

----------------------------------------
Bug #4961: [ext/openssl] SSLSession#initialize fails with OpenSSL 0.9.7
http://redmine.ruby-lang.org/issues/4961

Author: Martin Bosslet
Status: Assigned
Priority: Normal
Assignee: Martin Bosslet
Category: ext
Target version: 1.9.3
ruby -v: trunk r32366


With Ruby at r32366 and OpenSSL 0.97m on Fedora 15, running

  make test-all TESTS="openssl/test_ssl_session.rb"

yields this:

  1) Error:
test_session_time(OpenSSL::TestSSLSession):
ArgumentError: unknown type: expecting an asn1 sequence
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:63:in `initialize'
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:63:in `new'
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:63:in `test_session_time'

  2) Error:
test_session_timeout(OpenSSL::TestSSLSession):
ArgumentError: unknown type: expecting an asn1 sequence
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:76:in `initialize'
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:76:in `new'
    /home/martin/Projekte/Ruby/ruby/test/openssl/test_ssl_session.rb:76:in `test_session_timeout'


The error occurs in ossl_ssl_session_initialize:

  ctx = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL);
  if (!ctx) {
    OSSL_BIO_reset(in);
    ctx = d2i_SSL_SESSION_bio(in, NULL);
  }
  
  BIO_free(in);

  if (!ctx)
    ossl_raise(rb_eArgError, "unknown type");

Since the test tries to create a session from a valid PEM encoding, 
the first call should already have succeeded but does not. It does
succeed with all 0.9.8 versions I tried with and also with 1.0.0d.

The error has first been reported by Koichi Sasada in [ruby-core:37724],
running on MacOS X and OpenSSL 0.9.7m.



-- 
http://redmine.ruby-lang.org