From 8ea43400a34855e8cd9092a2c4c0d969cf0be80d Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 18 Feb 2009 12:05:20 +0000 Subject: added runtime switch for anytun 0.2 crypto compability --- src/cipher.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/cipher.c') 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 #include -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; -- cgit v1.2.3