From 21c09643ff70488e98ecbc51aab6a0aacc23f999 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Fri, 3 Apr 2015 10:20:59 +0000 Subject: [PATCH] Fix merge error. Submitted by: jkim --- contrib/ntp/ntpd/ntp_crypto.c | 36 +++-------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/contrib/ntp/ntpd/ntp_crypto.c b/contrib/ntp/ntpd/ntp_crypto.c index 60a39bab6c18..8edc357f8ddd 100644 --- a/contrib/ntp/ntpd/ntp_crypto.c +++ b/contrib/ntp/ntpd/ntp_crypto.c @@ -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 @@ -3840,36 +3840,6 @@ crypto_setup(void) memset(&pubkey, 0, sizeof(pubkey)); memset(&tai_leap, 0, sizeof(tai_leap)); - /* - * Load required host key from file "ntpkey_host_". 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: 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_". If * no host key file is not found or has invalid password, life