| 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;
|
| }
|
|
|