rand.inc 766 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. * https://www.openssl.org/source/license.html
  8. * or in the file LICENSE in the source distribution.
  9. */
  10. #include <openssl/rand.h>
  11. static int fuzz_bytes(unsigned char *buf, int num)
  12. {
  13. unsigned char val = 1;
  14. while (--num >= 0)
  15. *buf++ = val++;
  16. return 1;
  17. }
  18. static int fuzz_status(void)
  19. {
  20. return 1;
  21. }
  22. static RAND_METHOD fuzz_rand_method = {
  23. NULL,
  24. fuzz_bytes,
  25. NULL,
  26. NULL,
  27. fuzz_bytes,
  28. fuzz_status
  29. };
  30. void FuzzerSetRand(void)
  31. {
  32. RAND_set_rand_method(&fuzz_rand_method);
  33. }