ruby / openssl

Provides SSL, TLS and general purpose cryptography.
Other
240 stars 167 forks source link

Test fail with OpenSSL 3.3.0 and mingw #744

Open hsbt opened 7 months ago

hsbt commented 7 months ago

I found test fails with OpenSSL 3.3.0 on mingw environment

https://github.com/ruby/ruby/actions/runs/8806703011/job/24172105094?pr=10610

    2) Error:
  OpenSSL::TestASN1#test_generalizedtime:
  OpenSSL::ASN1::ASN1Error: generalizedtime is too short
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode_test'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:435:in `test_generalizedtime'

    3) Error:
  OpenSSL::TestASN1#test_utctime:
  OpenSSL::ASN1::ASN1Error: utctime is too short
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode_test'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:408:in `test_utctime'
MSP-Greg commented 7 months ago

@hsbt

I ran the test file locally, and it passed. Also, ruby-loco's test-all in CI is passing.

I added a mingw job to this repo, and ran CI in my fork. All three ruby-loco builds passed. See https://github.com/MSP-Greg/ruby-openssl/actions/runs/8810008077, they're the last three jobs in the list (ucrt, mswin, & mingw).

Both MSYS2 (ucrt & mingw) and mswin (vcpkg) have updated to OpenSSL 3.3.0.

Tonite is not the best night for digging into this issue, I'll be able to check tomorrow, (if it hasn't been fixed)

It would seem this is particular to ruby/ruby CI...

MSP-Greg commented 7 months ago

Ignore everything above. The CI run that you listed is a backport to Ruby 3.1.x, and Windows 3.1 has always used OpenSSL 1.1.1, so it should be using the 1.1.1 build tool archive files. For some reason it's using the 3.x archives files. That's something in setup-ruby.

See https://github.com/ruby/ruby/actions/runs/8806703011/job/24172105094?pr=10610#step:6:38, which shows 'ucrt64-3.0 build tools'. Thats the archive that contains OpenSSL 3.x.

I just ran Puma CI in my fork, and the Windows Ruby 3.1 job is using the correct archives. Also, the Windows CI job I mentioned above is using the correct archives on the Windows 3.1 job. See https://github.com/MSP-Greg/ruby-openssl/actions/runs/8810008077/job/24181704227#step:3:21, which shows 'ucrt64 build tools'.

I'll look at it tomorrow and see if I can repro it.

junaruga commented 7 months ago

I found test fails with OpenSSL 3.3.0 on mingw environment

https://github.com/ruby/ruby/actions/runs/8806703011/job/24172105094?pr=10610

    2) Error:
  OpenSSL::TestASN1#test_generalizedtime:
  OpenSSL::ASN1::ASN1Error: generalizedtime is too short
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode_test'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:435:in `test_generalizedtime'

    3) Error:
  OpenSSL::TestASN1#test_utctime:
  OpenSSL::ASN1::ASN1Error: utctime is too short
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:700:in `decode_test'
      D:/a/ruby/ruby/src/test/openssl/test_asn1.rb:408:in `test_utctime'

I found the reason. The CI log's PR https://github.com/ruby/ruby/pull/10610 is for the ruby_3_1 branch.

And we need to backport this commit https://github.com/ruby/ruby/commit/dd5e625d7bcb7dc849fdbc2ad8053f9c2724efb4 (https://github.com/ruby/openssl/commit/2e826d571546cdc3beaa884f9e522a102d531641) on the ruby/ruby's master branch into the stable branches: ruby_3_3, ruby_3_2, ruby_3_1 ruby_3_0 branches when we want to pass the tests on the branches.

junaruga commented 7 months ago

I think this issue can generally happen in OpenSSL 3.3.0. Not only mingw.

rhenium commented 7 months ago

728 needs backport.