Browse Source

Some crypto comment fixes.

Adam Ierymenko 11 năm trước cách đây
mục cha
commit
c3cbc92757
2 tập tin đã thay đổi với 9 bổ sung6 xóa
  1. 4 4
      node/Poly1305.cpp
  2. 5 2
      node/Poly1305.hpp

+ 4 - 4
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;

+ 5 - 2
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
 {