Closed Bug 1286880 Opened 9 years ago Closed 5 years ago

crypto.subtle.deriveBits throws wrong error for null length result

Categories

(Core :: Security: PSM, defect, P3)

49 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: bugzilla, Assigned: rmf)

References

Details

(Whiteboard: [psm-backlog])

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0 Build ID: 20160711004013 Steps to reproduce: Run the following code in the JavaScript console: crypto.subtle.importKey("raw", new Uint8Array([1, 2, 3]), {name: "PBKDF2"}, false, ["deriveKey", "deriveBits"]) .then(function(baseKey) { crypto.subtle.deriveBits({name: "PBKDF2", salt: new Uint8Array([1]), hash: "SHA-256", iterations: 1}, baseKey, null) .then(function(key) {console.log("Derivation succeeded.");}) .catch(function(err) {console.log("Error " + err.name);}); }); Actual results: It displays "Error DataError". Expected results: It should have displayed "Error OperationError". The same error occurs with deriveKey. See step 1 of operation Derive bits at https://w3c.github.io/webcrypto/Overview.html#pbkdf2-operations.
See Also: → 1286878
Component: Untriaged → Security
Product: Firefox → Core
Component: Security → DOM: Security
Component: DOM: Security → Security
Component: Security → Security: PSM
Priority: -- → P3
Whiteboard: [psm-backlog]

Depends on D79455

Assignee: nobody → bugs
Attachment #9156299 - Attachment is obsolete: true
Pushed by rmaries@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/de7c4515c92e add test to ensure deriveBits and deriveKey throw the correct errors given invalid length arguments r=keeler
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c8e5e772e71a add test to ensure deriveBits and deriveKey throw the correct errors given invalid length arguments r=keeler
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: