File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 19
19
#include < test/fuzz/fuzz.h>
20
20
#include < util/strencodings.h>
21
21
22
+ #include < array>
22
23
#include < cassert>
23
24
#include < cstdint>
24
25
#include < numeric>
@@ -305,4 +306,25 @@ FUZZ_TARGET_INIT(key, initialize_key)
305
306
assert (key == loaded_key);
306
307
}
307
308
}
309
+
310
+ {
311
+ std::array<uint8_t , 32 > rnd32;
312
+ memcpy (rnd32.data (), &random_uint256, 32 );
313
+ assert (pubkey.EllSqEncode (rnd32)->size () == ELLSQ_ENCODED_SIZE);
314
+ }
315
+ }
316
+
317
+ FUZZ_TARGET_INIT (ellsq, initialize_key)
318
+ {
319
+ if (buffer.size () < 64 ) {
320
+ return ;
321
+ }
322
+
323
+ auto ellsq_bytes = buffer.first (64 );
324
+ // Any 64 bytes are a valid elligator squared encoding of a pubkey
325
+ EllSqPubKey ellsq_pubkey;
326
+ std::copy (ellsq_bytes.begin (), ellsq_bytes.end (), ellsq_pubkey.begin ());
327
+ CPubKey pubkey{ellsq_pubkey};
328
+
329
+ assert (pubkey.IsFullyValid ());
308
330
}
You can’t perform that action at this time.
0 commit comments