|
|
@@ -23,6 +23,7 @@ |
|
|
|
# |
|
|
|
|
|
|
|
import os |
|
|
|
import unittest |
|
|
|
|
|
|
|
from ctypes import Structure, POINTER, CFUNCTYPE, pointer, sizeof |
|
|
|
from ctypes import c_uint8, c_uint16, c_ssize_t, c_size_t, c_uint64, c_int |
|
|
@@ -161,3 +162,21 @@ def comms_process_wrap(state, input): |
|
|
|
comms_process(state, inpkt, outbuf) |
|
|
|
|
|
|
|
return outbuf._from() |
|
|
|
|
|
|
|
class TestX25519(unittest.TestCase): |
|
|
|
def test_basic(self): |
|
|
|
aprivkey = x25519_genkey() |
|
|
|
apubkey = x25519_base(aprivkey, 1) |
|
|
|
|
|
|
|
bprivkey = x25519_genkey() |
|
|
|
bpubkey = x25519_base(bprivkey, 1) |
|
|
|
|
|
|
|
self.assertNotEqual(aprivkey, bprivkey) |
|
|
|
self.assertNotEqual(apubkey, bpubkey) |
|
|
|
|
|
|
|
ra = x25519_wrap(apubkey, aprivkey, bpubkey, 1) |
|
|
|
|
|
|
|
rb = x25519_wrap(bpubkey, bprivkey, apubkey, 1) |
|
|
|
|
|
|
|
self.assertEqual(ra, rb) |
|
|
|
|