Disable checking parameters for non symmetric key
authorDmitrii Zhuravlev <d.zhuravlev@samsung.com>
Tue, 22 Sep 2015 13:18:32 +0000 (16:18 +0300)
committerSachin Agrawal <sachin.agrawal@intel.com>
Tue, 22 Sep 2015 20:36:47 +0000 (20:36 +0000)
Disables the second device and key length checking,
in the case of credential provisioning based on the types
that are different from SYMMETRIC_PAIR_WISE_KEY.

Change-Id: I8dc8581e7af7ef104e7e2dd473c53d60acc1c9d9
Signed-off-by: Dmitrii Zhuravlev <d.zhuravlev@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2931
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/security/provisioning/src/secureresourceprovider.c

index d2157ecff75f37f144ce219db8aa43f5e96e6b0b..5b61d652de0220946291268b6aa4834f0c3497e8 100644 (file)
@@ -618,10 +618,14 @@ OCStackResult SRPProvisionCredentials(void *ctx, OicSecCredType_t type, size_t k
                                       OCProvisionResultCB resultCallback)
 {
     VERIFY_NON_NULL(TAG, pDev1, ERROR,  OC_STACK_INVALID_PARAM);
-    VERIFY_NON_NULL(TAG, pDev2, ERROR,  OC_STACK_INVALID_PARAM);
+    if (SYMMETRIC_PAIR_WISE_KEY == type)
+    {
+        VERIFY_NON_NULL(TAG, pDev2, ERROR,  OC_STACK_INVALID_PARAM);
+    }
     VERIFY_NON_NULL(TAG, resultCallback, ERROR,  OC_STACK_INVALID_CALLBACK);
 
-    if (!(keySize == OWNER_PSK_LENGTH_128 || keySize == OWNER_PSK_LENGTH_256))
+    if (SYMMETRIC_PAIR_WISE_KEY == type &&
+       !(OWNER_PSK_LENGTH_128 == keySize || OWNER_PSK_LENGTH_256 == keySize))
     {
         OC_LOG(INFO, TAG, "Invalid key size");
         return OC_STACK_INVALID_PARAM;