summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-03-17 00:04:19 +0000
committerChristian Pointner <equinox@anytun.org>2009-03-17 00:04:19 +0000
commit1e82eb471a90291cedd3d8039cf9e40b96733088 (patch)
tree39adab092bbcde4f79f519510ee85a69059f1e0c
parentremoved role symmetric (useless) (diff)
fixed endianess error at new label
-rw-r--r--src/datatypes.h4
-rw-r--r--src/key_derivation.c6
-rw-r--r--src/key_derivation.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/src/datatypes.h b/src/datatypes.h
index a616dfe..3925f26 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -66,6 +66,10 @@ typedef u_int16_t mux_t;
#define MUX_T_NTOH(a) ntohs(a)
#define MUX_T_HTON(a) htons(a)
+typedef u_int32_t satp_prf_label_t;
+#define SATP_PRF_LABEL_T_NTOH(a) ntohl(a)
+#define SATP_PRF_LABEL_T_HTON(a) htonl(a)
+
struct buffer_struct {
u_int32_t length_;
u_int8_t* buf_;
diff --git a/src/key_derivation.c b/src/key_derivation.c
index a5a3650..531b02b 100644
--- a/src/key_derivation.c
+++ b/src/key_derivation.c
@@ -120,7 +120,7 @@ int key_derivation_generate_master_key(key_derivation_t* kd, const char* passphr
return -1;
if(kd->master_key_.buf_) {
- log_printf(ERROR, "master key and passphrase provided, ignoring passphrase");
+ log_printf(WARNING, "master key and passphrase provided, ignoring passphrase");
return 0;
}
log_printf(NOTICE, "using passphrase to generate master key");
@@ -176,7 +176,7 @@ int key_derivation_generate_master_salt(key_derivation_t* kd, const char* passph
return -1;
if(kd->master_salt_.buf_) {
- log_printf(ERROR, "master salt and passphrase provided, ignoring passphrase");
+ log_printf(WARNING, "master salt and passphrase provided, ignoring passphrase");
return 0;
}
log_printf(NOTICE, "using passphrase to generate master salt");
@@ -409,7 +409,7 @@ int key_derivation_aesctr_calc_ctr(key_derivation_t* kd, key_derivation_dir_t di
params->ctr_.params_compat_.seq_ ^= SEQ_NR_T_HTON(seq_nr);
}
else {
- params->ctr_.params_.label_ ^= convert_label(kd->role_, dir, label);
+ params->ctr_.params_.label_ ^= SATP_PRF_LABEL_T_HTON(convert_label(kd->role_, dir, label));
params->ctr_.params_.seq_ ^= SEQ_NR_T_HTON(seq_nr);
}
diff --git a/src/key_derivation.h b/src/key_derivation.h
index d2fafea..91345ce 100644
--- a/src/key_derivation.h
+++ b/src/key_derivation.h
@@ -55,8 +55,6 @@
#define LABEL_LEFT_AUTH 0xE0000683
#define LABEL_RIGHT_AUTH 0xE001B97C
-typedef u_int32_t satp_prf_label_t;
-
enum key_derivation_type_enum { kd_unknown, kd_null, kd_aes_ctr };
typedef enum key_derivation_type_enum key_derivation_type_t;
enum key_derivation_dir_enum { kd_inbound, kd_outbound };