summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-02 11:13:53 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-02 11:13:53 -0700
commitdee86e2448725d4ac592816cac504e5d43fcb026 (patch)
tree3375616141f2195e87cd25a09aadc578897e363e
parent17da733f97632a9153512d3dc32270e0c78508d2 (diff)
downloadinfinitytier-dee86e2448725d4ac592816cac504e5d43fcb026.tar.gz
infinitytier-dee86e2448725d4ac592816cac504e5d43fcb026.zip
But since we are now using middle 3 bits we can assign sane values for the cipher suite enum.
-rw-r--r--node/Packet.hpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/node/Packet.hpp b/node/Packet.hpp
index 3012fcfc..9499c519 100644
--- a/node/Packet.hpp
+++ b/node/Packet.hpp
@@ -85,7 +85,7 @@
* sent in the clear. Key agreement is performed using Curve25519 elliptic
* curve Diffie-Hellman.
*/
-#define ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_NONE 0x0
+#define ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_NONE 0
/**
* Cipher suite: Curve25519/Poly1305/Salsa20/12
@@ -95,7 +95,7 @@
* the remaining Salsa20/12 key stream. Key agreement is performed using
* Curve25519 elliptic curve Diffie-Hellman.
*/
-#define ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_SALSA2012 0x4
+#define ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_SALSA2012 1
/**
* Cipher suite: Curve25519/AES256-GCM
@@ -105,7 +105,7 @@
*
* (Not implemented yet in client but reserved for future use.)
*/
-#define ZT_PROTO_CIPHER_SUITE__C25519_AES256_GCM 0x1
+#define ZT_PROTO_CIPHER_SUITE__C25519_AES256_GCM 2
/**
* Header flag indicating that a packet is fragmented
@@ -1017,10 +1017,9 @@ public:
*/
inline unsigned int cipher() const
{
- unsigned char b = (*this)[ZT_PACKET_IDX_FLAGS];
//return (((unsigned int)(*this)[ZT_PACKET_IDX_FLAGS] & 0x38) >> 3);
// Use DEPRECATED 0x80 "encrypted" flag -- this will go away once there are no more <1.0.0 peers on the net
- return ((b & 0x80) == 0) ? ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_NONE : ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_SALSA2012;
+ return (((*this)[ZT_PACKET_IDX_FLAGS] & 0x80) == 0) ? ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_NONE : ZT_PROTO_CIPHER_SUITE__C25519_POLY1305_SALSA2012;
}
/**