| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * NSS utility functions | |
| 3 * | |
| 4 * This Source Code Form is subject to the terms of the Mozilla Public | |
| 5 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
| 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| 7 | |
| 8 #include "prtypes.h" | |
| 9 #include "prinit.h" | |
| 10 #include "seccomon.h" | |
| 11 #include "secerr.h" | |
| 12 #include "ssl.h" | |
| 13 #include "sslimpl.h" | |
| 14 #include "sslproto.h" | |
| 15 | |
| 16 static int ssl_isInited = 0; | |
| 17 static PRCallOnceType ssl_init = { 0 }; | |
| 18 | |
| 19 PRStatus | |
| 20 ssl_InitCallOnce(void *arg) | |
| 21 { | |
| 22 int *error = (int *)arg; | |
| 23 SECStatus rv; | |
| 24 | |
| 25 rv = ssl_InitializePRErrorTable(); | |
| 26 if (rv != SECSuccess) { | |
| 27 *error = SEC_ERROR_NO_MEMORY; | |
| 28 return PR_FAILURE; | |
| 29 } | |
| 30 #ifdef DEBUG | |
| 31 ssl3_CheckCipherSuiteOrderConsistency(); | |
| 32 #endif | |
| 33 | |
| 34 rv = ssl3_ApplyNSSPolicy(); | |
| 35 if (rv != SECSuccess) { | |
| 36 *error = PORT_GetError(); | |
| 37 return PR_FAILURE; | |
| 38 } | |
| 39 return PR_SUCCESS; | |
| 40 } | |
| 41 | |
| 42 SECStatus | |
| 43 ssl_Init(void) | |
| 44 { | |
| 45 PRStatus nrv; | |
| 46 | |
| 47 /* short circuit test if we are already inited */ | |
| 48 if (!ssl_isInited) { | |
| 49 int error; | |
| 50 /* only do this once at init time, block all others until we are done */ | |
| 51 nrv = PR_CallOnceWithArg(&ssl_init, ssl_InitCallOnce, &error); | |
| 52 if (nrv != PR_SUCCESS) { | |
| 53 PORT_SetError(error); | |
| 54 return SECFailure; | |
| 55 } | |
| 56 ssl_isInited = 1; | |
| 57 } | |
| 58 return SECSuccess; | |
| 59 } | |
| OLD | NEW |