SecurityEngineering/NSS Startup and Shutdown in Gecko
This is an informational document outlining the modernization and simplification of NSS startup and shutdown in Gecko. It is organized in three parts: the current setup, the desired setup, and a roadmap for achieving the desired setup. If the current date is later than 1 November 2016, this document is likely out of date.
The Current Setup
Classes in PSM implement a number of interfaces that require NSS functionality. Instantiating any of these classes causes the PSM component to be initialized. This initialization starts a few services needed by (for instance) certificate verification. It also performs the initialization of NSS. This involves calling the overall NSS_Initialize function as well as some configuration options like only enabling specific ciphersuites and loading the trust anchors for certificate verification.
The PSM component observes a number of events, including XPCOM shutdown.