mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-10 17:17:14 +01:00
2022917223
Add secp256k1_selftest call (Pieter Wuille)3bfca788b0
Remove explicit enabling of default modules (Pieter Wuille)4462cb0498
Adapt to libsecp256k1 API changes (Pieter Wuille)9d47e7b71b
Squashed 'src/secp256k1/' changes from 44c2452fd3..21ffe4b22a (Pieter Wuille) Pull request description: Now that libsecp256k1 has a release (https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-December/021271.html), update the subtree to match it. The changes themselves are not very impactful for Bitcoin Core, but include: * It's no longer needed to specify whether contexts are for signing or verification or both (all contexts support everything), so make use of that in this PR. * Verification operations can use the static context now, removing the need for some infrastructure in pubkey.cpp to make sure a context exists. * Most modules are now enabled by default, so we can drop explicit enabling for them. * CI improvements (in particular, MSVC and more recent MacOS) * Introduction of an internal int128 type, which has no effect for GCC/Clang builds, but enables 128-bit multiplication in MSVC, giving a ~20% speedup there (but still slower than GCC/Clang). * Release process changes (process documentation, changelog, ...). ACKs for top commit: Sjors: ACK2022917223
, but4462cb0498
could use more eyes on it. achow101: ACK2022917223
jonasnick: utACK2022917223
Tree-SHA512: 8a9fe28852abe74abd6f96fef16a94d5a427b1d99bff4caab1699014d24698aab9b966a5364a46ed1001c07a7c1d825154ed4e6557c7decce952b77330a8616b
103 lines
2.7 KiB
C++
103 lines
2.7 KiB
C++
// Copyright (c) 2009-2022 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#include <chainparams.h>
|
|
#include <core_io.h>
|
|
#include <rpc/client.h>
|
|
#include <rpc/util.h>
|
|
#include <test/fuzz/fuzz.h>
|
|
|
|
#include <limits>
|
|
#include <string>
|
|
|
|
void initialize_parse_univalue()
|
|
{
|
|
SelectParams(CBaseChainParams::REGTEST);
|
|
}
|
|
|
|
FUZZ_TARGET_INIT(parse_univalue, initialize_parse_univalue)
|
|
{
|
|
const std::string random_string(buffer.begin(), buffer.end());
|
|
bool valid = true;
|
|
const UniValue univalue = [&] {
|
|
try {
|
|
return ParseNonRFCJSONValue(random_string);
|
|
} catch (const std::runtime_error&) {
|
|
valid = false;
|
|
return UniValue{};
|
|
}
|
|
}();
|
|
if (!valid) {
|
|
return;
|
|
}
|
|
try {
|
|
(void)ParseHashO(univalue, "A");
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHashO(univalue, random_string);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHashV(univalue, "A");
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHashV(univalue, random_string);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHexO(univalue, "A");
|
|
} catch (const UniValue&) {
|
|
}
|
|
try {
|
|
(void)ParseHexO(univalue, random_string);
|
|
} catch (const UniValue&) {
|
|
}
|
|
try {
|
|
(void)ParseHexUV(univalue, "A");
|
|
(void)ParseHexUV(univalue, random_string);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHexV(univalue, "A");
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseHexV(univalue, random_string);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseSighashString(univalue);
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)AmountFromValue(univalue);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
FlatSigningProvider provider;
|
|
(void)EvalDescriptorStringOrObject(univalue, provider);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseConfirmTarget(univalue, std::numeric_limits<unsigned int>::max());
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
try {
|
|
(void)ParseDescriptorRange(univalue);
|
|
} catch (const UniValue&) {
|
|
} catch (const std::runtime_error&) {
|
|
}
|
|
}
|