xref: /freebsd/crypto/openssh/regress/misc/fuzz-harness/privkey_fuzz.cc (revision 19261079b74319502c6ffa1249920079f0f69a72)
1*19261079SEd Maste #include <stddef.h>
2*19261079SEd Maste #include <stdio.h>
3*19261079SEd Maste #include <stdint.h>
4*19261079SEd Maste 
5*19261079SEd Maste extern "C" {
6*19261079SEd Maste 
7*19261079SEd Maste #include "sshkey.h"
8*19261079SEd Maste #include "sshbuf.h"
9*19261079SEd Maste 
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)10*19261079SEd Maste int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
11*19261079SEd Maste {
12*19261079SEd Maste 	struct sshkey *k = NULL;
13*19261079SEd Maste 	struct sshbuf *b = sshbuf_from(data, size);
14*19261079SEd Maste 	int r = sshkey_private_deserialize(b, &k);
15*19261079SEd Maste 	if (r == 0) sshkey_free(k);
16*19261079SEd Maste 	sshbuf_free(b);
17*19261079SEd Maste 	return 0;
18*19261079SEd Maste }
19*19261079SEd Maste 
20*19261079SEd Maste } // extern
21*19261079SEd Maste 
22