v3name.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2012-2023 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <string.h>
  10. #include <openssl/e_os2.h>
  11. #include <openssl/x509.h>
  12. #include <openssl/x509v3.h>
  13. #include "internal/nelem.h"
  14. #include "fuzzer.h"
  15. int FuzzerInitialize(int *argc, char ***argv)
  16. {
  17. return 1;
  18. }
  19. int FuzzerTestOneInput(const uint8_t* data, size_t size){
  20. GENERAL_NAME *namesa;
  21. GENERAL_NAME *namesb;
  22. const unsigned char *derp = data;
  23. /*
  24. * We create two versions of each GENERAL_NAME so that we ensure when
  25. * we compare them they are always different pointers.
  26. */
  27. namesa = d2i_GENERAL_NAME(NULL, &derp, size);
  28. derp = data;
  29. namesb = d2i_GENERAL_NAME(NULL, &derp, size);
  30. GENERAL_NAME_cmp(namesa, namesb);
  31. if (namesa != NULL)
  32. GENERAL_NAME_free(namesa);
  33. if (namesb != NULL)
  34. GENERAL_NAME_free(namesb);
  35. return 0;
  36. }
  37. void FuzzerCleanup(void)
  38. {
  39. }