From af97535b7cc64bf4586da77fc0afa146230e758c Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 17 Aug 2021 14:59:32 +0530 Subject: fix(ext/crypto): exportKey() for HMAC (#11737) Fixes typings and innerKey processing (WPT doesn't test exportKey for HMAC so this wasn't caught earlier). --- ext/crypto/00_crypto.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/crypto/00_crypto.js') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index 5fdbe6ebc..115271dab 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -577,16 +577,17 @@ const handle = key[_handle]; // 2. - const bits = WeakMapPrototypeGet(KEY_STORE, handle); + const innerKey = WeakMapPrototypeGet(KEY_STORE, handle); switch (key[_algorithm].name) { case "HMAC": { - if (bits == null) { + if (innerKey == null) { throw new DOMException("Key is not available", "OperationError"); } switch (format) { // 3. case "raw": { + const bits = innerKey.data; for (let _i = 7 & (8 - bits.length % 8); _i > 0; _i--) { bits.push(0); } -- cgit v1.2.3