Skip to content

Commit d4ffcad

Browse files
authored
Allow length=0 in HKDF and PBKDF2 derive bits operations (#380)
* Revert "Throw an OperationError in the PBKDF2 and HKDF derive bits operations if length is zero (#275)" This reverts commit 6438d87. * Properly handle length=0 in the PBKDF2 derive bits operation RFC 8018 does not allow passing dkLen=0. Therefore, we explicitly return an empty ArrayBuffer in that case. * Explicitly return `ArrayBuffer`s in HKDF and PBKDF2 The algorithm registrations state that they return `ArrayBuffer`s, but the operations did not.
1 parent 85a4826 commit d4ffcad

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

spec/Overview.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13105,7 +13105,7 @@ <h4>Operations</h4>
1310513105
<ol>
1310613106
<li>
1310713107
<p>
13108-
If |length| is null or zero, or is not a multiple of 8, then [= exception/throw =] an {{OperationError}}.
13108+
If |length| is null or is not a multiple of 8, then [= exception/throw =] an {{OperationError}}.
1310913109
</p>
1311013110
</li>
1311113111
<li>
@@ -13160,7 +13160,8 @@ <h4>Operations</h4>
1316013160
</li>
1316113161
<li>
1316213162
<p>
13163-
Return |result|.
13163+
Return the result of [= ArrayBuffer/create | creating =]
13164+
an {{ArrayBuffer}} containing |result|.
1316413165
</p>
1316513166
</li>
1316613167
</ol>
@@ -13324,7 +13325,7 @@ <h4>Operations</h4>
1332413325
<ol>
1332513326
<li>
1332613327
<p>
13327-
If |length| is null or zero, or is not a multiple of 8, then [= exception/throw =] an {{OperationError}}.
13328+
If |length| is null or is not a multiple of 8, then [= exception/throw =] an {{OperationError}}.
1332813329
</p>
1332913330
</li>
1333013331
<li>
@@ -13333,6 +13334,13 @@ <h4>Operations</h4>
1333313334
then [= exception/throw =] an {{OperationError}}.
1333413335
</p>
1333513336
</li>
13337+
<li>
13338+
<p>
13339+
If |length| is zero, return the result of
13340+
[= ArrayBuffer/create | creating =] an {{ArrayBuffer}}
13341+
containing an empty [= byte sequence =].
13342+
</p>
13343+
</li>
1333613344
<li>
1333713345
<p>
1333813346
Let |prf| be the MAC Generation function described in Section 4 of
@@ -13362,7 +13370,8 @@ <h4>Operations</h4>
1336213370
</li>
1336313371
<li>
1336413372
<p>
13365-
Return |result|
13373+
Return the result of [= ArrayBuffer/create | creating =]
13374+
an {{ArrayBuffer}} containing |result|.
1336613375
</p>
1336713376
</li>
1336813377
</ol>

0 commit comments

Comments
 (0)