summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-15 11:02:53 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-15 11:02:53 -0400
commit02f336918547b93b4c03d608eafdf62de5d0a786 (patch)
tree801c25da5a4dc7bbb157d98fc2fd882b3a1441d0
parent300d26973a56b4b544fb4a29ec134fd600976d98 (diff)
downloadinfinitytier-02f336918547b93b4c03d608eafdf62de5d0a786.tar.gz
infinitytier-02f336918547b93b4c03d608eafdf62de5d0a786.zip
Small amount of crypto cleanup.
-rw-r--r--node/C25519.cpp5
-rw-r--r--node/SHA512.cpp6
2 files changed, 9 insertions, 2 deletions
diff --git a/node/C25519.cpp b/node/C25519.cpp
index 06123c90..82ba7884 100644
--- a/node/C25519.cpp
+++ b/node/C25519.cpp
@@ -29,8 +29,9 @@
#include <stdlib.h>
#include <string.h>
-#include "Utils.hpp"
+#include "Constants.hpp"
#include "C25519.hpp"
+#include "Utils.hpp"
#include "SHA512.hpp"
namespace ZeroTier {
@@ -1024,7 +1025,7 @@ typedef struct
/* Packed coordinates of the base point */
-const ge25519 ge25519_base = {{{0x1A, 0xD5, 0x25, 0x8F, 0x60, 0x2D, 0x56, 0xC9, 0xB2, 0xA7, 0x25, 0x95, 0x60, 0xC7, 0x2C, 0x69,
+static const ge25519 ge25519_base = {{{0x1A, 0xD5, 0x25, 0x8F, 0x60, 0x2D, 0x56, 0xC9, 0xB2, 0xA7, 0x25, 0x95, 0x60, 0xC7, 0x2C, 0x69,
0x5C, 0xDC, 0xD6, 0xFD, 0x31, 0xE2, 0xA4, 0xC0, 0xFE, 0x53, 0x6E, 0xCD, 0xD3, 0x36, 0x69, 0x21}},
{{0x58, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66,
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66}},
diff --git a/node/SHA512.cpp b/node/SHA512.cpp
index b9700109..9d6fbd95 100644
--- a/node/SHA512.cpp
+++ b/node/SHA512.cpp
@@ -30,6 +30,7 @@
#include <string.h>
#include "SHA512.hpp"
+#include "Utils.hpp"
namespace ZeroTier {
@@ -47,6 +48,10 @@ Public domain.
#define uint64 uint64_t
+#define load_bigendian(x) Utils::ntoh(*((const uint64_t *)(x)))
+#define store_bigendian(x,u) (*((uint64_t *)(x)) = Utils::hton((u)))
+
+#if 0
static uint64 load_bigendian(const unsigned char *x)
{
return
@@ -72,6 +77,7 @@ static void store_bigendian(unsigned char *x,uint64 u)
x[1] = u; u >>= 8;
x[0] = u;
}
+#endif
#define SHR(x,c) ((x) >> (c))
#define ROTR(x,c) (((x) >> (c)) | ((x) << (64 - (c))))