Coverage Report

Created: 2026-01-22 06:19

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/nss/lib/ssl/sslinit.c
Line
Count
Source
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 "nss.h"
11
#include "seccomon.h"
12
#include "secerr.h"
13
#include "ssl.h"
14
#include "sslimpl.h"
15
#include "sslproto.h"
16
17
static PRCallOnceType ssl_init = { 0 };
18
PR_STATIC_ASSERT(sizeof(unsigned long) <= sizeof(PRUint64));
19
20
static SECStatus
21
ssl_InitShutdown(void *appData, void *nssData)
22
9
{
23
9
    memset(&ssl_init, 0, sizeof(ssl_init));
24
9
    return SECSuccess;
25
9
}
26
27
PRStatus
28
ssl_InitCallOnce(void *arg)
29
9
{
30
9
    int *error = (int *)arg;
31
9
    SECStatus rv;
32
33
9
    rv = ssl_InitializePRErrorTable();
34
9
    if (rv != SECSuccess) {
35
0
        *error = SEC_ERROR_NO_MEMORY;
36
0
        return PR_FAILURE;
37
0
    }
38
9
#ifdef DEBUG
39
9
    ssl3_CheckCipherSuiteOrderConsistency();
40
9
#endif
41
42
9
    rv = ssl3_ApplyNSSPolicy();
43
9
    if (rv != SECSuccess) {
44
0
        *error = PORT_GetError();
45
0
        return PR_FAILURE;
46
0
    }
47
48
9
    rv = NSS_RegisterShutdown(ssl_InitShutdown, NULL);
49
9
    if (rv != SECSuccess) {
50
0
        *error = PORT_GetError();
51
0
        return PR_FAILURE;
52
0
    }
53
9
    return PR_SUCCESS;
54
9
}
55
56
SECStatus
57
ssl_Init(void)
58
59.5k
{
59
59.5k
    int error;
60
59.5k
    PRStatus nrv = PR_CallOnceWithArg(&ssl_init, ssl_InitCallOnce, &error);
61
59.5k
    if (nrv != PR_SUCCESS) {
62
0
        PORT_SetError(error);
63
0
        return SECFailure;
64
0
    }
65
59.5k
    return SECSuccess;
66
59.5k
}