/* * Copyright (C) 2020 Sony Interactive Entertainment Inc. * * 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 "CryptoAlgorithmECDH.h" #if ENABLE(WEB_CRYPTO) #include "CryptoKeyEC.h" #include "OpenSSLUtilities.h" namespace WebCore { std::optional> CryptoAlgorithmECDH::platformDeriveBits(const CryptoKeyEC& baseKey, const CryptoKeyEC& publicKey) { auto ctx = EvpPKeyCtxPtr(EVP_PKEY_CTX_new(baseKey.platformKey(), nullptr)); if (!ctx) return std::nullopt; if (EVP_PKEY_derive_init(ctx.get()) <= 0) return std::nullopt; if (EVP_PKEY_derive_set_peer(ctx.get(), publicKey.platformKey()) <= 0) return std::nullopt; // Call with a nullptr to get the required buffer size. size_t keyLen; if (EVP_PKEY_derive(ctx.get(), nullptr, &keyLen) <= 0) return std::nullopt; Vector key(keyLen); if (EVP_PKEY_derive(ctx.get(), key.data(), &keyLen) <= 0) return std::nullopt; // Shrink the buffer since the new keyLen may differ from the buffer size. key.shrink(keyLen); return key; } } // namespace WebCore #endif // ENABLE(WEB_CRYPTO) ta.resolve Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-11-15Update ZigGlobalObject.cppGravatar Jarred Sumner 1-3/+1
2022-11-15Add a test with decently large headersGravatar Jarred Sumner 1-0/+61
2022-11-15Update test types a littleGravatar Jarred Sumner 1-2/+2
cc @colinhacks `test` is an alias of `it` `done` accepts an `error` object
2022-11-15Add missing typeGravatar Jarred Sumner 1-0/+5
2022-11-14switch default encoding order (#1510)Gravatar Dylan Conway 1-1/+1
2022-11-14Fix spawn macOS issueGravatar Jarred Sumner 1-7/+11
2022-11-14Fix crash in web crypto. caused by refptrGravatar Jarred Sumner 3-2/+15
2022-11-14Fix crashiness with `process.env`Gravatar Jarred Sumner 2-27/+66
This also makes it a lot slower
2022-11-14Fix string encoding issue in JSC C API usagesGravatar Jarred Sumner 3-139/+74
2022-11-14Prevent double-frees in log msgsGravatar Jarred Sumner 1-4/+15
2022-11-14Fix build errorGravatar Jarred SUmner 2-6/+1
2022-11-14Bugfixes and perf improvements to child_processGravatar Jarred SUmner 15-192/+416
2022-11-13use `write$NOCANCEL`, more loggingGravatar Jarred Sumner 3-12/+42
2022-11-13Add an e2e testGravatar Jarred Sumner 3-0/+52
2022-11-13Add missing `rmdir` exportGravatar Jarred Sumner 1-1/+2
2022-11-13Make node streams faster (#1502)Gravatar Jarred Sumner 23-406/+836
* Make node streams faster * Fix for macOS, improve performance, handle ref and unref Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
2022-11-13Fix incorrect exit status messageGravatar Jarred Sumner 1-3/+6
2022-11-12Fix syntax errorGravatar Jarred Sumner 1-2/+2
2022-11-12Set linker script to Bun 0.2Gravatar Jarred SUmner 1-1/+1
2022-11-12Fix infinite write loop on LinuxGravatar Jarred SUmner 3-44/+185
2022-11-12Add missing typeGravatar Jarred SUmner 1-1/+1
2022-11-12Add linker script to remove unwanted exports (#1499)Gravatar Tom Birch 2-1/+9
2022-11-12Fix memory leak in gzip pool + add test for gzip'd dataGravatar Jarred SUmner 7-62/+1530
2022-11-12Redo how we poll pipes (#1496)Gravatar Jarred Sumner 22-707/+1251
* Fix pipe * Handle unregistered * Fix failing test
2022-11-11Add test that fails on linuxGravatar Jarred Sumner 7-21/+42
2022-11-112 framesGravatar Jarred Sumner 1-1/+1
2022-11-11Revert "Omit frame pointer"Gravatar Jarred Sumner 1-0/+1
This reverts commit 4f91f66a373a295f9a469eb8d84a06b271f6a70a.
2022-11-11Don't rm cachedGravatar Jarred Sumner 4-4/+0
2022-11-11try thisGravatar Jarred Sumner 4-0/+4
2022-11-11Update bun-linux-build.ymlGravatar Jarred Sumner 1-1/+0
2022-11-11try using git actionGravatar Jarred Sumner 4-7/+8
2022-11-11Remove with `git rm`Gravatar Jarred Sumner 2-8/+0