/* * Copyright (C) 2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "CryptoAlgorithmPBKDF2.h" #if ENABLE(WEB_CRYPTO) #include "CryptoAlgorithmPbkdf2Params.h" #include "CryptoKeyRaw.h" #include #include namespace WebCore { Ref CryptoAlgorithmPBKDF2::create() { return adoptRef(*new CryptoAlgorithmPBKDF2); } CryptoAlgorithmIdentifier CryptoAlgorithmPBKDF2::identifier() const { return s_identifier; } void CryptoAlgorithmPBKDF2::deriveBits(const CryptoAlgorithmParameters& parameters, Ref&& baseKey, size_t length, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue) { if (!length || length % 8) { exceptionCallback(OperationError); return; } dispatchOperationInWorkQueue(workQueue, context, WTFMove(callback), WTFMove(exceptionCallback), [parameters = crossThreadCopy(downcast(parameters)), baseKey = WTFMove(baseKey), length] { return platformDeriveBits(parameters, downcast(baseKey.get()), length); }); } void CryptoAlgorithmPBKDF2::importKey(CryptoKeyFormat format, KeyData&& data, const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback) { if (format != CryptoKeyFormat::Raw) { exceptionCallback(NotSupportedError); return; } if (usages & (CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt | CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageWrapKey | CryptoKeyUsageUnwrapKey)) { exceptionCallback(SyntaxError); return; } if (extractable) { exceptionCallback(SyntaxError); return; } callback(CryptoKeyRaw::create(parameters.identifier, WTFMove(std::get>(data)), usages)); } ExceptionOr CryptoAlgorithmPBKDF2::getKeyLength(const CryptoAlgorithmParameters&) { return 0; } } // namespace WebCore #endif // ENABLE(WEB_CRYPTO) e-tests'>derrick/fix/node-tests Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2022-03-30[Bun.js] fixup Bun.hashGravatar Jarred Sumner 1-4/+9
2022-03-30[bun-framework-next] Support Next 12.1.3 & React 18Gravatar Jarred Sumner 4-18/+86
2022-03-30[bun-framework-next] Remove unnecessary polyfillsGravatar Jarred Sumner 2-655/+0
2022-03-30Don't need to import react hereGravatar Jarred Sumner 1-1/+0
2022-03-28Delete url.zigGravatar Jarred Sumner 1-151/+0
2022-03-28[bun.js] Add `Bun.hash`Gravatar Jarred Sumner 2-0/+160
2022-03-28CustomEventGravatar Jarred Sumner 11-14/+738
2022-03-28ScriptExecutionContextGravatar Jarred Sumner 2-15/+14
2022-03-28[`bun.js`] Add `Event`, `EventTarget`, `AbortController`, `AbortSignal`Gravatar Jarred Sumner 111-21/+11463
2022-03-27Safer error handlingGravatar Jarred Sumner 2-13/+19
2022-03-27[Bun.js] Add `DOMException`Gravatar Jarred Sumner 1-7/+18
2022-03-27No to FormData for nowGravatar Jarred Sumner 3-272/+2
2022-03-27Update WebKitGravatar Jarred Sumner 1-0/+0
2022-03-27Update base.zigGravatar Jarred Sumner 1-1/+1
2022-03-27Update .clang-formatGravatar Jarred Sumner 1-1/+1
2022-03-27Update MakefileGravatar Jarred Sumner 1-7/+24
2022-03-27Begin adding WebCore classes to bunGravatar Jarred Sumner 123-1014/+12717
2022-03-27Add Bun.mmap exampleGravatar Jarred Sumner 3-0/+34