Bug 206449 - [OpenSSL] Add stubs and build for Web Crypto
Summary: [OpenSSL] Add stubs and build for Web Crypto
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Don Olmstead
URL:
Keywords: InRadar
Depends on:
Blocks: 206439
  Show dependency treegraph
 
Reported: 2020-01-17 15:22 PST by Don Olmstead
Modified: 2020-01-22 18:46 PST (History)
10 users (show)

See Also:


Attachments
Patch (58.24 KB, patch)
2020-01-17 16:01 PST, Don Olmstead
no flags Details | Formatted Diff | Diff
Patch (58.24 KB, patch)
2020-01-17 16:05 PST, Don Olmstead
jiewen_tan: review+
Details | Formatted Diff | Diff
Patch (58.87 KB, patch)
2020-01-22 17:34 PST, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Don Olmstead 2020-01-17 15:22:04 PST
Make Web Crypto build with OpenSSL.
Comment 1 Don Olmstead 2020-01-17 16:01:29 PST
Created attachment 388106 [details]
Patch
Comment 2 Don Olmstead 2020-01-17 16:05:03 PST
Created attachment 388107 [details]
Patch

Make style checker as happy as its realistically going to be.
Comment 3 Yoshiaki Jitsukawa 2020-01-17 16:33:49 PST
Comment on attachment 388107 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388107&action=review

> Source/WebCore/crypto/openssl/CryptoKeyRSAOpenSSL.cpp:56
> +    notImplemented();

Shouldn't we call back the "failureCallback" just in case?
Comment 4 Jiewen Tan 2020-01-21 11:28:23 PST
Comment on attachment 388107 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388107&action=review

LGTM. r=me. Please address the following minor issues.

> Source/WebCore/crypto/keys/CryptoKeyRSA.h:55
> +typedef std::unique_ptr<void*> PlatformRSAKeyContainer;

PlatformRSAKey, I believe.

> Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp:29
> +#if ENABLE(WEB_CRYPTO)

I wonder after your change if this ENABLE macro is still needed.

> Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp:29
> +#if ENABLE(WEB_CRYPTO) && HAVE(RSA_PSS)

You probably don't need to include the HAVE(RSA_PSS) macro. And you probably need to set it to 1 for your ports.
Comment 5 Don Olmstead 2020-01-21 11:43:40 PST
Comment on attachment 388107 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=388107&action=review

>> Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp:29
>> +#if ENABLE(WEB_CRYPTO)
> 
> I wonder after your change if this ENABLE macro is still needed.

WEB_CRYPTO can be enabled and disabled so all the .cpp files should technically have these blocks.

>> Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp:29
>> +#if ENABLE(WEB_CRYPTO) && HAVE(RSA_PSS)
> 
> You probably don't need to include the HAVE(RSA_PSS) macro. And you probably need to set it to 1 for your ports.

It looks like this is OpenSSL 1.1.1 where support was added. Things get a bit more tricky with LibreSSL because it always reports as OpenSSL 2.0. When enabling this I think we need to do some kind of HAVE check within the CMake and I'd just want to put that off at the moment.
Comment 6 Jiewen Tan 2020-01-21 11:55:22 PST
(In reply to Don Olmstead from comment #5)
> Comment on attachment 388107 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=388107&action=review
> 
> >> Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp:29
> >> +#if ENABLE(WEB_CRYPTO)
> > 
> > I wonder after your change if this ENABLE macro is still needed.
> 
> WEB_CRYPTO can be enabled and disabled so all the .cpp files should
> technically have these blocks.

I think there is no points to have an ENABLE compile time flag if all ports have the implementation.

> 
> >> Source/WebCore/crypto/openssl/CryptoAlgorithmRSA_PSSOpenSSL.cpp:29
> >> +#if ENABLE(WEB_CRYPTO) && HAVE(RSA_PSS)
> > 
> > You probably don't need to include the HAVE(RSA_PSS) macro. And you probably need to set it to 1 for your ports.
> 
> It looks like this is OpenSSL 1.1.1 where support was added. Things get a
> bit more tricky with LibreSSL because it always reports as OpenSSL 2.0. When
> enabling this I think we need to do some kind of HAVE check within the CMake
> and I'd just want to put that off at the moment.

Apple ports have this because RSA-PSS was added to CommonCrypto recently. Didn't know that OpenSSL has the same issue.
Comment 7 Don Olmstead 2020-01-22 17:34:36 PST
Created attachment 388495 [details]
Patch
Comment 8 Don Olmstead 2020-01-22 17:37:02 PST
(In reply to Jiewen Tan from comment #6)
> (In reply to Don Olmstead from comment #5)
> > Comment on attachment 388107 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=388107&action=review
> > 
> > >> Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp:29
> > >> +#if ENABLE(WEB_CRYPTO)
> > > 
> > > I wonder after your change if this ENABLE macro is still needed.
> > 
> > WEB_CRYPTO can be enabled and disabled so all the .cpp files should
> > technically have these blocks.
> 
> I think there is no points to have an ENABLE compile time flag if all ports
> have the implementation.
> 

I'd be happy to remove the ENABLE flags after there's actual implementations for everything.
Comment 9 Jiewen Tan 2020-01-22 17:39:48 PST
(In reply to Don Olmstead from comment #8)
> (In reply to Jiewen Tan from comment #6)
> > (In reply to Don Olmstead from comment #5)
> > > Comment on attachment 388107 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=388107&action=review
> > > 
> > > >> Source/WebCore/crypto/openssl/CryptoAlgorithmAES_CBCOpenSSL.cpp:29
> > > >> +#if ENABLE(WEB_CRYPTO)
> > > > 
> > > > I wonder after your change if this ENABLE macro is still needed.
> > > 
> > > WEB_CRYPTO can be enabled and disabled so all the .cpp files should
> > > technically have these blocks.
> > 
> > I think there is no points to have an ENABLE compile time flag if all ports
> > have the implementation.
> > 
> 
> I'd be happy to remove the ENABLE flags after there's actual implementations
> for everything.

Great!
Comment 10 WebKit Commit Bot 2020-01-22 18:44:32 PST
The commit-queue encountered the following flaky tests while processing attachment 388495 [details]:

imported/w3c/web-platform-tests/IndexedDB/fire-error-event-exception.html bug 201481 (authors: shvaikalesh@gmail.com and youennf@gmail.com)
The commit-queue is continuing to process your patch.
Comment 11 WebKit Commit Bot 2020-01-22 18:45:24 PST
Comment on attachment 388495 [details]
Patch

Clearing flags on attachment: 388495

Committed r254958: <https://trac.webkit.org/changeset/254958>
Comment 12 WebKit Commit Bot 2020-01-22 18:45:26 PST
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2020-01-22 18:46:12 PST
<rdar://problem/58820660>