61 test->ciphertext,
test->ciphertext_len,
63 okx ( decrypted_len == ( (
int )
test->plaintext_len ), file, line );
69 test->plaintext,
test->plaintext_len,
71 okx ( encrypted_len >= 0, file, line );
73 encrypted_len, decrypted );
74 okx ( decrypted_len == ( (
int )
test->plaintext_len ), file, line );
80 test->plaintext,
test->plaintext_len,
82 okx ( encrypted_len >= 0, file, line );
84 encrypted_len, decrypted );
85 okx ( decrypted_len == ( (
int )
test->plaintext_len ), file, line );
111 test->plaintext_len );
117 okx ( signature_len == ( (
int )
test->signature_len ), file, line );
123 test->signature,
test->signature_len ) == 0,
128 bad[
test->signature_len / 2 ] ^= 0x40;
130 bad, sizeof ( bad ) ) != 0, file, line );
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
static int pubkey_verify(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const void *signature, size_t signature_len)
void pubkey_okx(struct pubkey_test *test, const char *file, unsigned int line)
Report public key encryption and decryption test result.
static int pubkey_encrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const void *data, size_t len, void *out)
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
A public-key encryption and decryption test.
Self-test infrastructure.
static int pubkey_decrypt(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, const void *data, size_t len, void *out)
void pubkey_sign_okx(struct pubkey_sign_test *test, const char *file, unsigned int line)
Report public key signature test result.
A public-key signature test.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define okx(success, file, line)
Report test result.
static void digest_init(struct digest_algorithm *digest, void *ctx)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
size_t ctxsize
Context size.
size_t digestsize
Digest size.
A message digest algorithm.
static size_t pubkey_max_len(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key)
static int pubkey_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, void *signature)
u8 signature
CPU signature.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
size_t(* max_len)(const struct asn1_cursor *key)
Calculate maximum output length.