summaryrefslogtreecommitdiff
path: root/src/cipher.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-18 12:05:20 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-18 12:05:20 +0000
commit8ea43400a34855e8cd9092a2c4c0d969cf0be80d (patch)
tree16a23bb99930d702f157e4bec2524ee3c725bdef /src/cipher.c
parentupdated kamikaze package description (diff)
added runtime switch for anytun 0.2 crypto compability
Diffstat (limited to 'src/cipher.c')
-rw-r--r--src/cipher.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/cipher.c b/src/cipher.c
index 58467cb..f585471 100644
--- a/src/cipher.c
+++ b/src/cipher.c
@@ -44,11 +44,12 @@
#include <stdlib.h>
#include <string.h>
-int cipher_init(cipher_t* c, const char* type)
+int cipher_init(cipher_t* c, const char* type, int8_t anytun02_compat)
{
if(!c)
return -1;
+ c->anytun02_compat_ = anytun02_compat;
c->key_length_ = 0;
c->type_ = c_unknown;
@@ -261,10 +262,10 @@ int cipher_aesctr_calc_ctr(cipher_t* c, key_derivation_t* kd, key_store_dir_t di
if(ret < 0)
return ret;
-#ifdef ANYTUN_02_COMPAT
- if(!c->salt_.buf_[0])
- c->salt_.buf_[0] = 1;
-#endif
+ if(c->anytun02_compat_) {
+ if(!c->salt_.buf_[0])
+ c->salt_.buf_[0] = 1;
+ }
memcpy(params->ctr_.salt_.buf_, c->salt_.buf_, C_AESCTR_SALT_LENGTH);
params->ctr_.salt_.zero_ = 0;