54 #define PRIVATE(...) { __VA_ARGS__ } 57 #define PUBLIC(...) { __VA_ARGS__ } 60 #define PLAINTEXT(...) { __VA_ARGS__ } 63 #define CIPHERTEXT(...) { __VA_ARGS__ } 66 #define SIGNATURE(...) { __VA_ARGS__ } 79 #define PUBKEY_TEST( name, PUBKEY, PRIVATE, PUBLIC, PLAINTEXT, \ 81 static const uint8_t name ## _private[] = PRIVATE; \ 82 static const uint8_t name ## _public[] = PUBLIC; \ 83 static const uint8_t name ## _plaintext[] = PLAINTEXT; \ 84 static const uint8_t name ## _ciphertext[] = CIPHERTEXT; \ 85 static struct pubkey_test name = { \ 88 .data = name ## _private, \ 89 .len = sizeof ( name ## _private ), \ 92 .data = name ## _public, \ 93 .len = sizeof ( name ## _public ), \ 95 .plaintext = name ## _plaintext, \ 96 .plaintext_len = sizeof ( name ## _plaintext ), \ 97 .ciphertext = name ## _ciphertext, \ 98 .ciphertext_len = sizeof ( name ## _ciphertext ), \ 113 #define PUBKEY_SIGN_TEST( name, PUBKEY, PRIVATE, PUBLIC, PLAINTEXT, \ 114 DIGEST, SIGNATURE ) \ 115 static const uint8_t name ## _private[] = PRIVATE; \ 116 static const uint8_t name ## _public[] = PUBLIC; \ 117 static const uint8_t name ## _plaintext[] = PLAINTEXT; \ 118 static const uint8_t name ## _signature[] = SIGNATURE; \ 119 static struct pubkey_sign_test name = { \ 122 .data = name ## _private, \ 123 .len = sizeof ( name ## _private ), \ 126 .data = name ## _public, \ 127 .len = sizeof ( name ## _public ), \ 129 .plaintext = name ## _plaintext, \ 130 .plaintext_len = sizeof ( name ## _plaintext ), \ 132 .signature = name ## _signature, \ 133 .signature_len = sizeof ( name ## _signature ), \ 137 const char *file,
unsigned int line );
139 const char *file,
unsigned int line );
146 #define pubkey_ok( test ) \ 147 pubkey_okx ( test, __FILE__, __LINE__ ) 154 #define pubkey_sign_ok( test ) \ 155 pubkey_sign_okx ( test, __FILE__, __LINE__ ) const struct asn1_cursor public
Public key.
A public-key encryption and decryption test.
Self-test infrastructure.
struct pubkey_algorithm * pubkey
Public-key algorithm.
size_t signature_len
Signature length.
size_t ciphertext_len
Length of ciphertext.
const void * plaintext
Plaintext.
A public-key signature test.
const void * signature
Signature.
const struct asn1_cursor public
Public key.
struct pubkey_algorithm * pubkey
Public-key algorithm.
void pubkey_okx(struct pubkey_test *test, const char *file, unsigned int line)
Report public key encryption and decryption test result.
const struct asn1_cursor private
Private key.
size_t plaintext_len
Length of plaintext.
struct digest_algorithm * digest
Signature algorithm.
void pubkey_sign_okx(struct pubkey_sign_test *test, const char *file, unsigned int line)
Report public key signature test result.
size_t plaintext_len
Plaintext length.
A message digest algorithm.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const void * plaintext
Plaintext.
const struct asn1_cursor private
Private key.
const void * ciphertext
Ciphertext.