From: Kurt Zeilenga Date: Wed, 27 Oct 1999 04:41:38 +0000 (+0000) Subject: Port to NT. X-Git-Tag: UCDATA_2_4~310 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f804da9bef8513fcc3375dc6bc9f4ff9cac544bf;p=openldap Port to NT. --- diff --git a/include/portable.nt b/include/portable.nt index af077ef6f2..e358c26848 100644 --- a/include/portable.nt +++ b/include/portable.nt @@ -94,6 +94,9 @@ typedef char * caddr_t; /* we have */ #define HAVE_PROCESS_H 1 +/* we have */ +#define HAVE_WINCRYPT_H 1 + #define LDAP_SIGUSR1 SIGILL #define LDAP_SIGUSR2 SIGTERM diff --git a/libraries/liblutil/entropy.c b/libraries/liblutil/entropy.c index c372efab10..07b4c83b5f 100644 --- a/libraries/liblutil/entropy.c +++ b/libraries/liblutil/entropy.c @@ -6,6 +6,16 @@ #include "portable.h" +#include +#include + +#ifdef HAVE_WINCRYPT_H +#include +#endif +#ifdef HAVE_PROCESS_H +#include +#endif + #include #include @@ -35,6 +45,26 @@ int lutil_entropy( char *buf, int nbytes ) /* should return nbytes */ if( rc < nbytes ) return -1; + return 0; + } +#elif PROV_RSA_FULL + { + /* Not used since _WIN32_WINNT not set... */ + HCRYPTPROV hProv = 0; + + /* Get handle to user default provider */ + if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)) { + return -1; + } + + /* Generate random initialization vector */ + if(!CryptGenRandom(hProv, (DWORD) nbytes, (BYTE *) buf)) { + return -1; + } + + /* Release provider handle */ + if(hProv != 0) CryptReleaseContext(hProv, 0); + return 0; } #else diff --git a/libraries/liblutil/liblutil.dsp b/libraries/liblutil/liblutil.dsp index 54800a3eca..af200def70 100644 --- a/libraries/liblutil/liblutil.dsp +++ b/libraries/liblutil/liblutil.dsp @@ -136,6 +136,10 @@ SOURCE=.\debug.c # End Source File # Begin Source File +SOURCE=.\entropy.c +# End Source File +# Begin Source File + SOURCE="..\..\include\getopt-compat.h" # End Source File # Begin Source File