79 const char *file,
unsigned int line ) {
84 okx (
test->key->public.len != 0, file, line );
85 okx (
test->ciphertext.len != 0, file, line );
93 &ciphertext ) == 0, file, line );
96 &
test->ciphertext ) == 0, file, line );
108 const char *file,
unsigned int line ) {
113 okx (
test->key->private.len != 0, file, line );
114 okx (
test->ciphertext.len != 0, file, line );
120 &plaintext ) == 0, file, line );
122 &
test->plaintext ) == 0, file, line );
134 const char *file,
unsigned int line ) {
144 &ciphertext ) != 0, file, line );
156 const char *file,
unsigned int line ) {
164 &plaintext ) != 0, file, line );
176 const char *file,
unsigned int line ) {
182 okx (
test->key->private.len != 0, file, line );
183 okx (
test->key->public.len != 0, file, line );
184 okx (
test->ciphertext.len != 0, file, line );
188 &
test->key->public ) == 0, file, line );
204 &ciphertext ) == 0, file, line );
208 &plaintext ) == 0, file, line );
210 &
test->plaintext ) == 0, file, line );
222 &ciphertext ) == 0, file, line );
226 &plaintext ) == 0, file, line );
228 &
test->plaintext ) == 0, file, line );
241 const char *file,
unsigned int line ) {
249 okx (
test->key->private.len != 0, file, line );
250 okx (
test->key->public.len != 0, file, line );
251 okx (
test->signature.len != 0, file, line );
255 &
test->key->public ) == 0, file, line );
260 test->plaintext_len );
267 &builder ) == 0, file, line );
269 okx ( builder.
len != 0, file, line );
289 const char *file,
unsigned int line ) {
299 okx (
test->key->public.len != 0, file, line );
300 okx (
test->signature.len != 0, file, line );
305 test->plaintext_len );
310 &
test->signature ) == 0, file, line );
317 &cursor ) != 0, file, line );
320 &cursor ) == 0, file, line );
331 const char *file,
unsigned int line ) {
340 test->plaintext_len );
345 &
test->signature ) != 0, file, line );
356 const char *file,
unsigned int line ) {
360 okx (
test->key->private.len != 0, file, line );
361 okx (
test->key->public.len != 0, file, line );
362 okx (
test->signature.len != 0, file, line );
366 &
test->key->public ) == 0, file, line );
#define NULL
NULL pointer (VOID *).
u8 signature
CPU signature.
int asn1_compare(const struct asn1_cursor *cursor1, const struct asn1_cursor *cursor2)
Compare two ASN.1 objects.
static struct asn1_cursor * asn1_built(struct asn1_builder *builder)
Get cursor for built object.
#define assert(condition)
Assert a condition at run-time.
uint8_t data[48]
Additional event data.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
static int pubkey_match(struct pubkey_algorithm *pubkey, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
static void digest_init(struct digest_algorithm *digest, void *ctx)
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
static int pubkey_encrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
static int pubkey_verify(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
static int pubkey_decrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
static int pubkey_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
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.
static size_t pubkey_random_len
Length of random data input.
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.
static const uint8_t * pubkey_random
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.
static void(* free)(struct refcnt *refcnt))
size_t len
Length of data.
A message digest algorithm.
size_t digestsize
Digest size.
size_t ctxsize
Context size.
A public-key encryption/decryption test.
A public-key signature/verification test.
Self-test infrastructure.
#define okx(success, file, line)
Report test result.