51#define PRIVATE(...) { __VA_ARGS__ }
54#define PUBLIC(...) { __VA_ARGS__ }
57#define RANDOM(...) { __VA_ARGS__ }
60#define PLAINTEXT(...) { __VA_ARGS__ }
63#define CIPHERTEXT(...) { __VA_ARGS__ }
66#define SIGNATURE(...) { __VA_ARGS__ }
80#define PUBKEY_TEST( name, PUBKEY, PRIVATE, PUBLIC, RANDOM, PLAINTEXT, \
82 static const uint8_t name ## _private[] = PRIVATE; \
83 static const uint8_t name ## _public[] = PUBLIC; \
84 static const uint8_t name ## _random[] = RANDOM; \
85 static const uint8_t name ## _plaintext[] = PLAINTEXT; \
86 static const uint8_t name ## _ciphertext[] = CIPHERTEXT; \
87 static struct pubkey_test name = { \
90 .data = name ## _private, \
91 .len = sizeof ( name ## _private ), \
94 .data = name ## _public, \
95 .len = sizeof ( name ## _public ), \
97 .random = name ## _random, \
98 .random_len = sizeof ( name ## _random ), \
100 .data = name ## _plaintext, \
101 .len = sizeof ( name ## _plaintext ), \
104 .data = name ## _ciphertext, \
105 .len = sizeof ( name ## _ciphertext ), \
122#define PUBKEY_SIGN_TEST( name, PUBKEY, PRIVATE, PUBLIC, RANDOM, \
123 PLAINTEXT, DIGEST, SIGNATURE ) \
124 static const uint8_t name ## _private[] = PRIVATE; \
125 static const uint8_t name ## _public[] = PUBLIC; \
126 static const uint8_t name ## _random[] = RANDOM; \
127 static const uint8_t name ## _plaintext[] = PLAINTEXT; \
128 static const uint8_t name ## _signature[] = SIGNATURE; \
129 static struct pubkey_sign_test name = { \
132 .data = name ## _private, \
133 .len = sizeof ( name ## _private ), \
136 .data = name ## _public, \
137 .len = sizeof ( name ## _public ), \
139 .random = name ## _random, \
140 .random_len = sizeof ( name ## _random ), \
141 .plaintext = name ## _plaintext, \
142 .plaintext_len = sizeof ( name ## _plaintext ), \
145 .data = name ## _signature, \
146 .len = sizeof ( name ## _signature ), \
152 const char *file,
unsigned int line );
154 const char *file,
unsigned int line );
161#define pubkey_ok( test ) \
162 pubkey_okx ( test, __FILE__, __LINE__ )
169#define pubkey_sign_ok( test ) \
170 pubkey_sign_okx ( test, __FILE__, __LINE__ )
uint8_t data[48]
Additional event data.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
void pubkey_okx(struct pubkey_test *test, const char *file, unsigned int line)
Report public key encryption and decryption test result.
void pubkey_sign_okx(struct pubkey_sign_test *test, const char *file, unsigned int line)
Report public key signature test result.
int pubkey_test_get_random(void *data, size_t len)
Get random data input.
A message digest algorithm.
A public-key signature test.
const struct asn1_cursor public
Public key.
struct pubkey_algorithm * pubkey
Public-key algorithm.
const struct asn1_cursor private
Private key.
struct digest_algorithm * digest
Signature algorithm.
const void * plaintext
Plaintext.
size_t random_len
Random data input length.
const void * random
Random data input.
size_t plaintext_len
Plaintext length.
const struct asn1_cursor signature
Signature.
A public-key encryption and decryption test.
const struct asn1_cursor private
Private key.
const struct asn1_cursor public
Public key.
struct pubkey_algorithm * pubkey
Public-key algorithm.
const void * random
Random data input.
const struct asn1_cursor plaintext
Plaintext.
size_t random_len
Random data input length.
const struct asn1_cursor ciphertext
Ciphertext.
Self-test infrastructure.