53#define PRIVATE(...) { __VA_ARGS__ }
56#define PUBLIC(...) { __VA_ARGS__ }
59#define RANDOM(...) { __VA_ARGS__ }
62#define PLAINTEXT(...) { __VA_ARGS__ }
65#define CIPHERTEXT(...) { __VA_ARGS__ }
68#define SIGNATURE(...) { __VA_ARGS__ }
82#define PUBKEY_TEST( name, PUBKEY, PRIVATE, PUBLIC ) \
83 static const uint8_t name ## _private[] = PRIVATE; \
84 static const uint8_t name ## _public[] = PUBLIC; \
85 static struct pubkey_test name = { \
88 .data = name ## _private, \
89 .len = sizeof ( name ## _private ), \
92 .data = name ## _public, \
93 .len = sizeof ( name ## _public ), \
107#define PUBKEY_ENCRYPTION_TEST( name, KEY, RANDOM, PLAINTEXT, \
109 static const uint8_t name ## _random[] = RANDOM; \
110 static const uint8_t name ## _plaintext[] = PLAINTEXT; \
111 static const uint8_t name ## _ciphertext[] = CIPHERTEXT; \
112 static struct pubkey_encryption_test name = { \
114 .random = name ## _random, \
115 .random_len = sizeof ( name ## _random ), \
117 .data = name ## _plaintext, \
118 .len = sizeof ( name ## _plaintext ), \
121 .data = name ## _ciphertext, \
122 .len = sizeof ( name ## _ciphertext ), \
137#define PUBKEY_SIGNATURE_TEST( name, KEY, RANDOM, PLAINTEXT, DIGEST, \
139 static const uint8_t name ## _random[] = RANDOM; \
140 static const uint8_t name ## _plaintext[] = PLAINTEXT; \
141 static const uint8_t name ## _signature[] = SIGNATURE; \
142 static struct pubkey_signature_test name = { \
144 .random = name ## _random, \
145 .random_len = sizeof ( name ## _random ), \
146 .plaintext = name ## _plaintext, \
147 .plaintext_len = sizeof ( name ## _plaintext ), \
150 .data = name ## _signature, \
151 .len = sizeof ( name ## _signature ), \
157 const char *file,
unsigned int line );
159 const char *file,
unsigned int line );
161 const char *file,
unsigned int line );
163 const char *file,
unsigned int line );
168 const char *file,
unsigned int line );
170 const char *file,
unsigned int line );
172 const char *file,
unsigned int line );
174 const char *file,
unsigned int line );
181#define pubkey_encrypt_ok( test ) \
182 pubkey_encrypt_okx ( test, __FILE__, __LINE__ )
189#define pubkey_decrypt_ok( test ) \
190 pubkey_decrypt_okx ( test, __FILE__, __LINE__ )
197#define pubkey_encrypt_fail_ok( test ) \
198 pubkey_encrypt_fail_okx ( test, __FILE__, __LINE__ )
205#define pubkey_decrypt_fail_ok( test ) \
206 pubkey_decrypt_fail_okx ( test, __FILE__, __LINE__ )
213#define pubkey_encrypt_decrypt_ok( test ) \
214 pubkey_encrypt_decrypt_okx ( test, __FILE__, __LINE__ )
221#define pubkey_sign_ok( test ) \
222 pubkey_sign_okx ( test, __FILE__, __LINE__ )
229#define pubkey_verify_ok( test ) \
230 pubkey_verify_okx ( test, __FILE__, __LINE__ )
237#define pubkey_verify_fail_ok( test ) \
238 pubkey_verify_fail_okx ( test, __FILE__, __LINE__ )
245#define pubkey_sign_verify_ok( test ) \
246 pubkey_sign_verify_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_encrypt_fail_okx(struct pubkey_encryption_test *test, const char *file, unsigned int line)
Report a public key encryption failure test result.
void pubkey_sign_okx(struct pubkey_signature_test *test, const char *file, unsigned int line)
Report a public key signature test result.
void pubkey_encrypt_decrypt_okx(struct pubkey_encryption_test *test, const char *file, unsigned int line)
Report a public key encryption and decryption test result.
void pubkey_decrypt_fail_okx(struct pubkey_encryption_test *test, const char *file, unsigned int line)
Report a public key decryption failure test result.
void pubkey_sign_verify_okx(struct pubkey_signature_test *test, const char *file, unsigned int line)
Report a public key signature and verification test result.
void pubkey_decrypt_okx(struct pubkey_encryption_test *test, const char *file, unsigned int line)
Report a public key decryption test result.
void pubkey_verify_okx(struct pubkey_signature_test *test, const char *file, unsigned int line)
Report a public key verification test result.
void pubkey_encrypt_okx(struct pubkey_encryption_test *test, const char *file, unsigned int line)
Report a public key encryption test result.
int pubkey_test_get_random(void *data, size_t len)
Get random data input.
void pubkey_verify_fail_okx(struct pubkey_signature_test *test, const char *file, unsigned int line)
Report a public key verification failure test result.
A message digest algorithm.
A public-key encryption/decryption test.
const struct asn1_cursor plaintext
Plaintext.
const struct asn1_cursor ciphertext
Ciphertext.
size_t random_len
Random data input length.
const void * random
Random data input.
const struct pubkey_test * key
Test key.
A public-key signature/verification test.
const struct pubkey_test * key
Test key.
const void * random
Random data input.
size_t random_len
Random data input length.
struct digest_algorithm * digest
Signature algorithm.
const struct asn1_cursor signature
Signature.
const void * plaintext
Plaintext.
size_t plaintext_len
Plaintext length.
const struct asn1_cursor private
Private key.
const struct asn1_cursor public
Public key.
struct pubkey_algorithm * pubkey
Public-key algorithm.
Self-test infrastructure.