1 #ifndef _ELLIPTIC_TEST_H 2 #define _ELLIPTIC_TEST_H 29 #define BASE(...) { __VA_ARGS__ } 32 #define BASE_GENERATOR BASE() 35 #define SCALAR(...) { __VA_ARGS__ } 38 #define EXPECTED(...) { __VA_ARGS__ } 41 #define EXPECTED_FAIL EXPECTED() 53 #define ELLIPTIC_TEST( name, CURVE, BASE, SCALAR, EXPECTED ) \ 54 static const uint8_t name ## _base[] = BASE; \ 55 static const uint8_t name ## _scalar[] = SCALAR; \ 56 static const uint8_t name ## _expected[] = EXPECTED; \ 57 static struct elliptic_test name = { \ 59 .base = name ## _base, \ 60 .base_len = sizeof ( name ## _base ), \ 61 .scalar = name ## _scalar, \ 62 .scalar_len = sizeof ( name ## _scalar ), \ 63 .expected = name ## _expected, \ 64 .expected_len = sizeof ( name ## _expected ), \ 75 #define elliptic_ok( test ) elliptic_okx ( test, __FILE__, __LINE__ ) size_t expected_len
Length of expected result point (or 0 to expect failure)
const void * scalar
Scalar multiple.
struct elliptic_curve * curve
Elliptic curve.
Self-test infrastructure.
An elliptic curve point multiplication test.
size_t base_len
Length of base point (or 0 to use generator)
size_t scalar_len
Length of scalar multiple.
const void * base
Base point.
void elliptic_okx(struct elliptic_test *test, const char *file, unsigned int line)
Report elliptic curve point multiplication test result.
const void * expected
Expected result point.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)