[ntp:hackers] Crash in ntpd and ntp_keygen

Dave Hart davehart at gmail.com
Sun Nov 15 20:47:49 UTC 2009


On Fri, Nov 13, 2009 at 1:22 PM, Emmanuel, Mathews  IN BLR SISL
<Mathews.Emmannuel at siemens.com> wrote:
> Hi All ,
>
>
> I am trying to run the NTP Daemon source code (ntp-4.2.4p7.tar.gz) with OpenSSL (Win32OpenSSL-0_9_8k.exe) . The application ntpd.exe as well as ntp_keygen.exe crashes while running.
>
>
> I have debugged the source code and found that the crash is happening with the calls PEM_read_PrivateKey and PEM_write_PrivateKey .
>
> What could be the reason and what is the possible resolution?

Make sure you compile ntpd to use the DLL C runtime, and that the
OpenSSL DLL you're using was built against the same version of the C
runtime.  Alternatively, build openssl static .lib files and link
against those.

OpenSSL has a mechanism on Windows that is supposed to isolate the
DLL's C runtime version from the app's, called applink.

Unfortunately, even with the latest OpenSSL and recent ntp-dev ntpd
using the "applink.c" workaround to get openssl to use the app's C
runtime routines for file handles passed in by the app, and special
steps to ensure openssl uses the app's malloc(), Autokey is broken on
Windows when the app and openssl are not sharing a single compatible C
runtime.  This is because OpenSSL fails to honor the "fsetmod" applink
due to a typo (fsetmode instead of fsetmod).  The only way I know to
get Autokey on Windows working is to ensure ntpd and openssl are
sharing the same C runtime code, whether in a DLL or static.

Cheers,
Dave Hart


More information about the hackers mailing list