Skip to content

Commit 475b2bf

Browse files
committed
Use EVP_Digest{Sign,Verify} when available
LibreSSL 3.4 added EVP_DigestSign() and EVP_DigestVerify(). Use them when available to prepare for the addition of Ed25519 support in LibreSSL 3.7.
1 parent 17fb6f1 commit 475b2bf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/openssl/ossl_pkey.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ ossl_pkey_sign(int argc, VALUE *argv, VALUE self)
951951
rb_jump_tag(state);
952952
}
953953
}
954-
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
954+
#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_LIBRESSL_PREREQ(3, 4, 0)
955955
if (EVP_DigestSign(ctx, NULL, &siglen, (unsigned char *)RSTRING_PTR(data),
956956
RSTRING_LEN(data)) < 1) {
957957
EVP_MD_CTX_free(ctx);
@@ -1056,7 +1056,7 @@ ossl_pkey_verify(int argc, VALUE *argv, VALUE self)
10561056
rb_jump_tag(state);
10571057
}
10581058
}
1059-
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER)
1059+
#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_LIBRESSL_PREREQ(3, 4, 0)
10601060
ret = EVP_DigestVerify(ctx, (unsigned char *)RSTRING_PTR(sig),
10611061
RSTRING_LEN(sig), (unsigned char *)RSTRING_PTR(data),
10621062
RSTRING_LEN(data));

0 commit comments

Comments
 (0)