Re: [DOMCRYPT] Crypto interface should use WebIDL overloads instead of a 'type check' step in the algorithm

On Fri, Apr 6, 2012 at 3:59 AM, Kyle Huey <me@kylehuey.com> wrote:

> Hi All,
>
> In the draft at https://dvcs.w3.org/hg/domcrypt/raw-file/tip/Overview.html,
> the current WebIDL snippet for the Crypto interface is
>
> interface Crypto {
>  ArrayBufferView getRandomValues(ArrayBufferView array);
> };
>
> And the first step of the algorithm for getRandom values is "If array is
> not of an integer type (i.e., Int8Array, Uint8Array, Int16Array,
> Uint16Array, Int32Array, or Uint32Array), throw a TypeMismatchError and
> abort these steps."
>
> I believe this should be written as
>
> interface Crypto {
>   Int8Array getRandomValues(Int8Array array);
>   Uint8Array getRandomValues(Uint8Array array);
>   Int16Array getRandomValues(Int16Array array);
>   Uint16Array getRandomValues(Uint16Array array);
>   Int32Array getRandomValues(Int32Array array);
>   Uint32Array getRandomValues(Uint32Array array);
> };
>
> to use WebIDL overloading instead of the explicit type check step.


Those types are distinguishable as platform objects and therefore this
would be a valid change.

Step 2 would also need to clarify that the array's byteLength should be
tested and not the length, as the length would represent the number of
elements in the view and not the number of bytes.  David confirmed that we
care about the NSS seed refresh interval at 64k bytes.


>
>
> - Kyle
>

Received on Friday, 6 April 2012 05:35:56 UTC