From: Danny Mayer Date: Sat, 28 Jun 2003 02:19:49 +0000 (-0400) Subject: Add Win32 support for ntp-keygen and upgrade OpenSSL to 0.9.7b. X-Git-Tag: NTP_4_2_0~70^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b955831d749eb85cbc06351c346d43e438a421b2;p=thirdparty%2Fntp.git Add Win32 support for ntp-keygen and upgrade OpenSSL to 0.9.7b. bk: 3efcfb45lBrCGQTHg842qapwJWvI1A --- diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index 7566006b09..d411ab1989 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -82,6 +82,7 @@ int NT_set_process_priority(void); /* Define this function */ # define QSORT_USES_VOID_P # define HAVE_SETVBUF # define HAVE_VSPRINTF +# define HAVE_SNPRINTF # define HAVE_PROTOTYPES /* from ntpq.mak */ # define HAVE_MEMMOVE # define HAVE_TERMIOS_H diff --git a/ports/winnt/libntp/libntp.dsp b/ports/winnt/libntp/libntp.dsp index 5fae5a6b26..f1a32760fd 100644 --- a/ports/winnt/libntp/libntp.dsp +++ b/ports/winnt/libntp/libntp.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W4 /GX /O2 /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c +# ADD CPP /nologo /MT /W4 /GX /O2 /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /D "NDEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /FI"windows.h" /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /FI"windows.h" /D "_DEBUG" /D "_LIB" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -329,6 +329,10 @@ SOURCE=..\..\..\libntp\prettydate.c # End Source File # Begin Source File +SOURCE=.\randfile.c +# End Source File +# Begin Source File + SOURCE=..\..\..\libntp\ranny.c # End Source File # Begin Source File diff --git a/ports/winnt/libntp/randfile.c b/ports/winnt/libntp/randfile.c new file mode 100644 index 0000000000..80689174df --- /dev/null +++ b/ports/winnt/libntp/randfile.c @@ -0,0 +1,114 @@ +/* + * Make sure that there is a good source of random characters + * so that OpenSSL can work properly and securely. + */ + +/* Skip asynch rpc inclusion */ +#ifndef __RPCASYNC_H__ +#define __RPCASYNC_H__ +#endif + +#include +#include + +#include + +unsigned int getrandom_chars(int desired, unsigned char *buf, int lenbuf); +BOOL create_random_file(char *filename); + +BOOL +init_randfile() +{ + FILE *rf; + char *randfile; + char *homedir; + char tmp[256]; + /* See if the environmental variable RANDFILE is defined + * and the file exists + */ + randfile = getenv("RANDFILE"); + if (randfile != NULL) { + rf = fopen(randfile, "rb"); + if (rf != NULL) { + fclose(rf); + return (TRUE); + } + else { + /* The environmental variable exists but not the file */ + return (create_random_file(randfile)); + } + } + /* + * If the RANDFILE environmental variable does not exist, + * see if the HOME enviromental variable exists and + * a .rnd file is in there. + */ + homedir = getenv("HOME"); + if (homedir != NULL) { + strcpy(tmp, homedir); + strcat(tmp, "\\.rnd"); + rf = fopen(tmp, "rb"); + if (rf != NULL) { + fclose(rf); + return (TRUE); + } + else { + /* The HOME environmental variable exists but not the file */ + return (create_random_file(tmp)); + } + } + /* + * Final try. Look for it on the C:\ directory + * NOTE: This is a really bad place for it security-wise + * However, OpenSSL looks for it there if it can't find it elsewhere + */ + rf = fopen("C:\\.rnd", "rb"); + if (rf != NULL) { + fclose(rf); + return (TRUE); + } + /* The file does not exist */ + return (create_random_file("C:\\.rnd")); +} +/* + * Routine to create the random file with 1024 random characters + */ +BOOL +create_random_file(char *filename) { + FILE *rf; + int nchars; + unsigned char buf[1025]; + + nchars = getrandom_chars(1024, buf, sizeof(buf)); + rf = fopen(filename, "wb"); + if (rf == NULL) + return (FALSE); + fwrite(buf, sizeof(unsigned char), nchars, rf); + fclose(rf); + return (TRUE); +} + +unsigned int +getrandom_chars(int desired, unsigned char *buf, int lenbuf) { + HCRYPTPROV hcryptprov; + BOOL err; + + if (buf == NULL || lenbuf <= 0 || desired > lenbuf) + return (0); + /* + * The first time we just try to acquire the context + */ + err = CryptAcquireContext(&hcryptprov, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT); + if (!err){ + return (0); + } + if (!CryptGenRandom(hcryptprov, desired, buf)) { + CryptReleaseContext(hcryptprov, 0); + return (0); + } + + CryptReleaseContext(hcryptprov, 0); + return (desired); +} + diff --git a/ports/winnt/ntp-keygen/ntpkeygen.dsp b/ports/winnt/ntp-keygen/ntpkeygen.dsp new file mode 100644 index 0000000000..7b6270709b --- /dev/null +++ b/ports/winnt/ntp-keygen/ntpkeygen.dsp @@ -0,0 +1,150 @@ +# Microsoft Developer Studio Project File - Name="ntpkeygen" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=ntpkeygen - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "ntpkeygen.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "ntpkeygen.mak" CFG="ntpkeygen - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "ntpkeygen - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "ntpkeygen - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName ""$/ntp/dev/ports/winnt/ntpkeygen", OWBAAAAA" +# PROP Scc_LocalPath "." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "ntpkeygen - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W4 /GX /O2 /I "\\" /I "..\..\..\openssl\inc32" /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/Release/ntp-keygen.exe" + +!ELSEIF "$(CFG)" == "ntpkeygen - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib advapi32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/Debug/ntp-keygen.exe" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "ntpkeygen - Win32 Release" +# Name "ntpkeygen - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\libntp\getopt.c +# End Source File +# Begin Source File + +SOURCE="..\..\..\util\ntp-keygen.c" +# End Source File +# Begin Source File + +SOURCE=..\libntp\randfile.c +# End Source File +# Begin Source File + +SOURCE=..\libntp\util_clockstuff.c +# End Source File +# Begin Source File + +SOURCE=.\version.c +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=..\..\..\configure + +!IF "$(CFG)" == "ntpkeygen - Win32 Release" + +# Begin Custom Build +ProjDir=. +InputPath=..\..\..\configure + +"$(ProjDir)\version.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo Using NT Shell Script to generate version.c + ..\scripts\mkver.bat -P ntpkeygen + +# End Custom Build + +!ELSEIF "$(CFG)" == "ntpkeygen - Win32 Debug" + +# Begin Custom Build +ProjDir=. +InputPath=..\..\..\configure + +"$(ProjDir)\version.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + echo Using NT Shell Script to generate version.c + ..\scripts\mkver.bat -P ntpkeygen + +# End Custom Build + +!ENDIF + +# End Source File +# End Target +# End Project diff --git a/ports/winnt/ntp.dsw b/ports/winnt/ntp.dsw index 222484079b..16ded26aec 100644 --- a/ports/winnt/ntp.dsw +++ b/ports/winnt/ntp.dsw @@ -72,6 +72,18 @@ Package=<4> ############################################################################### +Project: "ntpkeygen"=".\ntp-keygen\ntpkeygen.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + Project: "ntpq"=".\ntpq\ntpq.dsp" - Package Owner=<4> Package=<5> diff --git a/ports/winnt/ntpd/ntpd.dsp b/ports/winnt/ntpd/ntpd.dsp index 54ba4c97c0..c89f770a43 100644 --- a/ports/winnt/ntpd/ntpd.dsp +++ b/ports/winnt/ntpd/ntpd.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W4 /GX /O2 /I "\\" /I "..\..\..\openssl\inc32" /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c +# ADD CPP /nologo /MT /W4 /GX /O2 /I "\\" /I "..\..\..\openssl\inc32" /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /YX"windows.h" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -50,7 +50,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.6g\out32dll\libeay32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/Release/ntpd.exe" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /machine:I386 /out:"../bin/Release/ntpd.exe" !ELSEIF "$(CFG)" == "ntpd - Win32 Debug" @@ -66,7 +66,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.6g\inc32" /FI"windows.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "." /I "..\include" /I "..\..\..\include" /I "\openssl-0.9.7b\inc32" /FI"windows.h" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_MBCS" /D "__STDC__" /D "SYS_WINNT" /D "HAVE_CONFIG_H" /D _WIN32_WINNT=0x400 /FR /YX"windows.h" /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -74,7 +74,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.6g\out32dll\libeay32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/Debug/ntpd.exe" /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib \openssl-0.9.7b\out32dll\libeay32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/Debug/ntpd.exe" /pdbtype:sept !ENDIF diff --git a/util/ntp-keygen.c b/util/ntp-keygen.c index b1bd18a8ea..850ae4cec4 100644 --- a/util/ntp-keygen.c +++ b/util/ntp-keygen.c @@ -98,6 +98,12 @@ #include "ntp_types.h" #include "l_stdlib.h" +#ifdef SYS_WINNT +extern int ntp_getopt P((int, char **, const char *)); +#define getopt ntp_getopt +#define optarg ntp_optarg +#endif + #ifdef OPENSSL #include "openssl/bn.h" #include "openssl/evp.h" @@ -165,6 +171,39 @@ char *passwd2 = NULL; /* output private key password */ long d0, d1, d2, d3; /* callback counters */ #endif /* OPENSSL */ +#ifdef SYS_WINNT +BOOL init_randfile(); + +/* + * Don't try to follow symbolic links + */ +int +readlink(char * link, char * file, int len) { + return (-1); +} +/* + * Don't try to create a symbolic link for now. + * Just move the file to the name you need. + */ +int +symlink(char *filename, char *linkname) { + DeleteFile(linkname); + MoveFile(filename, linkname); + return 0; +} +void +InitWin32Sockets() { + WORD wVersionRequested; + WSADATA wsaData; + wVersionRequested = MAKEWORD(2,0); + if (WSAStartup(wVersionRequested, &wsaData)) + { + fprintf(stderr, "No useable winsock.dll"); + exit(1); + } +} +#endif /* SYS_WINNT */ + /* * Main program */ @@ -203,6 +242,13 @@ main( #endif /* OPENSSL */ u_int temp; +#ifdef SYS_WINNT + /* Initialize before OpenSSL checks */ + InitWin32Sockets(); + if(!init_randfile()) + fprintf(stderr, "Unable to initialize .rnd file\n"); +#endif + #ifdef OPENSSL if (SSLeay() != OPENSSL_VERSION_NUMBER) { fprintf(stderr, @@ -216,7 +262,6 @@ main( } #endif /* OPENSSL */ - /* * Process options, initialize host name and timestamp. */ @@ -224,7 +269,11 @@ main( hostname = hostbuf; trustname = hostbuf; passwd1 = hostbuf; +#ifndef SYS_WINNT gettimeofday(&tv, 0); +#else + gettimeofday(&tv); +#endif epoch = tv.tv_sec; rval = 0; while ((temp = getopt(argc, argv, @@ -648,7 +697,7 @@ gen_md5( { u_char md5key[16]; /* MD5 key */ FILE *str; - u_int temp; + u_int temp = 0; /* Initialize to prevent warnings during compile */ int i, j; fprintf(stderr, "Generating MD5 keys...\n"); @@ -1630,7 +1679,7 @@ x509 ( FILE *str; /* file handle */ ASN1_INTEGER *serial; /* serial number */ const char *id; /* digest/signature scheme name */ - u_char pathbuf[MAXFILENAME + 1]; + char pathbuf[MAXFILENAME + 1]; /* * Generate X509 self-signed certificate. @@ -1652,10 +1701,10 @@ x509 ( X509_gmtime_adj(X509_get_notAfter(cert), YEAR); subj = X509_get_subject_name(cert); X509_NAME_add_entry_by_txt(subj, "commonName", MBSTRING_ASC, - hostname, strlen(hostname), -1, 0); + (unsigned char *) hostname, strlen(hostname), -1, 0); subj = X509_get_issuer_name(cert); X509_NAME_add_entry_by_txt(subj, "commonName", MBSTRING_ASC, - trustname, strlen(trustname), -1, 0); + (unsigned char *) trustname, strlen(trustname), -1, 0); if (!X509_set_pubkey(cert, pkey)) { fprintf(stderr, "Assign key fails\n%s\n", ERR_error_string(ERR_get_error(), NULL)); @@ -1764,7 +1813,7 @@ x509 ( return (1); } - +#if 0 /* asn2ntp is not used */ /* * asn2ntp - convert ASN1_TIME time structure to NTP time */ @@ -1799,7 +1848,7 @@ asn2ntp ( tm.tm_isdst = 0; return (mktime(&tm) + JAN_1970); } - +#endif /* * Callback routine