Ver código fonte

* Disable SSLv2 support

Bryan Drewery 15 anos atrás
pai
commit
a93f862d9f
2 arquivos alterados com 5 adições e 0 exclusões
  1. 4 0
      src/libssl.c
  2. 1 0
      src/libssl.h

+ 4 - 0
src/libssl.c

@@ -61,6 +61,7 @@ static int load_symbols(void *handle) {
   DLSYM_GLOBAL(handle, SSL_shutdown);
   DLSYM_GLOBAL(handle, SSL_shutdown);
   DLSYM_GLOBAL(handle, SSLv23_client_method);
   DLSYM_GLOBAL(handle, SSLv23_client_method);
   DLSYM_GLOBAL(handle, SSL_write);
   DLSYM_GLOBAL(handle, SSL_write);
+  DLSYM_GLOBAL(handle, SSL_CTX_ctrl);
 
 
   return 0;
   return 0;
 }
 }
@@ -100,6 +101,9 @@ int load_ssl() {
     return 1;
     return 1;
   }
   }
 
 
+  // Disable insecure SSLv2
+  SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2);
+
   if (seed_PRNG()) {
   if (seed_PRNG()) {
     sdprintf("Wasn't able to properly seed the PRNG!");
     sdprintf("Wasn't able to properly seed the PRNG!");
     return 1;
     return 1;

+ 1 - 0
src/libssl.h

@@ -32,6 +32,7 @@ typedef void (*SSL_load_error_strings_t)(void);
 typedef int (*SSL_library_init_t)(void);
 typedef int (*SSL_library_init_t)(void);
 typedef void (*SSL_CTX_free_t)(SSL_CTX*);
 typedef void (*SSL_CTX_free_t)(SSL_CTX*);
 typedef SSL_CTX* (*SSL_CTX_new_t)(const SSL_METHOD*);
 typedef SSL_CTX* (*SSL_CTX_new_t)(const SSL_METHOD*);
+typedef long (*SSL_CTX_ctrl_t)(SSL_CTX*, int, long, void*);
 
 
 int load_ssl();
 int load_ssl();
 int unload_ssl();
 int unload_ssl();