Skip to content

Commit

Permalink
Properly define the length in bits of a byte sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
twiss committed Jan 7, 2025
1 parent d76b53b commit 29ed765
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions spec/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,10 @@ <h2>Terminology</h2>
The terms {{DOMString}},
{{BufferSource}} and [= byte sequence =] are defined in [[WEBIDL]].
</p>
<p>
The <dfn id="dfn-length-in-bits" data-lt="length in bits">length in bits</dfn> of a [= byte sequence =]
is its [= byte sequence/length =] multiplied by 8.
</p>
<p>
A <dfn id="dfn-byte-sequence-containing" data-lt="byte sequence containing">byte sequence containing a bit sequence</dfn> |b| is the
[= byte sequence =] obtained by first appending zero or more
Expand Down Expand Up @@ -9013,7 +9017,7 @@ <h4>Operations</h4>
<dd>
<dl class="switch">
<dt>
If the length of |secret| in bits is less than
If the [= length in bits =] of |secret| is less than
|length|:
</dt>
<dd>
Expand Down Expand Up @@ -12241,7 +12245,7 @@ <h4>Operations</h4>
</li>
<li>
<p>
If the length in bits of |data| is not 128, 192 or 256
If the [= length in bits =] of |data| is not 128, 192 or 256
then [= exception/throw =] a
{{DataError}}.
</p>
Expand Down Expand Up @@ -12283,17 +12287,17 @@ <h4>Operations</h4>
</li>
<li>
<dl class="switch">
<dt>If |data| has length 128 bits:</dt>
<dt>If the [= length in bits =] of |data| is 128:</dt>
<dd>
If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A128CTR`", then [= exception/throw =] a {{DataError}}.
</dd>
<dt>If |data| has length 192 bits:</dt>
<dt>If the [= length in bits =] of |data| is 192:</dt>
<dd>
If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A192CTR`", then [= exception/throw =] a {{DataError}}.
</dd>
<dt>If |data| has length 256 bits:</dt>
<dt>If the [= length in bits =] of |data| is 256:</dt>
<dd>
If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A256CTR`", then [= exception/throw =] a {{DataError}}.
Expand Down Expand Up @@ -12784,7 +12788,7 @@ <h4>Operations</h4>
</li>
<li>
<p>
If the length in bits of |data| is not 128, 192 or 256
If the [= length in bits =] of |data| is not 128, 192 or 256
then [= exception/throw =] a
{{DataError}}.
</p>
Expand Down Expand Up @@ -12826,17 +12830,17 @@ <h4>Operations</h4>
</li>
<li>
<dl class="switch">
<dt>If |data| has length 128 bits:</dt>
<dt>If the [= length in bits =] of |data| is 128:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A128CBC`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 192 bits:</dt>
<dt>If the [= length in bits =] of |data| is 192:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A192CBC`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 256 bits:</dt>
<dt>If the [= length in bits =] of |data| is 256:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A256CBC`",
then [= exception/throw =] a
Expand Down Expand Up @@ -13220,7 +13224,7 @@ <h4>Operations</h4>
</li>
<li>
<p>
If |ciphertext| has a length less than |tagLength| bits,
If |ciphertext| has a [= length in bits =] less than |tagLength|,
then [= exception/throw =] an
{{OperationError}}.
</p>
Expand Down Expand Up @@ -13411,7 +13415,7 @@ <h4>Operations</h4>
</li>
<li>
<p>
If the length in bits of |data| is not 128, 192 or 256
If the [= length in bits =] of |data| is not 128, 192 or 256
then [= exception/throw =] a
{{DataError}}.
</p>
Expand Down Expand Up @@ -13453,17 +13457,17 @@ <h4>Operations</h4>
</li>
<li>
<dl class="switch">
<dt>If |data| has length 128 bits:</dt>
<dt>If the [= length in bits =] of |data| is 128:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A128GCM`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 192 bits:</dt>
<dt>If the [= length in bits =] of |data| is 192:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A192GCM`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 256 bits:</dt>
<dt>If the [= length in bits =] of |data| is 256:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A256GCM`",
then [= exception/throw =] a
Expand Down Expand Up @@ -13898,7 +13902,7 @@ <h4>Operations</h4>
</li>
<li>
<p>
If the length in bits of |data| is not 128, 192 or 256
If the [= length in bits =] of |data| is not 128, 192 or 256
then [= exception/throw =] a
{{DataError}}.
</p>
Expand Down Expand Up @@ -13940,17 +13944,17 @@ <h4>Operations</h4>
</li>
<li>
<dl class="switch">
<dt>If |data| has length 128 bits:</dt>
<dt>If the [= length in bits =] of |data| is 128:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A128KW`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 192 bits:</dt>
<dt>If the [= length in bits =] of |data| is 192:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A192KW`",
then [= exception/throw =] a
{{DataError}}.</dd>
<dt>If |data| has length 256 bits:</dt>
<dt>If the [= length in bits =] of |data| is 256:</dt>
<dd>If the {{JsonWebKey/alg}} field of |jwk| is present, and is
not "`A256KW`",
then [= exception/throw =] a
Expand Down Expand Up @@ -14602,8 +14606,8 @@ <h4>Operations</h4>
</li>
<li>
<p>
Let |length| be equivalent to the length, in octets, of
|data|, multiplied by 8.
Let |length| be the [= length in bits =] of
|data|.
</p>
</li>
<li>
Expand Down

0 comments on commit 29ed765

Please sign in to comment.