1 /* Copyright (C) 2021 Yubico AB - See COPYING */ 2 #ifndef FUZZ_H 3 #define FUZZ_H 4 5 #include <stdint.h> 6 #include <stddef.h> 7 #include <security/pam_modules.h> 8 9 #define FUZZ_DEV_HANDLE 0x68696421 10 #define FUZZ_PAM_HANDLE 0x68696423 11 12 #define MAXSTR 256 13 #define MAXBLOB 3072 14 15 struct blob { 16 uint8_t body[MAXBLOB]; 17 size_t len; 18 }; 19 20 void set_wiredata(uint8_t *, size_t); 21 void set_user(const char *); 22 void set_conv(struct pam_conv *); 23 void set_authfile(int); 24 25 int pack_u32(uint8_t **, size_t *, uint32_t); 26 int unpack_u32(const uint8_t **, size_t *, uint32_t *); 27 int pack_blob(uint8_t **, size_t *, const struct blob *); 28 int unpack_blob(const uint8_t **, size_t *, struct blob *); 29 int pack_string(uint8_t **, size_t *, const char *); 30 int unpack_string(const uint8_t **, size_t *, char *); 31 32 /* part of libfido2's fuzzing instrumentation, requires build with -DFUZZ=1 */ 33 void prng_init(unsigned long); 34 uint32_t uniform_random(uint32_t); 35 36 #endif 37