Some crypto comment fixes.

This commit is contained in:
Adam Ierymenko 2014-06-26 17:15:20 -07:00
parent 45a1e048bb
commit c3cbc92757
2 changed files with 9 additions and 6 deletions

View File

@ -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 j;
unsigned int u; 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; } 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 j;
unsigned int u; 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 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 horig[17];
unsigned int j; 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]); 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 hr[17];
unsigned int i; unsigned int i;

View File

@ -38,8 +38,11 @@ namespace ZeroTier {
* *
* This takes a one-time-use 32-byte key and generates a 16-byte message * 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 * 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 * message.
* using a nonce and possibly other data, as in Packet. *
* 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 class Poly1305
{ {