WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
155247
[Win] Implement CryptoDigest
https://bugs.webkit.org/show_bug.cgi?id=155247
Summary
[Win] Implement CryptoDigest
Daniel Bates
Reported
2016-03-09 12:03:03 PST
We should implement CryptoDigest for Windows to have access to cryptographically secure hash algorithms. This will allow us to support Content Security Policy inline script and inline stylesheet hashes on Windows among other benefits.
Attachments
Patch
(6.51 KB, patch)
2016-03-09 12:06 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(6.84 KB, patch)
2016-03-09 14:29 PST
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Patch
(6.85 KB, patch)
2016-03-09 14:35 PST
,
Daniel Bates
bfulgham
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews114 for mac-yosemite
(937.75 KB, application/zip)
2016-03-09 15:49 PST
,
Build Bot
no flags
Details
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-03-09 12:03:49 PST
<
rdar://problem/25065843
>
Daniel Bates
Comment 2
2016-03-09 12:06:45 PST
Created
attachment 273453
[details]
Patch
Alexey Proskuryakov
Comment 3
2016-03-09 12:25:49 PST
Comment on
attachment 273453
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=273453&action=review
> Source/WebCore/ChangeLog:9 > + Implement the CryptoDigest abstraction for Windows so that we can compute cryptographically
Is this covered by any regression tests that can be unskipped?
> Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:83 > + CryptHashData(m_context->hHash, input, length, 0);
Please add a RELEASE_ASSERT for return value. Also, what does the function do for null input and zero length? I don't remember if we ever pass such arguments, or what CommonCrypto does.
> Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:91 > + CryptGetHashParam(m_context->hHash, HP_HASHSIZE, nullptr, &digestLength, 0);
This function also returns a result that we should check.
> Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:94 > + CryptGetHashParam(m_context->hHash, HP_HASHVAL, result.data(), result.size());
I don't think that this is going to compile, as this call has fewer arguments. We should probably assert that the newly provided size matches digestLength.
Daniel Bates
Comment 4
2016-03-09 12:50:05 PST
(In reply to
comment #3
)
> > Source/WebCore/ChangeLog:9 > > + Implement the CryptoDigest abstraction for Windows so that we can compute cryptographically > > Is this covered by any regression tests that can be unskipped? >
Yes, this code is covered by the Content Security Policy tests for inline script and inline stylesheet hashes that I will unskip in the patch for
bug #155007
.
> > Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:83 > > + CryptHashData(m_context->hHash, input, length, 0); > > Please add a RELEASE_ASSERT for return value. >
Will do.
> Also, what does the function do for null input and zero length? [...] >
Will bail out early if either input is null or length is 0. From reading <
https://msdn.microsoft.com/en-us/library/windows/desktop/aa380202(v=vs.85).aspx
> I suspect that this function is likely unhappy when passed a null pointer or zero length based on the presence of the possible error value ERROR_INVALID_PARAMETER.
> > Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:91 > > + CryptGetHashParam(m_context->hHash, HP_HASHSIZE, nullptr, &digestLength, 0); > > This function also returns a result that we should check. >
Will do.
> > Source/WebCore/platform/crypto/win/CryptoDigestWin.cpp:94 > > + CryptGetHashParam(m_context->hHash, HP_HASHVAL, result.data(), result.size()); > > I don't think that this is going to compile, as this call has fewer > arguments. We should probably assert that the newly provided size matches > digestLength.
Oops! Will fix.
Daniel Bates
Comment 5
2016-03-09 14:29:46 PST
Created
attachment 273479
[details]
Patch
Daniel Bates
Comment 6
2016-03-09 14:35:47 PST
Created
attachment 273483
[details]
Patch
Brent Fulgham
Comment 7
2016-03-09 14:50:07 PST
Comment on
attachment 273483
[details]
Patch r=me. Please land if the tests are green.
Build Bot
Comment 8
2016-03-09 15:49:24 PST
Comment on
attachment 273483
[details]
Patch
Attachment 273483
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/950532
New failing tests: js/function-apply.html
Build Bot
Comment 9
2016-03-09 15:49:26 PST
Created
attachment 273495
[details]
Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
Daniel Bates
Comment 10
2016-03-09 17:08:54 PST
Committed
r197905
: <
http://trac.webkit.org/changeset/197905
>
Daniel Bates
Comment 11
2016-03-09 17:47:25 PST
Committed Windows build fix in <
https://trac.webkit.org/changeset/197911
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug