1#ifndef _EXCHANGE_TEST_H
2#define _EXCHANGE_TEST_H
33#define PRIVATE(...) { __VA_ARGS__ }
36#define PARTNER(...) { __VA_ARGS__ }
39#define PUBLIC(...) { __VA_ARGS__ }
42#define PUBLIC_UNSPECIFIED PUBLIC()
45#define SHARED(...) { __VA_ARGS__ }
48#define SHARED_FAIL SHARED()
61#define EXCHANGE_TEST( name, EXCHANGE, PRIVATE, PARTNER, PUBLIC, \
63 static const uint8_t name ## _private[] = PRIVATE; \
64 static const uint8_t name ## _partner[] = PARTNER; \
65 static const uint8_t name ## _public[] = PUBLIC; \
66 static const uint8_t name ## _shared[] = SHARED; \
67 static struct exchange_test name = { \
68 .exchange = EXCHANGE, \
69 .private = name ## _private, \
70 .private_len = sizeof ( name ## _private ), \
71 .partner = name ## _partner, \
72 .partner_len = sizeof ( name ## _partner ), \
73 .public = name ## _public, \
74 .public_len = sizeof ( name ## _public ), \
75 .shared = name ## _shared, \
76 .shared_len = sizeof ( name ## _shared ), \
84#define exchange_ok(test) exchange_okx ( test, __FILE__, __LINE__ )
void exchange_okx(struct exchange_test *test, const char *file, unsigned int line)
Report a key exchange test result.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
A key exchange algorithm.
size_t public_len
Length of expected public key.
size_t partner_len
Length of partner key.
size_t private_len
Length of private key.
const void * partner
Partner public key.
struct exchange_algorithm * exchange
Key exchange algorithm.
const void * shared
Expected shared secret.
size_t shared_len
Length of expected shared secret, or 0 to expect failure.
Self-test infrastructure.