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

Unified Diff: components/webcrypto/algorithms/pbkdf2.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/webcrypto/status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/pbkdf2.cc
diff --git a/components/webcrypto/algorithms/pbkdf2.cc b/components/webcrypto/algorithms/pbkdf2.cc
index 8dd059e000d289562419455c74370b96e1ff28e7..976d73d69b4aa1fec6a443835d3306abed631f53 100644
--- a/components/webcrypto/algorithms/pbkdf2.cc
+++ b/components/webcrypto/algorithms/pbkdf2.cc
@@ -64,6 +64,12 @@ class Pbkdf2Implementation : public AlgorithmImplementation {
if (optional_length_bits % 8)
return Status::ErrorPbkdf2InvalidLength();
+ // According to RFC 2898 "dkLength" (derived key length) is
+ // described as being a "positive integer", so it is an error for
+ // it to be 0.
+ if (optional_length_bits == 0)
+ return Status::ErrorPbkdf2DeriveBitsLengthZero();
+
const blink::WebCryptoPbkdf2Params* params = algorithm.pbkdf2Params();
if (params->iterations() == 0)
« no previous file with comments | « no previous file | components/webcrypto/status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698