@@ -5196,6 +5196,31 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void)
51965196 if (ret != 0)
51975197 return WC_TEST_RET_ENC_EC(ret);
51985198
5199+ {
5200+ byte long_key[BLAKE2B_BLOCKBYTES + 72];
5201+ static const byte expected_long[] = {
5202+ 0xb5, 0x17, 0xd2, 0x26, 0xcb, 0x6c, 0xa2, 0x09,
5203+ 0xd2, 0x56, 0x30, 0xa2, 0x55, 0xe9, 0xfa, 0xfb,
5204+ 0x1e, 0x0f, 0xbf, 0x60, 0x00, 0xbd, 0x44, 0x09,
5205+ 0xb7, 0xf6, 0x25, 0x75, 0x90, 0x80, 0xb1, 0xde,
5206+ 0x72, 0xa5, 0x8a, 0x15, 0x95, 0xd2, 0x49, 0x8d,
5207+ 0x4c, 0xdc, 0xc8, 0x68, 0x68, 0xa5, 0x07, 0x62,
5208+ 0x10, 0x64, 0x0b, 0x20, 0x0b, 0xe0, 0xb0, 0xb2,
5209+ 0x13, 0xf4, 0x2d, 0x42, 0x15, 0x7a, 0x5c, 0xd6,
5210+ };
5211+ int i;
5212+
5213+ for (i = 0; i < (int)sizeof(long_key); ++i)
5214+ long_key[i] = (byte)i;
5215+
5216+ ret = wc_Blake2bHmac(message2, sizeof(message2),
5217+ long_key, sizeof(long_key), out, sizeof(out));
5218+ if (ret != 0)
5219+ return WC_TEST_RET_ENC_EC(ret);
5220+ if (XMEMCMP(out, expected_long, sizeof(out)) != 0)
5221+ return WC_TEST_RET_ENC_NC;
5222+ }
5223+
51995224 return 0;
52005225}
52015226#endif /* HAVE_BLAKE2B */
@@ -5334,6 +5359,27 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2s_hmac_test(void)
53345359 if (ret != 0)
53355360 return WC_TEST_RET_ENC_EC(ret);
53365361
5362+ {
5363+ byte long_key[BLAKE2S_BLOCKBYTES + 36];
5364+ static const byte expected_long[] = {
5365+ 0x1a, 0xd0, 0x73, 0xd7, 0xba, 0xab, 0x55, 0x83,
5366+ 0x26, 0xa8, 0xc2, 0x71, 0xf2, 0x1a, 0xdf, 0x3e,
5367+ 0x28, 0x57, 0x14, 0x49, 0x3a, 0x26, 0x33, 0xe7,
5368+ 0x7f, 0xf4, 0xca, 0x1a, 0xfd, 0xa3, 0xe0, 0xd9,
5369+ };
5370+ int i;
5371+
5372+ for (i = 0; i < (int)sizeof(long_key); ++i)
5373+ long_key[i] = (byte)i;
5374+
5375+ ret = wc_Blake2sHmac(message2, sizeof(message2),
5376+ long_key, sizeof(long_key), out, sizeof(out));
5377+ if (ret != 0)
5378+ return WC_TEST_RET_ENC_EC(ret);
5379+ if (XMEMCMP(out, expected_long, sizeof(out)) != 0)
5380+ return WC_TEST_RET_ENC_NC;
5381+ }
5382+
53375383 return 0;
53385384}
53395385#endif /* HAVE_BLAKE2S */
0 commit comments