diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 09:07:42 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 09:07:42 +0200 |
commit | aff03b0a67c41cf7af5df9c9eef715a8b27a2667 (patch) | |
tree | aa2909ae4718f81c83c8cfb68c1f5a23485b3173 /security/nss/lib/freebl/det_rng.c | |
parent | bdb4ff581677ad1cd411b55a68c87534f9a64882 (diff) | |
parent | 11caf6ecb3cb8c84d2355a6c6e9580a290147e92 (diff) | |
download | UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.gz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.lz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.tar.xz UXP-aff03b0a67c41cf7af5df9c9eef715a8b27a2667.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into js_dom_performance-resource-timing_1
Diffstat (limited to 'security/nss/lib/freebl/det_rng.c')
-rw-r--r-- | security/nss/lib/freebl/det_rng.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/security/nss/lib/freebl/det_rng.c b/security/nss/lib/freebl/det_rng.c index 53d48bc7c..04fce30e8 100644 --- a/security/nss/lib/freebl/det_rng.c +++ b/security/nss/lib/freebl/det_rng.c @@ -8,22 +8,19 @@ #include "nssilock.h" #include "seccomon.h" #include "secerr.h" -#include "prinit.h" #define GLOBAL_BYTES_SIZE 100 static PRUint8 globalBytes[GLOBAL_BYTES_SIZE]; static unsigned long globalNumCalls = 0; static PZLock *rng_lock = NULL; -static PRCallOnceType coRNGInit; -static const PRCallOnceType pristineCallOnce; -static PRStatus -rng_init(void) +SECStatus +RNG_RNGInit(void) { rng_lock = PZ_NewLock(nssILockOther); if (!rng_lock) { PORT_SetError(SEC_ERROR_LIBRARY_FAILURE); - return PR_FAILURE; + return SECFailure; } /* --- LOCKED --- */ PZ_Lock(rng_lock); @@ -31,17 +28,6 @@ rng_init(void) PZ_Unlock(rng_lock); /* --- UNLOCKED --- */ - return PR_SUCCESS; -} - -SECStatus -RNG_RNGInit(void) -{ - /* Allow only one call to initialize the context */ - if (PR_CallOnce(&coRNGInit, rng_init) != PR_SUCCESS) { - return SECFailure; - } - return SECSuccess; } @@ -111,11 +97,8 @@ RNG_GenerateGlobalRandomBytes(void *dest, size_t len) void RNG_RNGShutdown(void) { - if (rng_lock) { - PZ_DestroyLock(rng_lock); - rng_lock = NULL; - } - coRNGInit = pristineCallOnce; + PZ_DestroyLock(rng_lock); + rng_lock = NULL; } /* Test functions are not implemented! */ |