Closed
Bug 1239421
Opened 9 years ago
Closed 3 years ago
don't go through XPCOM for instantiating nsI{CryptoHash,KeyObject,KeyObjectFactory} things
Categories
(Core :: Security: PSM, defect)
Core
Security: PSM
Tracking
()
RESOLVED
DUPLICATE
of bug 1773797
People
(Reporter: froydnj, Unassigned)
Details
Attachments
(2 files)
4.01 KB,
patch
|
keeler
:
review+
|
Details | Diff | Splinter Review |
2.97 KB,
patch
|
keeler
:
review+
|
Details | Diff | Splinter Review |
No description provided.
![]() |
Reporter | |
Comment 1•9 years ago
|
||
There's no need for things in security/manager/ssl/ to go through XPCOM
to create instances of nsIKeyObject{,Factory}.
Furthermore, the code in nsNTLMAuthModule.cpp was creating nsIKeyObject
objects only to blow them away later with calls to
nsIKeyObjectFactory::KeyFromString. That's useless work, so let's just
get rid of it.
Attachment #8707572 -
Flags: review?(dkeeler)
![]() |
Reporter | |
Comment 2•9 years ago
|
||
Attachment #8707573 -
Flags: review?(dkeeler)
![]() |
||
Comment 3•9 years ago
|
||
Comment on attachment 8707572 [details] [diff] [review]
part 1 - create nsIKeyObject{,Factory} instances directory
Review of attachment 8707572 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good, but one concrete change as a result of not going through XPCOM is that these objects won't ensure that NSS has been initialized. If I'm reading this code correctly, though, these sites can only be reached through something else that will first ensure that NSS has been initialized, so I think we're good there. It might be nice to include a comment to this effect, though.
Attachment #8707572 -
Flags: review?(dkeeler) → review+
![]() |
||
Comment 4•9 years ago
|
||
Comment on attachment 8707573 [details] [diff] [review]
part 2 - create nsICryptoHash instances directly
Review of attachment 8707573 [details] [diff] [review]:
-----------------------------------------------------------------
::: security/manager/ssl/CertBlocklist.cpp
@@ +580,5 @@
> ("certblocklist::IsCertRevoked found by issuer / serial"));
> return NS_OK;
> }
>
> + nsCOMPtr<nsICryptoHash> crypto = new nsCryptoHash();
Same idea that this won't guarantee NSS has been initialized, but currently on all code paths to this point it will have been. Just a comment here should be fine.
Attachment #8707573 -
Flags: review?(dkeeler) → review+
![]() |
Reporter | |
Comment 5•9 years ago
|
||
Ah, I didn't realize there were other constraints at play here. Thanks for pointing those out!
Just having comments seems a bit fragile, though. It seems better to do:
class nsCryptoHash
{
public:
// This does all the NS_NSS_GENERIC_FACTORY_CONSTRUCTOR* stuff from
// nsNSSModule.cpp.
static already_AddRefed<nsCryptoHash> Create();
};
and then call |Create()| from the bits in nsNSSModule.cpp. I'm not sure it can be made to work with the |ensureOperator| bits from NS_NSS_GENERIC_FACTORY_CONSTRUCTOR*, but I'd like to figure out a way to stop calling the component manager from off the main thread. And that means there are going to be more of these sorts of patches to security/, so it seems worthwhile to try and get things right.
WDYT?
Flags: needinfo?(dkeeler)
![]() |
||
Comment 6•9 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #5)
> I'd like to figure out a way to
> stop calling the component manager from off the main thread.
The first NSS initialization has to happen on the main thread as well, so if any of these classes are instantiated off the main thread before NSS has been initialized, things will fail (of course, if NSS has already been initialized, it doesn't matter either way).
There's an ongoing project to rework how all of this initialization happens (more info here: https://wiki.mozilla.org/SecurityEngineering/NSS_Startup_and_Shutdown_in_Gecko ). Part of the plan is to set it up so we don't even need the special NS_NSS_GENERIC_FACTORY_* junk (basically by guaranteeing that NSS will be initialized early in startup). Maybe this can be part of that work?
Flags: needinfo?(dkeeler)
Comment 7•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:dveditz, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee: froydnj+bz → nobody
Flags: needinfo?(dveditz)
Updated•3 years ago
|
Component: Security → Security: PSM
Flags: needinfo?(dveditz)
![]() |
||
Updated•3 years ago
|
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•