Changeset 275535 in webkit
- Timestamp:
- Apr 6, 2021 11:10:31 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r275533 r275535 1 2021-04-06 Jiewen Tan <jiewen_tan@apple.com> 2 3 WebCrypto in Safari will not AES-GCM encrypt 0 bytes 4 https://bugs.webkit.org/show_bug.cgi?id=224083 5 <rdar://75093377> 6 7 Reviewed by Youenn Fablet. 8 9 * crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text-expected.txt: Added. 10 * crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html: Added. 11 1 12 2021-04-06 Chris Gambrell <cgambrell@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r275529 r275535 1 2021-04-06 Jiewen Tan <jiewen_tan@apple.com> 2 3 WebCrypto in Safari will not AES-GCM encrypt 0 bytes 4 https://bugs.webkit.org/show_bug.cgi?id=224083 5 <rdar://75093377> 6 7 Reviewed by Youenn Fablet. 8 9 CommonCrypto will bail out both the encryption and decryption process if the dataOut is a null pointer. 10 To workaround the issue, this patch forces the dataOut to be a non-null pointer. 11 12 Test: crypto/subtle/aes-gcm-generate-key-encrypt-decrypt-null-plain-text.html 13 14 * crypto/mac/CryptoAlgorithmAES_GCMMac.cpp: 15 (WebCore::encryptAES_GCM): 16 (WebCore::decyptAES_GCM): 17 1 18 2021-04-06 Patrick Angle <pangle@apple.com> 2 19 -
trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_GCMMac.cpp
r239461 r275535 38 38 static ExceptionOr<Vector<uint8_t>> encryptAES_GCM(const Vector<uint8_t>& iv, const Vector<uint8_t>& key, const Vector<uint8_t>& plainText, const Vector<uint8_t>& additionalData, size_t desiredTagLengthInBytes) 39 39 { 40 Vector<uint8_t> cipherText(plainText.size()); // Per section 5.2.1.2: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf 40 // This is a wordaround for rdar://75093377. Force the buffer to be a non null pointer. 41 Vector<uint8_t> cipherText(plainText.size() + desiredTagLengthInBytes); // Per section 5.2.1.2: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf 41 42 Vector<uint8_t> tag(desiredTagLengthInBytes); 42 43 // tagLength is actual an input <rdar://problem/30660074> … … 47 48 return Exception { OperationError }; 48 49 49 cipherText.append(tag.data(), desiredTagLengthInBytes);50 memcpy(cipherText.data() + plainText.size(), tag.data(), desiredTagLengthInBytes); 50 51 51 52 return WTFMove(cipherText); … … 54 55 static ExceptionOr<Vector<uint8_t>> decyptAES_GCM(const Vector<uint8_t>& iv, const Vector<uint8_t>& key, const Vector<uint8_t>& cipherText, const Vector<uint8_t>& additionalData, size_t desiredTagLengthInBytes) 55 56 { 56 Vector<uint8_t> plainText(cipherText.size() - desiredTagLengthInBytes); // Per section 5.2.1.2: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf 57 // This is a wordaround for rdar://75093377. Force the buffer to be a non null pointer. 58 Vector<uint8_t> plainText(cipherText.size()); // Per section 5.2.1.2: http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf 57 59 Vector<uint8_t> tag(desiredTagLengthInBytes); 58 60 size_t offset = cipherText.size() - desiredTagLengthInBytes; … … 68 70 return Exception { OperationError }; 69 71 72 // This is a wordaround for rdar://75093377. Force the buffer to be a non null pointer. 73 plainText.shrink(offset); 70 74 return WTFMove(plainText); 71 75 }
Note: See TracChangeset
for help on using the changeset viewer.