-/* $OpenBSD: whirlpool_test.c,v 1.1 2024/03/29 07:13:38 joshua Exp $ */
+/* $OpenBSD: whirlpool_test.c,v 1.2 2024/04/09 18:08:43 tb Exp $ */
/*
* Copyright (c) 2024 Joshua Sing <joshua@joshuasing.dev>
*
.in = "a",
.in_len = 1,
.out = {
- 0x8a, 0xca, 0x26, 0x02, 0x79, 0x2a, 0xec, 0x6f,
- 0x11, 0xa6, 0x72, 0x06, 0x53, 0x1f, 0xb7, 0xd7,
- 0xf0, 0xdf, 0xf5, 0x94, 0x13, 0x14, 0x5e, 0x69,
- 0x73, 0xc4, 0x50, 0x01, 0xd0, 0x08, 0x7b, 0x42,
- 0xd1, 0x1b, 0xc6, 0x45, 0x41, 0x3a, 0xef, 0xf6,
- 0x3a, 0x42, 0x39, 0x1a, 0x39, 0x14, 0x5a, 0x59,
- 0x1a, 0x92, 0x20, 0x0d, 0x56, 0x01, 0x95, 0xe5,
- 0x3b, 0x47, 0x85, 0x84, 0xfd, 0xae, 0x23, 0x1a,
+ 0x8a, 0xca, 0x26, 0x02, 0x79, 0x2a, 0xec, 0x6f,
+ 0x11, 0xa6, 0x72, 0x06, 0x53, 0x1f, 0xb7, 0xd7,
+ 0xf0, 0xdf, 0xf5, 0x94, 0x13, 0x14, 0x5e, 0x69,
+ 0x73, 0xc4, 0x50, 0x01, 0xd0, 0x08, 0x7b, 0x42,
+ 0xd1, 0x1b, 0xc6, 0x45, 0x41, 0x3a, 0xef, 0xf6,
+ 0x3a, 0x42, 0x39, 0x1a, 0x39, 0x14, 0x5a, 0x59,
+ 0x1a, 0x92, 0x20, 0x0d, 0x56, 0x01, 0x95, 0xe5,
+ 0x3b, 0x47, 0x85, 0x84, 0xfd, 0xae, 0x23, 0x1a,
},
},
{
.in = "abc",
.in_len = 3,
.out = {
- 0x4e, 0x24, 0x48, 0xa4, 0xc6, 0xf4, 0x86, 0xbb,
- 0x16, 0xb6, 0x56, 0x2c, 0x73, 0xb4, 0x02, 0x0b,
- 0xf3, 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456789012345678901234567890123456789012345678901234567890",
.in_len = 80,
.out = {
- 0x46, 0x6e, 0xf1, 0x8b, 0xab, 0xb0, 0x15, 0x4d,
- 0x25, 0xb9, 0xd3, 0x8a, 0x64, 0x14, 0xf5, 0xc0,
- 0x87, 0x84, 0x37, 0x2b, 0xcc, 0xb2, 0x04, 0xd6,
- 0x54, 0x9c, 0x4a, 0xfa, 0xdb, 0x60, 0x14, 0x29,
- 0x4d, 0x5b, 0xd8, 0xdf, 0x2a, 0x6c, 0x44, 0xe5,
- 0x38, 0xcd, 0x04, 0x7b, 0x26, 0x81, 0xa5, 0x1a,
- 0x2c, 0x60, 0x48, 0x1e, 0x88, 0xc5, 0xa2, 0x0b,
+ 0x46, 0x6e, 0xf1, 0x8b, 0xab, 0xb0, 0x15, 0x4d,
+ 0x25, 0xb9, 0xd3, 0x8a, 0x64, 0x14, 0xf5, 0xc0,
+ 0x87, 0x84, 0x37, 0x2b, 0xcc, 0xb2, 0x04, 0xd6,
+ 0x54, 0x9c, 0x4a, 0xfa, 0xdb, 0x60, 0x14, 0x29,
+ 0x4d, 0x5b, 0xd8, 0xdf, 0x2a, 0x6c, 0x44, 0xe5,
+ 0x38, 0xcd, 0x04, 0x7b, 0x26, 0x81, 0xa5, 0x1a,
+ 0x2c, 0x60, 0x48, 0x1e, 0x88, 0xc5, 0xa2, 0x0b,
0x2c, 0X2A, 0X80, 0XCF, 0X3A, 0X9A, 0X08, 0X3B,
},
- },
+ },
{
.in = "abcdbcdecdefdefgefghfghighijhijk",
.in_len = 32,
.out = {
- 0x2a, 0x98, 0x7e, 0xa4, 0x0f, 0x91, 0x70, 0x61,
- 0xf5, 0xd6, 0xf0, 0xa0, 0xe4, 0x64, 0x4f, 0x48,
- 0x8a, 0x7a, 0x5a, 0x52, 0xde, 0xee, 0x65, 0x62,
- 0x07, 0xc5, 0x62, 0xf9, 0x88, 0xe9, 0x5c, 0x69,
- 0x16, 0xbd, 0xc8, 0x03, 0x1b, 0xc5, 0xbe, 0x1b,
- 0x7b, 0x94, 0x76, 0x39, 0xfe, 0x05, 0x0b, 0x56,
- 0x93, 0x9b, 0xaa, 0xa0, 0xad, 0xff, 0x9a, 0xe6,
- 0x74, 0x5b, 0x7b, 0x18, 0x1c, 0x3b, 0xe3, 0xfd,
+ 0x2a, 0x98, 0x7e, 0xa4, 0x0f, 0x91, 0x70, 0x61,
+ 0xf5, 0xd6, 0xf0, 0xa0, 0xe4, 0x64, 0x4f, 0x48,
+ 0x8a, 0x7a, 0x5a, 0x52, 0xde, 0xee, 0x65, 0x62,
+ 0x07, 0xc5, 0x62, 0xf9, 0x88, 0xe9, 0x5c, 0x69,
+ 0x16, 0xbd, 0xc8, 0x03, 0x1b, 0xc5, 0xbe, 0x1b,
+ 0x7b, 0x94, 0x76, 0x39, 0xfe, 0x05, 0x0b, 0x56,
+ 0x93, 0x9b, 0xaa, 0xa0, 0xad, 0xff, 0x9a, 0xe6,
+ 0x74, 0x5b, 0x7b, 0x18, 0x1c, 0x3b, 0xe3, 0xfd,
},
},
};
if ((md_ctx = EVP_MD_CTX_new()) == NULL) {
fprintf(stderr, "FAIL: EVP_MD_CTX_new() failed\n");
- goto failed;
+ goto failed;
}
for (i = 0; i < N_WHIRLPOOL_TESTS; i++) {