48 #define PRIVATE(...) { __VA_ARGS__ } 51 #define PUBLIC(...) { __VA_ARGS__ } 54 #define PLAINTEXT(...) { __VA_ARGS__ } 57 #define CIPHERTEXT(...) { __VA_ARGS__ } 60 #define SIGNATURE(...) { __VA_ARGS__ } 73 #define PUBKEY_TEST( name, PUBKEY, PRIVATE, PUBLIC, PLAINTEXT, \ 75 static const uint8_t name ## _private[] = PRIVATE; \ 76 static const uint8_t name ## _public[] = PUBLIC; \ 77 static const uint8_t name ## _plaintext[] = PLAINTEXT; \ 78 static const uint8_t name ## _ciphertext[] = CIPHERTEXT; \ 79 static struct pubkey_test name = { \ 82 .data = name ## _private, \ 83 .len = sizeof ( name ## _private ), \ 86 .data = name ## _public, \ 87 .len = sizeof ( name ## _public ), \ 90 .data = name ## _plaintext, \ 91 .len = sizeof ( name ## _plaintext ), \ 94 .data = name ## _ciphertext, \ 95 .len = sizeof ( name ## _ciphertext ), \ 111 #define PUBKEY_SIGN_TEST( name, PUBKEY, PRIVATE, PUBLIC, PLAINTEXT, \ 112 DIGEST, SIGNATURE ) \ 113 static const uint8_t name ## _private[] = PRIVATE; \ 114 static const uint8_t name ## _public[] = PUBLIC; \ 115 static const uint8_t name ## _plaintext[] = PLAINTEXT; \ 116 static const uint8_t name ## _signature[] = SIGNATURE; \ 117 static struct pubkey_sign_test name = { \ 120 .data = name ## _private, \ 121 .len = sizeof ( name ## _private ), \ 124 .data = name ## _public, \ 125 .len = sizeof ( name ## _public ), \ 127 .plaintext = name ## _plaintext, \ 128 .plaintext_len = sizeof ( name ## _plaintext ), \ 131 .data = name ## _signature, \ 132 .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.
const struct asn1_cursor plaintext
Plaintext.
A public-key encryption and decryption test.
Self-test infrastructure.
struct pubkey_algorithm * pubkey
Public-key algorithm.
const void * plaintext
Plaintext.
A public-key signature test.
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.
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.
const struct asn1_cursor signature
Signature.
A message digest algorithm.
const struct asn1_cursor ciphertext
Ciphertext.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const struct asn1_cursor private
Private key.