[Git][NTPsec/ntpsec][master] 2 commits: Add version test for ntplogtemp and ntploggps
Hal Murray
gitlab at mg.gitlab.com
Wed Feb 28 20:18:19 UTC 2018
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
6fb6f3ae by Hal Murray at 2018-02-28T12:17:24-08:00
Add version test for ntplogtemp and ntploggps
Cleanup 2>&1 | => |&
- - - - -
58ad217e by Hal Murray at 2018-02-28T12:17:24-08:00
Fix for Issue #461 (OSx)
Remove include openssl/evp.h from ntp_stdlib.h
ntp_stdlib is included by the parser: host vs main
Move ssl_init to macencrypt to avoid a global.
Delete libntp/ssl_init.c
- - - - -
6 changed files:
- attic/digest-timing.c
- include/ntp_stdlib.h
- libntp/macencrypt.c
- − libntp/ssl_init.c
- libntp/wscript
- tests/option-tester.sh
Changes:
=====================================
attic/digest-timing.c
=====================================
--- a/attic/digest-timing.c
+++ b/attic/digest-timing.c
@@ -23,10 +23,10 @@
#ifndef EVP_MD_CTX_reset
/* Slightly older version of OpenSSL */
-/* Similar hack in ssl_init.c */
+/* Similar hack in libntp/macencrypt.c */
#define EVP_MD_CTX_new() EVP_MD_CTX_create()
-#define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy(ctx)
-#define EVP_MD_CTX_reset(ctx) EVP_MD_CTX_init(ctx)
+#define EVP_MD_CTX_free(ctx) EVP_MD_CTX_destroy((ctx))
+#define EVP_MD_CTX_reset(ctx) EVP_MD_CTX_init((ctx))
#endif
=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -10,7 +10,6 @@
#include <signal.h>
#include <errno.h>
#include <stdarg.h>
-#include <openssl/evp.h>
#include "declcond.h" /* ntpd uses ntpd/declcond.h, others include/ */
#include "ntp_net.h"
@@ -155,10 +154,6 @@ extern bool ipv6_works;
/* ssl_init.c */
extern void ssl_init (void);
-/* Avoid 2x create/destroy per packet.
- * need per thread if we start using threads. */
-EVP_MD_CTX *digest_ctx;
-
/* strl-obsd.c */
#ifndef HAVE_STRLCPY /* + */
/*
=====================================
libntp/macencrypt.c
=====================================
--- a/libntp/macencrypt.c
+++ b/libntp/macencrypt.c
@@ -14,10 +14,14 @@
#include "ntp_stdlib.h"
#include "ntp.h"
+static bool ssl_init_done;
+/* Need one per thread. */
+EVP_MD_CTX *digest_ctx;
+
#ifndef EVP_MD_CTX_reset
/* Slightly older version of OpenSSL */
/* Similar hack in ssl_init.c and attic/digest-timing.c */
-#define EVP_MD_CTX_reset(ctx) EVP_MD_CTX_init(ctx)
+#define EVP_MD_CTX_reset(ctx) EVP_MD_CTX_init((ctx))
#endif
/* ctmemeq - test two blocks memory for equality without leaking
@@ -155,3 +159,35 @@ addr2refid(sockaddr_u *addr)
memcpy(&addr_refid, digest, sizeof(addr_refid));
return (addr_refid);
}
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+static void atexit_ssl_cleanup(void);
+#endif
+
+void
+ssl_init(void)
+{
+ if (ssl_init_done)
+ return;
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+ OpenSSL_add_all_digests();
+ atexit(&atexit_ssl_cleanup);
+#endif
+
+ digest_ctx = EVP_MD_CTX_new();
+ ssl_init_done = true;
+}
+
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+static void
+atexit_ssl_cleanup(void)
+{
+ if (!ssl_init_done)
+ return;
+
+ ssl_init_done = false;
+ EVP_cleanup();
+}
+#endif
=====================================
libntp/ssl_init.c deleted
=====================================
--- a/libntp/ssl_init.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ssl_init.c Common OpenSSL initialization code for the various
- * programs which use it.
- *
- * Moved from ntpd/ntp_crypto.c crypto_setup()
- */
-
-#include "config.h"
-#include "ntp_stdlib.h"
-
-#include <stdbool.h>
-#include <openssl/evp.h>
-
-#ifndef EVP_MD_CTX_new
-/* Slightly older version of OpenSSL */
-/* Similar hack in macencrypt.c and attic/digest-timing.c */
-#define EVP_MD_CTX_new() EVP_MD_CTX_create()
-#endif
-
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-static void atexit_ssl_cleanup(void);
-#endif
-
-static bool ssl_init_done;
-EVP_MD_CTX *digest_ctx;
-
-void
-ssl_init(void)
-{
- if (ssl_init_done)
- return;
-
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- OpenSSL_add_all_digests();
- atexit(&atexit_ssl_cleanup);
-#endif
-
- digest_ctx = EVP_MD_CTX_new();
- ssl_init_done = true;
-}
-
-
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-static void
-atexit_ssl_cleanup(void)
-{
- if (!ssl_init_done)
- return;
-
- ssl_init_done = false;
- EVP_cleanup();
-}
-#endif
=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -22,7 +22,6 @@ def build(ctx):
"refidsmear.c",
"socket.c",
"socktoa.c",
- "ssl_init.c",
"syssignal.c",
]
=====================================
tests/option-tester.sh
=====================================
--- a/tests/option-tester.sh
+++ b/tests/option-tester.sh
@@ -20,35 +20,43 @@ doit ()
DIR=test-$1
[ ! -d $DIR ] && mkdir $DIR
rm -rf $DIR/*
- ./waf configure --out=$DIR $2 2>&1 | tee $DIR/test.log
+ ./waf configure --out=$DIR $2 |& tee $DIR/test.log
WAF1=${PIPESTATUS[0]}
WAF2=0
WAF3=0
if [ "$WAF1" = 0 ]
then
- echo 2>&1 | tee -a $DIR/test.log
- ./waf build 2>&1 | tee -a $DIR/test.log
+ echo |& tee -a $DIR/test.log
+ ./waf build |& tee -a $DIR/test.log
WAF2=${PIPESTATUS[0]}
if [ "$WAF2" = 0 ]
then
- echo 2>&1 | tee -a $DIR/test.log
- ./waf check 2>&1 | tee -a $DIR/test.log
+ echo |& tee -a $DIR/test.log
+ ./waf check |& tee -a $DIR/test.log
WAF3=${PIPESTATUS[0]}
fi
fi
if [ "$WAF1" != 0 -o "$WAF2" != 0 -o "$WAF3" != 0 ]
then
- echo | tee -a $DIR/test.log
- echo "Trouble with $DIR" | tee -a $DIR/test.log
+ echo |& tee -a $DIR/test.log
+ echo "Trouble with $DIR" |& tee -a $DIR/test.log
else
- echo -n "VERSION: " | tee -a $DIR/test.log
- ./$DIR/main/ntpd/ntpd --version 2>&1 | tee -a $DIR/test.log
- echo -n "VERSION: " | tee -a $DIR/test.log
- ./$DIR/main/ntpclients/ntpq --version 2>&1 | tee -a $DIR/test.log
- echo -n "VERSION: " | tee -a $DIR/test.log
- ./$DIR/main/ntpclients/ntpdig --version 2>&1 | tee -a $DIR/test.log
- echo -n "VERSION: " | tee -a $DIR/test.log
- ./$DIR/main/ntpclients/ntpmon --version 2>&1 | tee -a $DIR/test.log
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpd/ntpd --version |& tee -a $DIR/test.log
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpclients/ntpq --version |& tee -a $DIR/test.log
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpclients/ntpdig --version |& tee -a $DIR/test.log
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpclients/ntpmon --version |& tee -a $DIR/test.log
+if [ "`which gpsmon 2>/dev/null`" != "" ]
+then
+ # needs GPSD library
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpclients/ntploggps --version |& tee -a $DIR/test.log
+fi
+ echo -n "VERSION: " |& tee -a $DIR/test.log
+ ./$DIR/main/ntpclients/ntplogtemp --version |& tee -a $DIR/test.log
fi
echo
echo
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/fbbead74c7415adec4c40050f9ea67fb15e329d2...58ad217e07330ee6e30da98b6c4b241d551ceb00
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/fbbead74c7415adec4c40050f9ea67fb15e329d2...58ad217e07330ee6e30da98b6c4b241d551ceb00
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180228/1b70ecd9/attachment.html>
More information about the vc
mailing list