summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-15 17:08:37 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-15 17:08:37 +0000
commit8bdc2bd3d46dfa40af1eb241905f8b0e33c0e5d8 (patch)
tree4fc333a1baa997613f2e530d26334f71239c7f0d
parentsmall cleanup (diff)
fixed NOPACKED (Windows build)
-rw-r--r--src/cipher.h6
-rw-r--r--src/datatypes.h6
-rw-r--r--src/encryptedPacket.h8
-rw-r--r--src/keyDerivation.h8
4 files changed, 15 insertions, 13 deletions
diff --git a/src/cipher.h b/src/cipher.h
index c77142e..1e3471b 100644
--- a/src/cipher.h
+++ b/src/cipher.h
@@ -105,13 +105,13 @@ private:
Buffer key_;
Buffer salt_;
- union __attribute__((__packed__)) cipher_aesctr_ctr_union {
+ union ATTR_PACKED cipher_aesctr_ctr_union {
u_int8_t buf_[CTR_LENGTH];
- struct __attribute__ ((__packed__)) {
+ struct ATTR_PACKED {
u_int8_t buf_[SALT_LENGTH];
u_int16_t zero_;
} salt_;
- struct __attribute__((__packed__)) {
+ struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(mux_t) - sizeof(sender_id_t) - 2 - sizeof(seq_nr_t)];
mux_t mux_;
sender_id_t sender_id_;
diff --git a/src/datatypes.h b/src/datatypes.h
index fef1cbf..8a7daff 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -52,4 +52,10 @@ typedef u_int16_t sender_id_t;
typedef u_int16_t payload_type_t;
typedef u_int16_t mux_t;
+#ifndef NOPACKED
+#define ATTR_PACKED __attribute__((__packed__))
+#else
+#define ATTR_PACKED
+#endif
+
#endif
diff --git a/src/encryptedPacket.h b/src/encryptedPacket.h
index a4356dd..4a9b21b 100644
--- a/src/encryptedPacket.h
+++ b/src/encryptedPacket.h
@@ -130,16 +130,12 @@ private:
void reinit();
- struct HeaderStruct
+ struct ATTR_PACKED HeaderStruct
{
seq_nr_t seq_nr;
sender_id_t sender_id;
mux_t mux;
- }
-#ifndef NOPACKED
- __attribute__((__packed__))
-#endif
-;
+ };
struct HeaderStruct* header_;
u_int8_t * payload_;
diff --git a/src/keyDerivation.h b/src/keyDerivation.h
index 2798d3b..f977922 100644
--- a/src/keyDerivation.h
+++ b/src/keyDerivation.h
@@ -169,21 +169,21 @@ private:
key_store_t key_store_[2][KD_LABEL_COUNT];
- union __attribute__((__packed__)) key_derivation_aesctr_ctr_union {
+ union ATTR_PACKED key_derivation_aesctr_ctr_union {
u_int8_t buf_[CTR_LENGTH];
- struct __attribute__ ((__packed__)) {
+ struct ATTR_PACKED {
u_int8_t buf_[SALT_LENGTH];
u_int16_t zero_;
} salt_;
#ifndef ANYTUN_02_COMPAT
- struct __attribute__((__packed__)) {
+ struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(u_int8_t) - sizeof(seq_nr_t)];
u_int8_t label_;
seq_nr_t r_;
u_int16_t zero_;
} params_;
#else
- struct __attribute__((__packed__)) {
+ struct ATTR_PACKED {
u_int8_t fill_[SALT_LENGTH - sizeof(u_int8_t) - 2 - sizeof(seq_nr_t)];
u_int8_t label_;
u_int8_t r_fill_[2];