Bug 123216 - Add CryptoKey base class and bindings
Summary: Add CryptoKey base class and bindings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks: 122679
  Show dependency treegraph
 
Reported: 2013-10-23 13:41 PDT by Alexey Proskuryakov
Modified: 2013-10-24 10:31 PDT (History)
8 users (show)

See Also:


Attachments
proposed patch (33.14 KB, patch)
2013-10-23 13:57 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff
with release build fix (32.55 KB, patch)
2013-10-23 14:27 PDT, Alexey Proskuryakov
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2013-10-23 13:41:54 PDT
Add CryptoKey base class and bindings.
Comment 1 Alexey Proskuryakov 2013-10-23 13:57:40 PDT
Created attachment 214994 [details]
proposed patch
Comment 2 Alexey Proskuryakov 2013-10-23 14:27:37 PDT
Created attachment 214997 [details]
with release build fix
Comment 3 Sam Weinig 2013-10-23 20:44:49 PDT
Comment on attachment 214997 [details]
with release build fix

View in context: https://bugs.webkit.org/attachment.cgi?id=214997&action=review

r=me

> Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h:49
> +    JSC::ExecState* m_exec;

It might be slightly more efficient to store a VM& here.  I think everything except perhaps constructEmptyObject has an override that takes a VM& or VM*.

> Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h:50
> +    JSC::Strong<JSC::JSObject> m_dictionary;

If this is only ever used on the stack, does this have to be a Strong?
Comment 4 Alexey Proskuryakov 2013-10-23 22:05:57 PDT
> It might be slightly more efficient to store a VM& here.  I think everything except perhaps constructEmptyObject has an override that takes a VM& or VM*.

Yes, I started with VM, but had to switch to ExecState because I'll need to call constructEmptyObject again for nested dictionaries (it's not in the patch right now).

> If this is only ever used on the stack, does this have to be a Strong?

Good point, I copied it from elsewhere thoughtlessly.
Comment 5 Alexey Proskuryakov 2013-10-24 10:04:09 PDT
Committed <http://trac.webkit.org/r157936>.
Comment 6 Darin Adler 2013-10-24 10:14:20 PDT
Comment on attachment 214997 [details]
with release build fix

View in context: https://bugs.webkit.org/attachment.cgi?id=214997&action=review

> Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.h:45
> +    virtual void add(const char*, unsigned long) OVERRIDE;

Why “unsigned long” instead of unsigned?
Comment 7 Alexey Proskuryakov 2013-10-24 10:24:44 PDT
> Why “unsigned long” instead of unsigned?

This is for adding dictionary items that are marked "unsigned long" in IDL, what should this map to in C++ code?

In practice, key length could as well be 16 bit:

dictionary HmacKeyParams : Algorithm {
  // The inner hash function to use.
  AlgorithmIdentifier hash;

  // The length (in bytes) of the key to generate. If unspecified, the
  // recommended length will be used, which is the size of the associated hash function's block
  // size.
  unsigned long length?;
};
Comment 8 Darin Adler 2013-10-24 10:31:44 PDT
(In reply to comment #7)
> > Why “unsigned long” instead of unsigned?
> 
> This is for adding dictionary items that are marked "unsigned long" in IDL, what should this map to in C++ code?

unsigned.

I know, it’s not obvious.