25 #define DATA(...) { __VA_ARGS__ } 28 #define DIGEST(...) { __VA_ARGS__ } 39 #define DIGEST_TEST( name, DIGEST, DATA, EXPECTED ) \ 40 static const uint8_t name ## _data[] = DATA; \ 41 static const uint8_t name ## _expected[] = EXPECTED; \ 42 static struct digest_test name = { \ 44 .data = name ## _data, \ 45 .len = sizeof ( name ## _data ), \ 46 .expected = name ## _expected, \ 47 .expected_len = sizeof ( name ## _expected ), \ 51 #define DIGEST_EMPTY DATA() 60 #define DIGEST_NIST_ABC \ 61 DATA ( 0x61, 0x62, 0x63 ) 71 #define DIGEST_NIST_ABC_OPQ \ 72 DATA ( 0x61, 0x62, 0x63, 0x64, 0x62, 0x63, 0x64, 0x65, 0x63, \ 73 0x64, 0x65, 0x66, 0x64, 0x65, 0x66, 0x67, 0x65, 0x66, \ 74 0x67, 0x68, 0x66, 0x67, 0x68, 0x69, 0x67, 0x68, 0x69, \ 75 0x6a, 0x68, 0x69, 0x6a, 0x6b, 0x69, 0x6a, 0x6b, 0x6c, \ 76 0x6a, 0x6b, 0x6c, 0x6d, 0x6b, 0x6c, 0x6d, 0x6e, 0x6c, \ 77 0x6d, 0x6e, 0x6f, 0x6d, 0x6e, 0x6f, 0x70, 0x6e, 0x6f, \ 89 #define DIGEST_NIST_ABC_STU \ 90 DATA ( 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x62, \ 91 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x63, 0x64, \ 92 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x64, 0x65, 0x66, \ 93 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x65, 0x66, 0x67, 0x68, \ 94 0x69, 0x6a, 0x6b, 0x6c, 0x66, 0x67, 0x68, 0x69, 0x6a, \ 95 0x6b, 0x6c, 0x6d, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, \ 96 0x6d, 0x6e, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, \ 97 0x6f, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, \ 98 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x6b, \ 99 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x6c, 0x6d, \ 100 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x6d, 0x6e, 0x6f, \ 101 0x70, 0x71, 0x72, 0x73, 0x74, 0x6e, 0x6f, 0x70, 0x71, \ 102 0x72, 0x73, 0x74, 0x75 ) 109 #define digest_ok(test) digest_okx ( test, __FILE__, __LINE__ ) size_t expected_len
Expected digest length.
Self-test infrastructure.
const void * data
Test data.
const void * expected
Expected digest value.
struct digest_algorithm * digest
Digest algorithm.
size_t len
Length of test data.
void digest_okx(struct digest_test *test, const char *file, unsigned int line)
Report a digest test result.
unsigned long digest_cost(struct digest_algorithm *digest)
Calculate digest algorithm cost.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
A message digest algorithm.