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

Unified Diff: net/third_party/nss/ssl/sslinit.c

Issue 1844813002: Uprev NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more GN fix Created 4 years, 8 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 | « net/third_party/nss/ssl/sslinfo.c ('k') | net/third_party/nss/ssl/sslmutex.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/nss/ssl/sslinit.c
diff --git a/net/third_party/nss/ssl/sslinit.c b/net/third_party/nss/ssl/sslinit.c
index bb9df255f35d6cd89a363c94f65625232b1264d0..0f38c0b57bd41f7a4982f4a9298f6fe1a25c619a 100644
--- a/net/third_party/nss/ssl/sslinit.c
+++ b/net/third_party/nss/ssl/sslinit.c
@@ -11,23 +11,49 @@
#include "secerr.h"
#include "ssl.h"
#include "sslimpl.h"
+#include "sslproto.h"
-static int ssl_inited = 0;
+static int ssl_isInited = 0;
+static PRCallOnceType ssl_init = { 0 };
-SECStatus
-ssl_Init(void)
+PRStatus
+ssl_InitCallOnce(void *arg)
{
- if (!ssl_inited) {
- if (ssl_InitializePRErrorTable() != SECSuccess) {
- PORT_SetError(SEC_ERROR_NO_MEMORY);
- return (SECFailure);
- }
+ int *error = (int *)arg;
+ SECStatus rv;
+ rv = ssl_InitializePRErrorTable();
+ if (rv != SECSuccess) {
+ *error = SEC_ERROR_NO_MEMORY;
+ return PR_FAILURE;
+ }
#ifdef DEBUG
- ssl3_CheckCipherSuiteOrderConsistency();
+ ssl3_CheckCipherSuiteOrderConsistency();
#endif
- ssl_inited = 1;
+ rv = ssl3_ApplyNSSPolicy();
+ if (rv != SECSuccess) {
+ *error = PORT_GetError();
+ return PR_FAILURE;
+ }
+ return PR_SUCCESS;
+}
+
+SECStatus
+ssl_Init(void)
+{
+ PRStatus nrv;
+
+ /* short circuit test if we are already inited */
+ if (!ssl_isInited) {
+ int error;
+ /* only do this once at init time, block all others until we are done */
+ nrv = PR_CallOnceWithArg(&ssl_init, ssl_InitCallOnce, &error);
+ if (nrv != PR_SUCCESS) {
+ PORT_SetError(error);
+ return SECFailure;
+ }
+ ssl_isInited = 1;
}
return SECSuccess;
}
« no previous file with comments | « net/third_party/nss/ssl/sslinfo.c ('k') | net/third_party/nss/ssl/sslmutex.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698