WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
188978
[WinCairo] Add CryptoDigestOpenSSL
https://bugs.webkit.org/show_bug.cgi?id=188978
Summary
[WinCairo] Add CryptoDigestOpenSSL
Yoshiaki Jitsukawa
Reported
2018-08-26 23:28:39 PDT
It's nice to have a CryptoDigest implementation with OpenSSL/LibreSSL, which could potentially be shared with other ports.
Attachments
patch
(17.67 KB, patch)
2018-08-27 02:29 PDT
,
Yoshiaki Jitsukawa
no flags
Details
Formatted Diff
Diff
Patch take2
(17.19 KB, patch)
2018-08-27 16:37 PDT
,
Yoshiaki Jitsukawa
achristensen
: review-
Details
Formatted Diff
Diff
Patch take3
(15.79 KB, patch)
2018-08-29 05:38 PDT
,
Yoshiaki Jitsukawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Yoshiaki Jitsukawa
Comment 1
2018-08-27 02:29:37 PDT
Created
attachment 348128
[details]
patch
Don Olmstead
Comment 2
2018-08-27 10:29:42 PDT
Comment on
attachment 348128
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=348128&action=review
LGTM and adding tests is awesome. I'm just not sure we need all the #ifndef's hanging out.
> Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:38 > +#ifndef OPENSSL_NO_SHA1
What are the cases where this and the other macros would be defined?
> Tools/TestWebKitAPI/PlatformWin.cmake:129 > +if (PAL_LIBRARY_TYPE MATCHES STATIC)
Could this go into the root CMakelists.txt?
Alex Christensen
Comment 3
2018-08-27 11:23:08 PDT
Comment on
attachment 348128
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=348128&action=review
>> Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:38 >> +#ifndef OPENSSL_NO_SHA1 > > What are the cases where this and the other macros would be defined?
Do we want to support those cases? I think probably not, especially not without a fallback.
> Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:71 > + : m_context(new CryptoDigestContext)
This is what std::make_unique is for.
Don Olmstead
Comment 4
2018-08-27 16:02:10 PDT
Myles and Alex after this would we like to create a TestPAL project? There's a legit test now in the repository.
Yoshiaki Jitsukawa
Comment 5
2018-08-27 16:25:38 PDT
Thanks for the reviews. I'm revising my patch.
Yoshiaki Jitsukawa
Comment 6
2018-08-27 16:31:00 PDT
(In reply to Don Olmstead from
comment #2
)
> > Tools/TestWebKitAPI/PlatformWin.cmake:129 > > +if (PAL_LIBRARY_TYPE MATCHES STATIC) > > Could this go into the root CMakelists.txt?
I don't think so since somehow TestWebCoreLib is defined in each Platform*.cmake, perhaps due to JSCOnly.
Don Olmstead
Comment 7
2018-08-27 16:34:59 PDT
(In reply to Yoshiaki Jitsukawa from
comment #6
)
> (In reply to Don Olmstead from
comment #2
) > > > Tools/TestWebKitAPI/PlatformWin.cmake:129 > > > +if (PAL_LIBRARY_TYPE MATCHES STATIC) > > > > Could this go into the root CMakelists.txt? > > I don't think so since somehow TestWebCoreLib is defined in each > Platform*.cmake, perhaps due to JSCOnly.
K I'll maybe take a look at the CMake stuff for the tests in the future.
Yoshiaki Jitsukawa
Comment 8
2018-08-27 16:37:41 PDT
Created
attachment 348235
[details]
Patch take2 Removing #ifndefs and switching to make_unique().
Alex Christensen
Comment 9
2018-08-28 09:27:40 PDT
Comment on
attachment 348235
[details]
Patch take2 View in context:
https://bugs.webkit.org/attachment.cgi?id=348235&action=review
> Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:81 > + case CryptoDigest::Algorithm::SHA_1: > + delete toSHA1Context(m_context.get()); > + return; > + case CryptoDigest::Algorithm::SHA_224: > + delete toSHA224Context(m_context.get()); > + return;
This is what a virtual destructor is for.
> Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:96 > + std::unique_ptr<CryptoDigest> digest(new CryptoDigest);
This is also what make_unique is for.
Yoshiaki Jitsukawa
Comment 10
2018-08-29 05:38:26 PDT
Created
attachment 348399
[details]
Patch take3 Using template to generate CryptoDigestContextImpl variants of SHA family.
Yoshiaki Jitsukawa
Comment 11
2018-08-29 05:41:52 PDT
(In reply to Alex Christensen from
comment #9
)
> > Source/WebCore/PAL/pal/crypto/openssl/CryptoDigestOpenSSL.cpp:96 > > + std::unique_ptr<CryptoDigest> digest(new CryptoDigest); > > This is also what make_unique is for.
Since the constructor of CryptoDigest is private, unfortunately make_unique cannot invoke it.
Alex Christensen
Comment 12
2018-08-29 18:58:43 PDT
Why don't we make the constructor public instead of having a static create method that returns a unique_ptr? And why doesn't this replace wtf/SHA1.h?
Yoshiaki Jitsukawa
Comment 13
2018-08-29 20:35:42 PDT
(In reply to Alex Christensen from
comment #12
)
> And why doesn't this replace wtf/SHA1.h?
I think that's because WTF::Persistence::Encoder and JSC::CodeBlockHash use it.
Yoshiaki Jitsukawa
Comment 14
2018-08-29 20:47:20 PDT
(In reply to Alex Christensen from
comment #12
)
> Why don't we make the constructor public instead of having a static create > method that returns a unique_ptr?
I suppose we don't want to return a CryptoDigest instance with unsupported algorithm. As far as I see CryptoDigestWin lacks SHA_224.
WebKit Commit Bot
Comment 15
2018-09-01 22:33:59 PDT
Comment on
attachment 348399
[details]
Patch take3 Clearing flags on attachment: 348399 Committed
r235587
: <
https://trac.webkit.org/changeset/235587
>
WebKit Commit Bot
Comment 16
2018-09-01 22:34:01 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 17
2018-09-01 22:34:15 PDT
<
rdar://problem/44041807
>
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