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/key_derivation.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/key_derivation.h') diff --git a/src/key_derivation.h b/src/key_derivation.h index d78a93e..b566334 100644 --- a/src/key_derivation.h +++ b/src/key_derivation.h @@ -64,6 +64,7 @@ struct key_derivation_struct { key_derivation_type_t type_; u_int16_t key_length_; int8_t ld_kdr_; + int8_t anytun02_compat_; buffer_t master_key_; buffer_t master_salt_; key_store_t key_store_[2][KD_LABEL_COUNT]; @@ -71,7 +72,7 @@ struct key_derivation_struct { }; typedef struct key_derivation_struct key_derivation_t; -int key_derivation_init(key_derivation_t* kd, const char* type, int8_t ld_kdr, const char* passphrase, u_int8_t* key, u_int32_t key_len, u_int8_t* salt, u_int32_t salt_len); +int key_derivation_init(key_derivation_t* kd, const char* type, int8_t ld_kdr, int8_t anytun02_compat, const char* passphrase, u_int8_t* key, u_int32_t key_len, u_int8_t* salt, u_int32_t salt_len); #ifndef NO_PASSPHRASE int key_derivation_generate_master_key(key_derivation_t* kd, const char* passphrase, u_int16_t key_length); int key_derivation_generate_master_salt(key_derivation_t* kd, const char* passphrase, u_int16_t salt_length); @@ -92,14 +93,12 @@ union __attribute__((__packed__)) key_derivation_aesctr_ctr_union { u_int8_t buf_[KD_AESCTR_SALT_LENGTH]; u_int16_t zero_; } salt_; -#ifndef ANYTUN_02_COMPAT struct __attribute__((__packed__)) { u_int8_t fill_[KD_AESCTR_SALT_LENGTH - sizeof(u_int8_t) - sizeof(seq_nr_t)]; u_int8_t label_; seq_nr_t r_; u_int16_t zero_; - } params_; -#else + } params_compat_; struct __attribute__((__packed__)) { u_int8_t fill_[KD_AESCTR_SALT_LENGTH - sizeof(u_int8_t) - 2 - sizeof(seq_nr_t)]; u_int8_t label_; @@ -107,7 +106,6 @@ union __attribute__((__packed__)) key_derivation_aesctr_ctr_union { seq_nr_t r_; u_int16_t zero_; } params_; -#endif }; typedef union key_derivation_aesctr_ctr_union key_derivation_aesctr_ctr_t; -- cgit v1.2.3