Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1286)

Unified Diff: third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html

Issue 2837383002: Raise an error when calling WebCrypto's deriveBits() for HKDF with (Closed)
Patch Set: checkpoint Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html
diff --git a/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html b/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html
index 55ae7f4b485cbfb416074e5662458eda814aee60..a661f4e0f7ab22db75adce8cba6da4ba0030237e 100644
--- a/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html
+++ b/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/deriveBits-failures.html
@@ -47,9 +47,15 @@ Promise.resolve(null).then(function(result) {
// The maximum length (in bytes) of output material for HKDF is 255 times
// the digest length. In this case, the digest length (in bytes) of
// SHA-256 is 32; 32*255 = 8160. deriveBits expects the length to be in
- // bits, so 8160*8=65280 and add 1 to exceed the maximum length.
+ // bits, so 8160*8=65280 and add 8 to exceed the maximum length.
debug("\nderiveBits() with length of 65281...");
- return crypto.subtle.deriveBits({name: "HKDF", hash: "SHA-256", salt: new Uint8Array(), info: new Uint8Array()}, hkdfKey, 65281);
+ return crypto.subtle.deriveBits({name: "HKDF", hash: "SHA-256", salt: new Uint8Array(), info: new Uint8Array()}, hkdfKey, 65288);
+}).then(failAndFinishJSTest, function(result) {
+ logError(result);
+
+ // Use a bit length that is not a multiple of 8.
+ debug("\nderiveBits() with length of 15...");
+ return crypto.subtle.deriveBits({name: "HKDF", hash: "SHA-256", salt: new Uint8Array(), info: new Uint8Array()}, hkdfKey, 15);
}).then(failAndFinishJSTest, function(result) {
logError(result);
}).then(finishJSTest, failAndFinishJSTest);

Powered by Google App Engine
This is Rietveld 408576698