ponylang / crypto

Library of common cryptographic algorithms and functions for Pony
https://ponylang.io
BSD 2-Clause "Simplified" License
11 stars 8 forks source link

Segfault with OpenSSL 3 #77

Closed SeanTAllen closed 1 year ago

SeanTAllen commented 1 year ago

The current tests compile fine with OpenSSL 3 but, there is a segfault with the crypto/Digest test (and perhaps others that are run later). The "OpenSSL 3 migration guide" notes that some functions don't work anymore with 3 but still exist or otherwise return different results. The segfault coming from "FFI land" is probably related to this and will need to be addressed to get this library working with OpenSSL 3. This is particularly bad as it does compile.

SeanTAllen commented 1 year ago

Migration guide is here:

https://www.openssl.org/docs/man3.0/man7/migration_guide.html

SeanTAllen commented 1 year ago

It's the md4 digest that segfault. In particular, calling md4.append("message1")?

SeanTAllen commented 1 year ago

md4 is being deprecated so, the crash doesn't entirely surprise me.

image

SeanTAllen commented 1 year ago

I think we should drop md4 rather than trying to figure out what goes boom with it.

SeanTAllen commented 1 year ago

So the issue is that the MD4 is now a legacy algo and unless you use it directly rather than via the EVP methods that we do in Digest it has to be explicitly loaded otherwise, you get back a null pointer from initialization. This furthers my belief that we should drop support for md4 and set a general policy of dropping any algo that gets made available by openssl's legacy provider.

SeanTAllen commented 1 year ago

We can however only remote the md4 constructor from Digest and have the more limited MD4 primitive continue to work which seems reasonable to be rather than removing all MD4 even if slightly harder to explain.