-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include <string> | ||
|
||
extern bool rust_miniscript_from_str(const char* miniscript_str); | ||
extern bool rust_bitcoin_psbt(const char* miniscript_str); | ||
extern char* rust_miniscript_from_str_check_key(const char* miniscript_str); | ||
extern char* rust_bitcoin_des_block(const uint8_t *data, size_t len); | ||
extern char* rust_bitcoin_prefilledtransaction(const uint8_t *data, size_t len); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <fuzzer/FuzzedDataProvider.h> | ||
#include <string> | ||
#include <iostream> | ||
#include <stdio.h> | ||
|
||
#include "psbt.h" | ||
#include "bitcoin/src/psbt.h" | ||
#include "bitcoin/src/span.h" | ||
#include "bitcoin/src/node/psbt.h" | ||
|
||
extern "C" bool rust_bitcoin_psbt(uint8_t *data, size_t len); | ||
|
||
bool PSBTCore(Span<const uint8_t> buffer) | ||
{ | ||
PartiallySignedTransaction psbt_mut; | ||
std::string error; | ||
if (!DecodeRawPSBT(psbt_mut, MakeByteSpan(buffer), error)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
|
||
void Psbt(FuzzedDataProvider& provider) | ||
{ | ||
std::vector<uint8_t> buffer{provider.ConsumeRemainingBytes<uint8_t>()}; | ||
bool core{PSBTCore(buffer)}; | ||
bool rust_bitcoin{rust_bitcoin_psbt(buffer.data(), buffer.size())}; | ||
assert(rust_bitcoin == core); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef PSBT_H | ||
#define PSBT_H | ||
|
||
#include <fuzzer/FuzzedDataProvider.h> | ||
|
||
void Psbt(FuzzedDataProvider& provider); | ||
#endif |