AC_SUBST(OPENSSL_INC)
AC_SUBST(OPENSSL_LIB)
-AC_SUBST(MAKE_NTP_KEYGEN)
-
AC_MSG_CHECKING(for openssl library directory)
AC_ARG_WITH(openssl-libdir,
AC_HELP_STRING([--with-openssl-libdir], [+ =/something/reasonable]),
CPPFLAGS="$CPPFLAGS -I$OPENSSL_INC"
LDFLAGS="$LDFLAGS -L$OPENSSL_LIB"
AC_SUBST(LCRYPTO, [-lcrypto])
- MAKE_NTP_KEYGEN=ntp-keygen
AC_DEFINE(OPENSSL, , [Use OpenSSL?])
AC_CHECK_FUNCS(EVP_md2 EVP_mdc2)
fi
extern char *optarg; /* command line argument */
int debug = 0; /* debug, not de bug */
int rval; /* return status */
+#ifdef OPENSSL
u_int modulus = PLEN; /* prime modulus size (bits) */
+#endif
int nkeys = 0; /* MV keys */
time_t epoch; /* Unix epoch (seconds) since 1970 */
char *hostname; /* host name (subject name) */
EVP_PKEY *pkey_iff = NULL; /* IFF parameters */
EVP_PKEY *pkey_gq = NULL; /* GQ parameters */
EVP_PKEY *pkey_mv = NULL; /* MV parameters */
+#endif
int md5key = 0; /* generate MD5 keys */
+#ifdef OPENSSL
int hostkey = 0; /* generate RSA keys */
int iffkey = 0; /* generate IFF parameters */
int gqpar = 0; /* generate GQ parameters */
/*
* Process options, initialize host name and timestamp.
*/
+#ifdef OPENSSL
gethostname(hostbuf, MAXHOSTNAME);
hostname = hostbuf;
trustname = hostbuf;
passwd1 = hostbuf;
+#endif
#ifndef SYS_WINNT
gettimeofday(&tv, 0);
#else
epoch = tv.tv_sec;
rval = 0;
while ((temp = getopt(argc, argv,
- "c:deGgHIi:Mm:nPp:q:S:s:TV:v:")) != -1) {
+#ifdef OPENSSL
+ "c:deGgHIi:Mm:nPp:q:S:s:TV:v:"
+#else
+ "dM"
+#endif
+ )) != -1) {
switch(temp) {
+#ifdef OPENSSL
/*
* -c select public certificate type
*/
case 'c':
scheme = optarg;
continue;
+#endif
/*
* -d debug
debug++;
continue;
+#ifdef OPENSSL
/*
* -e write identity keys
*/
case 'e':
iffsw++;
continue;
+#endif
+#ifdef OPENSSL
/*
* -G generate GQ parameters and keys
*/
case 'G':
gqpar++;
continue;
+#endif
+#ifdef OPENSSL
/*
* -g update GQ keys
*/
case 'g':
gqkey++;
continue;
+#endif
+#ifdef OPENSSL
/*
* -H generate host key (RSA)
*/
case 'H':
hostkey++;
continue;
+#endif
+#ifdef OPENSSL
/*
* -I generate IFF parameters
*/
case 'I':
iffkey++;
continue;
+#endif
+#ifdef OPENSSL
/*
* -i set issuer name
*/
case 'i':
trustname = optarg;
continue;
+#endif
/*
* -M generate MD5 keys
md5key++;
continue;
-
+#ifdef OPENSSL
/*
* -m select modulus (256-2048)
*/
fprintf(stderr,
"invalid option -m %s\n", optarg);
continue;
-
+#endif
+
+#ifdef OPENSSL
/*
* -P generate PC private certificate
*/
case 'P':
exten = EXT_KEY_PRIVATE;
continue;
+#endif
+#ifdef OPENSSL
/*
* -p output private key password
*/
case 'p':
passwd2 = optarg;
continue;
+#endif
+#ifdef OPENSSL
/*
* -q input private key password
*/
case 'q':
passwd1 = optarg;
continue;
+#endif
+#ifdef OPENSSL
/*
* -S generate sign key (RSA or DSA)
*/
case 'S':
sign = optarg;
continue;
+#endif
+#ifdef OPENSSL
/*
* -s set subject name
*/
case 's':
hostname = optarg;
continue;
-
+#endif
+
+#ifdef OPENSSL
/*
* -T trusted certificate (TC scheme)
*/
case 'T':
exten = EXT_KEY_TRUST;
continue;
+#endif
+#ifdef OPENSSL
/*
* -V <keys> generate MV parameters
*/
fprintf(stderr,
"invalid option -V %s\n", optarg);
continue;
+#endif
+#ifdef OPENSSL
/*
* -v <key> update MV keys
*/
fprintf(stderr,
"invalid option -v %s\n", optarg);
continue;
+#endif
/*
* None of the above.
fprintf(stderr,
"Random seed file %s %u bytes\n", pathbuf, temp);
RAND_add(&epoch, sizeof(epoch), 4.0);
+#endif
/*
* Generate new parameters and keys as requested. These replace
*/
if (md5key)
gen_md5("MD5");
+#ifdef OPENSSL
if (hostkey)
pkey_host = genkey("RSA", "host");
if (sign != NULL)
break;
}
}
-#endif /* OPENSSL */
/*
rval = -1;
return (NULL);
}
+#endif /* OPENSSL */
/*