From 60edff1b502b3f9f314fe10daa4bd57e7a1a3b4c Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Wed, 30 Sep 2026 11:03:27 -0600 Subject: [PATCH] Throw clear errors for the removed MD2 and DSS1 digests EVP_md2 and EVP_dss1 aren't in any OpenSSL version this package supports (1.1 and 3.x), so EvpMD2() and EvpDSS1() failed with "could not load symbol". Closes #28. Co-Authored-By: Claude Opus 5.5 --- src/OpenSSL.jl | 4 ++-- test/runtests.jl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/OpenSSL.jl b/src/OpenSSL.jl index 976fb9a..6bb0968 100644 --- a/src/OpenSSL.jl +++ b/src/OpenSSL.jl @@ -1172,7 +1172,7 @@ end EvpMDNull()::EvpDigest = EvpDigest(ccall((:EVP_md_null, libcrypto), Ptr{Cvoid}, ())) -EvpMD2()::EvpDigest = EvpDigest(ccall((:EVP_md2, libcrypto), Ptr{Cvoid}, ())) +EvpMD2()::EvpDigest = error("MD2 is not available in OpenSSL 1.1 and later") EvpMD5()::EvpDigest = EvpDigest(ccall((:EVP_md5, libcrypto), Ptr{Cvoid}, ())) @@ -1186,7 +1186,7 @@ EvpSHA384()::EvpDigest = EvpDigest(ccall((:EVP_sha384, libcrypto), Ptr{Cvoid}, ( EvpSHA512()::EvpDigest = EvpDigest(ccall((:EVP_sha512, libcrypto), Ptr{Cvoid}, ())) -EvpDSS1()::EvpDigest = EvpDigest(ccall((:EVP_dss1, libcrypto), Ptr{Cvoid}, ())) +EvpDSS1()::EvpDigest = error("DSS1 was removed in OpenSSL 1.1; use EvpSHA1() with DSA keys") """ EVP Message Digest Context. diff --git a/test/runtests.jl b/test/runtests.jl index 15479d2..1b48d4c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -270,6 +270,8 @@ end end @testset "Hash" begin + @test_throws ErrorException EvpMD2() + @test_throws ErrorException EvpDSS1() res = digest(EvpMD5(), IOBuffer("The quick brown fox jumps over the lazy dog")) @test res == UInt8[0x9e, 0x10, 0x7d, 0x9d, 0x37, 0x2b, 0xb6, 0x82, 0x6b, 0xd8, 0x1d, 0x35, 0x42, 0xa4, 0x19, 0xd6] end