[IOT-2121] [IOT-2116] Fix CTT "message mac does not match"
authorDan Mihai <Daniel.Mihai@microsoft.com>
Tue, 2 May 2017 00:25:39 +0000 (17:25 -0700)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Thu, 4 May 2017 17:49:26 +0000 (17:49 +0000)
Test case CT1.7.2.1-2 from CTT v1.5.6 fails with "message mac does
not match":
- After CTT successfully posted the owner credential
- While trying to establish a new DTLS session, using the new
credential

Change-Id: I282632d1071c76afba629081d6853d376c347473
Signed-off-by: Dan Mihai <Daniel.Mihai@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19515
Reviewed-by: Kevin Kane <kkane@microsoft.com>
Reviewed-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Tested-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index 4657182..5e1cd3d 100644 (file)
@@ -2403,7 +2403,7 @@ static int pHash (const unsigned char *key, size_t keyLen,
 
     CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacP, key, keyLen);
 
-    while (len + dLen < bufLen)
+    while (len + dLen <= bufLen)
     {
         CHECK_MBEDTLS_RET(mbedtls_md_hmac_reset, &hmacP);
         CHECK_MBEDTLS_RET(mbedtls_md_hmac_starts, &hmacP, key, keyLen);