Bug 157175 - WebCrypto API support for AES-GCM
Summary: WebCrypto API support for AES-GCM
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Macintosh OS X 10.11
: P2 Major
Assignee: Jiewen Tan
URL:
Keywords: InRadar
: 151125 (view as bug list)
Depends on: 160880
Blocks: 166746
  Show dependency treegraph
 
Reported: 2016-04-29 04:33 PDT by Stan Vladut Angel
Modified: 2017-03-03 12:51 PST (History)
12 users (show)

See Also:


Attachments
Console error for AES-GCM generateKey method (17.02 KB, image/png)
2016-04-29 04:33 PDT, Stan Vladut Angel
no flags Details
Patch (773.87 KB, patch)
2017-02-22 21:57 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews121 for ios-simulator-wk2 (854.83 KB, application/zip)
2017-02-22 23:16 PST, Build Bot
no flags Details
Archive of layout-test-results from ews103 for mac-elcapitan (777.58 KB, application/zip)
2017-02-23 06:19 PST, Build Bot
no flags Details
Patch (773.96 KB, patch)
2017-02-23 12:16 PST, Jiewen Tan
bfulgham: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-elcapitan (1.70 MB, application/zip)
2017-02-23 13:45 PST, Build Bot
no flags Details
Patch for landing (774.10 KB, patch)
2017-03-02 13:00 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch for landing (774.10 KB, patch)
2017-03-02 13:51 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff
Patch for landing (774.19 KB, patch)
2017-03-02 18:31 PST, Jiewen Tan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stan Vladut Angel 2016-04-29 04:33:09 PDT
Created attachment 277692 [details]
Console error for AES-GCM generateKey method

Safari lacks of support for WebCrypto.Using WebCrypto requires Chrome, Firefox or Opera on the Mac due to Safari's lack of full support for WebCrypto. Everyone is expecting from Safari to finally add support.

The AES algorithm is the most used one in symmetric key crypto, but Safari doesn't support AES-GCM and many others. It should be added.

No support for AES-GCM, ECDSA, ECDH, PBKDF2 at all.
There is also a lack in supporting RSA-OAEP.
Comment 1 unsung_hero-97 2016-05-19 10:36:05 PDT
+1
Comment 2 Radar WebKit Bug Importer 2016-07-12 16:06:17 PDT
<rdar://problem/27311691>
Comment 3 Barrett Harber 2016-10-14 06:06:00 PDT
+1
Comment 4 Jiewen Tan 2017-01-03 14:35:19 PST
*** Bug 151125 has been marked as a duplicate of this bug. ***
Comment 5 Jiewen Tan 2017-02-22 21:57:26 PST
Created attachment 302492 [details]
Patch
Comment 6 WebKit Commit Bot 2017-02-22 22:01:16 PST
Attachment 302492 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:45:  usagesAreInvalidForCryptoAlgorithmAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:59:  CryptoAlgorithmAES_GCM::create is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:64:  CryptoAlgorithmAES_GCM::identifier is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:69:  CryptoAlgorithmAES_GCM::encrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:96:  CryptoAlgorithmAES_GCM::decrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:123:  CryptoAlgorithmAES_GCM::generateKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:141:  CryptoAlgorithmAES_GCM::importKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:181:  CryptoAlgorithmAES_GCM::exportKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:36:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:41:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:40:  encryptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:53:  decyptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:70:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:93:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 14 in 92 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Brent Fulgham 2017-02-22 22:14:22 PST
Looks like some compile errors under 32-bit:

/Volumes/Data/EWS/WebKit/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:74:26: error: comparison of constant 549755813632 with expression of type 'size_t' (aka 'unsigned long') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
    if (plainText.size() > PlainTextMaxLength) {
        ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
Comment 8 Build Bot 2017-02-22 23:16:16 PST
Comment on attachment 302492 [details]
Patch

Attachment 302492 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/3177058

New failing tests:
scrollingcoordinator/ios/non-stable-viewport-scroll.html
Comment 9 Build Bot 2017-02-22 23:16:19 PST
Created attachment 302497 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 10 Build Bot 2017-02-23 06:19:27 PST
Comment on attachment 302492 [details]
Patch

Attachment 302492 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3178550

New failing tests:
editing/spelling/spellcheck-async.html
Comment 11 Build Bot 2017-02-23 06:19:31 PST
Created attachment 302507 [details]
Archive of layout-test-results from ews103 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 12 Jiewen Tan 2017-02-23 12:16:20 PST
Created attachment 302557 [details]
Patch
Comment 13 WebKit Commit Bot 2017-02-23 12:20:23 PST
Attachment 302557 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:47:  usagesAreInvalidForCryptoAlgorithmAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:61:  CryptoAlgorithmAES_GCM::create is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:66:  CryptoAlgorithmAES_GCM::identifier is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:71:  CryptoAlgorithmAES_GCM::encrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:100:  CryptoAlgorithmAES_GCM::decrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:129:  CryptoAlgorithmAES_GCM::generateKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:147:  CryptoAlgorithmAES_GCM::importKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:187:  CryptoAlgorithmAES_GCM::exportKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:36:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:41:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:40:  encryptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:53:  decyptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:70:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:93:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 14 in 92 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 Build Bot 2017-02-23 13:45:12 PST
Comment on attachment 302557 [details]
Patch

Attachment 302557 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3180761

New failing tests:
media/modern-media-controls/volume-down-support/volume-down-support.html
Comment 15 Build Bot 2017-02-23 13:45:16 PST
Created attachment 302570 [details]
Archive of layout-test-results from ews116 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 16 Brent Fulgham 2017-03-01 18:21:10 PST
Comment on attachment 302557 [details]
Patch

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

I'm sorry this took so long to get reviewed. The mac-debug failure looks unrelated to your change (the bot was in a bad state). Please commit.

> LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/aes_gcm.worker-expected.txt:331
> +PASS AES-GCM 256-bit key, illegal tag length 256-bits decryption 

Hooray!

> LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/encrypt_decrypt/test_aes_gcm-expected.txt:333
> +PASS AES-GCM 256-bit key, illegal tag length 256-bits decryption 

Excellent!
Comment 17 WebKit Commit Bot 2017-03-01 18:24:40 PST
Comment on attachment 302557 [details]
Patch

Rejecting attachment 302557 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 302557, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Last 500 characters of output:
s/imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/test_successes_AES-GCM-expected.txt
patching file LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/symmetric_importKey.worker-expected.txt
patching file LayoutTests/imported/w3c/web-platform-tests/WebCryptoAPI/import_export/test_symmetric_importKey-expected.txt

Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Brent Fulgham']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Full output: http://webkit-queues.webkit.org/results/3219298
Comment 18 Jiewen Tan 2017-03-02 13:00:30 PST
Created attachment 303227 [details]
Patch for landing
Comment 19 Jiewen Tan 2017-03-02 13:01:47 PST
Comment on attachment 302557 [details]
Patch

Thanks Brent for r+ my patch.
Comment 20 WebKit Commit Bot 2017-03-02 13:02:53 PST
Attachment 303227 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:47:  usagesAreInvalidForCryptoAlgorithmAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:61:  CryptoAlgorithmAES_GCM::create is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:66:  CryptoAlgorithmAES_GCM::identifier is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:71:  CryptoAlgorithmAES_GCM::encrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:100:  CryptoAlgorithmAES_GCM::decrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:129:  CryptoAlgorithmAES_GCM::generateKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:147:  CryptoAlgorithmAES_GCM::importKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:187:  CryptoAlgorithmAES_GCM::exportKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:36:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:41:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:40:  encryptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:53:  decyptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:70:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:93:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 14 in 92 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 Jiewen Tan 2017-03-02 13:51:18 PST
Created attachment 303234 [details]
Patch for landing
Comment 22 Jiewen Tan 2017-03-02 13:55:01 PST
Committed r213301: <http://trac.webkit.org/changeset/213301>
Comment 23 Ryan Haddad 2017-03-02 16:01:49 PST
This change broke internal builds. Rolled out in http://trac.webkit.org/projects/webkit/changeset/213320
Comment 24 Jiewen Tan 2017-03-02 18:31:39 PST
Created attachment 303284 [details]
Patch for landing
Comment 25 WebKit Commit Bot 2017-03-02 18:35:20 PST
Attachment 303284 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:47:  usagesAreInvalidForCryptoAlgorithmAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:61:  CryptoAlgorithmAES_GCM::create is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:66:  CryptoAlgorithmAES_GCM::identifier is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:71:  CryptoAlgorithmAES_GCM::encrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:100:  CryptoAlgorithmAES_GCM::decrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:129:  CryptoAlgorithmAES_GCM::generateKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:147:  CryptoAlgorithmAES_GCM::importKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:187:  CryptoAlgorithmAES_GCM::exportKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:36:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_GCMGnuTLS.cpp:41:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:40:  encryptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:54:  decyptAES_GCM is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:71:  CryptoAlgorithmAES_GCM::platformEncrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp:94:  CryptoAlgorithmAES_GCM::platformDecrypt is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 14 in 92 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 26 WebKit Commit Bot 2017-03-02 20:23:11 PST
Comment on attachment 303284 [details]
Patch for landing

Clearing flags on attachment: 303284

Committed r213345: <http://trac.webkit.org/changeset/213345>