This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23660 - Algorithm normalizing rules issues
Summary: Algorithm normalizing rules issues
Status: RESOLVED FIXED
Alias: None
Product: Web Cryptography
Classification: Unclassified
Component: Web Cryptography API Document (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Mark Watson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-28 21:29 UTC by Alexey Proskuryakov
Modified: 2014-03-06 18:02 UTC (History)
1 user (show)

See Also:


Attachments

Description Alexey Proskuryakov 2013-10-28 21:29:07 UTC
I think that there are some issues in the algorithm normalizing rules algorithm.

1. In string input case, there is a dictionary created, "result be re-initialized to the aliased dictionary and this algorithm restarted".

But the dictionary to create depends on function being called - e.g. for HMAC it could be HmacParams or HmacKeyParams.

So, the normalization algorithm should take function as input too.

2. In the non-string case, there are two options: 
 - If the associated value V is an AlgorithmIdentifier...
 - If the associated value V is a dictionary...

But there are no dictionaries currently specified in WebCrypto that have dictionary members. In fact, a dictionary is not allowed to have dictionary members at all (not even AlgorithmIdentifiers), which is a separate issue which has been previously reported I believe.

Seems best to remove this fairly confusing case if it's not used anywhere in the spec.
Comment 1 Mark Watson 2014-03-05 22:47:55 UTC
As per Bug 24947 we will need to include in each operation an explicit step which performs the WebIDL type conversion of the Algorithm dictionary to the expected sub-class for that operation.

It would make more sense for the 'normalization' step for any members of that dictionary that are type AlgorithmIdentifier to be explicitly specified here, rather than doing the recursive normalization thing generically.

So, then, the normalization algorithm would be simplified to doing a lookup of pre-defined string values to map to specific object literals.
Comment 2 Mark Watson 2014-03-06 18:02:08 UTC
Changeset 5663751fe535 also resolves this issue.

For (1), the algorithm normalization procedure takes the target output dictionary type as a parameter. It resolves aliases and does type mapping to that target type.

For (2), the recursion is still necessary to resolve things like:

{ name: "HMAC", hash: "SHA-1" }

to

{ name: "HMAC", hash: { name: "SHA-1" } }

[Nevertheless, we still have no such aliases defined in the specification]