Fixed Windows build errors
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 27 Nov 2017 20:50:56 +0000 (22:50 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 27 Nov 2017 20:52:11 +0000 (22:52 +0200)
src/flow_analyzer/libipfix/ipfix_ssl.c
src/flow_analyzer/libipfix/ipfix_ssl.h
src/flow_analyzer/libipfix/libipfix.vcxproj
src/flow_analyzer/nxflowd/messages.mc

index 730520a..57ded85 100644 (file)
@@ -50,12 +50,21 @@ static DH *get_dh512()
              0x02,
              };
      DH *dh;
-
-     if ((dh=DH_new()) == NULL) return(NULL);
-     dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
-     dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
-     if ((dh->p == NULL) || (dh->g == NULL))
-             { DH_free(dh); return(NULL); }
+     BIGNUM *p, *g;
+
+     p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
+     if (p == NULL)
+        return NULL;
+     g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
+     if (g == NULL)
+     {
+        BN_free(p);
+        return NULL;
+     }
+
+     if ((dh=DH_new()) == NULL) 
+        return(NULL);
+     DH_set0_pqg(dh, p, NULL, g);
      return(dh);
 }
 
@@ -78,12 +87,21 @@ static DH *get_dh1024()
              0x02,
              };
      DH *dh;
+     BIGNUM *p, *g;
+
+     p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
+     if (p == NULL)
+        return NULL;
+     g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
+     if (g == NULL)
+     {
+        BN_free(p);
+        return NULL;
+     }
 
      if ((dh=DH_new()) == NULL) return(NULL);
-     dh->p=BN_bin2bn(dh1024_p,sizeof(dh1024_p),NULL);
-     dh->g=BN_bin2bn(dh1024_g,sizeof(dh1024_g),NULL);
-     if ((dh->p == NULL) || (dh->g == NULL))
-             { DH_free(dh); return(NULL); }
+
+     DH_set0_pqg(dh, p, NULL, g);
      return(dh);
 }
 
@@ -185,15 +203,18 @@ long ipfix_ssl_post_connection_check(SSL *ssl, char *host)
 
                 if (!(meth = X509V3_EXT_get(ext)))
                     break;
-                data = ext->value->data;
 
-#if (OPENSSL_VERSION_NUMBER > 0x00907000L)
+#if OPENSSL_VERSION_NUMBER >= 0x01010000L
+// FIXME: OpenSSL 1.1 implementation
+#elif (OPENSSL_VERSION_NUMBER > 0x00907000L)
+                data = ext->value->data;
                 if (meth->it)
                   ext_str = ASN1_item_d2i(NULL, &data, ext->value->length,
                                           ASN1_ITEM_ptr(meth->it));
                 else
                   ext_str = meth->d2i(NULL, &data, ext->value->length);
 #else
+                data = ext->value->data;
                 ext_str = meth->d2i(NULL, &data, ext->value->length);
 #endif
                 val = meth->i2v(meth, ext_str, NULL);
index e1b72eb..513328d 100644 (file)
@@ -16,6 +16,7 @@ $$LIC$$
 #include <openssl/rand.h>
 #include <openssl/ssl.h>
 #include <openssl/x509v3.h>
+#include <openssl/dh.h>
 
 #define CIPHER_LIST "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
 
index 463f895..29a68fb 100644 (file)
@@ -99,7 +99,7 @@
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <TargetMachine>MachineX86</TargetMachine>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <TargetMachine>MachineX64</TargetMachine>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
     <Link>
-      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
index 0d706e5..5c40dd4 100644 (file)
@@ -83,7 +83,7 @@ SQL query failed (Query = "%1"): %2
 MessageId=
 SymbolicName=MSG_DEBUG_TAG
 Language=English
-<%1> %2
+[%1] %2
 .
 
 ;#endif