[Git][NTPsec/ntpsec][master] Abolish an unnecessary macro.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Jan 30 12:51:03 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
21363cf4 by Eric S. Raymond at 2017-01-30T07:50:16-05:00
Abolish an unnecessary macro.

- - - - -


5 changed files:

- include/ntp_stdlib.h
- libntp/authreadkeys.c
- libntp/macencrypt.c
- libntp/ssl_init.c
- ntpd/ntpd.c


Changes:

=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -192,12 +192,6 @@ extern pset_tod_using	set_tod_using;
 
 /* ssl_init.c */
 extern	void	ssl_init		(void);
-extern	bool	ssl_init_done;
-#define	INIT_SSL()				\
-	do {					\
-		if (!ssl_init_done)		\
-			ssl_init();		\
-	} while (0)
 extern	int	keytype_from_text	(const char *,	size_t *);
 extern	const char *keytype_name	(int);
 


=====================================
libntp/authreadkeys.c
=====================================
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -88,7 +88,7 @@ authreadkeys(
 		    file);
 		return false;
 	}
-	INIT_SSL();
+	ssl_init();
 msyslog(LOG_ERR, "authreadkeys: reading %s", file);
 
 	/*


=====================================
libntp/macencrypt.c
=====================================
--- a/libntp/macencrypt.c
+++ b/libntp/macencrypt.c
@@ -59,7 +59,7 @@ mac_authencrypt(
 	 * key type and digest type have been verified when the key
 	 * was created.
 	 */
-	INIT_SSL();
+	ssl_init();
 	if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
 		msyslog(LOG_ERR,
 		    "MAC encrypt: digest init failed");
@@ -96,7 +96,7 @@ mac_authdecrypt(
 	 * key type and digest type have been verified when the key
 	 * was created.
 	 */
-	INIT_SSL();
+	ssl_init();
 	if (!EVP_DigestInit(&ctx, EVP_get_digestbynid(type))) {
 		msyslog(LOG_ERR,
 		    "MAC decrypt: digest init failed");
@@ -130,7 +130,7 @@ addr2refid(sockaddr_u *addr)
 	if (IS_IPV4(addr))
 		return (NSRCADR(addr));
 
-	INIT_SSL();
+	ssl_init();
 
 	EVP_MD_CTX_init(&ctx);
 #ifdef EVP_MD_CTX_FLAG_NON_FIPS_ALLOW


=====================================
libntp/ssl_init.c
=====================================
--- a/libntp/ssl_init.c
+++ b/libntp/ssl_init.c
@@ -18,16 +18,16 @@
 
 void	atexit_ssl_cleanup(void);
 
-bool ssl_init_done;
+static bool ssl_init_done;
 
 void
 ssl_init(void)
 {
-	init_lib();
-
 	if (ssl_init_done)
 		return;
 
+	init_lib();
+
 	ERR_load_crypto_strings();
 	OpenSSL_add_all_algorithms();
 	atexit(&atexit_ssl_cleanup);
@@ -74,7 +74,7 @@ keytype_from_text(
 	 * recognized but begins with 'M' use NID_md5 to be consistent
 	 * with past behavior.
 	 */
-	INIT_SSL();
+	ssl_init();
 	LIB_GETBUF(upcased);
 	strlcpy(upcased, text, LIB_BUFLENGTH);
 	for (pch = upcased; '\0' != *pch; pch++)
@@ -121,7 +121,7 @@ keytype_name(
 	static const char unknown_type[] = "(unknown key type)";
 	const char *name;
 
-	INIT_SSL();
+	ssl_init();
 	name = OBJ_nid2sn(nid);
 	if (NULL == name)
 		name = unknown_type;


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -671,7 +671,7 @@ ntpdmain(
 	 *
 	 * Exactly what command-line options are we expecting here?
 	 */
-	INIT_SSL();
+	ssl_init();
 	init_auth();
 	init_util();
 	init_restrict();



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/21363cf4d2dde7ee299a19d8ba671aceeadbaa54
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170130/34b9b6a3/attachment.html>


More information about the vc mailing list