diff options
Diffstat (limited to 'node')
-rw-r--r-- | node/Poly1305.cpp | 8 | ||||
-rw-r--r-- | node/Poly1305.hpp | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/node/Poly1305.cpp b/node/Poly1305.cpp index e9ac8ce7..230b2eff 100644 --- a/node/Poly1305.cpp +++ b/node/Poly1305.cpp @@ -16,7 +16,7 @@ namespace ZeroTier { ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -static void add(unsigned int h[17],const unsigned int c[17]) +static inline void add(unsigned int h[17],const unsigned int c[17]) { unsigned int j; unsigned int u; @@ -24,7 +24,7 @@ static void add(unsigned int h[17],const unsigned int c[17]) for (j = 0;j < 17;++j) { u += h[j] + c[j]; h[j] = u & 255; u >>= 8; } } -static void squeeze(unsigned int h[17]) +static inline void squeeze(unsigned int h[17]) { unsigned int j; unsigned int u; @@ -40,7 +40,7 @@ static const unsigned int minusp[17] = { 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 } ; -static void freeze(unsigned int h[17]) +static inline void freeze(unsigned int h[17]) { unsigned int horig[17]; unsigned int j; @@ -51,7 +51,7 @@ static void freeze(unsigned int h[17]) for (j = 0;j < 17;++j) h[j] ^= negative & (horig[j] ^ h[j]); } -static void mulmod(unsigned int h[17],const unsigned int r[17]) +static inline void mulmod(unsigned int h[17],const unsigned int r[17]) { unsigned int hr[17]; unsigned int i; diff --git a/node/Poly1305.hpp b/node/Poly1305.hpp index c0e231eb..8ef200c6 100644 --- a/node/Poly1305.hpp +++ b/node/Poly1305.hpp @@ -38,8 +38,11 @@ namespace ZeroTier { * * This takes a one-time-use 32-byte key and generates a 16-byte message * authentication code. The key must never be re-used for a different - * message. Normally this is done by taking a base key and mangling it - * using a nonce and possibly other data, as in Packet. + * message. + * + * In Packet this is done by using the first 32 bytes of the stream cipher + * keystream as a one-time-use key. These 32 bytes are then discarded and + * the packet is encrypted with the next N bytes. */ class Poly1305 { |