Changeset 21369 for trunk/src


Ignore:
Timestamp:
Apr 5, 2010, 8:58:35 PM (15 years ago)
Author:
vladest
Message:

Random function, required for security implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/advapi32/crypt.c

    r21353 r21369  
    11461146
    11471147        if (RegOpenKeyW(HKEY_LOCAL_MACHINE, providerW, &hKey))
    1148         {
    1149                 SetLastError(NTE_FAIL);
    1150                 return FALSE;
     1148        {
     1149            dprintf(("CryptEnumProvidersW error. cannot open key"));
     1150            SetLastError(NTE_FAIL);
     1151            return FALSE;
    11511152        }
    11521153
     
    22882289BOOL WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen)
    22892290{
    2290     int dev_random;
    2291 #if 0
    2292     dev_random = open("/dev/urandom", O_RDONLY);
    2293     if (dev_random != -1)
     2291    char *rand_buf = (char*)pbBuffer;
     2292    int i;
     2293
     2294    if (!pbBuffer || dwLen <= 0)
    22942295    {
    2295         if (read(dev_random, pbBuffer, dwLen) == dwLen)
    2296         {
    2297             close(dev_random);
    2298             return TRUE;
    2299         }
    2300         close(dev_random);
     2296        dprintf(("SystemFunction036 error. cannot get random number length %d", dwLen));
     2297        SetLastError(NTE_FAIL);
     2298        return FALSE;
    23012299    }
    2302     else
    2303         FIXME("couldn't open /dev/urandom\n");
    2304 #endif
    2305     SetLastError(NTE_FAIL);
    2306     return FALSE;
    2307 }   
    2308    
     2300
     2301    for (i=0; i<dwLen; i++)
     2302    {
     2303        rand_buf[i] = (char)rand();
     2304    }
     2305    return TRUE;
     2306}
     2307
    23092308/*
    23102309   These functions have nearly identical prototypes to CryptProtectMemory and CryptUnprotectMemory,
Note: See TracChangeset for help on using the changeset viewer.