Changeset 209191 in webkit


Ignore:
Timestamp:
Dec 1, 2016 11:42:30 AM (7 years ago)
Author:
jiewen_tan@apple.com
Message:

SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now
https://bugs.webkit.org/show_bug.cgi?id=164745
<rdar://problem/29258118>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • WebCryptoAPI/idlharness-expected.txt:

Source/WebCore:

Since we don't support any cryptography algorithms that has deriveBits operations,
SubtleCrypto::deriveBits will always return NOT_SUPPORTED_ERR for now.

Test: crypto/subtle/deriveBits-malformed-parameters.html

  • bindings/js/JSSubtleCryptoCustom.cpp:

(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
(WebCore::JSSubtleCrypto::deriveBits):

  • crypto/SubtleCrypto.idl:

LayoutTests:

  • crypto/subtle/deriveBits-malformed-parameters-expected.txt: Added.
  • crypto/subtle/deriveBits-malformed-parameters.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r209190 r209191  
     12016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now
     4        https://bugs.webkit.org/show_bug.cgi?id=164745
     5        <rdar://problem/29258118>
     6
     7        Reviewed by Darin Adler.
     8
     9        * crypto/subtle/deriveBits-malformed-parameters-expected.txt: Added.
     10        * crypto/subtle/deriveBits-malformed-parameters.html: Added.
     11
    1122016-12-01  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r209184 r209191  
     12016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now
     4        https://bugs.webkit.org/show_bug.cgi?id=164745
     5        <rdar://problem/29258118>
     6
     7        Reviewed by Darin Adler.
     8
     9        * WebCryptoAPI/idlharness-expected.txt:
     10
    1112016-11-30  Sam Weinig  <sam@webkit.org>
    212
  • trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt

    r209166 r209191  
    5858PASS SubtleCrypto interface: crypto.subtle must inherit property "deriveKey" with the proper type (6)
    5959PASS SubtleCrypto interface: calling deriveKey(AlgorithmIdentifier,CryptoKey,AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError
    60 FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7) assert_inherits: property "deriveBits" not found in prototype chain
    61 FAIL SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "deriveBits" not found in prototype chain
     60PASS SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7)
     61PASS SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError
    6262PASS SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8)
    6363PASS SubtleCrypto interface: calling importKey(KeyFormat,[object Object],[object Object],AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError
  • trunk/Source/WebCore/ChangeLog

    r209188 r209191  
     12016-12-01  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        SubtleCrypto::deriveBits always return NOT_SUPPORTED_ERR for now
     4        https://bugs.webkit.org/show_bug.cgi?id=164745
     5        <rdar://problem/29258118>
     6
     7        Reviewed by Darin Adler.
     8
     9        Since we don't support any cryptography algorithms that has deriveBits operations,
     10        SubtleCrypto::deriveBits will always return NOT_SUPPORTED_ERR for now.
     11
     12        Test: crypto/subtle/deriveBits-malformed-parameters.html
     13
     14        * bindings/js/JSSubtleCryptoCustom.cpp:
     15        (WebCore::normalizeCryptoAlgorithmParameters):
     16        (WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
     17        (WebCore::JSSubtleCrypto::deriveBits):
     18        * crypto/SubtleCrypto.idl:
     19
    1202016-12-01  Eric Carlson  <eric.carlson@apple.com>
    221
  • trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp

    r209166 r209191  
    6060    Digest,
    6161    DeriveKey,
     62    DeriveBits,
    6263    GenerateKey,
    6364    ImportKey,
     
    150151            break;
    151152        case Operations::DeriveKey:
     153        case Operations::DeriveBits:
    152154            setDOMException(&state, NOT_SUPPORTED_ERR);
    153155            return nullptr;
     
    699701}
    700702
     703static void jsSubtleCryptoFunctionDeriveBitsPromise(ExecState& state, Ref<DeferredPromise>&& promise)
     704{
     705    VM& vm = state.vm();
     706    auto scope = DECLARE_THROW_SCOPE(vm);
     707
     708    if (UNLIKELY(state.argumentCount() < 3)) {
     709        promise->reject<JSValue>(createNotEnoughArgumentsError(&state));
     710        return;
     711    }
     712
     713    auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(0), Operations::DeriveBits);
     714    RETURN_IF_EXCEPTION(scope, void());
     715
     716    // We should always return a NOT_SUPPORTED_ERR since we currently don't support any algorithms that has deriveBits operation.
     717    ASSERT_NOT_REACHED();
     718}
     719
    701720static void jsSubtleCryptoFunctionGenerateKeyPromise(ExecState& state, Ref<DeferredPromise>&& promise)
    702721{
     
    974993}
    975994
     995JSValue JSSubtleCrypto::deriveBits(ExecState& state)
     996{
     997    return callPromiseFunction<jsSubtleCryptoFunctionDeriveBitsPromise, PromiseExecutionScope::WindowOrWorker>(state);
     998}
     999
    9761000JSValue JSSubtleCrypto::generateKey(ExecState& state)
    9771001{
  • trunk/Source/WebCore/crypto/SubtleCrypto.idl

    r209166 r209191  
    3838    [Custom] Promise<any> digest(AlgorithmIdentifier algorithm, BufferSource data);
    3939    [Custom] Promise<any> deriveKey(AlgorithmIdentifier algorithm, CryptoKey baseKey, AlgorithmIdentifier derivedKeyType, boolean extractable, sequence<KeyUsage> keyUsages);
     40    [Custom] Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, CryptoKey baseKey, unsigned long length);
    4041    // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
    4142    [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
Note: See TracChangeset for help on using the changeset viewer.