apple / swift-nio-ssl

TLS Support for SwiftNIO, based on BoringSSL.
https://swiftpackageindex.com/apple/swift-nio-ssl/main/documentation/niossl
Apache License 2.0
392 stars 142 forks source link

SSLCertificateTest.testNotValidAfter fails on Android armv7 and likely other 32-bit platforms #344

Closed finagolfin closed 1 year ago

finagolfin commented 2 years ago

Somebody recently reported problems using this package on Android armv7, termux/termux-packages#8569, so I had him run the tests for this package on there and he reported this test failing. I reproduced and looked into it today: the issue is an overflow when trying to put too large a UNIX epoch time in seconds into time_t, which is a 32-bit signed integer on Android armv7.

That test has a certificate valid till 2047, which is too long so it fails; you should be able to reproduce on any other 32-bit platform with a similar time_t.

Lukasa commented 2 years ago

While we should update the test to avoid hitting this failure mode, this is a self-healing problem. 32-bit time_t is going away: recent 32-bit Linux userlands will automatically start using a 64-bit time_t (subject to the constraints here) at some point before 2038, or they'll be in real trouble.

Lukasa commented 2 years ago

FWIW I mostly suspect we should simply skip this test on platforms that have a 32-bit time_t, rather than regenerate the cert.

bharsaklemukesh975 commented 1 year ago

Can I work on this?

Lukasa commented 1 year ago

Sure, feel free.