WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
123582
[WebCrypto] Add SHA-1
https://bugs.webkit.org/show_bug.cgi?id=123582
Summary
[WebCrypto] Add SHA-1
Alexey Proskuryakov
Reported
2013-10-31 12:06:29 PDT
Implement SHA-1 glue code, and use Mac system libraries for actual implementation.
Attachments
proposed patch
(30.93 KB, patch)
2013-10-31 12:12 PDT
,
Alexey Proskuryakov
no flags
Details
Formatted Diff
Diff
with a better skip list
(30.98 KB, patch)
2013-10-31 12:20 PDT
,
Alexey Proskuryakov
andersca
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2013-10-31 12:12:19 PDT
Created
attachment 215662
[details]
proposed patch
WebKit Commit Bot
Comment 2
2013-10-31 12:13:25 PDT
Attachment 215662
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/TestExpectations', u'LayoutTests/security/crypto-subtle-arguments-expected.txt', u'LayoutTests/security/crypto-subtle-arguments.html', u'LayoutTests/security/crypto-subtle-sha1-expected.txt', u'LayoutTests/security/crypto-subtle-sha1.html', u'LayoutTests/security/resources/common.js', u'Source/WebCore/ChangeLog', u'Source/WebCore/WebCore.xcodeproj/project.pbxproj', u'Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp', u'Source/WebCore/crypto/SubtleCrypto.idl', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.cpp', u'Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h', u'Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp', u'Source/WebCore/crypto/mac/CryptoAlgorithmSHA1Mac.cpp']" exit_code: 1 LayoutTests/TestExpectations:79: Path does not exist. [test/expectations] [5] Total errors found: 1 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alexey Proskuryakov
Comment 3
2013-10-31 12:20:48 PDT
Created
attachment 215664
[details]
with a better skip list
Anders Carlsson
Comment 4
2013-10-31 12:24:14 PDT
Comment on
attachment 215664
[details]
with a better skip list View in context:
https://bugs.webkit.org/attachment.cgi?id=215664&action=review
> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:49 > + return 0;
nullptr.
> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:55 > + return std::move(result);
No need for std::move here.
> Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h:38 > + static const char* const m_name; > + static const CryptoAlgorithmIdentifier m_identifier = CryptoAlgorithmIdentifier::SHA_1;
We usually don’t use m_ for public member variables, at least I don’t think we do.
Alexey Proskuryakov
Comment 5
2013-10-31 12:30:14 PDT
Committed <
http://trac.webkit.org/r158387
>.
Darin Adler
Comment 6
2013-10-31 13:45:51 PDT
Comment on
attachment 215664
[details]
with a better skip list View in context:
https://bugs.webkit.org/attachment.cgi?id=215664&action=review
> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:52 > + std::unique_ptr<CryptoAlgorithm> result(CryptoAlgorithmRegistry::shared().create(algorithmIdentifier));
I would write: auto result = CryptoAlgorithmRegistry::shared().create(algorithmIdentifier);
> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:86 > + std::unique_ptr<CryptoAlgorithm> algorithm = createAlgorithmFromJSValue(exec, exec->uncheckedArgument(0));
I like auto better than std::unique_ptr here.
> Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp:92 > + std::unique_ptr<CryptoAlgorithmParameters> parameters = JSCryptoAlgorithmDictionary::createParametersForDigest(exec, algorithm->identifier(), exec->uncheckedArgument(0));
I like auto better than std::unique_ptr here.
>> Source/WebCore/crypto/algorithms/CryptoAlgorithmSHA1.h:38 >> + static const CryptoAlgorithmIdentifier m_identifier = CryptoAlgorithmIdentifier::SHA_1; > > We usually don’t use m_ for public member variables, at least I don’t think we do.
We definitely don’t use m_ for static data members. We normally avoid public member variables entirely, except when we use a struct instead of a class and we don’t use prefixes at all. I think it would be best to use a public static function instead of a public static data member. Inline if it needs to be.
> Source/WebCore/crypto/mac/CryptoAlgorithmSHA1Mac.cpp:36 > +void CryptoAlgorithmSHA1::digest(const CryptoAlgorithmParameters&, const Vector<CryptoOperationData>& data, std::unique_ptr<PromiseWrapper> promise, ExceptionCode&)
Seems like this should take PromiseWrapper& instead of unique_ptr<PromiseWrapper>.
Alexey Proskuryakov
Comment 7
2013-10-31 14:02:02 PDT
> I like auto better than std::unique_ptr here.
Can try how this works. I'm worried that with smart pointers replaced with auto, it will be harder to confirm that there are no memory leaks.
> Seems like this should take PromiseWrapper& instead of unique_ptr<PromiseWrapper>.
The interface is designed to allow for async execution, so I don't think that this would work.
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