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 SHARED(...) { __VA_ARGS__ }
45#define SHARED_FAIL SHARED()
58#define EXCHANGE_TEST( name, EXCHANGE, PRIVATE, PARTNER, PUBLIC, \
60 static const uint8_t name ## _private[] = PRIVATE; \
61 static const uint8_t name ## _partner[] = PARTNER; \
62 static const uint8_t name ## _public[] = PUBLIC; \
63 static const uint8_t name ## _shared[] = SHARED; \
64 static struct exchange_test name = { \
65 .exchange = EXCHANGE, \
66 .private = name ## _private, \
67 .private_len = sizeof ( name ## _private ), \
68 .partner = name ## _partner, \
69 .partner_len = sizeof ( name ## _partner ), \
70 .public = name ## _public, \
71 .public_len = sizeof ( name ## _public ), \
72 .shared = name ## _shared, \
73 .shared_len = sizeof ( name ## _shared ), \
81#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.