5a0ef4664255f7833063fba5b04e353517f53375
[iotivity.git] / resource / csdk / security / provisioning / unittest / secureresourceprovider.cpp
1 /* *****************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * *****************************************************************/
20 #include "gtest/gtest.h"
21 #include "secureresourceprovider.h"
22
23 static OicSecAcl_t acl;
24 static OCProvisionDev_t pDev1;
25 static OCProvisionDev_t pDev2;
26 static OicSecCredType_t credType = SYMMETRIC_PAIR_WISE_KEY;
27 static OCProvisionDev_t selectedDeviceInfo;
28 static OicSecPconf_t pconf;
29 static OicSecOxm_t oicSecDoxmJustWorks = OIC_JUST_WORKS;
30 static OicSecOxm_t oicSecDoxmRandomPin = OIC_RANDOM_DEVICE_PIN;
31 static unsigned short timeout = 60;
32 static OicSecDoxm_t defaultDoxm1 =
33 {
34     NULL,                   /* OicUrn_t *oxmType */
35     0,                      /* size_t oxmTypeLen */
36     &oicSecDoxmJustWorks,  /* uint16_t *oxm */
37     1,                      /* size_t oxmLen */
38     OIC_JUST_WORKS,         /* uint16_t oxmSel */
39     SYMMETRIC_PAIR_WISE_KEY,/* OicSecCredType_t sct */
40     false,                  /* bool owned */
41     {{0}},            /* OicUuid_t deviceID */
42     false,                  /* bool dpc */
43     {{0}},            /* OicUuid_t owner */
44 };
45
46 static OicSecDoxm_t defaultDoxm2 =
47 {
48     NULL,                   /* OicUrn_t *oxmType */
49     0,                      /* size_t oxmTypeLen */
50     &oicSecDoxmRandomPin,  /* uint16_t *oxm */
51     1,                      /* size_t oxmLen */
52     OIC_RANDOM_DEVICE_PIN,         /* uint16_t oxmSel */
53     SYMMETRIC_PAIR_WISE_KEY,/* OicSecCredType_t sct */
54     false,                  /* bool owned */
55     {{0}},            /* OicUuid_t deviceID */
56     false,                  /* bool dpc */
57     {{0}},            /* OicUuid_t owner */
58 };
59
60 static void provisioningCB (void* UNUSED1, int UNUSED2, OCProvisionResult_t *UNUSED3, bool UNUSED4)
61 {
62     //dummy callback
63     (void) UNUSED1;
64     (void) UNUSED2;
65     (void) UNUSED3;
66     (void) UNUSED4;
67 }
68
69 TEST(SRPProvisionACLTest, NullDeviceInfo)
70 {
71     pDev1.doxm = &defaultDoxm1;
72     uint8_t deviceId1[] = {0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64};
73     memcpy(pDev1.doxm->deviceID.id, deviceId1, sizeof(deviceId1));
74
75     pDev2.doxm = &defaultDoxm2;
76     uint8_t deviceId2[] = {0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x63};
77     memcpy(pDev2.doxm->deviceID.id, deviceId2, sizeof(deviceId2));
78
79     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionACL(NULL, NULL, &acl, &provisioningCB));
80 }
81
82 TEST(SRPProvisionACLTest, NullCallback)
83 {
84     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPProvisionACL(NULL, &pDev1, &acl, NULL));
85 }
86
87 TEST(SRPProvisionACLTest, NullACL)
88 {
89     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionACL(NULL, &pDev1, NULL, &provisioningCB));
90 }
91
92 TEST(SRPProvisionCredentialsTest, NullDevice1)
93 {
94     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionCredentials(NULL, credType,
95                                                               OWNER_PSK_LENGTH_128, NULL,
96                                                               &pDev2, &provisioningCB));
97 }
98
99 TEST(SRPProvisionCredentialsTest, SamelDeviceId)
100 {
101     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionCredentials(NULL, credType,
102                                                               OWNER_PSK_LENGTH_128, &pDev1,
103                                                               &pDev1, &provisioningCB));
104 }
105
106 TEST(SRPProvisionCredentialsTest, NullCallback)
107 {
108     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPProvisionCredentials(NULL, credType,
109                                                                  OWNER_PSK_LENGTH_128,
110                                                                  &pDev1, &pDev2, NULL));
111 }
112
113 TEST(SRPProvisionCredentialsTest, InvalidKeySize)
114 {
115     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionCredentials(NULL, credType,
116                                                                 0, &pDev1, &pDev2,
117                                                                 &provisioningCB));
118 }
119
120 TEST(SRPUnlinkDevicesTest, NullDevice1)
121 {
122     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPUnlinkDevices(NULL, NULL, &pDev2, provisioningCB));
123 }
124
125 TEST(SRPUnlinkDevicesTest, NullDevice2)
126 {
127     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPUnlinkDevices(NULL, &pDev1, NULL, provisioningCB));
128 }
129
130 TEST(SRPUnlinkDevicesTest, SamelDeviceId)
131 {
132     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPUnlinkDevices(NULL, &pDev1, &pDev1, provisioningCB));
133 }
134
135 TEST(SRPUnlinkDevicesTest, NullCallback)
136 {
137     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPUnlinkDevices(NULL, &pDev1, &pDev2, NULL));
138 }
139
140 TEST(SRPRemoveDeviceTest, NullTargetDevice)
141 {
142     unsigned short waitTime = 10 ;
143     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPRemoveDevice(NULL, waitTime, NULL, provisioningCB));
144 }
145
146 TEST(SRPRemoveDeviceTest, NullResultCallback)
147 {
148     unsigned short waitTime = 10;
149     OCProvisionDev_t dev1;
150     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPRemoveDevice(NULL, waitTime, &dev1, NULL));
151 }
152
153 TEST(SRPRemoveDeviceTest, ZeroWaitTime)
154 {
155     OCProvisionDev_t dev1;
156     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPRemoveDevice(NULL, 0, &dev1, NULL));
157 }
158
159 TEST(SRPProvisionDirectPairingTest, NullselectedDeviceInfo)
160 {
161     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionDirectPairing(NULL, NULL, &pconf, &provisioningCB));
162 }
163
164 TEST(SRPProvisionDirectPairingTest, Nullpconf)
165 {
166     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPProvisionDirectPairing(NULL, &selectedDeviceInfo, NULL, &provisioningCB));
167 }
168
169 TEST(SRPProvisionDirectPairingTest, Nullcallback)
170 {
171     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPProvisionDirectPairing(NULL, &selectedDeviceInfo, &pconf, NULL));
172 }
173
174 const char *SECURE_RESOURCE_PROVIDER_TEST_FILE_NAME = "secureresourceprovider.dat";
175 OCPersistentStorage ps = { NULL, NULL, NULL, NULL, NULL};
176
177 static FILE* TestFopen(const char *path, const char *mode)
178 {
179     if (0 == strcmp(path, OC_SECURITY_DB_DAT_FILE_NAME))
180     {
181         return fopen(SECURE_RESOURCE_PROVIDER_TEST_FILE_NAME, mode);
182     }
183     else
184     {
185         return fopen(path, mode);
186     }
187 }
188
189 void SetPersistentHandler(OCPersistentStorage *ps)
190 {
191     if(ps)
192     {
193         ps->open = TestFopen;
194         ps->read = fread;
195         ps->write = fwrite;
196         ps->close = fclose;
197         ps->unlink = unlink;
198     }
199 }
200
201 class SRPTest : public ::testing::Test
202 {
203 public:
204     static void SetUpTestCase()
205     {
206         SetPersistentHandler(&ps);
207         OCStackResult res = OCRegisterPersistentStorageHandler(&ps);
208         ASSERT_TRUE(res == OC_STACK_OK);
209     }
210
211     static void TearDownTestCase()
212     {
213     }
214
215     static const ByteArray g_caPublicKey;
216
217     static const ByteArray g_derCode ;
218
219     static ByteArray g_serNum;
220 };
221
222 static uint8_t certData[] = {
223         0x30, 0x82, 0x02, 0x39, 0x30, 0x82, 0x01, 0xdf, 0x02, 0x01, 0x01, 0x30, 0x0a, 0x06, 0x08, 0x2a,
224         0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x7c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,
225         0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c,
226         0x09, 0x53, 0x6f, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x74, 0x65, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03,
227         0x55, 0x04, 0x07, 0x0c, 0x08, 0x53, 0x6f, 0x6d, 0x65, 0x63, 0x69, 0x74, 0x79, 0x31, 0x0b, 0x30,
228         0x09, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x02, 0x42, 0x42, 0x31, 0x16, 0x30, 0x14, 0x06, 0x03,
229         0x55, 0x04, 0x0b, 0x0c, 0x0d, 0x53, 0x65, 0x71, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x50, 0x61,
230         0x72, 0x74, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x02, 0x6f, 0x62, 0x31,
231         0x14, 0x30, 0x12, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01, 0x16, 0x05,
232         0x6f, 0x62, 0x40, 0x62, 0x62, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x36, 0x30, 0x38, 0x31, 0x35, 0x31,
233         0x33, 0x31, 0x31, 0x31, 0x37, 0x5a, 0x17, 0x0d, 0x31, 0x39, 0x30, 0x35, 0x31, 0x32, 0x31, 0x33,
234         0x31, 0x31, 0x31, 0x37, 0x5a, 0x30, 0x81, 0xd4, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,
235         0x06, 0x13, 0x02, 0x55, 0x41, 0x31, 0x0c, 0x30, 0x0a, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x03,
236         0x41, 0x73, 0x64, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0c, 0x06, 0x47, 0x6f,
237         0x74, 0x68, 0x61, 0x6d, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x02, 0x5a,
238         0x5a, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x0c, 0x08, 0x42, 0x65, 0x61, 0x6d,
239         0x54, 0x65, 0x61, 0x6d, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d,
240         0x01, 0x09, 0x01, 0x16, 0x0d, 0x72, 0x61, 0x69, 0x6c, 0x40, 0x6d, 0x61, 0x69, 0x6c, 0x2e, 0x63,
241         0x6f, 0x6d, 0x31, 0x32, 0x30, 0x30, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x29, 0x75, 0x75, 0x69,
242         0x64, 0x3a, 0x33, 0x32, 0x33, 0x32, 0x33, 0x32, 0x33, 0x32, 0x2d, 0x33, 0x32, 0x33, 0x32, 0x2d,
243         0x33, 0x32, 0x33, 0x32, 0x2d, 0x33, 0x32, 0x33, 0x32, 0x2d, 0x33, 0x32, 0x33, 0x32, 0x33, 0x32,
244         0x33, 0x32, 0x33, 0x32, 0x33, 0x32, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55, 0x1d, 0x11, 0x0c,
245         0x2b, 0x75, 0x73, 0x65, 0x72, 0x69, 0x64, 0x3a, 0x36, 0x37, 0x36, 0x37, 0x36, 0x37, 0x36, 0x37,
246         0x2d, 0x36, 0x37, 0x36, 0x37, 0x2d, 0x36, 0x37, 0x36, 0x37, 0x2d, 0x36, 0x37, 0x36, 0x37, 0x2d,
247         0x36, 0x37, 0x36, 0x37, 0x36, 0x37, 0x36, 0x37, 0x36, 0x37, 0x36, 0x37, 0x30, 0x59, 0x30, 0x13,
248         0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
249         0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0xf7, 0x13, 0x5c, 0x73, 0x72, 0xce, 0x10, 0xe5, 0x09,
250         0x97, 0x9a, 0xf8, 0xf2, 0x70, 0xa6, 0x3d, 0x89, 0xf5, 0xc5, 0xe4, 0x44, 0xe2, 0x4a, 0xb6, 0x61,
251         0xa8, 0x12, 0x8d, 0xb4, 0xdc, 0x2b, 0x47, 0x84, 0x60, 0x0c, 0x25, 0x66, 0xe9, 0xe0, 0xe5, 0xac,
252         0x22, 0xbf, 0x15, 0xdc, 0x71, 0xb1, 0x88, 0x4f, 0x16, 0xbf, 0xc2, 0x77, 0x37, 0x76, 0x3f, 0xe0,
253         0x67, 0xc6, 0x1d, 0x23, 0xfe, 0x7c, 0x8b, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
254         0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x47, 0xcc, 0x41, 0x8a, 0x27, 0xc7,
255         0xd0, 0xaa, 0xb4, 0xab, 0x85, 0xbf, 0x09, 0x4d, 0x06, 0xd7, 0x7e, 0x0d, 0x39, 0xf9, 0x36, 0xa1,
256         0x3d, 0x96, 0x23, 0xe2, 0x24, 0x64, 0x98, 0x63, 0x21, 0xba, 0x02, 0x21, 0x00, 0xe5, 0x8f, 0x7f,
257         0xf1, 0xa6, 0x82, 0x03, 0x6a, 0x18, 0x7a, 0x54, 0xe7, 0x0e, 0x25, 0x77, 0xd8, 0x46, 0xfa, 0x96,
258         0x8a, 0x7e, 0x14, 0xc4, 0xcb, 0x21, 0x32, 0x3e, 0x89, 0xd9, 0xba, 0x8c, 0x3f
259     };
260
261 static uint8_t keyData[] = {
262             0x67, 0xc6, 0x1d, 0x23, 0xfe, 0x7c, 0x8b, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
263         0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20, 0x47, 0xcc, 0x41, 0x8a, 0x27, 0xc7,
264         0xd0, 0xaa, 0xb4, 0xab, 0x85, 0xbf, 0x09, 0x4d, 0x06, 0xd7, 0x7e, 0x0d, 0x39, 0xf9, 0x36, 0xa1,
265         0x3d, 0x96, 0x23, 0xe2, 0x24, 0x64, 0x98, 0x63, 0x21, 0xba, 0x02, 0x21
266     };
267
268 TEST_F(SRPTest, SRPSaveTrustCertChainDER)
269 {
270     int result;
271     uint16_t credId;
272
273     result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_DER, &credId);
274
275     EXPECT_EQ(OC_STACK_OK, result);
276 }
277
278 TEST_F(SRPTest, SRPSaveTrustCertChainPEM)
279 {
280     int result;
281     uint16_t credId;
282
283     result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_PEM, &credId);
284
285     EXPECT_EQ(OC_STACK_OK, result);
286 }
287
288 TEST_F(SRPTest, SRPSaveTrustCertChainNullCertData)
289 {
290     int result;
291     uint16_t credId;
292
293     result = SRPSaveTrustCertChain(NULL, sizeof(certData), OIC_ENCODING_DER, &credId);
294
295     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
296 }
297
298 TEST_F(SRPTest, SRPSaveTrustCertChainNullCredId)
299 {
300     int result;
301     uint16_t credId;
302
303     result = SRPSaveTrustCertChain(certData, sizeof(certData), OIC_ENCODING_DER, NULL);
304
305     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
306 }
307
308 TEST_F(SRPTest, SRPSaveOwnCertChainTest)
309 {
310     int result;
311     uint16_t credId;
312     OicSecKey_t cert;
313     OicSecKey_t key;
314
315     cert.data = certData;
316     cert.len = sizeof(certData);
317     key.data = keyData;
318     key.len = sizeof(keyData);
319
320     //This test case cannot succeed. because doxm resource has not been initialized.
321     result = SRPSaveOwnCertChain(&cert, &key, &credId);
322
323     EXPECT_EQ(OC_STACK_ERROR, result);
324 }
325
326 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCert)
327 {
328     int result;
329     uint16_t credId;
330     OicSecKey_t key;
331
332     key.data = keyData;
333     key.len = sizeof(keyData);
334
335     result = SRPSaveOwnCertChain(NULL, &key, &credId);
336
337     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
338 }
339
340 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCertData)
341 {
342     int result;
343     uint16_t credId;
344     OicSecKey_t cert;
345     OicSecKey_t key;
346
347     cert.data = NULL;
348     cert.len = sizeof(certData);
349     key.data = keyData;
350     key.len = sizeof(keyData);
351
352     result = SRPSaveOwnCertChain(&cert, &key, &credId);
353
354     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
355 }
356
357 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullKey)
358 {
359     int result;
360     uint16_t credId;
361     OicSecKey_t cert;
362
363     cert.data = certData;
364     cert.len = sizeof(certData);
365
366     result = SRPSaveOwnCertChain(&cert, NULL, &credId);
367
368     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
369 }
370
371 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullKeyData)
372 {
373     int result;
374     uint16_t credId;
375     OicSecKey_t cert;
376     OicSecKey_t key;
377
378     cert.data = certData;
379     cert.len = sizeof(certData);
380     key.data = NULL;
381     key.len = sizeof(keyData);
382
383     result = SRPSaveOwnCertChain(&cert, &key, &credId);
384
385     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
386 }
387
388 TEST_F(SRPTest, SRPSaveOwnCertChainTestNullCredId)
389 {
390     int result;
391     OicSecKey_t cert;
392     OicSecKey_t key;
393
394     cert.data = certData;
395     cert.len = sizeof(certData);
396     key.data = keyData;
397     key.len = sizeof(keyData);
398
399     result = SRPSaveOwnCertChain(&cert, &key, NULL);
400
401     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
402 }
403
404
405 TEST(SRPProvisionTrustCertChainTest, SRPProvisionTrustCertChainNullSelectedDeviceInfo)
406 {
407     int result;
408     int ctx;
409     OicSecCredType_t type = SIGNED_ASYMMETRIC_KEY;
410     uint16_t credId = 0;
411
412     result = SRPProvisionTrustCertChain(&ctx, type, credId, NULL, provisioningCB);
413     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
414 }
415
416 TEST(SRPProvisionTrustCertChainTest, SRPProvisionTrustCertChainNullResultCallback)
417 {
418     int result;
419     int ctx;
420     OicSecCredType_t type = SIGNED_ASYMMETRIC_KEY;
421     uint16_t credId = 0;
422     OCProvisionDev_t selectedDeviceInfo;
423
424     result = SRPProvisionTrustCertChain(&ctx, type, credId, &selectedDeviceInfo, NULL);
425     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, result);
426 }
427
428 TEST(SRPProvisionTrustCertChainTest, SRPProvisionTrustCertChainInvalidOicSecCredType)
429 {
430     int result;
431     int ctx;
432     OicSecCredType_t type = PIN_PASSWORD;
433     uint16_t credId = 0;
434     OCProvisionDev_t selectedDeviceInfo;
435
436     result = SRPProvisionTrustCertChain(&ctx, type, credId, &selectedDeviceInfo, provisioningCB);
437     EXPECT_EQ(OC_STACK_INVALID_PARAM, result);
438 }
439
440 TEST_F(SRPTest, SRPProvisionTrustCertChainNoResource)
441 {
442     int result;
443     int ctx;
444     OicSecCredType_t type = SIGNED_ASYMMETRIC_KEY;
445     uint16_t credId = 0;
446     OCProvisionDev_t selectedDeviceInfo;
447
448     result = SRPProvisionTrustCertChain(&ctx, type, credId, &selectedDeviceInfo, provisioningCB);
449     EXPECT_EQ(OC_STACK_NO_RESOURCE, result);
450 }
451
452 TEST(SRPProvisionTrustCertChainTest, SRPGetACLResourceNoCallback)
453 {
454     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPGetACLResource(NULL, &pDev1, NULL));
455 }
456
457 TEST(SRPProvisionTrustCertChainTest, SRPGetACLResourceNoDevice)
458 {
459     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPGetACLResource(NULL, NULL, provisioningCB));
460 }
461
462 TEST(SRPProvisionTrustCertChainTest, SRPGetCredResourceNoCallback)
463 {
464     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPGetCredResource(NULL, &pDev1, NULL));
465 }
466
467 TEST(SRPProvisionTrustCertChainTest, SRPGetCredResourceNoDevice)
468 {
469     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPGetCredResource(NULL, NULL, provisioningCB));
470 }
471
472 TEST(SRPProvisionTrustCertChainTest, SRPResetDeviceNoCallback)
473 {
474     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPResetDevice(&pDev1, NULL));
475 }
476
477 TEST(SRPProvisionTrustCertChainTest, SRPResetDeviceNoDevice)
478 {
479     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPResetDevice(NULL, provisioningCB));
480 }
481
482 TEST(SRPProvisionTrustCertChainTest, SRPSyncDeviceNoCallback)
483 {
484     EXPECT_EQ(OC_STACK_INVALID_CALLBACK, SRPSyncDevice(NULL, timeout, &pDev1, NULL));
485 }
486
487 TEST(SRPProvisionTrustCertChainTest, SRPSyncDeviceNoDevice)
488 {
489     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPSyncDevice(NULL, timeout, NULL, provisioningCB));
490 }
491
492 TEST(SRPProvisionTrustCertChainTest, SRPSyncDeviceZeroWaitTime)
493 {
494     EXPECT_EQ(OC_STACK_INVALID_PARAM, SRPSyncDevice(NULL, 0, &pDev1, provisioningCB));
495 }
496
497 TEST(SRPProvisionTrustCertChainTest, SRPRemoveDeviceWithoutDiscoveryNoCallback)
498 {
499     EXPECT_EQ(OC_STACK_INVALID_CALLBACK,
500               SRPRemoveDeviceWithoutDiscovery(NULL, &pDev1, &pDev2, NULL));
501 }
502
503 TEST(SRPProvisionTrustCertChainTest, SRPRemoveDeviceWithoutDiscoveryNoDevice)
504 {
505     EXPECT_EQ(OC_STACK_INVALID_PARAM,
506               SRPRemoveDeviceWithoutDiscovery(NULL, &pDev1, NULL, provisioningCB));
507 }
508
509 TEST(SRPProvisionTrustCertChainTest, SRPRemoveDeviceWithoutDiscoveryNoDeviceList)
510 {
511     EXPECT_EQ(OC_STACK_CONTINUE,
512               SRPRemoveDeviceWithoutDiscovery(NULL, NULL, &pDev2, provisioningCB));
513 }
514