Skip to content

Commit 9d647b6

Browse files
committed
Throw on truncation in the X25519 and X448 derive bits operation
1 parent 067671c commit 9d647b6

File tree

1 file changed

+12
-42
lines changed

1 file changed

+12
-42
lines changed

index.html

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ <h4>Operations</h4>
150150
|key|, then [= exception/throw =] an {{InvalidAccessError}}.
151151
</p>
152152
</li>
153+
<li>
154+
<p>
155+
If |length| is not null, and not equal to 256, then [= exception/throw =] an {{OperationError}}.
156+
</p>
157+
</li>
153158
<li>
154159
<p>
155160
Let |secret| be the result of performing the X25519 function specified in
@@ -166,27 +171,7 @@ <h4>Operations</h4>
166171
</p>
167172
</li>
168173
<li>
169-
<dl class="switch">
170-
<dt>If |length| is null:</dt>
171-
<dd>Return |secret|</dd>
172-
<dt>Otherwise:</dt>
173-
<dd>
174-
<dl class="switch">
175-
<dt>
176-
If the length of |secret| in bits is less than
177-
|length|:
178-
</dt>
179-
<dd>
180-
[= exception/throw =] an
181-
{{OperationError}}.
182-
</dd>
183-
<dt>Otherwise:</dt>
184-
<dd>
185-
Return an <a data-cite="WebCryptoAPI#octet-string-containing">octet string containing</a> the first |length| bits of |secret|.
186-
</dd>
187-
</dl>
188-
</dd>
189-
</dl>
174+
Return |secret|.
190175
</li>
191176
</ol>
192177
</dd>
@@ -1002,6 +987,11 @@ <h4>Operations</h4>
1002987
|key|, then [= exception/throw =] an {{InvalidAccessError}}.
1003988
</p>
1004989
</li>
990+
<li>
991+
<p>
992+
If |length| is not null, and not equal to 448, then [= exception/throw =] an {{OperationError}}.
993+
</p>
994+
</li>
1005995
<li>
1006996
<p>
1007997
Let |secret| be the result of performing the X448 function specified in
@@ -1018,27 +1008,7 @@ <h4>Operations</h4>
10181008
</p>
10191009
</li>
10201010
<li>
1021-
<dl class="switch">
1022-
<dt>If |length| is null:</dt>
1023-
<dd>Return |secret|</dd>
1024-
<dt>Otherwise:</dt>
1025-
<dd>
1026-
<dl class="switch">
1027-
<dt>
1028-
If the length of |secret| in bits is less than
1029-
|length|:
1030-
</dt>
1031-
<dd>
1032-
[= exception/throw =] an
1033-
{{OperationError}}.
1034-
</dd>
1035-
<dt>Otherwise:</dt>
1036-
<dd>
1037-
Return an <a data-cite="WebCryptoAPI#octet-string-containing">octet string containing</a> the first |length| bits of |secret|.
1038-
</dd>
1039-
</dl>
1040-
</dd>
1041-
</dl>
1011+
Return |secret|.
10421012
</li>
10431013
</ol>
10441014
</dd>

0 commit comments

Comments
 (0)