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

UNCONFIRMED
Unassigned

Status

()

Core
Security: PSM
P3
normal
UNCONFIRMED
2 years ago
2 years ago

People

(Reporter: Charles Engelke, Unassigned)

Tracking

49 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [psm-backlog])

(Reporter)

Description

2 years ago
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.

Updated

2 years ago
See Also: → bug 1286878

Updated

2 years ago
Component: Untriaged → Security
Product: Firefox → Core
Component: Security → DOM: Security
Component: DOM: Security → Security
Component: Security → Security: PSM
Priority: -- → P3
Whiteboard: [psm-backlog]
You need to log in before you can comment on or make changes to this bug.