mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 12:22:50 -05: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
51 lines
1.8 KiB
C++
51 lines
1.8 KiB
C++
// Copyright (c) 2019-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 <test/fuzz/fuzz.h>
|
|
|
|
#include <base58.h>
|
|
#include <psbt.h>
|
|
#include <util/strencodings.h>
|
|
#include <util/string.h>
|
|
|
|
#include <cassert>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
FUZZ_TARGET(base_encode_decode)
|
|
{
|
|
const std::string random_encoded_string(buffer.begin(), buffer.end());
|
|
|
|
std::vector<unsigned char> decoded;
|
|
if (DecodeBase58(random_encoded_string, decoded, 100)) {
|
|
const std::string encoded_string = EncodeBase58(decoded);
|
|
assert(encoded_string == TrimStringView(encoded_string));
|
|
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
|
}
|
|
|
|
if (DecodeBase58Check(random_encoded_string, decoded, 100)) {
|
|
const std::string encoded_string = EncodeBase58Check(decoded);
|
|
assert(encoded_string == TrimString(encoded_string));
|
|
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
|
}
|
|
|
|
auto result = DecodeBase32(random_encoded_string);
|
|
if (result) {
|
|
const std::string encoded_string = EncodeBase32(*result);
|
|
assert(encoded_string == TrimStringView(encoded_string));
|
|
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
|
}
|
|
|
|
result = DecodeBase64(random_encoded_string);
|
|
if (result) {
|
|
const std::string encoded_string = EncodeBase64(*result);
|
|
assert(encoded_string == TrimString(encoded_string));
|
|
assert(ToLower(encoded_string) == ToLower(TrimString(random_encoded_string)));
|
|
}
|
|
|
|
PartiallySignedTransaction psbt;
|
|
std::string error;
|
|
(void)DecodeBase64PSBT(psbt, random_encoded_string, error);
|
|
}
|