aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/curve25519-donna.h18
-rwxr-xr-xlib/curve25519-donna/python-src/curve25519/test/test_curve25519.py2
-rwxr-xr-xlib/curve25519-donna/python-src/curve25519/test/test_speed.py2
-rwxr-xr-xlib/curve25519-donna/setup.py2
-rw-r--r--lib/ed25519_additions.c43
5 files changed, 21 insertions, 46 deletions
diff --git a/lib/curve25519-donna.h b/lib/curve25519-donna.h
new file mode 100644
index 0000000..3c53d4a
--- /dev/null
+++ b/lib/curve25519-donna.h
@@ -0,0 +1,18 @@
+/* header file for the curve25519-donna implementation, because the
+ * authors of that project don't supply one.
+ */
+#ifndef CURVE25519_DONNA_H
+#define CURVE25519_DONNA_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int curve25519_donna(unsigned char *output, const unsigned char *a,
+ const unsigned char *b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/lib/curve25519-donna/python-src/curve25519/test/test_curve25519.py b/lib/curve25519-donna/python-src/curve25519/test/test_curve25519.py
index 2ecbd47..b3a5447 100755
--- a/lib/curve25519-donna/python-src/curve25519/test/test_curve25519.py
+++ b/lib/curve25519-donna/python-src/curve25519/test/test_curve25519.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
import unittest
diff --git a/lib/curve25519-donna/python-src/curve25519/test/test_speed.py b/lib/curve25519-donna/python-src/curve25519/test/test_speed.py
index 87952fa..4d7e0c8 100755
--- a/lib/curve25519-donna/python-src/curve25519/test/test_speed.py
+++ b/lib/curve25519-donna/python-src/curve25519/test/test_speed.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
from time import time
from curve25519 import Private
diff --git a/lib/curve25519-donna/setup.py b/lib/curve25519-donna/setup.py
index dc1b8eb..df5cbfd 100755
--- a/lib/curve25519-donna/setup.py
+++ b/lib/curve25519-donna/setup.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/env python
from subprocess import Popen, PIPE
from distutils.core import setup, Extension
diff --git a/lib/ed25519_additions.c b/lib/ed25519_additions.c
deleted file mode 100644
index 5fa0c68..0000000
--- a/lib/ed25519_additions.c
+++ /dev/null
@@ -1,43 +0,0 @@
-void convert_curve25519_to_ed25519(
- unsigned char * public_key,
- unsigned char * signature
-) {
- fe mont_x, mont_x_minus_one, mont_x_plus_one, inv_mont_x_plus_one;
- fe one;
- fe ed_y;
-
- fe_frombytes(mont_x, public_key);
- fe_1(one);
- fe_sub(mont_x_minus_one, mont_x, one);
- fe_add(mont_x_plus_one, mont_x, one);
- fe_invert(inv_mont_x_plus_one, mont_x_plus_one);
- fe_mul(ed_y, mont_x_minus_one, inv_mont_x_plus_one);
- fe_tobytes(public_key, ed_y);
-
- public_key[31] &= 0x7F;
- public_key[31] |= (signature[63] & 0x80);
- signature[63] &= 0x7F;
-}
-
-
-void convert_ed25519_to_curve25519(
- unsigned char const * public_key,
- unsigned char * signature
-) {
- unsigned char sign_bit = public_key[31] & 0x80;
- signature[63] &= 0x7F;
- signature[63] |= sign_bit;
-}
-
-
-void ed25519_keypair(
- unsigned char * private_key,
- unsigned char * public_key
-) {
- ge_p3 A;
- private_key[0] &= 248;
- private_key[31] &= 63;
- private_key[31] |= 64;
- ge_scalarmult_base(&A, private_key);
- ge_p3_tobytes(public_key, &A);
-}