File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1515#include < script/signingprovider.h>
1616#include < script/standard.h>
1717#include < streams.h>
18+ #include < test/fuzz/FuzzedDataProvider.h>
1819#include < test/fuzz/fuzz.h>
1920#include < util/chaintype.h>
2021#include < util/strencodings.h>
2122
23+ #include < array>
2224#include < cassert>
2325#include < cstdint>
2426#include < numeric>
@@ -303,3 +305,22 @@ FUZZ_TARGET_INIT(key, initialize_key)
303305 }
304306 }
305307}
308+
309+ FUZZ_TARGET_INIT (ellswift_roundtrip, initialize_key)
310+ {
311+ FuzzedDataProvider fdp{buffer.data (), buffer.size ()};
312+
313+ auto key_bytes = fdp.ConsumeBytes <uint8_t >(32 );
314+ key_bytes.resize (32 );
315+ CKey key;
316+ key.Set (key_bytes.begin (), key_bytes.end (), true );
317+ if (!key.IsValid ()) return ;
318+
319+ auto ent32 = fdp.ConsumeBytes <std::byte>(32 );
320+ ent32.resize (32 );
321+
322+ auto encoded_ellswift = key.EllSwiftCreate (ent32);
323+ auto decoded_pubkey = encoded_ellswift.Decode ();
324+
325+ assert (key.VerifyPubKey (decoded_pubkey));
326+ }
You can’t perform that action at this time.
0 commit comments