Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Apr 2015 10:21:00 +0000 (UTC)
From:      Cy Schubert <cy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281016 - head/contrib/ntp/ntpd
Message-ID:  <201504031021.t33AL00o069766@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cy
Date: Fri Apr  3 10:20:59 2015
New Revision: 281016
URL: https://svnweb.freebsd.org/changeset/base/281016

Log:
  Fix merge error.
  
  Submitted by:	jkim

Modified:
  head/contrib/ntp/ntpd/ntp_crypto.c

Modified: head/contrib/ntp/ntpd/ntp_crypto.c
==============================================================================
--- head/contrib/ntp/ntpd/ntp_crypto.c	Fri Apr  3 10:17:36 2015	(r281015)
+++ head/contrib/ntp/ntpd/ntp_crypto.c	Fri Apr  3 10:20:59 2015	(r281016)
@@ -826,10 +826,10 @@ crypto_recv(
 			 * Decrypt the cookie, hunting all the time for
 			 * errors.
 			 */
-			if (vallen == (u_int) EVP_PKEY_size(host_pkey)) {
+			if (vallen == (u_int)EVP_PKEY_size(host_pkey)) {
 				u_int32 *cookiebuf = malloc(
 				    RSA_size(host_pkey->pkey.rsa));
-				if (cookiebuf == NULL) {
+				if (!cookiebuf) {
 					rval = XEVNT_CKY;
 					break;
 				}
@@ -3817,7 +3817,7 @@ crypto_setup(void)
 			    randfile);
 			exit (-1);
 		}
-		get_systime(&seed);
+		arc4random_buf(&seed, sizeof(l_fp));
 		RAND_seed(&seed, sizeof(l_fp));
 		RAND_write_file(randfile);
 #ifdef DEBUG
@@ -3850,36 +3850,6 @@ crypto_setup(void)
 	pinfo = crypto_key(filename, passwd, NULL);
 	if (pinfo == NULL) {
 		msyslog(LOG_ERR,
-		    "crypto_setup: random seed file not specified");
-		exit (-1);
-	}
-	if ((bytes = RAND_load_file(rand_file, -1)) == 0) {
-		msyslog(LOG_ERR,
-		    "crypto_setup: random seed file %s not found\n",
-		    rand_file);
-		exit (-1);
-	}
-	arc4random_buf(&seed, sizeof(l_fp));
-	RAND_seed(&seed, sizeof(l_fp));
-	RAND_write_file(rand_file);
-	OpenSSL_add_all_algorithms();
-#ifdef DEBUG
-	if (debug)
-		printf(
-		    "crypto_setup: OpenSSL version %lx random seed file %s bytes read %d\n",
-		    SSLeay(), rand_file, bytes);
-#endif
-
-	/*
-	 * Load required host key from file "ntpkey_host_<hostname>". If
-	 * no host key file is not found or has invalid password, life
-	 * as we know it ends. The host key also becomes the default
-	 * sign key. 
-	 */
-	snprintf(filename, sizeof(filename), "ntpkey_host_%s", hostname);
-	pinfo = crypto_key(filename, passwd, NULL);
-	if (pinfo == NULL) {
-		msyslog(LOG_ERR,
 		    "crypto_setup: host key file %s not found or corrupt",
 		    filename);
 		exit (-1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504031021.t33AL00o069766>