Closed Bug 1553372 Opened 7 years ago Closed 6 years ago

Can't derive more than 576 bytes of output using HKDF

Categories

(Core :: DOM: Web Crypto, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: rfkelly, Unassigned)

Details

Attachments

(1 file)

Firefox's implementation of crypto.subtle.deriveBits({ name: "HKDF" }) seems to be limited to producing 576 bytes of output, despite RFC5869 allowing HKDF to derive up to (255 * HashLen) output bytes.

Attached is a simple example script that tries to derive both a 576 byte array and a 577 byte array. On Chrome, both of these succeed. On Firefox, the second fails with "The operation failed for an operation-specific reason".

This seems like it might be a limitation of NSS's HKDF implementation, thanks to the check for keySize > sizeof key_block here:

https://dxr.mozilla.org/mozilla-central/rev/3c0f78074b727fbae112b6eda111d4c4d30cc3ec/security/nss/lib/softoken/pkcs11c.c#7758

I don't really need this for anything and will totally understand if you WONTFIX it, I just noticed the inconsistent behaviour compared to Chrome and wanted to report it for completeness...

Thanks for the report! It's worth fixing, but WebCrypto is currently underneath WebAuthn in terms of priorities, so it'l have to hold for a bit.

Priority: -- → P3

The attached testcase now works fine for me in latest Nightly, so I think we can call this fixed.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: