aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc/selftest/curve25519.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-24 22:02:13 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-09-25 03:01:21 +0200
commit28d8b7eafe49450ef1bd20939334baebbea0a367 (patch)
tree5404d3b10c4141d31f23bb2e21ef0c73814308d0 /src/crypto/zinc/selftest/curve25519.h
parenthchacha20: keep in native endian in words (diff)
downloadwireguard-monolithic-historical-28d8b7eafe49450ef1bd20939334baebbea0a367.tar.xz
wireguard-monolithic-historical-28d8b7eafe49450ef1bd20939334baebbea0a367.zip
crypto: make constant naming scheme consistent
Diffstat (limited to '')
-rw-r--r--src/crypto/zinc/selftest/curve25519.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/crypto/zinc/selftest/curve25519.h b/src/crypto/zinc/selftest/curve25519.h
index 5d3f268..8c11d80 100644
--- a/src/crypto/zinc/selftest/curve25519.h
+++ b/src/crypto/zinc/selftest/curve25519.h
@@ -5,9 +5,9 @@
#ifdef DEBUG
struct curve25519_test_vector {
- u8 private[CURVE25519_POINT_SIZE];
- u8 public[CURVE25519_POINT_SIZE];
- u8 result[CURVE25519_POINT_SIZE];
+ u8 private[CURVE25519_KEY_SIZE];
+ u8 public[CURVE25519_KEY_SIZE];
+ u8 result[CURVE25519_KEY_SIZE];
bool valid;
};
static const struct curve25519_test_vector curve25519_test_vectors[] __initconst = {
@@ -1283,16 +1283,16 @@ static bool __init curve25519_selftest(void)
{
bool success = true, ret, ret2;
size_t i = 0, j;
- u8 in[CURVE25519_POINT_SIZE];
- u8 out[CURVE25519_POINT_SIZE], out2[CURVE25519_POINT_SIZE];
+ u8 in[CURVE25519_KEY_SIZE];
+ u8 out[CURVE25519_KEY_SIZE], out2[CURVE25519_KEY_SIZE];
for (i = 0; i < ARRAY_SIZE(curve25519_test_vectors); ++i) {
- memset(out, 0, CURVE25519_POINT_SIZE);
+ memset(out, 0, CURVE25519_KEY_SIZE);
ret = curve25519(out, curve25519_test_vectors[i].private,
curve25519_test_vectors[i].public);
if (ret != curve25519_test_vectors[i].valid ||
memcmp(out, curve25519_test_vectors[i].result,
- CURVE25519_POINT_SIZE)) {
+ CURVE25519_KEY_SIZE)) {
pr_info("curve25519 self-test %zu: FAIL\n", i + 1);
success = false;
break;
@@ -1302,11 +1302,11 @@ static bool __init curve25519_selftest(void)
for (i = 0; i < 5; ++i) {
get_random_bytes(in, sizeof(in));
ret = curve25519_generate_public(out, in);
- ret2 = curve25519(out2, in, (u8[CURVE25519_POINT_SIZE]){ 9 });
- if (ret != ret2 || memcmp(out, out2, CURVE25519_POINT_SIZE)) {
+ ret2 = curve25519(out2, in, (u8[CURVE25519_KEY_SIZE]){ 9 });
+ if (ret != ret2 || memcmp(out, out2, CURVE25519_KEY_SIZE)) {
pr_info("curve25519 basepoint self-test %zu: FAIL: input - 0x",
i + 1);
- for (j = CURVE25519_POINT_SIZE; j-- > 0;)
+ for (j = CURVE25519_KEY_SIZE; j-- > 0;)
printk(KERN_CONT "%02x", in[j]);
printk(KERN_CONT "\n");
success = false;