chaskey constants

main
JP Aumasson 2016-12-16 17:14:34 +01:00
parent f98f5fedc5
commit 7ce7f04709
2 changed files with 132 additions and 131 deletions

View File

@ -45,17 +45,17 @@
#define SIPROUND \ #define SIPROUND \
do { \ do { \
v0 += v1; \ v0 += v1; \
v1 = ROTL(v1, 7); \ v1 = ROTL(v1, 5); \
v1 ^= v0; \ v1 ^= v0; \
v0 = ROTL(v0, 16); \ v0 = ROTL(v0, 16); \
v2 += v3; \ v2 += v3; \
v3 = ROTL(v3, 8); \ v3 = ROTL(v3, 8); \
v3 ^= v2; \ v3 ^= v2; \
v0 += v3; \ v0 += v3; \
v3 = ROTL(v3, 11); \ v3 = ROTL(v3, 7); \
v3 ^= v0; \ v3 ^= v0; \
v2 += v1; \ v2 += v1; \
v1 = ROTL(v1, 9); \ v1 = ROTL(v1, 13); \
v1 ^= v2; \ v1 ^= v2; \
v2 = ROTL(v2, 16); \ v2 = ROTL(v2, 16); \
} while (0) } while (0)

257
test.c
View File

@ -169,138 +169,139 @@ const uint8_t vectors_sip128[MAXLEN][16] =
const uint8_t vectors_halfsip32[MAXLEN][4] = const uint8_t vectors_halfsip32[MAXLEN][4] =
{ {
{ 0xc0, 0xac, 0xd5, 0x9d }, {0x08, 0x99, 0xcb, 0xf6 },
{ 0xa4, 0x8e, 0x47, 0x8e }, {0xbc, 0xc9, 0x99, 0xe4 },
{ 0xc1, 0x7d, 0xc7, 0xdf }, {0x48, 0x62, 0x08, 0xc5 },
{ 0x18, 0x01, 0x1e, 0xa4 }, {0x1b, 0x1c, 0x06, 0x8c },
{ 0xd2, 0x67, 0x8a, 0x91 }, {0xe7, 0x60, 0x30, 0xfd },
{ 0xa8, 0x3d, 0xbc, 0xf2 }, {0xe9, 0x73, 0xbb, 0xba },
{ 0x55, 0xe5, 0x0f, 0xca }, {0xf1, 0xeb, 0xa4, 0x9c },
{ 0xe1, 0xae, 0x0f, 0xf7 }, {0x92, 0x52, 0xa9, 0x2c },
{ 0x30, 0x85, 0xd7, 0xcc }, {0xeb, 0x00, 0xf4, 0xa7 },
{ 0x99, 0x73, 0x18, 0x49 }, {0x39, 0xf4, 0xcd, 0xf6 },
{ 0x5e, 0x84, 0x3d, 0xca }, {0x28, 0xaa, 0x20, 0x71 },
{ 0x5d, 0x5b, 0x50, 0x6a }, {0x76, 0xcc, 0x30, 0x5d },
{ 0x84, 0x33, 0x46, 0xe7 }, {0x5e, 0x7c, 0xff, 0x01 },
{ 0xec, 0x60, 0x1b, 0x04 }, {0x2b, 0x53, 0x2e, 0xb4 },
{ 0xb9, 0x84, 0x31, 0x05 }, {0x7d, 0x35, 0x77, 0xe9 },
{ 0x7b, 0x56, 0x51, 0x4f }, {0xe2, 0x7d, 0xbe, 0xe7 },
{ 0xc0, 0xdd, 0xba, 0x66 }, {0x8c, 0x1b, 0xe7, 0x97 },
{ 0xf4, 0x50, 0x8d, 0x51 }, {0x0e, 0x01, 0xba, 0xee },
{ 0xe8, 0x0c, 0x26, 0x7e }, {0xe7, 0x1a, 0x84, 0x27 },
{ 0x5f, 0x9b, 0x41, 0x4f }, {0xf8, 0xc3, 0x76, 0xf9 },
{ 0x7b, 0x60, 0x36, 0x82 }, {0xf4, 0xbb, 0x68, 0x3c },
{ 0x47, 0x9a, 0xaf, 0xec }, {0x6f, 0x9e, 0x29, 0xc7 },
{ 0xda, 0x9d, 0xff, 0x82 }, {0xbc, 0xa0, 0xfa, 0x94 },
{ 0x31, 0xfa, 0xa9, 0x9b }, {0xd1, 0x6a, 0x55, 0xbc },
{ 0xf4, 0xda, 0x9e, 0xf0 }, {0xf4, 0xd6, 0x08, 0x96 },
{ 0x0a, 0x96, 0x2b, 0x24 }, {0x50, 0xf1, 0xff, 0xa5 },
{ 0x84, 0xb1, 0xca, 0x95 }, {0xca, 0x30, 0x6b, 0x0d },
{ 0x8a, 0xeb, 0xe7, 0xd0 }, {0x3d, 0xad, 0x3c, 0xdc },
{ 0xc1, 0x02, 0xea, 0xea }, {0x7b, 0x4b, 0xbb, 0x5d },
{ 0xe8, 0x46, 0xe9, 0xae }, {0x29, 0x97, 0xbf, 0x8d },
{ 0x5c, 0xf6, 0x91, 0xcb }, {0x56, 0xb9, 0x50, 0x90 },
{ 0x74, 0x79, 0xa0, 0x1a }, {0xe8, 0x54, 0x7d, 0xc0 },
{ 0xcb, 0x2a, 0x7c, 0x53 }, {0x34, 0xd0, 0x3a, 0xc4 },
{ 0x23, 0x80, 0x69, 0x73 }, {0xfb, 0x6f, 0x04, 0x6d },
{ 0xd2, 0x39, 0x39, 0x0a }, {0x86, 0x11, 0x8a, 0x54 },
{ 0x51, 0x0f, 0x5d, 0xe5 }, {0x76, 0x21, 0x02, 0x7c },
{ 0x4b, 0xd9, 0xbe, 0x04 }, {0x25, 0xc3, 0x55, 0x46 },
{ 0x65, 0xc7, 0x3a, 0xcb }, {0x7a, 0xe5, 0x19, 0x61 },
{ 0xd4, 0xb4, 0xf4, 0xa6 }, {0xef, 0x77, 0x52, 0xe2 },
{ 0xff, 0x50, 0xb3, 0xa8 }, {0xb5, 0x8a, 0x16, 0x95 },
{ 0xfa, 0x17, 0xf5, 0xfd }, {0x48, 0x40, 0x47, 0x41 },
{ 0xe5, 0xf0, 0xe6, 0x75 }, {0x5e, 0xa9, 0x09, 0xde },
{ 0x90, 0x02, 0x9f, 0x7f }, {0xb3, 0x83, 0xd0, 0x08 },
{ 0x4c, 0x8d, 0xc5, 0x0c }, {0xb3, 0x81, 0x5b, 0x1f },
{ 0xd4, 0xab, 0x38, 0x01 }, {0x20, 0x7a, 0xdb, 0x50 },
{ 0x14, 0x5a, 0x47, 0x65 }, {0x91, 0x6a, 0x77, 0x0e },
{ 0x69, 0x00, 0xf8, 0x29 }, {0xfb, 0x7d, 0x5f, 0x65 },
{ 0x67, 0xdd, 0x53, 0x9a }, {0xd8, 0x91, 0x36, 0xef },
{ 0x9f, 0x9d, 0x47, 0xab }, {0xc0, 0xa2, 0x25, 0x7f },
{ 0x34, 0x20, 0x67, 0x9e }, {0x68, 0x82, 0xb2, 0x08 },
{ 0xf0, 0x7a, 0x7e, 0x26 }, {0x01, 0xd1, 0x1b, 0xb5 },
{ 0x02, 0xc5, 0xa1, 0xa8 }, {0x2a, 0x7c, 0x73, 0x7d },
{ 0xc0, 0xe3, 0x28, 0x72 }, {0xa0, 0xf2, 0xde, 0x0e },
{ 0xf7, 0x1a, 0x0c, 0xe5 }, {0x59, 0xc4, 0x8d, 0x4a },
{ 0x3b, 0x0b, 0x94, 0x67 }, {0x43, 0xc4, 0x38, 0x73 },
{ 0x30, 0xbe, 0xf0, 0xcf }, {0xd9, 0x02, 0xc3, 0x33 },
{ 0xd7, 0x1c, 0xa7, 0xe7 }, {0xb9, 0xd2, 0xfb, 0x16 },
{ 0x74, 0xfb, 0xc0, 0xd8 }, {0x98, 0x3c, 0xdc, 0x43 },
{ 0x76, 0x24, 0xcc, 0xe2 }, {0x34, 0xbf, 0x29, 0x3c },
{ 0x33, 0x2d, 0x18, 0x2a }, {0x17, 0x32, 0x39, 0x01 },
{ 0x71, 0x3b, 0x59, 0x2d }, {0xc1, 0xa8, 0x89, 0x02 },
{ 0xaa, 0xfd, 0x42, 0x6a }, {0xed, 0xa5, 0x8d, 0x32 },
{ 0xd1, 0xcf, 0x9d, 0x0a }, {0xea, 0x75, 0xa7, 0xf6 },
{ 0x86, 0x0b, 0x6e, 0xc8 }, {0xd0, 0x51, 0x73, 0x5c }
}; };
const uint8_t vectors_halfsip64[MAXLEN][8] = const uint8_t vectors_halfsip64[MAXLEN][8] =
{ {
{ 0xf5, 0x70, 0x92, 0x8e, 0x16, 0x88, 0x96, 0x26 }, {0x2b, 0x21, 0x70, 0xca, 0x52, 0x14, 0xce, 0x7c },
{ 0xd8, 0x52, 0x14, 0x35, 0x00, 0x67, 0xa3, 0xbc }, {0x2f, 0x7b, 0x14, 0x5b, 0xf0, 0xc0, 0x35, 0xbe },
{ 0xed, 0x69, 0xfc, 0xed, 0xc0, 0x27, 0x8a, 0xe1 }, {0xd9, 0x65, 0x05, 0x6f, 0x38, 0x69, 0xd1, 0xe4 },
{ 0x82, 0x17, 0x5a, 0x64, 0x06, 0x40, 0xec, 0xfa }, {0x97, 0xa6, 0x3d, 0x56, 0x45, 0xba, 0xee, 0x3e },
{ 0xd8, 0xaa, 0x10, 0x07, 0x76, 0xdc, 0xb3, 0x29 }, {0x63, 0xe8, 0x92, 0x6f, 0xbe, 0xfd, 0xe2, 0x2a },
{ 0x5f, 0x16, 0x6c, 0x90, 0x16, 0x14, 0x74, 0x95 }, {0x34, 0xb9, 0xd8, 0x9b, 0xda, 0x60, 0x3c, 0x60 },
{ 0xb9, 0xf3, 0x10, 0x35, 0xae, 0xd2, 0x13, 0x46 }, {0xb5, 0xcb, 0xbf, 0xdc, 0x11, 0x88, 0xe6, 0xc5 },
{ 0x2a, 0x10, 0xc4, 0x8a, 0xb7, 0xb8, 0x75, 0x65 }, {0x24, 0x5e, 0x4b, 0x2e, 0xea, 0xf8, 0x66, 0xa3 },
{ 0x6a, 0x49, 0xab, 0xce, 0x02, 0xb7, 0x48, 0x1f }, {0x1e, 0x25, 0x8f, 0x31, 0x01, 0x51, 0x6a, 0x55 },
{ 0xfd, 0xc8, 0xd1, 0x5b, 0xea, 0x5f, 0x14, 0x96 }, {0x72, 0x86, 0x52, 0xc3, 0xe7, 0x10, 0x37, 0x02 },
{ 0x52, 0x80, 0xe0, 0xfb, 0x95, 0xf3, 0x04, 0x03 }, {0xbc, 0xdd, 0x32, 0x5f, 0xa3, 0x02, 0xef, 0x68 },
{ 0x08, 0x05, 0x2a, 0xea, 0x38, 0xcf, 0xc0, 0x0d }, {0xf1, 0x89, 0x0d, 0xe5, 0xd6, 0xf3, 0xc6, 0x27 },
{ 0xca, 0x6c, 0x72, 0x51, 0xbb, 0x08, 0x03, 0x5d }, {0x9c, 0x09, 0x37, 0x57, 0xa5, 0x06, 0xc5, 0x3e },
{ 0xda, 0x4a, 0xe2, 0xce, 0xb9, 0x62, 0xc7, 0xc9 }, {0x2a, 0x32, 0x80, 0x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x94, 0x78, 0x8c, 0x8a, 0xb1, 0xa2, 0xd7, 0xfb },
{ 0x4a, 0x30, 0xee, 0x7c, 0x62, 0xc6, 0xa2, 0xe8 }, {0x33, 0x4e, 0x46, 0x2c, 0x0e, 0xb7, 0x56, 0x67 },
{ 0x40, 0x38, 0xab, 0xe5, 0x9e, 0x38, 0x51, 0xc4 }, {0x14, 0xa5, 0x34, 0x0f, 0x48, 0x61, 0x90, 0xea },
{ 0xd8, 0xf8, 0x5e, 0x30, 0x95, 0x15, 0x70, 0x7e }, {0xcf, 0x0b, 0xd7, 0x27, 0xc0, 0x79, 0x7c, 0x25 },
{ 0x34, 0xa0, 0xef, 0x84, 0x27, 0x34, 0x36, 0x87 }, {0x2c, 0x6b, 0x19, 0xbd, 0xc2, 0x22, 0x17, 0x11 },
{ 0x49, 0xed, 0x6d, 0xae, 0x01, 0xb9, 0x72, 0xf2 }, {0x5a, 0xb2, 0xb1, 0x6a, 0x92, 0x52, 0xe3, 0x44 },
{ 0xf7, 0x4b, 0x97, 0xe0, 0x36, 0xab, 0xe0, 0x76 }, {0x7c, 0xa7, 0xf3, 0xc4, 0x45, 0xa2, 0x33, 0xc1 },
{ 0x3a, 0x3e, 0x0c, 0xd8, 0xa9, 0x0a, 0xed, 0x96 }, {0x8e, 0x36, 0xe0, 0x0c, 0x93, 0x59, 0xf7, 0x61 },
{ 0x59, 0x37, 0xc9, 0xda, 0x44, 0x02, 0xe5, 0x96 }, {0x58, 0x90, 0xd3, 0xdb, 0x17, 0xc6, 0x90, 0x4a },
{ 0xda, 0x49, 0x67, 0x2a, 0xb1, 0x8c, 0x4c, 0xd5 }, {0x88, 0x48, 0x7b, 0x94, 0x18, 0x12, 0x7c, 0xa1 },
{ 0x7c, 0x1c, 0x21, 0x96, 0x32, 0x36, 0x5d, 0xdf }, {0x15, 0x9e, 0xb3, 0x70, 0x3f, 0x81, 0x7d, 0x55 },
{ 0x10, 0xef, 0x25, 0x89, 0x75, 0x2d, 0xf6, 0x5f }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 0xfc, 0x3b, 0xd3, 0x5a, 0xf1, 0x8a }, {0x55, 0x86, 0x68, 0x08, 0xea, 0x1f, 0x47, 0xa4 },
{ 0x10, 0x97, 0x29, 0xae, 0x74, 0x62, 0x62, 0x64 }, {0x23, 0x03, 0x88, 0x1d, 0x4a, 0xea, 0x59, 0xa0 },
{ 0xf4, 0x5e, 0xa6, 0xeb, 0x49, 0x02, 0xe0, 0x30 }, {0x4b, 0x06, 0xd7, 0x7d, 0x19, 0x57, 0xfe, 0xee },
{ 0x0b, 0x03, 0x87, 0xeb, 0xcb, 0x25, 0x8f, 0x83 }, {0x87, 0xa8, 0x08, 0x1a, 0xd9, 0x08, 0xac, 0xaa },
{ 0x55, 0x17, 0x07, 0x1b, 0x32, 0x0f, 0x5c, 0xf6 }, {0x4f, 0xb6, 0xce, 0x59, 0xfd, 0xc4, 0xf5, 0x81 },
{ 0x03, 0xa2, 0x08, 0x8e, 0x70, 0xd7, 0x65, 0x91 }, {0xd5, 0xd2, 0x74, 0xfc, 0xa0, 0x01, 0x91, 0x60 },
{ 0x89, 0x9d, 0x50, 0x42, 0x17, 0xdb, 0x52, 0xd3 } {0xd2, 0x6c, 0xed, 0x5b, 0x43, 0x65, 0x36, 0xea },
}; };
int main() int main()