mlichvar pushed to ntp (master). "fix generation of MD5 keys with ntp-keygen on big-endian systems (#1210324)"

notifications at fedoraproject.org notifications at fedoraproject.org
Tue Apr 14 08:01:56 UTC 2015


>From 04665ff25002c969188c9a10cfd9f532040735f7 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar at redhat.com>
Date: Tue, 14 Apr 2015 09:55:39 +0200
Subject: fix generation of MD5 keys with ntp-keygen on big-endian systems
 (#1210324)


diff --git a/ntp-4.2.6p5-bigkeygen.patch b/ntp-4.2.6p5-bigkeygen.patch
new file mode 100644
index 0000000..7cd238d
--- /dev/null
+++ b/ntp-4.2.6p5-bigkeygen.patch
@@ -0,0 +1,31 @@
+diff -up ntp-4.2.6p5/util/ntp-keygen.c.bigkeygen ntp-4.2.6p5/util/ntp-keygen.c
+--- ntp-4.2.6p5/util/ntp-keygen.c.bigkeygen	2015-04-14 09:47:54.205534510 +0200
++++ ntp-4.2.6p5/util/ntp-keygen.c	2015-04-14 09:50:04.068927862 +0200
+@@ -742,24 +742,23 @@ gen_md5(
+ 	ntp_srandom((u_long)epoch);
+ 	for (i = 1; i <= MD5KEYS; i++) {
+ 		for (j = 0; j < MD5SIZE; j++) {
+-			int temp;
++			u_char temp;
+ 
+ 			while (1) {
+ 				int rc;
+ 
+-				rc = ntp_crypto_random_buf(&temp, 1);
++				rc = ntp_crypto_random_buf(&temp, sizeof(temp));
+ 				if (-1 == rc) {
+ 					fprintf(stderr, "ntp_crypto_random_buf() failed.\n");
+ 					exit (-1);
+ 				}
+-				temp &= 0xff;
+ 				if (temp == '#')
+ 					continue;
+ 
+ 				if (temp > 0x20 && temp < 0x7f)
+ 					break;
+ 			}
+-			md5key[j] = (u_char)temp;
++			md5key[j] = temp;
+ 		}
+ 		md5key[j] = '\0';
+ 		fprintf(str, "%2d MD5 %s  # MD5 key\n", i,
diff --git a/ntp.spec b/ntp.spec
index 01ec386..e800f76 100644
--- a/ntp.spec
+++ b/ntp.spec
@@ -123,6 +123,8 @@ Patch35: ntp-4.2.6p5-xleap.patch
 Patch36: ntp-4.2.6p5-cve-2015-1798.patch
 # ntpbz #2781
 Patch37: ntp-4.2.6p5-cve-2015-1799.patch
+# ntpbz #2797
+Patch38: ntp-4.2.6p5-bigkeygen.patch
 
 # handle unknown clock types
 Patch50: ntpstat-0.2-clksrc.patch
@@ -253,6 +255,7 @@ This package contains NTP documentation in HTML format.
 %patch35 -p1 -b .xleap
 %patch36 -p1 -b .cve-2015-1798
 %patch37 -p1 -b .cve-2015-1799
+%patch38 -p1 -b .bigkeygen
 
 # ntpstat patches
 %patch50 -p1 -b .clksrc
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/ntp.git/commit/?h=master&id=04665ff25002c969188c9a10cfd9f532040735f7


More information about the scm-commits mailing list