diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-16 19:25:31 +0000 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-09-16 19:25:31 +0000 |
commit | de5cc82b5b29a47b0cc7de08800fe38860228850 (patch) | |
tree | 0845a9cca81b11f20bcc988fea2b060c85928143 | |
parent | 77f8d75529e401ac7b45927f1d75b4df87bc0c55 (diff) | |
download | infinitytier-de5cc82b5b29a47b0cc7de08800fe38860228850.tar.gz infinitytier-de5cc82b5b29a47b0cc7de08800fe38860228850.zip |
Build fix to eliminate strict aliasing warnings, and a bug fix.
-rw-r--r-- | node/C25519.cpp | 10 | ||||
-rw-r--r-- | node/Utils.hpp | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/node/C25519.cpp b/node/C25519.cpp index eab7d110..7b933e23 100644 --- a/node/C25519.cpp +++ b/node/C25519.cpp @@ -33,6 +33,7 @@ #include "C25519.hpp" #include "Utils.hpp" #include "SHA512.hpp" +#include "Buffer.hpp" namespace ZeroTier { @@ -1895,9 +1896,16 @@ static void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p) fe25519_mul(&r->z, &p->z, &p->t); } +static void p1p1_to_p2_2(ge25519_p3 *r, const ge25519_p1p1 *p) +{ + fe25519_mul(&r->x, &p->x, &p->t); + fe25519_mul(&r->y, &p->y, &p->z); + fe25519_mul(&r->z, &p->z, &p->t); +} + static void p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p) { - p1p1_to_p2((ge25519_p2 *)r, p); + p1p1_to_p2_2(r, p); fe25519_mul(&r->t, &p->x, &p->y); } diff --git a/node/Utils.hpp b/node/Utils.hpp index b214c78c..991ae31b 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -572,7 +572,7 @@ public: char *end = dest + len; while ((*dest++ = *src++)) { if (dest == end) { - dest[len - 1] = (char)0; + --dest = (char)0; return false; } } |