W3C home > Mailing lists > Public > public-webcrypto@w3.org > April 2012

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

From: Jarred Nicholls <jarred@webkit.org>
Date: Fri, 6 Apr 2012 05:35:07 +0000
Message-ID: <CANufG2NtYSAPQu6VbbHzVqMBnFETe2kqecCZF6ZebvcM-9VSgw@mail.gmail.com>
To: Kyle Huey <me@kylehuey.com>
Cc: public-webcrypto@w3.org, Boris Zbarsky <bzbarsky@mit.edu>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 16 May 2012 18:59:56 GMT