From: Dave Hart Date: Wed, 31 Jan 2024 20:47:13 +0000 (+0000) Subject: #ifdef out unused put_ieee754() which triggers a warning and appears buggy. X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=19f84b81697c3bf0f514d2cd3cb54edfbb8019bf;p=thirdparty%2Fntp.git #ifdef out unused put_ieee754() which triggers a warning and appears buggy. Insert newlines in long error messages in ntp_openssl.m4, ntp_crypto_rand.m4. bk: 65bab1d1-GrziZe9ubEP6pYabVw18Q --- diff --git a/libparse/ieee754io.c b/libparse/ieee754io.c index 6f6fb0d822..f2c48916ac 100644 --- a/libparse/ieee754io.c +++ b/libparse/ieee754io.c @@ -394,7 +394,22 @@ fetch_ieee754( } } } - + +/* + * DLH: This function is currently unused in ntpd. If you think about + * using it, be sure it does what you intend. I notice the bufpp arg + * is never referenced, and the calculated mantissa_high & mantissa_low + * are only referenced in debug output. It seems they're supposed to + * be composed into an ieee754-format float and stored at *bufpp or + * possibly **bufpp. Brought to my attention by this: + * + * ieee754io.c:414:10: warning: variable 'mantissa_low' set but not used + * [-Wunused-but-set-variable] + * + * To quiet it I'm #ifdef'ing the function away for now, here and below + * the call to it in main(). + */ +#ifdef PUT_IEEE754_UNUSED_FUNC int put_ieee754( unsigned char **bufpp, @@ -534,6 +549,7 @@ put_ieee754( } return IEEE_OK; } +#endif /* */PUT_IEEE754_UNUSED_FUNC */ #if defined(DEBUG) && defined(LIBDEBUG) @@ -560,8 +576,11 @@ int main( printf("fetch from %f = %d\n", f, fetch_ieee754((void *)&f_p, IEEE_DOUBLE, &fp, native_off)); printf("fp [%s %s] = %s\n", fmt_blong(fp.l_ui, 32), fmt_blong(fp.l_uf, 32), mfptoa(fp.l_ui, fp.l_uf, 15)); f_p = &f; +#ifdef PUT_IEEE754_UNUSED_FUNC put_ieee754((void *)&f_p, IEEE_DOUBLE, &fp, native_off); - +/* there should be a check on *f_p (f) having the expected result here */ +#endif /* */PUT_IEEE754_UNUSED_FUNC */ + return 0; } diff --git a/sntp/m4/ntp_crypto_rand.m4 b/sntp/m4/ntp_crypto_rand.m4 index 0341e38451..391f1cbd59 100644 --- a/sntp/m4/ntp_crypto_rand.m4 +++ b/sntp/m4/ntp_crypto_rand.m4 @@ -53,19 +53,20 @@ case "$ntp_openssl$ntp_use_openssl_random$ac_cv_func_RAND_bytes$ac_cv_func_RAND_ AC_MSG_NOTICE([SSL library's secure random number generator unavailable.]) case "$ntp_ssl_random_mandatory" in yes) - AC_MSG_FAILURE( - [No suiteable SSL library was found and ] - [--enable-openssl-random was given.. Remove ] - [--enable-openssl-random if you wish to build without a ] - [cryptographically secure RNG. ] - [WARNING: Use of ntp-keygen without a secure RNG may generate ] - [keys that are predictable.] + AC_MSG_ERROR( +[No suitable SSL library was found and +--enable-openssl-random was given.. Remove --enable-openssl-random +if you wish to build without a cryptographically secure random number +generator. + +WARNING: Use of ntp-keygen without a secure RNG may generate +------- keys that are predictable.] ) ;; *) AC_MSG_WARN( - [WARNING: Use of ntp-keygen without a secure RNG may generate ] - [keys that are predictable.] +[WARNING: Use of ntp-keygen without a secure RNG may generate +------- keys that are predictable.] ) esac esac diff --git a/sntp/m4/ntp_openssl.m4 b/sntp/m4/ntp_openssl.m4 index 6718b6dd63..74ffb5ad90 100644 --- a/sntp/m4/ntp_openssl.m4 +++ b/sntp/m4/ntp_openssl.m4 @@ -225,10 +225,13 @@ case "$with_crypto" in LIBS="$NTPSSL_SAVED_LIBS" case "$ntp_ssl_libdir" in not_found) - AC_MSG_ERROR([You may want to use --without-crypto, or] - [ add openssl.pc/libcrypto.pc to PKG_CONFIG_PATH,] - [ or use the --with-openssl-libdir=/some/path option to configure:] - [ libcrypto not found in $ntp_ssl_libdir_search.]) + AC_MSG_ERROR( +[You may want to use --without-crypto, or add +openssl.pc/libcrypto.pc to PKG_CONFIG_PATH, or use the +--with-openssl-libdir=/some/path option to configure. +libcrypto not found in any of the following directories: +$ntp_ssl_libdir_search] + ) esac AC_MSG_NOTICE([libcrypto found in $ntp_ssl_libdir]) esac @@ -245,8 +248,8 @@ case "$with_crypto" in esac case "$ntp_ssl_incdir" in 'not needed') - ntp_ssl_incdir_search="$ntp_ssl_incdir" - ;; + ntp_ssl_incdir_search="$ntp_ssl_incdir" + ;; *) AC_MSG_NOTICE([Searching for openssl include directory]) case "$with_openssl_incdir" in @@ -283,10 +286,13 @@ case "$with_crypto" in CPPFLAGS="$NTPSSL_SAVED_CPPFLAGS" case "$ntp_ssl_incdir" in '') - AC_MSG_ERROR([You may want to use --without-crypto, or] - [ add openssl.pc/libcrypto.pc to PKG_CONFIG_PATH,] - [ or use the --with-openssl-incdir=/some/path option to configure:] - [ usable openssl/evp.h not found in $ntp_ssl_incdir_search.]) + AC_MSG_ERROR( +[You may want to use --without-crypto, or add +openssl.pc/libcrypto.pc to PKG_CONFIG_PATH, or use the +-with-openssl-incdir=/some/path option to configure. +No usable openssl/evp.h found in any of the following direcotries: +$ntp_ssl_incdir_search] + ) esac ntp_ssl_cppflags="-I$ntp_ssl_incdir" AC_MSG_NOTICE([Found evp.h in $ntp_ssl_incdir/openssl]) @@ -379,9 +385,10 @@ case "$ntp_openssl:$ntp_ssl_libdir" in case "$build:$ntp_cv_ssl_needs_dashR" in $host:no) AC_MSG_FAILURE( - [Unable to run program using crypto, check openssl.pc or] - [ libcrypto.pc are in PKG_CONFIG_PATH, or provide] - [ --with-openssl-libdir=/some/path]) +[Unable to run program using crypto, check openssl.pc +or libcrypto.pc are in PKG_CONFIG_PATH, or provide the + --with-openssl-libdir=/some/path option to configure.] + ) esac esac esac