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

Side by Side Diff: third_party/WebKit/LayoutTests/crypto/subtle/pbkdf2/deriveBits-rfc6070-test-vectors.html

Issue 2164753002: Reject deriveBits() for PBKDF2 when given a length of 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script> 5 <script src="../resources/common.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <p id="description"></p> 8 <p id="description"></p>
9 <div id="console"></div> 9 <div id="console"></div>
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 tmpKey = key; 95 tmpKey = key;
96 shouldEvaluateAs("tmpKey.type", "secret"); 96 shouldEvaluateAs("tmpKey.type", "secret");
97 shouldEvaluateAs("tmpKey.extractable", false); 97 shouldEvaluateAs("tmpKey.extractable", false);
98 shouldEvaluateAs("tmpKey.algorithm.name", "PBKDF2"); 98 shouldEvaluateAs("tmpKey.algorithm.name", "PBKDF2");
99 shouldEvaluateAs("tmpKey.usages.join(',')", "deriveKey,deriveBits"); 99 shouldEvaluateAs("tmpKey.usages.join(',')", "deriveKey,deriveBits");
100 100
101 // (2) Derive bits 101 // (2) Derive bits
102 return crypto.subtle.deriveBits(params, key, testCase.dkLen*8); 102 return crypto.subtle.deriveBits(params, key, testCase.dkLen*8);
103 }).then(function(result) { 103 }).then(function(result) {
104 bytesShouldMatchHexString("deriveBits", testCase.derived_key, result); 104 bytesShouldMatchHexString("deriveBits", testCase.derived_key, result);
105 return crypto.subtle.deriveBits(params, key, 0);
106 }).then(function(result) {
107 derivedBits = result;
108 shouldBe("derivedBits.byteLength", "0");
109 }); 105 });
110 } 106 }
111 107
112 var lastPromise = Promise.resolve(null); 108 var lastPromise = Promise.resolve(null);
113 109
114 kPbkdf2SuccessVectors.forEach(function(test) { 110 kPbkdf2SuccessVectors.forEach(function(test) {
115 lastPromise = lastPromise.then(runPbkdf2SuccessTestCase.bind(null, test)); 111 lastPromise = lastPromise.then(runPbkdf2SuccessTestCase.bind(null, test));
116 }); 112 });
117 113
118 lastPromise.then(finishJSTest, failAndFinishJSTest); 114 lastPromise.then(finishJSTest, failAndFinishJSTest);
119 115
120 </script> 116 </script>
121 117
122 </body> 118 </body>
123 </html> 119 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698