Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

31 rinda
618 B

  1. #include <assert.h>
  2. #include <openssl/ssl.h>
  3. struct GlobalState {
  4. GlobalState() : ctx(SSL_CTX_new(SSLv23_method())) {}
  5. ~GlobalState() {
  6. SSL_CTX_free(ctx);
  7. }
  8. SSL_CTX *const ctx;
  9. };
  10. static GlobalState g_state;
  11. extern "C" int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) {
  12. // This only fuzzes the initial flow from the server so far.
  13. SSL *client = SSL_new(g_state.ctx);
  14. BIO *in = BIO_new(BIO_s_mem());
  15. BIO *out = BIO_new(BIO_s_mem());
  16. SSL_set_bio(client, in, out);
  17. SSL_set_connect_state(client);
  18. BIO_write(in, buf, len);
  19. SSL_do_handshake(client);
  20. SSL_free(client);
  21. return 0;
  22. }