Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: patches/nss-rtlgenrandom.patch

Issue 17773004: Update NSS to NSS_3_15_1_BETA2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « patches/nss-include-guard.patch ('k') | patches/nss-secoid-mistake.patch » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patches/nss-rtlgenrandom.patch
===================================================================
--- patches/nss-rtlgenrandom.patch (revision 206843)
+++ patches/nss-rtlgenrandom.patch (working copy)
@@ -1,110 +0,0 @@
-diff --git a/lib/freebl/win_rand.c b/lib/freebl/win_rand.c
---- a/lib/freebl/win_rand.c
-+++ b/lib/freebl/win_rand.c
-@@ -362,102 +362,37 @@ void RNG_FileForRNG(const char *filename
- }
-
- nBytes = RNG_GetNoise(buffer, 20); // get up to 20 bytes
- RNG_RandomUpdate(buffer, nBytes);
- }
-
-
- /*
-- * CryptoAPI requires Windows NT 4.0 or Windows 95 OSR2 and later.
-- * Until we drop support for Windows 95, we need to emulate some
-- * definitions and declarations in <wincrypt.h> and look up the
-- * functions in advapi32.dll at run time.
-- */
--
--#ifndef WIN64
--typedef unsigned long HCRYPTPROV;
--#endif
--
--#define CRYPT_VERIFYCONTEXT 0xF0000000
--
--#define PROV_RSA_FULL 1
--
--typedef BOOL
--(WINAPI *CryptAcquireContextAFn)(
-- HCRYPTPROV *phProv,
-- LPCSTR pszContainer,
-- LPCSTR pszProvider,
-- DWORD dwProvType,
-- DWORD dwFlags);
--
--typedef BOOL
--(WINAPI *CryptReleaseContextFn)(
-- HCRYPTPROV hProv,
-- DWORD dwFlags);
--
--typedef BOOL
--(WINAPI *CryptGenRandomFn)(
-- HCRYPTPROV hProv,
-- DWORD dwLen,
-- BYTE *pbBuffer);
--
--/*
- * Windows XP and Windows Server 2003 and later have RtlGenRandom,
- * which must be looked up by the name SystemFunction036.
- */
- typedef BOOLEAN
- (APIENTRY *RtlGenRandomFn)(
- PVOID RandomBuffer,
- ULONG RandomBufferLength);
-
- size_t RNG_SystemRNG(void *dest, size_t maxLen)
- {
- HMODULE hModule;
- RtlGenRandomFn pRtlGenRandom;
-- CryptAcquireContextAFn pCryptAcquireContextA;
-- CryptReleaseContextFn pCryptReleaseContext;
-- CryptGenRandomFn pCryptGenRandom;
-- HCRYPTPROV hCryptProv;
- size_t bytes = 0;
-
- usedWindowsPRNG = PR_FALSE;
- hModule = LoadLibrary("advapi32.dll");
- if (hModule == NULL) {
-- return rng_systemFromNoise(dest,maxLen);
-+ return bytes;
- }
- pRtlGenRandom = (RtlGenRandomFn)
- GetProcAddress(hModule, "SystemFunction036");
-- if (pRtlGenRandom) {
-- if (pRtlGenRandom(dest, maxLen)) {
-- bytes = maxLen;
-- usedWindowsPRNG = PR_TRUE;
-- } else {
-- bytes = rng_systemFromNoise(dest,maxLen);
-- }
-- goto done;
-+ if (pRtlGenRandom && pRtlGenRandom(dest, maxLen)) {
-+ bytes = maxLen;
-+ usedWindowsPRNG = PR_TRUE;
- }
-- pCryptAcquireContextA = (CryptAcquireContextAFn)
-- GetProcAddress(hModule, "CryptAcquireContextA");
-- pCryptReleaseContext = (CryptReleaseContextFn)
-- GetProcAddress(hModule, "CryptReleaseContext");
-- pCryptGenRandom = (CryptGenRandomFn)
-- GetProcAddress(hModule, "CryptGenRandom");
-- if (!pCryptAcquireContextA || !pCryptReleaseContext || !pCryptGenRandom) {
-- bytes = rng_systemFromNoise(dest,maxLen);
-- goto done;
-- }
-- if (pCryptAcquireContextA(&hCryptProv, NULL, NULL,
-- PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
-- if (pCryptGenRandom(hCryptProv, maxLen, dest)) {
-- bytes = maxLen;
-- usedWindowsPRNG = PR_TRUE;
-- }
-- pCryptReleaseContext(hCryptProv, 0);
-- }
-- if (bytes == 0) {
-- bytes = rng_systemFromNoise(dest,maxLen);
-- }
--done:
- FreeLibrary(hModule);
- return bytes;
- }
- #endif /* is XP_WIN */
« no previous file with comments | « patches/nss-include-guard.patch ('k') | patches/nss-secoid-mistake.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698