Closed Bug 1114882 Opened 10 years ago Closed 10 years ago

Allow nsICryptoHash to be used in a content process

Categories

(Core :: Security: PSM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: francois, Assigned: keeler)

References

Details

Attachments

(1 file, 3 obsolete files)

The following doesn't work in under e10s when run in a GeckoProcessType_Content process: nsresult rv; nsCOMPtr<nsICryptoHash> cryptoHash; cryptoHash = do_CreateInstance("@mozilla.org/security/hash;1", &rv); The last line above triggers this error: NS_ERROR("Trying to initialize PSM/NSS in a non-chrome process!"); (from http://dxr.mozilla.org/mozilla-central/source/security/manager/ssl/src/nsNSSComponent.cpp?from=nsNSSComponent.cpp&case=true#119) The sub-resource integrity code (bug 992096) uses nsICryptoHash to hash sub-resources and compare that with the expected hash provided in the "integrity" attribute of a script tag.
Attached patch cpp unit test (obsolete) — Splinter Review
Here's my attempt at writing a test (possibly wrong) that should work once nsICryptoHash is made available to the content process.
The test can be run like this: ./mach cppunittest ./obj-x86_64-unknown-linux-gnu/security/manager/ssl/tests/compiled/TestCryptoHash
Attached patch patch (obsolete) — Splinter Review
This should do what we want. The cpp unit test was having some troubles with XPCOM shutdown, I think, so I wrote an xpcshell test that should be sufficient. Long term, I think NSS initialization should be refactored a bit so that it's easier to understand.
Assignee: nobody → dkeeler
Status: NEW → ASSIGNED
Attachment #8547860 - Flags: review?(honzab.moz)
Attachment #8547860 - Flags: feedback?(francois)
Comment on attachment 8547860 [details] [diff] [review] patch I've just tested it with my patch on 992096 and all of my mochitests pass on e10s now.
Attachment #8547860 - Flags: feedback?(francois) → feedback+
Attachment #8547860 - Flags: review?(honzab.moz) → review+
Attachment #8540538 - Attachment is obsolete: true
Attached patch patch as landed (obsolete) — Splinter Review
Attachment #8547860 - Attachment is obsolete: true
Attachment #8552721 - Flags: review+
Well, I guess there's a similar situation with android. https://hg.mozilla.org/integration/mozilla-inbound/rev/51ccf5f265f1
Attachment #8552721 - Attachment is obsolete: true
Flags: needinfo?(dkeeler)
Attachment #8553229 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: