aboutsummaryrefslogtreecommitdiff
path: root/lib/curve25519-donna/test-noncanon.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-05 01:45:06 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-05 01:45:06 +0100
commit2a8202e74846d191a321cca1202175af9db6107d (patch)
treea6f455caf07da1186851f343a237a4c4e4484f46 /lib/curve25519-donna/test-noncanon.c
parent8efa0ec17d8c262f9c3fd7603e8074f74a053708 (diff)
Convert to sibs projectHEADmaster
Diffstat (limited to 'lib/curve25519-donna/test-noncanon.c')
-rw-r--r--lib/curve25519-donna/test-noncanon.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/curve25519-donna/test-noncanon.c b/lib/curve25519-donna/test-noncanon.c
deleted file mode 100644
index 6de4e8d..0000000
--- a/lib/curve25519-donna/test-noncanon.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This file can be used to test whether the code handles non-canonical curve
- * points (i.e. points with the 256th bit set) in the same way as the reference
- * implementation. */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-
-extern void curve25519_donna(unsigned char *output, const unsigned char *a,
- const unsigned char *b);
-int
-main()
-{
- static const uint8_t point1[32] = {
- 0x25,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- };
- static const uint8_t point2[32] = {
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
- };
- static const uint8_t scalar[32] = { 1 };
- uint8_t out1[32], out2[32];
-
- curve25519_donna(out1, scalar, point1);
- curve25519_donna(out2, scalar, point2);
-
- if (0 == memcmp(out1, out2, sizeof(out1))) {
- fprintf(stderr, "Top bit not ignored.\n");
- return 1;
- }
-
- fprintf(stderr, "Top bit correctly ignored.\n");
- return 0;
-}