summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-02 20:07:47 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-02 20:07:47 +0000
commit9dd6ba5addb0acafdde9599c8c777a78128735b6 (patch)
tree8f59663dbf1cdd61f5190f0f4fe578630f7e2673
parentchanged to anytun compatible version (diff)
added define for anytun compat
-rw-r--r--src/Makefile2
-rw-r--r--src/cipher.c11
-rw-r--r--src/key_derivation.c15
3 files changed, 18 insertions, 10 deletions
diff --git a/src/Makefile b/src/Makefile
index 3b3be02..3c0edba 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -34,7 +34,7 @@
TARGET=$(shell uname -s)
CC = gcc
-CCFLAGS = -g -O2
+CCFLAGS = -g -O2 # -DANYTUN_02_COMPAT
LD = gcc
LDFLAGS = -g -Wall -O2 -lgcrypt -lgpg-error -lgmp
diff --git a/src/cipher.c b/src/cipher.c
index d400ca8..b61dd22 100644
--- a/src/cipher.c
+++ b/src/cipher.c
@@ -239,10 +239,13 @@ buffer_t cipher_aesctr_calc_ctr(cipher_t* c, key_derivation_t* kd, seq_nr_t seq_
mpz_mul_2exp(ctr, ctr, 16);
result.buf_ = mpz_export(NULL, (size_t*)&result.length_, 1, 1, 0, 0, ctr);
-/* if(faked_msb) { */
-/* c->salt_.buf_[0] = 0; */
-/* result.buf_[0] = 0; */
-/* } */
+
+#ifndef ANYTUN_02_COMPAT
+ if(faked_msb) {
+ c->salt_.buf_[0] = 0;
+ result.buf_[0] = 0;
+ }
+#endif
mpz_clear(ctr);
mpz_clear(sid_mux);
diff --git a/src/key_derivation.c b/src/key_derivation.c
index e53d7f6..c14db40 100644
--- a/src/key_derivation.c
+++ b/src/key_derivation.c
@@ -229,8 +229,11 @@ int key_derivation_aesctr_calc_ctr(key_derivation_t* kd, key_store_t* result, sa
mpz_import(ctr, kd->master_salt_.length_, 1, 1, 0, 0, kd->master_salt_.buf_);
mpz_set_ui(key_id, label);
-/* mpz_mul_2exp(key_id, key_id, (sizeof(r) * 8)); */
+#ifndef ANYTUN_02_COMPAT
+ mpz_mul_2exp(key_id, key_id, (sizeof(r) * 8));
+#else
mpz_mul_2exp(key_id, key_id, 48);
+#endif
mpz_add_ui(key_id, key_id, r);
mpz_xor(ctr, ctr, key_id);
@@ -240,10 +243,12 @@ int key_derivation_aesctr_calc_ctr(key_derivation_t* kd, key_store_t* result, sa
free(result->key_.buf_);
result->key_.buf_ = mpz_export(NULL, (size_t*)&(result->key_.length_), 1, 1, 0, 0, ctr);
-/* if(faked_msb) { */
-/* kd->master_salt_.buf_[0] = 0; */
-/* result->key_.buf_[0] = 0; */
-/* } */
+#ifndef ANYTUN_02_COMPAT
+ if(faked_msb) {
+ kd->master_salt_.buf_[0] = 0;
+ result->key_.buf_[0] = 0;
+ }
+#endif
mpz_clear(ctr);
mpz_clear(key_id);