[Git][NTPsec/ntpsec][master] Fix OpenSSL version fencepost checks

Matt Selsky (@selsky) gitlab at mg.gitlab.com
Wed Oct 28 02:22:31 UTC 2026



Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
bc180180 by Matt Selsky at 2026-10-28T02:17:06+00:00
Fix OpenSSL version fencepost checks

RAND_priv_bytes() appeared in OpenSSL 1.1.1, but the checks for it
required a version above 1.1.1, so 1.1.1 itself fell back to
RAND_bytes(). tlscheck.py, which tests/option-tester.sh uses to decide
whether to test NTS, rejected 1.1.1b along with 1.1.1a.

- - - - -


3 changed files:

- attic/random.c
- libntp/ntp_random.c
- wafhelpers/tlscheck.py


Changes:

=====================================
attic/random.c
=====================================
@@ -128,7 +128,7 @@ static int do_avg_bytes(unsigned int bytes) {
 	return nanos/BATCHSIZE;
 }
 
-#if (OPENSSL_VERSION_NUMBER > 0x1010100fL)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL)
 static int do_avg_priv(unsigned int bytes) {
 	int err = 0;
 	struct timespec start, stop;
@@ -215,7 +215,7 @@ static int do_fast_bytes(unsigned bytes) {
 	return fastest;
 }
 
-#if (OPENSSL_VERSION_NUMBER > 0x1010100fL)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL)
 static int do_fast_priv(unsigned bytes) {
 	int err = 0;
 	struct timespec start, stop;
@@ -259,7 +259,7 @@ static void do_bytes(int bytes) {
 	fflush(stdout);
 }
 
-#if (OPENSSL_VERSION_NUMBER > 0x1010100fL)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL)
 static void do_priv(int bytes) {
 	int average = do_avg_priv(bytes);
 	int fastest = do_fast_priv(bytes);
@@ -296,7 +296,7 @@ int main(int argc, char *argv[]) {
 	do_bytes(160);
 	do_bytes(320);
 
-#if (OPENSSL_VERSION_NUMBER > 0x1010100fL)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL)
 	do_priv(4);
 	do_priv(16);
 	do_priv(32);


=====================================
libntp/ntp_random.c
=====================================
@@ -55,7 +55,7 @@ void ntp_RAND_bytes(unsigned char *buf, int num) {
 
 void ntp_RAND_priv_bytes(unsigned char *buf, int num) {
 	int err;
-#if (OPENSSL_VERSION_NUMBER > 0x1010100fL) && !defined(LIBRESSL_VERSION_NUMBER)
+#if (OPENSSL_VERSION_NUMBER >= 0x1010100fL) && !defined(LIBRESSL_VERSION_NUMBER)
 	err = RAND_priv_bytes(buf, num);
 #else
 	err = RAND_bytes(buf, num);


=====================================
wafhelpers/tlscheck.py
=====================================
@@ -50,6 +50,6 @@ if __name__ == '__main__':
     # OPENSSL_VERSION_NUMBER is a numeric release version identifier:
     # major minor fix patch status
     # Check if version is earlier than 1.1.1b
-    if ver <= ver_to_int(1, 1, 1, 2, 15):
+    if ver < ver_to_int(1, 1, 1, 2, 15):
         sys.exit(1)
     sys.exit(0)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/bc1801804cca361297e86f1f0444b35431ff099e

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/bc1801804cca361297e86f1f0444b35431ff099e
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20261028/fc2d406a/attachment-0001.htm>


More information about the vc mailing list