@@ -31783,6 +31783,8 @@ typedef struct Srtp_Kdf_Tv {
3178331783 word32 ksSz;
3178431784} Srtp_Kdf_Tv;
3178531785
31786+ #define SRTP_KDF_LONG_KEY 5000
31787+
3178631788WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srtpkdf_test(void)
3178731789{
3178831790 wc_test_ret_t ret = 0;
@@ -32034,6 +32036,18 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srtpkdf_test(void)
3203432036 unsigned char keyE[32];
3203532037 unsigned char keyA[20];
3203632038 unsigned char keyS[14];
32039+ #ifndef BENCH_EMBEDDED
32040+ WC_DECLARE_VAR(keyELong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32041+ WC_DECLARE_VAR(keyALong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32042+ WC_DECLARE_VAR(keySLong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32043+ #endif
32044+
32045+ #ifndef BENCH_EMBEDDED
32046+ WC_ALLOC_VAR(keyELong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32047+ WC_ALLOC_VAR(keyALong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32048+ WC_ALLOC_VAR(keySLong, byte, SRTP_KDF_LONG_KEY, HEAP_HINT);
32049+ #endif
32050+
3203732051 WOLFSSL_ENTER("srtpkdf_test");
3203832052
3203932053 for (i = 0; (ret == 0) && (i < SRTP_TV_CNT); i++) {
@@ -32284,6 +32298,30 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t srtpkdf_test(void)
3228432298 return WC_TEST_RET_ENC_NC;
3228532299 }
3228632300
32301+ #ifndef BENCH_EMBEDDED
32302+ /* Check that long messages can be created. */
32303+ ret = wc_SRTP_KDF(tv[0].key, tv[0].keySz, tv[0].salt, tv[0].saltSz,
32304+ tv[0].kdfIdx, tv[0].index_c, keyELong, SRTP_KDF_LONG_KEY, keyALong,
32305+ SRTP_KDF_LONG_KEY, keySLong, SRTP_KDF_LONG_KEY);
32306+ if (ret != 0)
32307+ return WC_TEST_RET_ENC_EC(ret);
32308+
32309+ /* Check that two bytes of counter are being used. */
32310+ if (XMEMCMP(keyELong, keyELong + 4096, SRTP_KDF_LONG_KEY - 4096) == 0) {
32311+ return WC_TEST_RET_ENC_NC;
32312+ }
32313+ if (XMEMCMP(keyELong, keyALong + 4096, SRTP_KDF_LONG_KEY - 4096) == 0) {
32314+ return WC_TEST_RET_ENC_NC;
32315+ }
32316+ if (XMEMCMP(keyELong, keySLong + 4096, SRTP_KDF_LONG_KEY - 4096) == 0) {
32317+ return WC_TEST_RET_ENC_NC;
32318+ }
32319+
32320+ WC_FREE_VAR(keyELong, HEAP_HINT);
32321+ WC_FREE_VAR(keyALong, HEAP_HINT);
32322+ WC_FREE_VAR(keySLong, HEAP_HINT);
32323+ #endif
32324+
3228732325 return 0;
3228832326}
3228932327#endif
0 commit comments