summaryrefslogtreecommitdiff
path: root/plugins/MirOTR/libgcrypt-1.4.6/random
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-28 15:05:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-28 15:05:53 +0000
commit5ed738eb52c269eb2ff89ee743fdf345efea16d9 (patch)
treede0afdf65d539d351f02a56d09abda0c39f56581 /plugins/MirOTR/libgcrypt-1.4.6/random
parenta1b54aadf426b4ce2ce3c900a889f53f1eec6bce (diff)
compilation fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@669 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirOTR/libgcrypt-1.4.6/random')
-rw-r--r--plugins/MirOTR/libgcrypt-1.4.6/random/random-csprng.c32
-rw-r--r--plugins/MirOTR/libgcrypt-1.4.6/random/rndw32.c24
2 files changed, 28 insertions, 28 deletions
diff --git a/plugins/MirOTR/libgcrypt-1.4.6/random/random-csprng.c b/plugins/MirOTR/libgcrypt-1.4.6/random/random-csprng.c
index 6ab868ae37..ccb90ee863 100644
--- a/plugins/MirOTR/libgcrypt-1.4.6/random/random-csprng.c
+++ b/plugins/MirOTR/libgcrypt-1.4.6/random/random-csprng.c
@@ -743,9 +743,9 @@ read_seed_file (void)
return 0;
#ifdef HAVE_DOSISH_SYSTEM
- fd = open( seed_file_name, O_RDONLY | O_BINARY );
+ fd = _open( seed_file_name, O_RDONLY | O_BINARY );
#else
- fd = open( seed_file_name, O_RDONLY );
+ fd = _open( seed_file_name, O_RDONLY );
#endif
if( fd == -1 && errno == ENOENT)
{
@@ -760,49 +760,49 @@ read_seed_file (void)
}
if (lock_seed_file (fd, seed_file_name, 0))
{
- close (fd);
+ _close (fd);
return 0;
}
if (fstat( fd, &sb ) )
{
log_info(_("can't stat `%s': %s\n"), seed_file_name, strerror(errno) );
- close(fd);
+ _close(fd);
return 0;
}
if (!S_ISREG(sb.st_mode) )
{
log_info(_("`%s' is not a regular file - ignored\n"), seed_file_name );
- close(fd);
+ _close(fd);
return 0;
}
if (!sb.st_size )
{
log_info(_("note: random_seed file is empty\n") );
- close(fd);
+ _close(fd);
allow_seed_file_update = 1;
return 0;
}
if (sb.st_size != POOLSIZE )
{
log_info(_("warning: invalid size of random_seed file - not used\n") );
- close(fd);
+ _close(fd);
return 0;
}
do
{
- n = read( fd, buffer, POOLSIZE );
+ n = _read( fd, buffer, POOLSIZE );
}
while (n == -1 && errno == EINTR );
if (n != POOLSIZE)
{
log_fatal(_("can't read `%s': %s\n"), seed_file_name,strerror(errno) );
- close(fd);/*NOTREACHED*/
+ _close(fd);/*NOTREACHED*/
return 0;
}
- close(fd);
+ _close(fd);
add_randomness( buffer, POOLSIZE, RANDOM_ORIGIN_INIT );
/* add some minor entropy to the pool now (this will also force a mixing) */
@@ -870,13 +870,13 @@ _gcry_rngcsprng_update_seed_file (void)
mix_pool(keypool); rndstats.mixkey++;
#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__)
- fd = open (seed_file_name, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
+ fd = _open (seed_file_name, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,
S_IRUSR|S_IWUSR );
#else
# if LOCK_SEED_FILE
- fd = open (seed_file_name, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR );
+ fd = _open (seed_file_name, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR );
# else
- fd = open (seed_file_name, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR );
+ fd = _open (seed_file_name, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR );
# endif
#endif
@@ -884,7 +884,7 @@ _gcry_rngcsprng_update_seed_file (void)
log_info (_("can't create `%s': %s\n"), seed_file_name, strerror(errno) );
else if (lock_seed_file (fd, seed_file_name, 1))
{
- close (fd);
+ _close (fd);
}
#if LOCK_SEED_FILE
else if (ftruncate (fd, 0))
@@ -897,12 +897,12 @@ _gcry_rngcsprng_update_seed_file (void)
{
do
{
- i = write (fd, keypool, POOLSIZE );
+ i = _write (fd, keypool, POOLSIZE );
}
while (i == -1 && errno == EINTR);
if (i != POOLSIZE)
log_info (_("can't write `%s': %s\n"),seed_file_name, strerror(errno));
- if (close(fd))
+ if (_close(fd))
log_info (_("can't close `%s': %s\n"),seed_file_name, strerror(errno));
}
diff --git a/plugins/MirOTR/libgcrypt-1.4.6/random/rndw32.c b/plugins/MirOTR/libgcrypt-1.4.6/random/rndw32.c
index 55b7256aba..05cc952b7a 100644
--- a/plugins/MirOTR/libgcrypt-1.4.6/random/rndw32.c
+++ b/plugins/MirOTR/libgcrypt-1.4.6/random/rndw32.c
@@ -258,16 +258,16 @@ init_system_rng (void)
system_rng_available = 0;
hRNGProv = NULL;
- hAdvAPI32 = GetModuleHandle ("AdvAPI32.dll");
+ hAdvAPI32 = GetModuleHandleA("AdvAPI32.dll");
if (!hAdvAPI32)
return;
pCryptAcquireContext = (CRYPTACQUIRECONTEXT)
- GetProcAddress (hAdvAPI32, "CryptAcquireContextA");
+ GetProcAddress(hAdvAPI32, "CryptAcquireContextA");
pCryptGenRandom = (CRYPTGENRANDOM)
- GetProcAddress (hAdvAPI32, "CryptGenRandom");
+ GetProcAddress(hAdvAPI32, "CryptGenRandom");
pCryptReleaseContext = (CRYPTRELEASECONTEXT)
- GetProcAddress (hAdvAPI32, "CryptReleaseContext");
+ GetProcAddress(hAdvAPI32, "CryptReleaseContext");
/* Get a pointer to the native randomness function if it's available.
This isn't exported by name, so we have to get it by ordinal. */
@@ -336,7 +336,7 @@ read_mbm_data (void (*add)(const void*, size_t, enum random_origins),
HANDLE hMBMData;
SharedData *mbmDataPtr;
- hMBMData = OpenFileMapping (FILE_MAP_READ, FALSE, "$M$B$M$5$S$D$" );
+ hMBMData = OpenFileMapping (FILE_MAP_READ, FALSE, _T("$M$B$M$5$S$D$"));
if (hMBMData)
{
mbmDataPtr = (SharedData*)MapViewOfFile (hMBMData, FILE_MAP_READ,0,0,0);
@@ -425,7 +425,7 @@ registry_poll (void (*add)(const void*, size_t, enum random_origins),
if ( debug_me )
log_debug ("rndw32#slow_gatherer_nt: get perf data\n" );
- status = RegQueryValueEx (HKEY_PERFORMANCE_DATA, "Global", NULL,
+ status = RegQueryValueEx (HKEY_PERFORMANCE_DATA, _T("Global"), NULL,
NULL, (LPBYTE) pPerfData, &dwSize);
if (status == ERROR_SUCCESS)
{
@@ -488,7 +488,7 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
log_debug ("rndw32#slow_gatherer: init toolkit\n" );
/* Find out whether this is an NT server or workstation if necessary */
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
+ _T("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
BYTE szValue[32 + 8];
@@ -497,9 +497,9 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
if ( debug_me )
log_debug ("rndw32#slow_gatherer: check product options\n" );
- status = RegQueryValueEx (hKey, "ProductType", 0, NULL,
+ status = RegQueryValueEx (hKey, _T("ProductType"), 0, NULL,
szValue, &dwSize);
- if (status == ERROR_SUCCESS && stricmp (szValue, "WinNT"))
+ if (status == ERROR_SUCCESS && _stricmp (szValue, "WinNT"))
{
/* Note: There are (at least) three cases for ProductType:
WinNT = NT Workstation, ServerNT = NT Server, LanmanNT =
@@ -516,7 +516,7 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
/* readPnPData (); - we have not implemented that. */
/* Initialize the NetAPI32 function pointers if necessary */
- hNetAPI32 = LoadLibrary ("NETAPI32.DLL");
+ hNetAPI32 = LoadLibraryA("NETAPI32.DLL");
if (hNetAPI32)
{
if (debug_me)
@@ -537,7 +537,7 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
}
/* Initialize the NT kernel native API function pointers if necessary */
- hNTAPI = GetModuleHandle ("NTDll.dll");
+ hNTAPI = GetModuleHandleA("NTDll.dll");
if (hNTAPI)
{
/* Get a pointer to the NT native information query functions */
@@ -590,7 +590,7 @@ slow_gatherer ( void (*add)(const void*, size_t, enum random_origins),
/* Check whether we can access this device. */
snprintf (szDevice, sizeof szDevice, "\\\\.\\PhysicalDrive%d",
drive_no);
- hDevice = CreateFile (szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
+ hDevice = CreateFileA(szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
if (hDevice == INVALID_HANDLE_VALUE)
break; /* No more drives. */