|
|
473877 |
diff -up ntp-4.2.6p5/html/keygen.html.pwcipher ntp-4.2.6p5/html/keygen.html
|
|
|
473877 |
--- ntp-4.2.6p5/html/keygen.html.pwcipher 2012-11-23 13:57:26.178868018 +0100
|
|
|
473877 |
+++ ntp-4.2.6p5/html/keygen.html 2012-11-23 14:44:50.952850361 +0100
|
|
|
473877 |
@@ -44,8 +44,8 @@
|
|
|
473877 |
Synopsis
|
|
|
473877 |
|
|
|
473877 |
<tt>ntp-keygen [ -deGHIMPT ] [ -b modulus ] [ -c [RSA-MD2 | RSA-MD5 | RSA-SHA
|
|
|
473877 |
- | RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ] ] [
|
|
|
473877 |
- -i group ]
|
|
|
473877 |
+ | RSA-SHA1 | RSA-MDC2 | RSA-RIPEMD160 | DSA-SHA | DSA-SHA1 ] ]
|
|
|
473877 |
+ [ -C cipher ] [ -i group ]
|
|
|
473877 |
[ -m modulus ] [ -p passwd2 ] [ -q passwd1 ] [ -S
|
|
|
473877 |
[ RSA | DSA ] ] [ -s host ] [ -V nkeys ]</tt>
|
|
|
473877 |
|
|
|
473877 |
@@ -148,6 +148,9 @@
|
|
|
473877 |
compatibility with FIPS 140-2 is required, either the <tt>DSA-SHA</tt> or <tt>DSA-SHA1</tt> scheme
|
|
|
473877 |
must be used.
|
|
|
473877 |
|
|
|
473877 |
+<tt>-C cipher</tt>
|
|
|
473877 |
+Select the cipher which is used to encrypt the files containing private keys. The default is three-key triple DES in CBC mode, equivalent to "-C des-ede3-cbc". The openssl tool lists ciphers available in "openssl -h" output.
|
|
|
473877 |
+
|
|
|
473877 |
<tt>-d</tt>
|
|
|
473877 |
Enable debugging. This option displays the cryptographic data produced for eye-friendly billboards.
|
|
|
473877 |
|
|
|
473877 |
@@ -215,7 +218,7 @@
|
|
|
473877 |
|
|
|
473877 |
All files begin with two nonencrypted lines. The first line contains the file name in the format <tt>ntpkey_key_host.fstamp</tt>. The second line contains the datestamp in conventional Unix <tt>date</tt> format. Lines beginning with <tt>#</tt> are ignored.
|
|
|
473877 |
|
|
|
473877 |
-The remainder of the file contains cryptographic data encoded first using ASN.1 rules, then encrypted using the DES-CBC algorithm and given password and finally written in PEM-encoded printable ASCII text preceded and followed by MIME content identifier lines.
|
|
|
473877 |
+The remainder of the file contains cryptographic data encoded first using ASN.1 rules, then encrypted using the cipher selected with <tt>-C</tt> and given password and finally written in PEM-encoded printable ASCII text preceded and followed by MIME content identifier lines.
|
|
|
473877 |
|
|
|
473877 |
The format of the symmetric keys file is somewhat different than the other files in the interest of backward compatibility. Since DES-CBC is deprecated in NTPv4, the only key format of interest is MD5 alphanumeric strings. Following the header the keys are entered one per line in the format
|
|
|
473877 |
|
|
|
473877 |
@@ -237,4 +240,4 @@
|
|
|
473877 |
|
|
|
473877 |
</body>
|
|
|
473877 |
|
|
|
473877 |
-</html>
|
|
|
473877 |
\ No newline at end of file
|
|
|
473877 |
+</html>
|
|
|
473877 |
diff -up ntp-4.2.6p5/util/ntp-keygen-opts.def.pwcipher ntp-4.2.6p5/util/ntp-keygen-opts.def
|
|
|
473877 |
--- ntp-4.2.6p5/util/ntp-keygen-opts.def.pwcipher 2009-12-09 08:36:35.000000000 +0100
|
|
|
473877 |
+++ ntp-4.2.6p5/util/ntp-keygen-opts.def 2012-11-23 13:57:26.211868051 +0100
|
|
|
473877 |
@@ -34,6 +34,21 @@ flag = {
|
|
|
473877 |
_EndOfDoc_;
|
|
|
473877 |
};
|
|
|
473877 |
|
|
|
473877 |
+flag = {
|
|
|
473877 |
+ value = C;
|
|
|
473877 |
+ name = cipher;
|
|
|
473877 |
+ arg-type = string;
|
|
|
473877 |
+ arg-name = cipher;
|
|
|
473877 |
+ ifdef = OPENSSL;
|
|
|
473877 |
+ descrip = "privatekey cipher";
|
|
|
473877 |
+ doc = <<- _EndOfDoc_
|
|
|
473877 |
+ Select the cipher which is used to encrypt the files containing
|
|
|
473877 |
+ private keys. The default is three-key triple DES in CBC mode,
|
|
|
473877 |
+ equivalent to "-C des-ede3-cbc". The openssl tool lists ciphers
|
|
|
473877 |
+ available in "openssl -h" output.
|
|
|
473877 |
+ _EndOfDoc_;
|
|
|
473877 |
+};
|
|
|
473877 |
+
|
|
|
473877 |
#include debug-opt.def
|
|
|
473877 |
|
|
|
473877 |
flag = {
|
|
|
473877 |
@@ -134,7 +149,7 @@ flag = {
|
|
|
473877 |
descrip = "output private password";
|
|
|
473877 |
doc = <<- _EndOfDoc_
|
|
|
473877 |
Encrypt generated files containing private data with the specified
|
|
|
473877 |
- password and the DES-CBC algorithm.
|
|
|
473877 |
+ password and the cipher selected with -C/--cipher.
|
|
|
473877 |
_EndOfDoc_;
|
|
|
473877 |
};
|
|
|
473877 |
|
|
|
473877 |
diff -up ntp-4.2.6p5/util/ntp-keygen.c.pwcipher ntp-4.2.6p5/util/ntp-keygen.c
|
|
|
473877 |
--- ntp-4.2.6p5/util/ntp-keygen.c.pwcipher 2012-11-23 13:57:26.202868041 +0100
|
|
|
473877 |
+++ ntp-4.2.6p5/util/ntp-keygen.c 2012-11-23 13:57:26.212868052 +0100
|
|
|
473877 |
@@ -169,6 +169,7 @@ char *passwd1 = NULL; /* input private k
|
|
|
473877 |
char *passwd2 = NULL; /* output private key password */
|
|
|
473877 |
#ifdef OPENSSL
|
|
|
473877 |
long d0, d1, d2, d3; /* callback counters */
|
|
|
473877 |
+const EVP_CIPHER * cipher = NULL;
|
|
|
473877 |
#endif /* OPENSSL */
|
|
|
473877 |
|
|
|
473877 |
#ifdef SYS_WINNT
|
|
|
473877 |
@@ -236,6 +237,7 @@ main(
|
|
|
473877 |
const EVP_MD *ectx; /* EVP digest */
|
|
|
473877 |
char pathbuf[MAXFILENAME + 1];
|
|
|
473877 |
const char *scheme = NULL; /* digest/signature scheme */
|
|
|
473877 |
+ const char *ciphername = NULL; /* to encrypt priv. key */
|
|
|
473877 |
char *exten = NULL; /* private extension */
|
|
|
473877 |
char *grpkey = NULL; /* identity extension */
|
|
|
473877 |
int nid; /* X509 digest/signature scheme */
|
|
|
473877 |
@@ -322,6 +324,9 @@ main(
|
|
|
473877 |
if (HAVE_OPT( CERTIFICATE ))
|
|
|
473877 |
scheme = OPT_ARG( CERTIFICATE );
|
|
|
473877 |
|
|
|
473877 |
+ if (HAVE_OPT( CIPHER ))
|
|
|
473877 |
+ ciphername = OPT_ARG( CIPHER );
|
|
|
473877 |
+
|
|
|
473877 |
if (HAVE_OPT( SUBJECT_NAME ))
|
|
|
473877 |
hostname = strdup(OPT_ARG( SUBJECT_NAME ));
|
|
|
473877 |
|
|
|
473877 |
@@ -418,6 +423,13 @@ main(
|
|
|
473877 |
}
|
|
|
473877 |
if (scheme == NULL)
|
|
|
473877 |
scheme = "RSA-MD5";
|
|
|
473877 |
+ if (ciphername == NULL)
|
|
|
473877 |
+ ciphername = "des-ede3-cbc";
|
|
|
473877 |
+ cipher = EVP_get_cipherbyname(ciphername);
|
|
|
473877 |
+ if (cipher == NULL) {
|
|
|
473877 |
+ fprintf(stderr, "Unknown cipher %s\n", ciphername);
|
|
|
473877 |
+ exit(-1);
|
|
|
473877 |
+ }
|
|
|
473877 |
if (groupname == NULL)
|
|
|
473877 |
groupname = hostname;
|
|
|
473877 |
fprintf(stderr, "Using host %s group %s\n", hostname,
|
|
|
473877 |
@@ -520,9 +532,9 @@ main(
|
|
|
473877 |
BN_copy(rsa->q, BN_value_one());
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_RSA(pkey, rsa);
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL,
|
|
|
473877 |
- NULL);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
|
|
|
473877 |
+ NULL, NULL);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
RSA_print_fp(stderr, rsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -542,9 +554,9 @@ main(
|
|
|
473877 |
rsa = pkey_gqkey->pkey.rsa;
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_RSA(pkey, rsa);
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey,
|
|
|
473877 |
- EVP_des_cbc(), NULL, 0, NULL, passwd2);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
|
|
|
473877 |
+ NULL, passwd2);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
RSA_print_fp(stderr, rsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -584,9 +596,9 @@ main(
|
|
|
473877 |
BN_copy(dsa->priv_key, BN_value_one());
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey, dsa);
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL,
|
|
|
473877 |
- NULL);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
|
|
|
473877 |
+ NULL, NULL);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
DSA_print_fp(stderr, dsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -607,9 +619,9 @@ main(
|
|
|
473877 |
dsa = pkey_iffkey->pkey.dsa;
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey, dsa);
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey, EVP_des_cbc(), NULL,
|
|
|
473877 |
- 0, NULL, passwd2);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
|
|
|
473877 |
+ NULL, passwd2);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
DSA_print_fp(stderr, dsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -645,9 +657,9 @@ main(
|
|
|
473877 |
fprintf(stdout, "# %s\n# %s\n", filename,
|
|
|
473877 |
ctime(&epoch));
|
|
|
473877 |
pkey = pkey_mvpar[2];
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL,
|
|
|
473877 |
- NULL);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, NULL, NULL, 0,
|
|
|
473877 |
+ NULL, NULL);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
DSA_print_fp(stderr, pkey->pkey.dsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -664,9 +676,9 @@ main(
|
|
|
473877 |
fprintf(stdout, "# %s\n# %s\n", filename,
|
|
|
473877 |
ctime(&epoch));
|
|
|
473877 |
pkey = pkey_mvpar[1];
|
|
|
473877 |
- PEM_write_PrivateKey(stdout, pkey, EVP_des_cbc(), NULL,
|
|
|
473877 |
- 0, NULL, passwd2);
|
|
|
473877 |
- fclose(stdout);
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(stdout, pkey, cipher, NULL, 0,
|
|
|
473877 |
+ NULL, passwd2);
|
|
|
473877 |
+ fflush(stdout);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
DSA_print_fp(stderr, pkey->pkey.dsa, 0);
|
|
|
473877 |
}
|
|
|
473877 |
@@ -886,7 +898,7 @@ gen_rsa(
|
|
|
473877 |
str = fheader("RSAhost", id, hostname);
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_RSA(pkey, rsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
fclose(str);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -941,7 +953,7 @@ gen_dsa(
|
|
|
473877 |
str = fheader("DSAsign", id, hostname);
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey, dsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
fclose(str);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -1108,7 +1120,7 @@ gen_iffkey(
|
|
|
473877 |
str = fheader("IFFkey", id, groupname);
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey, dsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
fclose(str);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -1305,7 +1317,7 @@ gen_gqkey(
|
|
|
473877 |
str = fheader("GQkey", id, groupname);
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_RSA(pkey, rsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
fclose(str);
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -1710,7 +1722,7 @@ gen_mvkey(
|
|
|
473877 |
BN_copy(dsa->pub_key, b);
|
|
|
473877 |
pkey = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey, dsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
evpars[i++] = pkey;
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -1736,7 +1748,7 @@ gen_mvkey(
|
|
|
473877 |
dsa2->pub_key = BN_dup(ghat);
|
|
|
473877 |
pkey1 = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_assign_DSA(pkey1, dsa2);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey1, EVP_des_cbc(), NULL, 0, NULL,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey1, cipher, NULL, 0, NULL,
|
|
|
473877 |
passwd1);
|
|
|
473877 |
evpars[i++] = pkey1;
|
|
|
473877 |
if (debug)
|
|
|
473877 |
@@ -1762,7 +1774,7 @@ gen_mvkey(
|
|
|
473877 |
sdsa->pub_key = BN_dup(xhat[j]);
|
|
|
473877 |
pkey1 = EVP_PKEY_new();
|
|
|
473877 |
EVP_PKEY_set1_DSA(pkey1, sdsa);
|
|
|
473877 |
- PEM_write_PrivateKey(str, pkey1, EVP_des_cbc(), NULL, 0,
|
|
|
473877 |
+ PEM_write_PKCS8PrivateKey(str, pkey1, cipher, NULL, 0,
|
|
|
473877 |
NULL, passwd1);
|
|
|
473877 |
evpars[i++] = pkey1;
|
|
|
473877 |
if (debug)
|