summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/anytun.suobin39936 -> 42496 bytes
-rw-r--r--src/anytun.vcproj23
-rw-r--r--src/cipher.cpp6
-rw-r--r--src/cipher.h8
-rw-r--r--src/datatypes.h2
-rw-r--r--src/encryptedPacket.h6
-rw-r--r--src/keyDerivation.cpp2
-rw-r--r--src/keyDerivation.h10
-rw-r--r--src/seqWindow.cpp6
9 files changed, 40 insertions, 23 deletions
diff --git a/src/anytun.suo b/src/anytun.suo
index 90b43cf..847888f 100644
--- a/src/anytun.suo
+++ b/src/anytun.suo
Binary files differ
diff --git a/src/anytun.vcproj b/src/anytun.vcproj
index bc74de4..29e7b81 100644
--- a/src/anytun.vcproj
+++ b/src/anytun.vcproj
@@ -42,13 +42,13 @@
Name="VCCLCompilerTool"
AdditionalOptions="/I "C:\Program Files\boost\boost_1_35_0\""
Optimization="0"
- PreprocessorDefinitions="LOGSTDOUT;NOCRYPT;NODAEMON;NOEXEC;NOPACKED;NOSYSLOG;NOSIGNALCONTROLLER;WIN32_LEAN_AND_MEAN"
+ PreprocessorDefinitions="LOGSTDOUT;USE_SSL_CRYPTO;NODAEMON;NOEXEC;NOSYSLOG;NOSIGNALCONTROLLER;WIN32_LEAN_AND_MEAN"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="true"
+ Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
ForcedIncludeFiles=""
/>
@@ -63,8 +63,10 @@
/>
<Tool
Name="VCLinkerTool"
+ AdditionalDependencies="libeay32MDd.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="C:\Program Files\boost\boost_1_35_0\lib"
+ AdditionalLibraryDirectories=""
+ IgnoreAllDefaultLibraries="false"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@@ -114,11 +116,11 @@
/>
<Tool
Name="VCCLCompilerTool"
- PreprocessorDefinitions="NOCRYPT;NODAEMON;NOEXEC;NOPACKED;NOSYSLOG;NOSIGNALCONTROLLER;WIN32_LEAN_AND_MEAN"
+ PreprocessorDefinitions="USE_SSL_CRYPTO;NODAEMON;NOEXEC;NOSYSLOG;NOSIGNALCONTROLLER;WIN32_LEAN_AND_MEAN"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="true"
+ Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
@@ -132,8 +134,9 @@
/>
<Tool
Name="VCLinkerTool"
+ AdditionalDependencies="libeay32MD.lib"
LinkIncremental="2"
- AdditionalLibraryDirectories="C:\Program Files\boost\boost_1_35_0\lib"
+ AdditionalLibraryDirectories=""
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
@@ -334,14 +337,6 @@
<File
RelativePath=".\authAlgo.cpp"
>
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions="NODAEMON;NOEXEC;NOCRYPT"
- />
- </FileConfiguration>
</File>
<File
RelativePath=".\authAlgoFactory.cpp"
diff --git a/src/cipher.cpp b/src/cipher.cpp
index 69686bb..3dc2314 100644
--- a/src/cipher.cpp
+++ b/src/cipher.cpp
@@ -131,8 +131,8 @@ void AesIcmCipher::calcCtr(KeyDerivation& kd, seq_nr_t seq_nr, sender_id_t sende
kd.generate(dir_, LABEL_SATP_SALT, seq_nr, salt_);
#ifdef ANYTUN_02_COMPAT
- if(!salt_[int32_t(0)])
- salt_[int32_t(0)] = 1;
+ if(!salt_[u_int32_t(0)])
+ salt_[u_int32_t(0)] = 1;
#endif
std::memcpy(ctr_.salt_.buf_, salt_.getBuf(), SALT_LENGTH);
@@ -185,7 +185,7 @@ void AesIcmCipher::calc(KeyDerivation& kd, u_int8_t* in, u_int32_t ilen, u_int8_
cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher CTR: size don't fits";
return;
}
- u_int32_t num = 0;
+ unsigned int num = 0;
std::memset(ecount_buf_, 0, AES_BLOCK_SIZE);
AES_ctr128_encrypt(in, out, (ilen < olen) ? ilen : olen, &aes_key_, ctr_.buf_, ecount_buf_, &num);
#endif
diff --git a/src/cipher.h b/src/cipher.h
index 1e3471b..b26416b 100644
--- a/src/cipher.h
+++ b/src/cipher.h
@@ -105,13 +105,16 @@ private:
Buffer key_;
Buffer salt_;
+#ifdef _MSC_VER
+ #pragma pack(push, 1)
+#endif
union ATTR_PACKED cipher_aesctr_ctr_union {
u_int8_t buf_[CTR_LENGTH];
struct ATTR_PACKED {
u_int8_t buf_[SALT_LENGTH];
u_int16_t zero_;
} salt_;
- struct ATTR_PACKED {
+ struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(mux_t) - sizeof(sender_id_t) - 2 - sizeof(seq_nr_t)];
mux_t mux_;
sender_id_t sender_id_;
@@ -120,6 +123,9 @@ private:
u_int16_t zero_;
} params_;
} ctr_;
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
};
#endif
diff --git a/src/datatypes.h b/src/datatypes.h
index 2fe492c..7025528 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -52,7 +52,7 @@ typedef u_int16_t sender_id_t;
typedef u_int16_t payload_type_t;
typedef u_int16_t mux_t;
-#ifndef NOPACKED
+#ifndef _MSC_VER
#define ATTR_PACKED __attribute__((__packed__))
#else
#define ATTR_PACKED
diff --git a/src/encryptedPacket.h b/src/encryptedPacket.h
index 4a9b21b..ac67950 100644
--- a/src/encryptedPacket.h
+++ b/src/encryptedPacket.h
@@ -130,12 +130,18 @@ private:
void reinit();
+#ifdef _MSC_VER
+ #pragma pack(push, 1)
+#endif
struct ATTR_PACKED HeaderStruct
{
seq_nr_t seq_nr;
sender_id_t sender_id;
mux_t mux;
};
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
struct HeaderStruct* header_;
u_int8_t * payload_;
diff --git a/src/keyDerivation.cpp b/src/keyDerivation.cpp
index 5b4f7a6..dbe5dee 100644
--- a/src/keyDerivation.cpp
+++ b/src/keyDerivation.cpp
@@ -225,7 +225,7 @@ bool AesIcmKeyDerivation::generate(kd_dir_t dir, satp_prf_label_t label, seq_nr_
cLog.msg(Log::PRIO_ERR) << "AesIcmCipher: Failed to set cipher CTR: size don't fits";
return false;
}
- u_int32_t num = 0;
+ unsigned int num = 0;
std::memset(ecount_buf_[dir], 0, AES_BLOCK_SIZE);
std::memset(key.getBuf(), 0, key.getLength());
AES_ctr128_encrypt(key.getBuf(), key.getBuf(), key.getLength(), &aes_key_[dir], ctr_[dir].buf_, ecount_buf_[dir], &num);
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index 5d433ca..926d35f 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -170,14 +170,17 @@ private:
key_store_t key_store_[2][KD_LABEL_COUNT];
+#ifdef _MSC_VER
+ #pragma pack(push, 1)
+#endif
union ATTR_PACKED key_derivation_aesctr_ctr_union {
u_int8_t buf_[CTR_LENGTH];
- struct ATTR_PACKED {
+ struct ATTR_PACKED {
u_int8_t buf_[SALT_LENGTH];
u_int16_t zero_;
} salt_;
#ifndef ANYTUN_02_COMPAT
- struct ATTR_PACKED {
+ struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(u_int8_t) - sizeof(seq_nr_t)];
u_int8_t label_;
seq_nr_t r_;
@@ -193,6 +196,9 @@ private:
} params_;
#endif
} ctr_[2];
+#ifdef _MSC_VER
+ #pragma pack(pop)
+#endif
};
#endif
diff --git a/src/seqWindow.cpp b/src/seqWindow.cpp
index 1ddd3ca..34ce02c 100644
--- a/src/seqWindow.cpp
+++ b/src/seqWindow.cpp
@@ -140,7 +140,11 @@ bool SeqWindow::checkAndAdd(sender_id_t sender, seq_nr_t seq_nr)
int ret = s->second.window_[pos];
s->second.window_[pos] = 1;
- return ret;
+
+ if(ret)
+ return true;
+
+ return false;
}
void SeqWindow::clear(sender_id_t sender)