Bug 170274

Summary: [GCrypt] Implement AES_KW support
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, jiewen_tan, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 170269, 170271    
Bug Blocks: 133122    
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description Zan Dobersek 2017-03-30 00:10:29 PDT
[GCrypt] Implement AES_KW support
Comment 1 Zan Dobersek 2017-03-30 00:13:31 PDT
Created attachment 305844 [details]
Patch
Comment 2 Build Bot 2017-03-30 00:15:11 PDT
Attachment 305844 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:109:  CryptoAlgorithmAES_KW::platformWrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:121:  CryptoAlgorithmAES_KW::platformUnwrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Zan Dobersek 2017-03-30 00:29:10 PDT
Created attachment 305846 [details]
Patch
Comment 4 Build Bot 2017-03-30 00:31:07 PDT
Attachment 305846 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:110:  CryptoAlgorithmAES_KW::platformWrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:122:  CryptoAlgorithmAES_KW::platformUnwrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Zan Dobersek 2017-03-30 00:44:37 PDT
Depends on the Utilities.h header that's being added in bug #170269, as well as the HandleDeleter<gcry_cipher_hd_t> specialization that's being added in bug #170271.
Comment 6 Michael Catanzaro 2017-04-01 18:06:31 PDT
Comment on attachment 305846 [details]
Patch

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

> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:36
> +#include <pal/crypto/gcrypt/Handle.h>
> +#include <pal/crypto/gcrypt/Utilities.h>

:(

> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:65
> +    Vector<uint8_t> output(data.size() + 8);

Correct, but it needs a short comment to explain the + 8 (e.g. "On encryption the provided output buffer must be 64 bit (8 byte) larger than the input buffer" from https://www.gnupg.org/documentation/manuals/gcrypt/Available-cipher-modes.html).

> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:72
> +    return WTFMove(output);

:(

> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:100
> +    Vector<uint8_t> output(data.size() - 8);

Comment

> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:107
> +    return WTFMove(output);

:(
Comment 7 Zan Dobersek 2017-04-02 23:58:20 PDT
Comment on attachment 305846 [details]
Patch

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

>> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:65
>> +    Vector<uint8_t> output(data.size() + 8);
> 
> Correct, but it needs a short comment to explain the + 8 (e.g. "On encryption the provided output buffer must be 64 bit (8 byte) larger than the input buffer" from https://www.gnupg.org/documentation/manuals/gcrypt/Available-cipher-modes.html).

OK.

>> Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:100
>> +    Vector<uint8_t> output(data.size() - 8);
> 
> Comment

OK.
Comment 8 Zan Dobersek 2017-04-03 03:59:51 PDT
Created attachment 306071 [details]
Patch for landing

Still depends on bug #170271.
Comment 9 Zan Dobersek 2017-04-03 11:19:03 PDT
Created attachment 306087 [details]
Patch for landing
Comment 10 Build Bot 2017-04-03 11:20:25 PDT
Attachment 306087 [details] did not pass style-queue:


ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:112:  CryptoAlgorithmAES_KW::platformWrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Source/WebCore/crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp:124:  CryptoAlgorithmAES_KW::platformUnwrapKey is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
Total errors found: 2 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Zan Dobersek 2017-04-03 11:36:10 PDT
Comment on attachment 306087 [details]
Patch for landing

Clearing flags on attachment: 306087

Committed r214823: <http://trac.webkit.org/changeset/214823>
Comment 12 Zan Dobersek 2017-04-03 11:36:24 PDT
All reviewed patches have been landed.  Closing bug.