439
edits
| Line 62: | Line 62: | ||
=== Comparison of the Current NSS Semantic and this proposal === | === Comparison of the Current NSS Semantic and this proposal === | ||
Current NSS Semantic | '''Current NSS Semantic''' | ||
Scenario 1. | Scenario 1. | ||
| Line 68: | Line 68: | ||
#Application calls NSS_Init(). NSS_Init uses configdir to decide what PKCS #11 modules to load and what databases softoken opens. | #Application calls NSS_Init(). NSS_Init uses configdir to decide what PKCS #11 modules to load and what databases softoken opens. | ||
#Library then calls NSS_Init(). Library ends up using whatever application already openned (in general, this ok, it make sense the the application controls what databases are used by all libraries it uses). | #Library then calls NSS_Init(). Library ends up using whatever application already openned (in general, this ok, it make sense the the application controls what databases are used by all libraries it uses). | ||
#* | #*at this point only the application specified databases are open | ||
#Library noticed that NSS was initializied already and does not call shutdown (hopefully). | #Library noticed that NSS was initializied already and does not call shutdown (hopefully). | ||
#Application calls shutdown. NSS shuts down. Note, if the library had not reached '3' above and continues to use NSS, BadThings(tm) happen. | #Application calls shutdown. NSS shuts down. Note, if the library had not reached '3' above and continues to use NSS, BadThings(tm) happen. | ||
| Line 76: | Line 76: | ||
#Library calls NSS_Init(). NSS is opened based on the library's default configuration (needed because the library may be used in a non-NSS app. | #Library calls NSS_Init(). NSS is opened based on the library's default configuration (needed because the library may be used in a non-NSS app. | ||
#Application calls NSS_Init(). -- none of the application config directories are opened because NSS has already been initialized. | #Application calls NSS_Init(). -- none of the application config directories are opened because NSS has already been initialized. | ||
#* | #*at this point only the library specified databases are open | ||
#Library calls NSS_Shutdown() because the library did not see any users of NSS_Init(). NSS shuts down. The application is hosed if it tries to use NSS. | #Library calls NSS_Shutdown() because the library did not see any users of NSS_Init(). NSS shuts down. The application is hosed if it tries to use NSS. | ||
#Application calls shutdown. NSS shuts down (if it wasn't already shutdown from step 3). Again BadThings happen if the library didn't shutdown at step 3 and continues to use NSS. | #Application calls shutdown. NSS shuts down (if it wasn't already shutdown from step 3). Again BadThings happen if the library didn't shutdown at step 3 and continues to use NSS. | ||
'''Proposal''' | |||
Scenario 1. | Scenario 1. | ||
#Application calls NSS_init() - Same as Scenario 1 step 1 | #Application calls NSS_init() - Same as Scenario 1 step 1 'Current Semantic'. | ||
#Library calls NSS_InitContext() - Application databases remain open, In addition those databases specified by the Library (that aren't already the same as those by the Application database) are opened as all. These are now visible to anyone making NSS calls. | #Library calls NSS_InitContext() - Application databases remain open, In addition those databases specified by the Library (that aren't already the same as those by the Application database) are opened as all. These are now visible to anyone making NSS calls. | ||
#* | #*at this point the union of the databases specified by the library and the application are opened | ||
#Library shutdowns calling NSS_ShutdownContext(). - NSS_ShutdownContext 'closes' the NSSInitContext and decrements the library open count. It notices that someone has called NSS_Init, so NSS is not shutdown yet. (if someone had not called NSS_Init, and the library open count had gone to zero, this call will shut down NSS). | #Library shutdowns calling NSS_ShutdownContext(). - NSS_ShutdownContext 'closes' the NSSInitContext and decrements the library open count. It notices that someone has called NSS_Init, so NSS is not shutdown yet. (if someone had not called NSS_Init, and the library open count had gone to zero, this call will shut down NSS). | ||
#Application calls: | #Application calls: | ||
| Line 95: | Line 95: | ||
Scenario 2. | Scenario 2. | ||
#Library calls NSS_InitContext(). NSS is opened same as Scenario 2 step 1 | #Library calls NSS_InitContext(). NSS is opened same as Scenario 2 step 1 'Current Semantic'. Note: that the internal nss_is_init flag will not be set, the library open count is incremented and a context is returned. | ||
#Application calls NSS_Init() - databases in the application's config that were not already opened are now opened. (of course the internal nss_is_init flag will now be set). | #Application calls NSS_Init() - databases in the application's config that were not already opened are now opened. (of course the internal nss_is_init flag will now be set). | ||
#* | #*at this point the union of the databases specified by the library and the application are opened | ||
#Library shuts down calling NSS_ShutdownContext(). Same as scenario 1 step 3 | #Library shuts down calling NSS_ShutdownContext(). Same as scenario 1 step 3 'Proposal'. | ||
#Application calls a shutdown function: same as scenario 1 step 4 | #Application calls a shutdown function: same as scenario 1 step 4 'Proposal'. | ||
Note 1 | Note 1: NSS_Init and NSS_Shutdown function like the do today. Applications that use them can depend on them just like the do today. | ||
Note 2: The only crashing scenario in the proposal is the application calling NSS_Shutdown on a library (which is the same as we already have today). This can be fixed in the application but using the other shutdown function. | Note 2: The only crashing scenario in the proposal is the application calling NSS_Shutdown on a library (which is the same as we already have today). This can be fixed in the application but using the other shutdown function. | ||
edits