From 208de8413e7d48a3fa9dd721d5bde41e8e08dbe4 Mon Sep 17 00:00:00 2001 From: Nathan Heldt-Sheller Date: Sat, 18 Mar 2017 21:17:19 -0700 Subject: [PATCH] [IOT-1763] Implemented device onboarding state CR 23 Added oic.r.pstat Property "dos" as made mandatory by OCF Security Specification CR 23. patch set 2: Functional cbor marshalling. patch set 3: Updated json2cbor tool and every svr.json and .dat file I could find to use the new pstat.dos property. patch set 4: Updated json2cbor tool to support oic 1.1 format but print warning if .dos property not found. patch set 5: Added better handling for .dat files that don't contain "dos" Property, to aid in legacy app migration. patch set 6: Rebase. patch set 7: Fixed unittest issue that appeared after re-base, and addressed misc comments on patch set 5. patch set 8: commit msg fix. patch set 9: added "TODO" items for UPDATE handling once other CRs are done. patch set 10: addressed a few of Kevin's comments. patch set 11: rebase patch set 12: addressed Greg's request for specific JIRA numbers. Change-Id: I6d9751ff1e6d7d88789e1462819736b38f176a53 Signed-off-by: Nathan Heldt-Sheller Reviewed-on: https://gerrit.iotivity.org/gerrit/17993 Tested-by: jenkins-iotivity Reviewed-by: Phil Coval Reviewed-by: Greg Zaverucha --- .../src/main/assets/oic_svr_db_client.dat | Bin 974 -> 936 bytes .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_client.dat | Bin 859 -> 821 bytes .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_client.dat | Bin 1092 -> 1054 bytes .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_server.dat | Bin 1349 -> 1311 bytes .../src/main/assets/oic_svr_db_server.json | 1 + .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_client.json | 1 + .../src/main/assets/oic_svr_db_server.dat | Bin 2493 -> 1203 bytes .../src/main/assets/oic_svr_db_server.json | 1 + .../security/include/internal/srmresourcestrings.h | 3 + .../security/include/securevirtualresourcetypes.h | 16 ++ .../csdk/security/provisioning/sample/cloud.dat | Bin 859 -> 821 bytes .../csdk/security/provisioning/sample/cloud.json | 1 + .../provisioning/sample/oic_svr_db_client.dat | Bin 2385 -> 821 bytes .../provisioning/sample/oic_svr_db_client.json | 1 + .../oic_svr_db_randompin_with_empty_deviceid.dat | Bin 950 -> 882 bytes .../oic_svr_db_randompin_with_empty_deviceid.json | 1 + .../sample/oic_svr_db_server_justworks.dat | Bin 949 -> 881 bytes .../sample/oic_svr_db_server_justworks.json | 1 + .../sample/oic_svr_db_server_mvjustworks.dat | Bin 922 -> 884 bytes .../sample/oic_svr_db_server_mvjustworks.json | 1 + .../sample/oic_svr_db_server_preconfpin.dat | Bin 922 -> 884 bytes .../sample/oic_svr_db_server_preconfpin.json | 1 + .../sample/oic_svr_db_server_randompin.dat | Bin 950 -> 882 bytes .../sample/oic_svr_db_server_randompin.json | 1 + .../sample/oic_svr_db_subowner_client.dat | Bin 1027 -> 989 bytes .../sample/oic_svr_db_subowner_client.json | 1 + resource/csdk/security/src/pstatresource.c | 222 ++++++++++++++++----- resource/csdk/security/src/srmresourcestrings.c | 3 + resource/csdk/security/tool/json2cbor.c | 35 +++- resource/csdk/security/unittest/oic_svr_db.dat | Bin 1085 -> 1047 bytes resource/csdk/security/unittest/oic_svr_db.json | 1 + .../csdk/security/unittest/oic_svr_db_prov.dat | Bin 1356 -> 1265 bytes .../csdk/security/unittest/oic_svr_db_prov.json | 7 +- resource/csdk/security/unittest/oic_unittest.dat | Bin 573 -> 605 bytes resource/csdk/security/unittest/oic_unittest.json | 1 + resource/csdk/security/unittest/pstatresource.cpp | 6 + resource/csdk/stack/samples/linux/secure/README | 14 -- .../stack/samples/linux/secure/oic_amss_db.dat | Bin 1150 -> 1112 bytes .../stack/samples/linux/secure/oic_amss_db.json | 1 + .../linux/secure/oic_svr_db_client_devowner.dat | Bin 1150 -> 1112 bytes .../linux/secure/oic_svr_db_client_devowner.json | 1 + .../secure/oic_svr_db_client_directpairing.dat | Bin 919 -> 881 bytes .../secure/oic_svr_db_client_directpairing.json | 1 + .../linux/secure/oic_svr_db_client_nondevowner.dat | Bin 1150 -> 1112 bytes .../secure/oic_svr_db_client_nondevowner.json | 1 + .../samples/linux/secure/oic_svr_db_server.dat | Bin 1714 -> 1676 bytes .../samples/linux/secure/oic_svr_db_server.json | 1 + .../linux/secure/oic_svr_db_server_justworks.dat | Bin 919 -> 881 bytes .../linux/secure/oic_svr_db_server_justworks.json | 1 + resource/examples/oic_svr_db_client.dat | Bin 1150 -> 1112 bytes resource/examples/oic_svr_db_client.json | 1 + .../examples/oic_svr_db_client_directpairing.dat | Bin 919 -> 881 bytes .../examples/oic_svr_db_client_directpairing.json | 1 + resource/examples/oic_svr_db_server.dat | Bin 1241 -> 1203 bytes resource/examples/oic_svr_db_server.json | 1 + resource/provisioning/examples/cloud.dat | Bin 859 -> 821 bytes resource/provisioning/examples/cloud.json | 1 + .../provisioning/examples/oic_svr_db_client.dat | Bin 859 -> 821 bytes .../provisioning/examples/oic_svr_db_client.json | 1 + .../examples/oic_svr_db_subowner_client.dat | Bin 1027 -> 989 bytes .../examples/oic_svr_db_subowner_client.json | 1 + .../app/src/main/assets/oic_svr_db_client.dat | Bin 859 -> 821 bytes .../app/src/main/assets/oic_svr_db_client.json | 1 + .../secureResourceExample/oic_svr_db_client.dat | Bin 1150 -> 1112 bytes .../secureResourceExample/oic_svr_db_client.json | 1 + .../secureResourceExample/oic_svr_db_server.dat | Bin 1349 -> 1311 bytes .../secureResourceExample/oic_svr_db_server.json | 1 + .../unittests/oic_svr_db_re_client.dat | Bin 2434 -> 1290 bytes .../unittests/oic_svr_db_re_client.json | 1 + 74 files changed, 276 insertions(+), 64 deletions(-) delete mode 100644 resource/csdk/stack/samples/linux/secure/README diff --git a/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.dat b/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.dat index 91be3ca7d9f3c84ecd55e038fdd81d7f4ee3f4b1..0586649fa966a562383fc5c40c1c835da40af499 100644 GIT binary patch delta 48 zcmX@dzJh&2Fq3lms^paX;zfzY%!vhGQZkG43%({L=Q1Ugg#3#RJGMF61Y&v;0(_a9BjS1`k diff --git a/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.json b/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.json index 03bca8c..bbcd7f9 100644 --- a/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.json +++ b/java/examples-android/cloudprovisioningclient/src/main/assets/oic_svr_db_client.json @@ -61,6 +61,7 @@ "rowneruuid" : "61646D69-6E44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 2, "tm": 0, diff --git a/java/examples-android/provisioningclient/src/main/assets/oic_svr_db_client.dat b/java/examples-android/provisioningclient/src/main/assets/oic_svr_db_client.dat index a7549d1ebb0408199ac48fafe2438c26d6bcafaa..e486637456945a4117276ea404a621d802cbf31c 100644 GIT binary patch delta 48 zcmcc3wv}ze14iZYRmmy&#fuV)nG*}Xq+}N77ko`h&Sgp}$z@2&&t*v}&SlxG$z;R` E0QKk+eEl*mE=y8zF3aRJ6 diff --git a/java/examples-android/simpleclient/src/main/assets/oic_svr_db_client.json b/java/examples-android/simpleclient/src/main/assets/oic_svr_db_client.json index 0cce3d9..cc0dde4 100644 --- a/java/examples-android/simpleclient/src/main/assets/oic_svr_db_client.json +++ b/java/examples-android/simpleclient/src/main/assets/oic_svr_db_client.json @@ -49,6 +49,7 @@ "rowneruuid" : "32323232-3232-3232-3232-323232323232" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "32323232-3232-3232-3232-323232323232", "rowneruuid": "32323232-3232-3232-3232-323232323232", diff --git a/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.dat b/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.dat index 1c6c9e12ed65a00387217eaf838a1d94f0e22096..f0184523b8c940be6379356702a1776932082b2a 100644 GIT binary patch delta 52 zcmX@gHJ@w4Lnh_&Rmmy&#fuV)nG*}Xq+}N77ko`h&Sgj{0pk2zmZaibmdPJjOgG0f HKVt*{MC=s+ delta 27 jcmbQwb(CwvLnfxVD<{8W5}#blY%uu&v*~6_=4Xrmo*)Xc diff --git a/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.json b/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.json index 776cccd..11dbf46 100644 --- a/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.json +++ b/java/examples-android/simpleserver/src/main/assets/oic_svr_db_server.json @@ -79,6 +79,7 @@ "rowneruuid" : "31313131-3131-3131-3131-313131313131" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "31313131-3131-3131-3131-313131313131", "rowneruuid": "31313131-3131-3131-3131-313131313131", diff --git a/java/examples-java/provisioningclient/src/main/assets/oic_svr_db_client.json b/java/examples-java/provisioningclient/src/main/assets/oic_svr_db_client.json index 1219d6a..d9b618f 100644 --- a/java/examples-java/provisioningclient/src/main/assets/oic_svr_db_client.json +++ b/java/examples-java/provisioningclient/src/main/assets/oic_svr_db_client.json @@ -24,6 +24,7 @@ } ], "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceid": "YWRtaW5EZXZpY2VVVUlEMA==", "ch": 0, diff --git a/java/examples-java/simpleclient/src/main/assets/oic_svr_db_client.json b/java/examples-java/simpleclient/src/main/assets/oic_svr_db_client.json index c16acb8..0b24158 100644 --- a/java/examples-java/simpleclient/src/main/assets/oic_svr_db_client.json +++ b/java/examples-java/simpleclient/src/main/assets/oic_svr_db_client.json @@ -24,6 +24,7 @@ } ], "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceid": "ZGV2aWNlaWQAAAAAABhanw==", "ch": 0, diff --git a/java/examples-java/simpleclientserver/src/main/assets/oic_svr_db_client.json b/java/examples-java/simpleclientserver/src/main/assets/oic_svr_db_client.json index c16acb8..0b24158 100644 --- a/java/examples-java/simpleclientserver/src/main/assets/oic_svr_db_client.json +++ b/java/examples-java/simpleclientserver/src/main/assets/oic_svr_db_client.json @@ -24,6 +24,7 @@ } ], "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceid": "ZGV2aWNlaWQAAAAAABhanw==", "ch": 0, diff --git a/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat b/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.dat index 9e4d7fa3f171e9a92d23efdbdfd778c4cb4453a0..5f303ded98e63a817ac1cde479cfbd836a757d52 100644 GIT binary patch delta 63 zcmdlhyqR+&Pacz2YC&;HVo5~#s^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z S%Vd6L)5$NG|4hEj@d^MR(;1Qg delta 109 zcmdnYxmTEHe|k}BacW6HS|rQO4S7tHPcpxpoX5m2F?VH3W^sPO*QDfJhNKc8&d+5@ iD$Zq@EWm6yIgZ72@>!-ojQ=+>mM{@iy7?^AGe!U@T`4aB diff --git a/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.json b/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.json index f6d3dca..2d43654 100644 --- a/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.json +++ b/java/examples-java/simpleserver/src/main/assets/oic_svr_db_server.json @@ -67,6 +67,7 @@ "rowneruuid" : "31313131-3131-3131-3131-313131313131" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "31313131-3131-3131-3131-313131313131", "rowneruuid": "31313131-3131-3131-3131-313131313131", diff --git a/resource/csdk/security/include/internal/srmresourcestrings.h b/resource/csdk/security/include/internal/srmresourcestrings.h index 85ba6e8..3a5d38a 100644 --- a/resource/csdk/security/include/internal/srmresourcestrings.h +++ b/resource/csdk/security/include/internal/srmresourcestrings.h @@ -157,6 +157,9 @@ extern const char * OIC_JSON_EOWNERID_NAME; extern const char * OIC_JSON_ENCODING_NAME; extern const char * OIC_JSON_DATA_NAME; extern const char * OIC_JSON_SEC_V_NAME; +extern const char * OIC_JSON_DOS_NAME; +extern const char * OIC_JSON_S_NAME; +extern const char * OIC_JSON_P_NAME; extern const char * OIC_JSON_EMPTY_STRING; diff --git a/resource/csdk/security/include/securevirtualresourcetypes.h b/resource/csdk/security/include/securevirtualresourcetypes.h index 7fdd5f3..c58d722 100644 --- a/resource/csdk/security/include/securevirtualresourcetypes.h +++ b/resource/csdk/security/include/securevirtualresourcetypes.h @@ -218,6 +218,21 @@ typedef unsigned int OSCTBitmask_t; */ typedef OSCTBitmask_t OicSecCredType_t; +typedef enum OicSecDeviceOnboardingState +{ + DOS_RESET = 0, + DOS_RFOTM, + DOS_RFPRO, + DOS_RFNOP, + DOS_SRESET +} OicSecDeviceOnboardingState_t; + +typedef struct OicSecDostype +{ + OicSecDeviceOnboardingState_t state; + bool pending; +} OicSecDostype_t; + typedef struct OicSecDoxm OicSecDoxm_t; /** @@ -541,6 +556,7 @@ struct OicSecDoxm struct OicSecPstat { // :::: + OicSecDostype_t dos; // -:RW:S:Y:oic.sec.dostype bool isOp; // 0:R:S:Y:Boolean OicSecDpm_t cm; // 1:R:S:Y:oic.sec.dpmtype OicSecDpm_t tm; // 2:RW:S:Y:oic.sec.dpmtype diff --git a/resource/csdk/security/provisioning/sample/cloud.dat b/resource/csdk/security/provisioning/sample/cloud.dat index a7549d1ebb0408199ac48fafe2438c26d6bcafaa..86434cc8f6b04b35bffea65cbb33cf38c1b73c1d 100644 GIT binary patch delta 48 zcmcc3wv}ze14iZYRmmy&#fuV)nG*}Xq+}N77ko`h&Sgj{0pk2zmZaibmd%<>MvMUU C#1eY| delta 26 icmdnWcAIU(14gE~D<{8Y6rWtfWH9+Ylj&p&roRA|BnrX+ diff --git a/resource/csdk/security/provisioning/sample/cloud.json b/resource/csdk/security/provisioning/sample/cloud.json index 7f6e747..31657f1 100644 --- a/resource/csdk/security/provisioning/sample/cloud.json +++ b/resource/csdk/security/provisioning/sample/cloud.json @@ -47,6 +47,7 @@ "rowneruuid" : "61646D69-6E44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 0, "tm": 0, diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_client.dat b/resource/csdk/security/provisioning/sample/oic_svr_db_client.dat index 1463162341f0430d1a4ab09aae67168d4ffe8e3a..86434cc8f6b04b35bffea65cbb33cf38c1b73c1d 100644 GIT binary patch delta 52 zcmca8w3Ur<|K{(k_ZgMTS0$(97cWXIW=<^ll9E}RU+^_4IhP@+1c>u6>P1F=O literal 2385 zcmc&#drTZf7{A>+prt_CTnv#0OH-q1=`FL|-f{;qg;HM9mPDw6@xeakxIOM}xBKA0 zHmzK>#%iM`Mq_I|C?^fX=pXV&OKK}hDn=`5j15*}V~k1DYOACq=9+>t_kb&ffQ`|+ z%zpFD%s2D<9>1BhqM$;tCGC0y;*J*TcVj7uM7w72UMT2>A&H$2vNX%EBI~lTkYQ}B zqlC4wF4m5E4o8Utbs0PGU`xGAfh)XE>M)bJj)-r_@fz|28bIb8I7D@GXib26|BJ{tFkg1Dys_`4ZfhV0z8nLO|vu&7@9$j z*`LhKwx_BH$%4CD@7mQG+jSf4kOVl3-Wo^0oLGVuU`@}6MSvs{p)eB}=B*}6F}jzo#7FGWM|%vAGKp(Wc=a>p$io+ z@7_2u!nfu>U%8>L6gUBke9vEFDFU`op`k$)1=T4+junbU8w8@u#z2;_Ie|m4*^2?~ zc9saN;9^qKVy-iRYI42l^QxwSE#o_T2flv$z=_GDzRym|*S@;1?&<62U#z|QaYa2^ z^7{FU+PYuP>?{2B&n>yH9BH|7Y3#Z|m1AgJ8=Nf?JVN>1Z30yF zc14vsI2|rkPbwFT)l+j92$BS0DbRbE*IpgUX^sv@N8cQ++1ykA+jKuec3d7BE@}QBhz{!wg+pXPW9b(SC-!e0oF1fp-?#R7r2MD; zfp_=XgA?A-4QuoLWo;_#&~#3}Iam6@cTOr`KvyyWhdu`0PKp3|UD3P6Dqd@aO@?jRSM;8p}fM_>CMLmL`jpCDPHiKcpWv_Z{an+#Vf`hq~$;9_XKgN xK!`ZL&EK8HLhClUv4B34pb0twajlC}{}`wbd6q(x!sI7!V@#8n tyD}xSIKSXaQgSX+Qb{gDQhqK=QgJTJ!sI7!V@#8n lyD}xSIKSXaQgSX+Qb{gDQhqK=QgJTJ* diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json b/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json index 92b63cc..fe9bd15 100644 --- a/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json +++ b/resource/csdk/security/provisioning/sample/oic_svr_db_server_justworks.json @@ -53,6 +53,7 @@ "rowneruuid" : "6A757374-776F-726B-4465-765575696430" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "6A757374-776F-726B-4465-765575696430", "rowneruuid": "6A757374-776F-726B-4465-765575696430", diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.dat b/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.dat index 2391448bbc8bd79a6c55b216898b90f414d00b21..31de64ef169c87fdb43d555e2f6da86aab74cf56 100644 GIT binary patch delta 30 mcmbQm{)KIW3=?nps^paX;zfzYjEMzbCd)C2Z%$(}VFUoMMhcez delta 41 xcmeyuHj90O43os%l_{CU`2}B+l5?4oN^%*J@^e{|igQ^e?_x6CY|muM2mnia4uk*z diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.json b/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.json index dd811fb..6b6c464 100644 --- a/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.json +++ b/resource/csdk/security/provisioning/sample/oic_svr_db_server_mvjustworks.json @@ -53,6 +53,7 @@ "rowneruuid" : "6D766A75-7374-776F-726B-735575696430" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "6D766A75-7374-776F-726B-735575696430", "rowneruuid": "6D766A75-7374-776F-726B-735575696430", diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.dat b/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.dat index 472ef8eb10693ef2d8e6b7faa3afd64b276502ab..14f7bc6adbdda132e90eb8de746a3bc16cc2ca30 100644 GIT binary patch delta 30 mcmbQm{)KIW3=?nps^paX;zfzYjEMzbCd)C2Z%$(}VFUoMMhcez delta 41 xcmeyuHj90O43os%l_{CU`2}B+l5?4oN^%*J@^e{|igQ^e?_x6CY|muM2mnia4uk*z diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.json b/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.json index 89b960c..2f9e80b 100644 --- a/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.json +++ b/resource/csdk/security/provisioning/sample/oic_svr_db_server_preconfpin.json @@ -53,6 +53,7 @@ "rowneruuid" : "50726563-6F6E-6669-6775-72656450494E" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "50726563-6F6E-6669-6775-72656450494E", "rowneruuid": "50726563-6F6E-6669-6775-72656450494E", diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat b/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.dat index 9da90357ffb374972c18d0dc9a38b3c70cc72087..141a9c6983330f734a77680df2c9af933c50a699 100644 GIT binary patch delta 93 zcmdnS{)vrae{y1SP9ziWM2<+tgo)|aKw<@mc$vtUFgbwH7D!HJ1PV;P!kDI9zA8B- szj#q%F=JxEmz2!n{DLn@$+=8PCAkbq`ME4f#knk#A26Cu-of+_02Xs1vH$=8 delta 113 zcmeywwvC-*e{y1SP9&4|M2<+d)U$tqU}BOrj5QC=x|IkOn{2~q3u9I>!sI7!V@#8n lyD}xSIKSXaQgSX+Qb{gDQhqK=QgJTJE< diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.json b/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.json index 90863b1..d808256 100644 --- a/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.json +++ b/resource/csdk/security/provisioning/sample/oic_svr_db_server_randompin.json @@ -53,6 +53,7 @@ "rowneruuid" : "72616E64-5069-6E44-6576-557569643030" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "72616E64-5069-6E44-6576-557569643030", "rowneruuid": "72616E64-5069-6E44-6576-557569643030", diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.dat b/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.dat index ae130bcc4f4e06a3f292ad681485c04c27970329..7de67471c0014f48c4663a1c1e103d0d02a2ab19 100644 GIT binary patch delta 48 zcmZqXxXZqwgGsr3RdPyx@uI|H=EQ<8DVfFj1z(era~YCKfH*&wIjK08dGkdkBSrw= C@e-W? delta 51 zcmcc1-psL~gGqkw%9PCF{DQAZ$+-+kB|w~?%bZl4%bb;xT9%odI=PQoYjQiY>Es7Y Fe*p+V6bb+U diff --git a/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.json b/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.json index eba0cdd..acd4ac8 100644 --- a/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.json +++ b/resource/csdk/security/provisioning/sample/oic_svr_db_subowner_client.json @@ -65,6 +65,7 @@ "rowneruuid" : "5375624F-776E-6572-436C-69656E743030" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 0, "tm": 0, diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index d6a7b68..d7ed7ba 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -43,14 +43,18 @@ static const uint16_t CBOR_SIZE = 512; static const uint16_t CBOR_MAX_SIZE = 4400; // PSTAT Map size - Number of mandatory items -static const uint8_t PSTAT_MAP_SIZE = 6; +static const uint8_t PSTAT_MAP_SIZE = 7; + +// .dos Property map size +static const uint8_t PSTAT_DOS_MAP_SIZE = 2; // Number of writeable property -static const uint8_t WRITEABLE_PROPERTY_SIZE = 2; +static const uint8_t WRITEABLE_PROPERTY_SIZE = 3; static OicSecDpom_t gSm = SINGLE_SERVICE_CLIENT_DRIVEN; static OicSecPstat_t gDefaultPstat = { + {DOS_RFOTM, false}, // OicSecDostype_t dos false, // bool isop TAKE_OWNER, // OicSecDpm_t cm NORMAL, // OicSecDpm_t tm @@ -66,6 +70,16 @@ static OicSecPstat_t *gPstat = NULL; static OCResourceHandle gPstatHandle = NULL; /** + * Get the default value. + * + * @return the gDefaultPstat pointer. + */ +static OicSecPstat_t* GetPstatDefault() +{ + return &gDefaultPstat; +} + +/** * This method is internal method. * the param roParsed is optionally used to know whether cborPayload has * at least read only property value or not. @@ -85,6 +99,28 @@ void DeletePstatBinData(OicSecPstat_t* pstat) } } +/** + * Function to update persistent storage + */ +static bool UpdatePersistentStorage(OicSecPstat_t *pstat) +{ + bool bRet = false; + + size_t size = 0; + uint8_t *cborPayload = NULL; + OCStackResult ret = PstatToCBORPayload(pstat, &cborPayload, &size, false); + if (OC_STACK_OK == ret) + { + if (OC_STACK_OK == UpdateSecureResourceInPS(OIC_JSON_PSTAT_NAME, cborPayload, size)) + { + bRet = true; + } + OICFree(cborPayload); + } + + return bRet; +} + OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload, size_t *size, bool writableOnly) { @@ -120,27 +156,59 @@ OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload, pstatMapSize += WRITEABLE_PROPERTY_SIZE; } + // Top Level Pstat Map cborEncoderResult = cbor_encoder_create_map(&encoder, &pstatMap, pstatMapSize); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Pstat Map."); + // Device Onboarding State Property tag + cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_DOS_NAME, + strlen(OIC_JSON_DOS_NAME)); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding dos Name Tag."); + + // Device Onboarding State Property map + CborEncoder dosMap; + cborEncoderResult = cbor_encoder_create_map(&pstatMap, &dosMap, PSTAT_DOS_MAP_SIZE); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed creating pstat.dos map"); + + cborEncoderResult = cbor_encode_text_string(&dosMap, OIC_JSON_S_NAME, + strlen(OIC_JSON_S_NAME)); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.s tag."); + + cborEncoderResult = cbor_encode_int(&dosMap, pstat->dos.state); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.s value."); + + cborEncoderResult = cbor_encode_text_string(&dosMap, OIC_JSON_P_NAME, + strlen(OIC_JSON_P_NAME)); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.p tag."); + + cborEncoderResult = cbor_encode_boolean(&dosMap, pstat->dos.pending); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed adding pstat.dos.p value."); + + cborEncoderResult = cbor_encoder_close_container(&pstatMap, &dosMap); + VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed closing pstat.dos map"); + + // IsOp Property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ISOP_NAME, strlen(OIC_JSON_ISOP_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ISOP Name Tag."); cborEncoderResult = cbor_encode_boolean(&pstatMap, pstat->isOp); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ISOP Name Value."); + // cm Property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_CM_NAME, strlen(OIC_JSON_CM_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CM Name Tag."); cborEncoderResult = cbor_encode_int(&pstatMap, pstat->cm); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding CM Name Value."); + // tm Property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_TM_NAME, strlen(OIC_JSON_TM_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding TM Name Tag."); cborEncoderResult = cbor_encode_int(&pstatMap, pstat->tm); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding TM Name Value."); + // om Property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_OM_NAME, strlen(OIC_JSON_OM_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding OM Name Tag."); @@ -149,12 +217,14 @@ OCStackResult PstatToCBORPayload(const OicSecPstat_t *pstat, uint8_t **payload, if (false == writableOnly) { + // sm Property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_SM_NAME, strlen(OIC_JSON_SM_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SM Name Tag."); cborEncoderResult = cbor_encode_int(&pstatMap, pstat->sm[0]); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding SM Name Value."); + // rowneruuid property cborEncoderResult = cbor_encode_text_string(&pstatMap, OIC_JSON_ROWNERID_NAME, strlen(OIC_JSON_ROWNERID_NAME)); VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding ROwner Id Tag."); @@ -250,24 +320,108 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz } OCStackResult ret = OC_STACK_ERROR; - *secPstat = NULL; - - CborValue pstatCbor; - CborParser parser; + CborValue pstatCbor = { .parser = NULL }; + CborValue pstatMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 }; + CborValue dosMap = { .parser = NULL, .ptr = NULL, .remaining = 0, .extra = 0, .type = 0, .flags = 0 }; + CborParser parser = { .end = NULL }; CborError cborFindResult = CborNoError; char *strUuid = NULL; + char *dosTagName = NULL; size_t len = 0; + size_t dosLen = 0; + OicSecPstat_t *pstat = NULL; - cbor_parser_init(cborPayload, size, 0, &parser, &pstatCbor); - CborValue pstatMap = { .parser = NULL }; + *secPstat = NULL; - OicSecPstat_t *pstat = NULL; - cborFindResult = cbor_value_enter_container(&pstatCbor, &pstatMap); - VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding PSTAT Map."); + // init cbor parser + cbor_parser_init(cborPayload, size, 0, &parser, &pstatCbor); + // allocate pstat struct pstat = (OicSecPstat_t *)OICCalloc(1, sizeof(OicSecPstat_t)); VERIFY_NOT_NULL(TAG, pstat, ERROR); + // Individual Properties missing from cbor representation may result in + // pstat Property assignment to existing gPstat values. Therefore, + // we must ensure that gPstat to a valid value, to avoid null deref. + if (!gPstat) + { + gPstat = GetPstatDefault(); + } + VERIFY_NOT_NULL(TAG, gPstat, FATAL); + + // Enter pstat Map + cborFindResult = cbor_value_enter_container(&pstatCbor, &pstatMap); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering pstat Map."); + + // Find pstat.dos tag + cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_DOS_NAME, &pstatMap); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding dos tag."); + + if (CborInvalidType != pstatMap.type) + { + // found pstat.dos tag "dos" in pstatMap + OIC_LOG(INFO, TAG, "Found pstat.dos tag in pstatMap."); + if (CborNoError == cborFindResult && cbor_value_is_container(&pstatMap)) + { + OIC_LOG(INFO, TAG, "Found pstat.dos cbor container; entering."); + cborFindResult = cbor_value_enter_container(&pstatMap, &dosMap); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Entering dos map."); + } + while (cbor_value_is_valid(&dosMap) && cbor_value_is_text_string(&dosMap)) + { + cborFindResult = cbor_value_dup_text_string(&dosMap, &dosTagName, &dosLen, NULL); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting dos map next tag."); + cborFindResult = cbor_value_advance(&dosMap); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing dos map."); + + if (NULL != dosTagName) + { + if (strcmp(dosTagName, OIC_JSON_S_NAME) == 0) + { + OIC_LOG(INFO, TAG, "Found pstat.dos.s tag; getting int value."); + int s = -1; + cborFindResult = cbor_value_get_int(&dosMap, &s); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting pstat.dos.s value."); + OIC_LOG_V(INFO, TAG, "Read pstat.dos.s value = %d.", s); + pstat->dos.state = (OicSecDeviceOnboardingState_t)s; + } + else if (strcmp(dosTagName, OIC_JSON_P_NAME) == 0) + { + OIC_LOG(INFO, TAG, "Found pstat.dos.p tag; getting boolean value."); + bool p = false; + cborFindResult = cbor_value_get_boolean(&dosMap, &p); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed getting pstat.dos.p value."); + OIC_LOG_V(INFO, TAG, "Read pstat.dos.p value = %s.", p?"true":"false"); + pstat->dos.pending = p; + } + else + { + OIC_LOG_V(WARNING, TAG, "Unknown tag name in dos map: %s", dosTagName); + } + free(dosTagName); + dosTagName = NULL; + } + + if (cbor_value_is_valid(&dosMap)) + { + cborFindResult = cbor_value_advance(&dosMap); + VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed advancing dos map."); + } + } + } + else + { + // didn't find pstat.dos tag "dos" in pstatMap + OIC_LOG(WARNING, TAG, "Did not find mandatory pstat.dos tag in pstatMap."); + OIC_LOG(WARNING, TAG, "If this is not an intentionally-partial pstat representation,"); + OIC_LOG(WARNING, TAG, "it may be an outdated .dat file that is missing the \"dos\" Property."); + OIC_LOG(WARNING, TAG, "Using existing pstat.dos value from gPstat."); + pstat->dos.state = gPstat->dos.state; + pstat->dos.pending = gPstat->dos.pending; + cborFindResult = CborNoError; + } + // end pstat.dos map + cborFindResult = cbor_value_map_find_value(&pstatCbor, OIC_JSON_ISOP_NAME, &pstatMap); if (CborNoError == cborFindResult && cbor_value_is_boolean(&pstatMap)) { @@ -368,6 +522,7 @@ static OCStackResult CBORPayloadToPstatBin(const uint8_t *cborPayload, const siz } *secPstat = pstat; + ret = OC_STACK_OK; exit: @@ -383,28 +538,6 @@ exit: return ret; } -/** - * Function to update persistent storage - */ -static bool UpdatePersistentStorage(OicSecPstat_t *pstat) -{ - bool bRet = false; - - size_t size = 0; - uint8_t *cborPayload = NULL; - OCStackResult ret = PstatToCBORPayload(pstat, &cborPayload, &size, false); - if (OC_STACK_OK == ret) - { - if (OC_STACK_OK == UpdateSecureResourceInPS(OIC_JSON_PSTAT_NAME, cborPayload, size)) - { - bRet = true; - } - OICFree(cborPayload); - } - - return bRet; -} - static bool ValidateQuery(const char * query) { OIC_LOG (DEBUG, TAG, "In ValidateQuery"); @@ -481,7 +614,7 @@ static OCEntityHandlerResult HandlePstatGetRequest (const OCEntityHandlerRequest * The entity handler determines how to process a POST request. * Per the REST paradigm, POST can also be used to update representation of existing * resource or create a new resource. - * For pstat, it updates only tm and om. + * For pstat, it updates only dos, isOp, tm, om, and rowneruuid. */ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRequest) { @@ -540,7 +673,8 @@ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRe } validReq = false; - //Currently, IoTivity only supports Single Service Client Directed provisioning + // Currently, IoTivity only supports Single Service Client Directed provisioning + // TODO [IOT-1763]: update this state management logic as part of CR 32. if (pstat->om == SINGLE_SERVICE_CLIENT_DRIVEN) { if ((pstat->cm & RESET) && false == pstat->isOp) @@ -591,10 +725,13 @@ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRe goto exit; } + // TODO [IOT-1763]: use SetState() function on dos as part of CR 32. + gPstat->dos.state = pstat->dos.state; + gPstat->dos.pending = pstat->dos.pending; gPstat->isOp = pstat->isOp; gPstat->om = pstat->om; gPstat->tm = pstat->tm; - gPstat->cm = pstat->cm; + gPstat->cm = pstat->cm; // TODO [IOT-1900]: remove once tm change is done in prov tool etc. memcpy(&(gPstat->rownerID), &(pstat->rownerID), sizeof(OicUuid_t)); // Convert pstat data into CBOR for update to persistent storage @@ -717,16 +854,6 @@ static OCEntityHandlerResult HandlePstatPostRequest(OCEntityHandlerRequest *ehRe return ret; } -/** - * Get the default value. - * - * @return the gDefaultPstat pointer. - */ -static OicSecPstat_t* GetPstatDefault() -{ - return &gDefaultPstat; -} - OCStackResult InitPstatResource() { OCStackResult ret = OC_STACK_ERROR; @@ -787,7 +914,8 @@ void RestorePstatToInitState() if(gPstat) { OIC_LOG(INFO, TAG, "PSTAT resource will revert back to initial status."); - + gPstat->dos.state = DOS_RFOTM; + gPstat->dos.pending = false; gPstat->cm = (OicSecDpm_t)(gPstat->cm | TAKE_OWNER); gPstat->tm = (OicSecDpm_t)(gPstat->tm & (~TAKE_OWNER)); gPstat->om = SINGLE_SERVICE_CLIENT_DRIVEN; diff --git a/resource/csdk/security/src/srmresourcestrings.c b/resource/csdk/security/src/srmresourcestrings.c index 3d4b913..c7f127a 100644 --- a/resource/csdk/security/src/srmresourcestrings.c +++ b/resource/csdk/security/src/srmresourcestrings.c @@ -151,6 +151,9 @@ const char * OIC_JSON_EOWNERID_NAME = "x.org.iotivity.eowneruuid"; const char * OIC_JSON_ENCODING_NAME = "encoding"; const char * OIC_JSON_DATA_NAME = "data"; const char * OIC_JSON_SEC_V_NAME = "secv"; +const char * OIC_JSON_DOS_NAME = "dos"; +const char * OIC_JSON_S_NAME = "s"; +const char * OIC_JSON_P_NAME = "p"; const char * OIC_JSON_EMPTY_STRING = ""; diff --git a/resource/csdk/security/tool/json2cbor.c b/resource/csdk/security/tool/json2cbor.c index da650f0..3149858 100644 --- a/resource/csdk/security/tool/json2cbor.c +++ b/resource/csdk/security/tool/json2cbor.c @@ -739,10 +739,14 @@ OicSecPstat_t* JSONToPstatBin(const char * jsonStr) return NULL; } + OIC_LOG(INFO, TAG, "Using pstat with mandatory .dos object."); + OCStackResult ret = OC_STACK_ERROR; OicSecPstat_t *pstat = NULL; - cJSON *jsonPstat = NULL; cJSON *jsonObj = NULL; + cJSON *jsonPstat = NULL; + cJSON *jsonDos = NULL; + cJSON *jsonDosObj = NULL; cJSON *jsonRoot = cJSON_Parse(jsonStr); VERIFY_NOT_NULL(TAG, jsonRoot, INFO); @@ -752,6 +756,35 @@ OicSecPstat_t* JSONToPstatBin(const char * jsonStr) pstat = (OicSecPstat_t*)OICCalloc(1, sizeof(OicSecPstat_t)); VERIFY_NOT_NULL(TAG, pstat, INFO); + + jsonDos = cJSON_GetObjectItem(jsonPstat, OIC_JSON_DOS_NAME); + if (jsonDos) // do not abort if no .dos found, but print warning + { + OIC_LOG(INFO, TAG, "pstat.dos object found in jsonPstat"); + + jsonDosObj = cJSON_GetObjectItem(jsonDos, OIC_JSON_S_NAME); + VERIFY_NOT_NULL(TAG, jsonDosObj, ERROR); + OIC_LOG(INFO, TAG, "pstat.dos.s object found in jsonDos"); + pstat->dos.state = jsonDosObj->valueint; + OIC_LOG_V(INFO, TAG, "pstat.dos.s = %d", pstat->dos.state); + + jsonDosObj = cJSON_GetObjectItem(jsonDos, OIC_JSON_P_NAME); + VERIFY_NOT_NULL(TAG, jsonDosObj, ERROR); + OIC_LOG(INFO, TAG, "pstat.dos.p object found in jsonDos"); + VERIFY_SUCCESS(TAG, (cJSON_True == jsonDosObj->type || cJSON_False == jsonDosObj->type) , ERROR); + pstat->dos.pending = (bool)jsonDosObj->valueint; + OIC_LOG_V(INFO, TAG, "pstat.dos.p = %s", pstat->dos.pending?"true":"false"); + } + else + { + pstat->dos.state = DOS_RFOTM; + pstat->dos.pending = false; + printf("\n***** Pstat.dos Property not found in JSON file. *****\ + \n***** Pstat.dos Property is MANDATORY as of OCF 1.0 *****\ + \n***** Using default .dos vals: s = %d, p = %s *****\n\n", pstat->dos.state, \ + pstat->dos.pending?"true":"false"); + } + jsonObj = cJSON_GetObjectItem(jsonPstat, OIC_JSON_ISOP_NAME); VERIFY_NOT_NULL(TAG, jsonObj, ERROR); VERIFY_SUCCESS(TAG, (cJSON_True == jsonObj->type || cJSON_False == jsonObj->type) , ERROR); diff --git a/resource/csdk/security/unittest/oic_svr_db.dat b/resource/csdk/security/unittest/oic_svr_db.dat index 56af560f853f19552b3325a05f5c0c2a07350092..87d515508c02084b1fb2ba515faae044393a1e0a 100644 GIT binary patch delta 48 zcmdnXF`Z+>AtvSWRmmy&#fuV)850Y>q+}N77ko)d&Sgp}$z@2&&t*v}&Slxm&1}R7 E0Oj)%2mk;8 delta 26 icmbQvv6o}RAtt7|D<_|45}zE$Y%uvCv*~0h=Dz@nE(!Sn diff --git a/resource/csdk/security/unittest/oic_svr_db.json b/resource/csdk/security/unittest/oic_svr_db.json index 00fdea4..d4639a3 100644 --- a/resource/csdk/security/unittest/oic_svr_db.json +++ b/resource/csdk/security/unittest/oic_svr_db.json @@ -73,6 +73,7 @@ "rowneruuid" : "756E6B6E-6F77-6564-4465-766963654964" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "756E6B6E-6F77-6564-4465-766963654964", "rowneruuid": "756E6B6E-6F77-6564-4465-766963654964", diff --git a/resource/csdk/security/unittest/oic_svr_db_prov.dat b/resource/csdk/security/unittest/oic_svr_db_prov.dat index 69dcf23d501b746d1fac976c8cf38d87d4bc0716..06b2851381ace354b7c8d034ff188d9edbf86a24 100644 GIT binary patch delta 62 zcmX@Z^^tRfB9n6Ys^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%jPU53r5D` R$%~oqP5!`aIQcnCDgX?n7+nAW delta 91 zcmey!d4_9)A`{cxm6P?D#3%1%GMKEuY`VFUiJ6gc#pGJ%d!~z0QW8rN0~{TloSdCq qTwGn<+}zzgJTg-AlJiqC^U_Q5Gn4g-Qz0(vQ_MU$ghrU3woS09-G diff --git a/resource/csdk/security/unittest/oic_svr_db_prov.json b/resource/csdk/security/unittest/oic_svr_db_prov.json index 608737b..8742bbe 100644 --- a/resource/csdk/security/unittest/oic_svr_db_prov.json +++ b/resource/csdk/security/unittest/oic_svr_db_prov.json @@ -6,7 +6,8 @@ "subjectuuid": "61646d69-6e44-6576-6963-655575696430", "credtype": 1, "privatedata": { - "data": "AAAAAAAAAAAAAAAA", + +"data": "AAAAAAAAAAAAAAAA", "encoding": "oic.sec.encoding.raw" } }, @@ -24,7 +25,8 @@ } } ], - "rowneruuid": "61646d69-6e44-6576-6963-655575696430" + +"rowneruuid": "61646d69-6e44-6576-6963-655575696430" }, "acl": { "aclist": { @@ -82,6 +84,7 @@ "rowneruuid": "61646d69-6e44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "646f6f72-4465-7669-6365-555549443030", "cm": 0, diff --git a/resource/csdk/security/unittest/oic_unittest.dat b/resource/csdk/security/unittest/oic_unittest.dat index 4befed00c604e5f388788594eb792e8fd20d89fe..d083815e051768f246582ba0f3d5bec2d95f4282 100644 GIT binary patch delta 121 zcmdnXa+ig3e{y1SP9)>yB^x<6Fxn&)l{9ANXC~_v=>dh4GSeFKLA=Z~y`;qA)SS$` w)YO9FlEjjT%2mlJ`NfM8iy0FOzNBOp=NEjL{FBjH6=Xm*!~n2DY)1SC0Ih^E)&Kwi delta 51 zcmcc1vX_N(e{y1SP9)>TMH@LcFp8xX6qh8HL{u+N$t=z<_>z^9T9%odI+>42d-69% HC&vE(84?t} diff --git a/resource/csdk/security/unittest/oic_unittest.json b/resource/csdk/security/unittest/oic_unittest.json index c435721..72683d5 100644 --- a/resource/csdk/security/unittest/oic_unittest.json +++ b/resource/csdk/security/unittest/oic_unittest.json @@ -43,6 +43,7 @@ "rowneruuid" : "32323232-3232-3232-3232-323232323232" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "756E6B6E-6F77-6564-4465-766963654964", "rowneruuid": "756E6B6E-6F77-6564-4465-766963654964", diff --git a/resource/csdk/security/unittest/pstatresource.cpp b/resource/csdk/security/unittest/pstatresource.cpp index c97dd6a..1a7db7b 100644 --- a/resource/csdk/security/unittest/pstatresource.cpp +++ b/resource/csdk/security/unittest/pstatresource.cpp @@ -62,6 +62,8 @@ TEST(PstatResourceTest, PstatEntityHandlerWithPostRequest) { OicSecPstat_t *defaultPstat = (OicSecPstat_t *) OICCalloc(1, sizeof(*defaultPstat)); ASSERT_TRUE(defaultPstat != NULL); + defaultPstat->dos.state = DOS_RFOTM; + defaultPstat->dos.pending = false; defaultPstat->isOp = false; defaultPstat->commitHash = 1234; defaultPstat->cm = 63; @@ -117,6 +119,8 @@ TEST(PstatResourceTest, CBORPayloadToPstat) TEST(PstatResourceTest, PstatToCBORPayloadAndCBORPayloadToPstat) { OicSecPstat_t pstat; + pstat.dos.state = DOS_RFNOP; + pstat.dos.pending = false; pstat.cm = NORMAL; pstat.commitHash = 0; pstat.isOp = true; @@ -140,6 +144,8 @@ TEST(PstatResourceTest, PstatToCBORPayloadAndCBORPayloadToPstat) OicSecPstat_t *pstat1 = NULL; EXPECT_EQ(OC_STACK_OK, CBORPayloadToPstat(cbor, size, &pstat1)); ASSERT_TRUE(NULL != pstat1); + EXPECT_EQ(pstat.dos.state, pstat1->dos.state); + EXPECT_EQ(pstat.dos.pending, pstat1->dos.pending); EXPECT_EQ(pstat.commitHash, pstat1->commitHash); EXPECT_EQ(pstat.isOp, pstat1->isOp); EXPECT_EQ(pstat.tm, pstat1->tm); diff --git a/resource/csdk/stack/samples/linux/secure/README b/resource/csdk/stack/samples/linux/secure/README deleted file mode 100644 index e874653..0000000 --- a/resource/csdk/stack/samples/linux/secure/README +++ /dev/null @@ -1,14 +0,0 @@ -Testing AMS service: -1. Copy subjectID ("NDQ0NDMzMzMyMjIyMTExMQ==") of ACE with resource "/a/led" from AMS service - database file, "oic_amss_db.json" into client Doxm resource deviceID located in file - "oic_svr_client.json". -2. Start ocserverbasicops -3. start ocamsservice -4. Start occlientbasicops - - -Expected Result: -1. New ACE with subjectID="NDQ0NDMzMzMyMjIyMTExMQ==" and rsrc="/a/led/" will be appended to the - server ACL resource in file "oic_svr_db_server.json". -2. GET request made by occlientbasicops will be received successfully -3. PUT reuest will received with result "OC_STACK_UNAUTHORIZED_REQ" diff --git a/resource/csdk/stack/samples/linux/secure/oic_amss_db.dat b/resource/csdk/stack/samples/linux/secure/oic_amss_db.dat index 3a8925e6ac731292a66de024b9ad0e2df188b027..8eb061650483785f663b3fabc1d72161c1491852 100644 GIT binary patch delta 52 zcmeyzaf4%n6q9oKs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%j5%$rkiIl HJ!1p_HJuc! delta 52 zcmcb?@sDGJ6qEeil_{CU`2}B-l5-i7N`N>&mnEqrkjhH Ho-qOd8p#uS diff --git a/resource/csdk/stack/samples/linux/secure/oic_amss_db.json b/resource/csdk/stack/samples/linux/secure/oic_amss_db.json index 55c1d01..32d7b62 100644 --- a/resource/csdk/stack/samples/linux/secure/oic_amss_db.json +++ b/resource/csdk/stack/samples/linux/secure/oic_amss_db.json @@ -55,6 +55,7 @@ "rowneruuid" : "31393139-3139-3139-3139-313931393139" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "31393139-3139-3139-3139-313931393139", "rowneruuid": "31393139-3139-3139-3139-313931393139", diff --git a/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_devowner.dat b/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_devowner.dat index 8574d700ddc9bafe756e75a56daead71d22cfeea..184e10f9520c3d3e7ad4e20eb0acd04a3160438f 100644 GIT binary patch delta 52 zcmeyzaf4%n6q9oKs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%j5%$rkiIl HJ!1p_HJuc! delta 52 zcmcb?@sDGJ6qEeil_{CU`2}B-l5-i7N`N>&mnEqF96bP40!+m delta 41 xcmey!Hl2Ng43os%l_{CU`2}B+l5?4oN^%*J@^e{|igQ^eZ)Y;xY|muG2mnfL4tM|n diff --git a/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_directpairing.json b/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_directpairing.json index 1fcceb7..c280b40 100644 --- a/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_directpairing.json +++ b/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_directpairing.json @@ -55,6 +55,7 @@ "rowneruuid" : "64697265-6374-7061-6972-696e67446576" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "64697265-6374-7061-6972-696e67446576", "rowneruuid": "64697265-6374-7061-6972-696e67446576", diff --git a/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_nondevowner.dat b/resource/csdk/stack/samples/linux/secure/oic_svr_db_client_nondevowner.dat index fd246a8b36fb3741cf19367f31fc528039d8e995..7354bfd561074afaf70def6d8ffdfe9b82381fd8 100644 GIT binary patch delta 52 zcmeyzaf4%n6q9oKs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%j5%$rkiIl HJ!1p_HJuc! delta 52 zcmcb?@sDGJ6qEeil_{CU`2}B-l5-i7N`N>&mnEqF96bP40!+m delta 41 xcmey!Hl2Ng43os%l_{CU`2}B+l5?4oN^%*J@^e{|igQ^eZ)Y;xY|muG2mnfL4tM|n diff --git a/resource/csdk/stack/samples/linux/secure/oic_svr_db_server_justworks.json b/resource/csdk/stack/samples/linux/secure/oic_svr_db_server_justworks.json index b8941d4..58d12de 100644 --- a/resource/csdk/stack/samples/linux/secure/oic_svr_db_server_justworks.json +++ b/resource/csdk/stack/samples/linux/secure/oic_svr_db_server_justworks.json @@ -55,6 +55,7 @@ "rowneruuid": "6a757374-776f-726b-4465-765575696430" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "6a757374-776f-726b-4465-765575696430", "cm": 2, diff --git a/resource/examples/oic_svr_db_client.dat b/resource/examples/oic_svr_db_client.dat index 8574d700ddc9bafe756e75a56daead71d22cfeea..184e10f9520c3d3e7ad4e20eb0acd04a3160438f 100644 GIT binary patch delta 52 zcmeyzaf4%n6q9oKs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%j5%$rkiIl HJ!1p_HJuc! delta 52 zcmcb?@sDGJ6qEeil_{CU`2}B-l5-i7N`N>&mnEqF96bP40!+m delta 41 xcmey!Hl2Ng43os%l_{CU`2}B+l5?4oN^%*J@^e{|igQ^eZ)Y;xY|muG2mnfL4tM|n diff --git a/resource/examples/oic_svr_db_client_directpairing.json b/resource/examples/oic_svr_db_client_directpairing.json index 577582f..e51bf08 100644 --- a/resource/examples/oic_svr_db_client_directpairing.json +++ b/resource/examples/oic_svr_db_client_directpairing.json @@ -55,6 +55,7 @@ "rowneruuid" : "64706169-7269-6e67-4465-765555494430" }, "pstat": { + "dos": {"s": 1, "p": false}, "isop": false, "deviceuuid": "64706169-7269-6e67-4465-765555494430", "rowneruuid": "64706169-7269-6e67-4465-765555494430", diff --git a/resource/examples/oic_svr_db_server.dat b/resource/examples/oic_svr_db_server.dat index 138b9603c3edd15b466a7f23f82193b1dec364ed..5f303ded98e63a817ac1cde479cfbd836a757d52 100644 GIT binary patch delta 48 zcmcb~xtViADU)*fs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%jSJd(o6v6 CbP|#P delta 45 zcmdnYd6RQPDU-z9l_{CU`2}B-l5-i7N`N>&mnEqMvMUU C#1eY| delta 26 icmdnWcAIU(14gE~D<{8Y6rWtfWH9+Ylj&p&roRA|BnrX+ diff --git a/resource/provisioning/examples/cloud.json b/resource/provisioning/examples/cloud.json index 7f6e747..31657f1 100644 --- a/resource/provisioning/examples/cloud.json +++ b/resource/provisioning/examples/cloud.json @@ -47,6 +47,7 @@ "rowneruuid" : "61646D69-6E44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 0, "tm": 0, diff --git a/resource/provisioning/examples/oic_svr_db_client.dat b/resource/provisioning/examples/oic_svr_db_client.dat index a7549d1ebb0408199ac48fafe2438c26d6bcafaa..86434cc8f6b04b35bffea65cbb33cf38c1b73c1d 100644 GIT binary patch delta 48 zcmcc3wv}ze14iZYRmmy&#fuV)nG*}Xq+}N77ko`h&Sgj{0pk2zmZaibmd%<>MvMUU C#1eY| delta 26 icmdnWcAIU(14gE~D<{8Y6rWtfWH9+Ylj&p&roRA|BnrX+ diff --git a/resource/provisioning/examples/oic_svr_db_client.json b/resource/provisioning/examples/oic_svr_db_client.json index 15a0afc..7cf5d6e 100644 --- a/resource/provisioning/examples/oic_svr_db_client.json +++ b/resource/provisioning/examples/oic_svr_db_client.json @@ -49,6 +49,7 @@ "rowneruuid" : "61646D69-6E44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 0, "tm": 0, diff --git a/resource/provisioning/examples/oic_svr_db_subowner_client.dat b/resource/provisioning/examples/oic_svr_db_subowner_client.dat index ae130bcc4f4e06a3f292ad681485c04c27970329..7de67471c0014f48c4663a1c1e103d0d02a2ab19 100644 GIT binary patch delta 48 zcmZqXxXZqwgGsr3RdPyx@uI|H=EQ<8DVfFj1z(era~YCKfH*&wIjK08dGkdkBSrw= C@e-W? delta 51 zcmcc1-psL~gGqkw%9PCF{DQAZ$+-+kB|w~?%bZl4%bb;xT9%odI=PQoYjQiY>Es7Y Fe*p+V6bb+U diff --git a/resource/provisioning/examples/oic_svr_db_subowner_client.json b/resource/provisioning/examples/oic_svr_db_subowner_client.json index eba0cdd..acd4ac8 100644 --- a/resource/provisioning/examples/oic_svr_db_subowner_client.json +++ b/resource/provisioning/examples/oic_svr_db_subowner_client.json @@ -65,6 +65,7 @@ "rowneruuid" : "5375624F-776E-6572-436C-69656E743030" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "cm": 0, "tm": 0, diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat index a7549d1ebb0408199ac48fafe2438c26d6bcafaa..86434cc8f6b04b35bffea65cbb33cf38c1b73c1d 100644 GIT binary patch delta 48 zcmcc3wv}ze14iZYRmmy&#fuV)nG*}Xq+}N77ko`h&Sgj{0pk2zmZaibmd%<>MvMUU C#1eY| delta 26 icmdnWcAIU(14gE~D<{8Y6rWtfWH9+Ylj&p&roRA|BnrX+ diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.json b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.json index 5bc15fc..bbf2144 100644 --- a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.json +++ b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.json @@ -49,6 +49,7 @@ "rowneruuid" : "61646d69-6e44-6576-6963-655575696430" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "61646d69-6e44-6576-6963-655575696430", "rowneruuid": "61646d69-6e44-6576-6963-655575696430", diff --git a/service/resource-encapsulation/examples/linux/secureResourceExample/oic_svr_db_client.dat b/service/resource-encapsulation/examples/linux/secureResourceExample/oic_svr_db_client.dat index 8574d700ddc9bafe756e75a56daead71d22cfeea..184e10f9520c3d3e7ad4e20eb0acd04a3160438f 100644 GIT binary patch delta 52 zcmeyzaf4%n6q9oKs^paX;zfzY%!vhGQZkG43%({L=Q1Rf0C9dUOHy$z%j5%$rkiIl HJ!1p_HJuc! delta 52 zcmcb?@sDGJ6qEeil_{CU`2}B-l5-i7N`N>&mnEqu?Pq delta 297 zcmeC;Y7*wzpI($&oLW+l7Rlni;S5v#+?6Sr#rXwalag~8l1hL$KbIw`IF}_WCABOw zIkmJjGo?bs019+LG#UYu%PPt*&r2;LUPDq*Nn`fpYmD-fU6>6tV8)=C4(7t-a)54{ r{Es6|BZ~NndAxhbMivw_{mop6*jvtA7canXp2?q diff --git a/service/resource-encapsulation/unittests/oic_svr_db_re_client.json b/service/resource-encapsulation/unittests/oic_svr_db_re_client.json index b6ff1aa..726ed9d 100644 --- a/service/resource-encapsulation/unittests/oic_svr_db_re_client.json +++ b/service/resource-encapsulation/unittests/oic_svr_db_re_client.json @@ -73,6 +73,7 @@ "rowneruuid" : "32323232-3232-3232-3232-323232323232" }, "pstat": { + "dos": {"s": 3, "p": false}, "isop": true, "deviceuuid": "32323232-3232-3232-3232-323232323232", "rowneruuid": "32323232-3232-3232-3232-323232323232", -- 2.7.4