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 15
15
#include < script/signingprovider.h>
16
16
#include < script/standard.h>
17
17
#include < streams.h>
18
+ #include < test/fuzz/FuzzedDataProvider.h>
18
19
#include < test/fuzz/fuzz.h>
19
20
#include < util/chaintype.h>
20
21
#include < util/strencodings.h>
21
22
23
+ #include < array>
22
24
#include < cassert>
23
25
#include < cstdint>
24
26
#include < numeric>
@@ -303,3 +305,22 @@ FUZZ_TARGET_INIT(key, initialize_key)
303
305
}
304
306
}
305
307
}
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