[前][次][番号順一覧][スレッド一覧]

ruby-changes:69394

From: Kazuki <ko1@a...>
Date: Mon, 25 Oct 2021 00:43:47 +0900 (JST)
Subject: [ruby-changes:69394] 32d49e93cf (master): [ruby/openssl] ext/openssl/ossl.h: add helper macros for OpenSSL/LibreSSL versions

https://git.ruby-lang.org/ruby.git/commit/?id=32d49e93cf

From 32d49e93cf958adf85eb12fa361f49f26d9559b7 Mon Sep 17 00:00:00 2001
From: Kazuki Yamaguchi <k@r...>
Date: Mon, 27 Sep 2021 13:32:03 +0900
Subject: [ruby/openssl] ext/openssl/ossl.h: add helper macros for
 OpenSSL/LibreSSL versions

Add following convenient macros:

 - OSSL_IS_LIBRESSL
 - OSSL_OPENSSL_PREREQ(maj, min, pat)
 - OSSL_LIBRESSL_PREREQ(maj, min, pat)

https://github.com/ruby/openssl/commit/00abee791d
---
 ext/openssl/ossl.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index be9dcbdff1..3a0ab1e593 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -42,6 +42,18 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl.h#L42
 #include <openssl/evp.h>
 #include <openssl/dh.h>
 
+#ifndef LIBRESSL_VERSION_NUMBER
+# define OSSL_IS_LIBRESSL 0
+# define OSSL_OPENSSL_PREREQ(maj, min, pat) \
+      (OPENSSL_VERSION_NUMBER >= (maj << 28) | (min << 20) | (pat << 12))
+# define OSSL_LIBRESSL_PREREQ(maj, min, pat) 0
+#else
+# define OSSL_IS_LIBRESSL 1
+# define OSSL_OPENSSL_PREREQ(maj, min, pat) 0
+# define OSSL_LIBRESSL_PREREQ(maj, min, pat) \
+      (LIBRESSL_VERSION_NUMBER >= (maj << 28) | (min << 20) | (pat << 12))
+#endif
+
 /*
  * Common Module
  */
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]