Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oc_ace: refactor and add tests #622

Merged
merged 9 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/oc_collection.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ oc_handle_collection_create_request(oc_method_t method, oc_request_t *request)
oc_rep_end_root_object();
#ifdef OC_SECURITY
oc_sec_acl_add_created_resource_ace(
oc_string(new_res->resource->uri), request->origin,
oc_string_view2(&new_res->resource->uri), request->origin,
request->resource->device,
false); /* TODO: handle creation of Collections */
#endif /* OC_SECURITY */
Expand Down
8 changes: 5 additions & 3 deletions include/oc_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ typedef enum {
*/
typedef struct oc_ace_res_t
{
struct oc_ace_res_t *next; ///< pointer to next entry
oc_string_t href; ///< href
struct oc_ace_res_t *next; ///< pointer to next entry
oc_string_t href; ///< href
#if 0
oc_interface_mask_t interfaces; ///< applicable interfaces (as bit mask)
oc_string_array_t types; ///< resource types (rt)
oc_ace_wildcard_t wildcard; ///< wildcard info
#endif
oc_ace_wildcard_t wildcard; ///< wildcard info
} oc_ace_res_t;

/**
Expand Down
2 changes: 1 addition & 1 deletion port/android/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ ifeq ($(PLGD_DEV_TIME),1)
endif

ifneq ($(SECURE),0)
SRC += $(addprefix ../../security/, oc_acl.c oc_acl_util.c oc_ael.c oc_audit.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
SRC += $(addprefix ../../security/,oc_ace.c oc_acl.c oc_acl_util.c oc_ael.c oc_audit.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
oc_cred.c oc_cred_util.c oc_csr.c oc_doxm.c oc_entropy.c oc_keypair.c oc_pki.c oc_pstat.c oc_roles.c oc_sdi.c \
oc_security.c oc_sp.c oc_store.c oc_svr.c oc_tls.c)
SRC_COMMON += $(addprefix $(MBEDTLS_DIR)/library/,${DTLS})
Expand Down
2 changes: 1 addition & 1 deletion port/arduino/adapter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ifeq ($(DYNAMIC),1)
endif

ifeq ($(SECURE),1)
SEC_SRC += $(addprefix $(ROOT_DIR)/security/, oc_acl.c oc_acl_util.c oc_cred.c oc_cred_util.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
SEC_SRC += $(addprefix $(ROOT_DIR)/security/,oc_ace.c oc_acl.c oc_acl_util.c oc_cred.c oc_cred_util.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
oc_csr.c oc_doxm.c oc_entropy.c oc_keypair.c oc_pki.c oc_pstat.c oc_roles.c oc_security.c oc_sp.c oc_store.c oc_svr.c \
oc_tls.c)
SRC += $(SEC_SRC)
Expand Down
1 change: 1 addition & 0 deletions port/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ endif()
if(CONFIG_SECURE)
list(APPEND OC_DEFINITIONS -DOC_SECURITY -DOC_PKI)
list(APPEND sources
${CMAKE_CURRENT_SOURCE_DIR}/../../../security/oc_ace.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../security/oc_acl.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../security/oc_acl_util.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../security/oc_ael.c
Expand Down
2 changes: 1 addition & 1 deletion port/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ endif
endif

ifneq ($(SECURE),0)
SRC += $(addprefix ../../security/, oc_acl.c oc_acl_util.c oc_ael.c oc_audit.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
SRC += $(addprefix ../../security/,oc_ace.c oc_acl.c oc_acl_util.c oc_ael.c oc_audit.c oc_certs.c oc_certs_generate.c oc_certs_validate.c \
oc_cred.c oc_cred_util.c oc_csr.c oc_doxm.c oc_entropy.c oc_keypair.c oc_oscore_engine.c oc_oscore_crypto.c \
oc_oscore_context.c oc_pki.c oc_pstat.c oc_roles.c oc_sdi.c oc_security.c oc_sp.c oc_store.c oc_svr.c oc_tls.c)
SRC_COMMON += $(addprefix $(MBEDTLS_DIR)/library/,${DTLS})
Expand Down
2 changes: 1 addition & 1 deletion port/openthread/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ifeq ($(MEMORY_TRACE), 1)
endif

ifeq ($(SECURE),1)
SRC_COMMON += oc_acl.c oc_acl_util.c oc_cred.c oc_cred_util.c oc_doxm.c oc_pstat.c oc_dtls.c oc_svr.c oc_store.c oc_sdi.c
SRC_COMMON += oc_ace.c oc_acl.c oc_acl_util.c oc_cred.c oc_cred_util.c oc_doxm.c oc_pstat.c oc_dtls.c oc_svr.c oc_store.c oc_sdi.c
SRC_COMMON += memory_buffer_alloc.c
CFLAGS += -DOC_SECURITY
endif
Expand Down
2 changes: 2 additions & 0 deletions port/windows/vs2015/IoTivity-lite.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@
<ClInclude Include="..\..\..\messaging\coap\oc_coap.h" />
<ClInclude Include="..\..\..\messaging\coap\separate_internal.h" />
<ClInclude Include="..\..\..\messaging\coap\transactions_internal.h" />
<ClInclude Include="..\..\..\security\oc_ace_internal.h" />
<ClInclude Include="..\..\..\security\oc_acl_internal.h" />
<ClInclude Include="..\..\..\security\oc_acl_util_internal.h" />
<ClInclude Include="..\..\..\security\oc_ael_internal.h" />
Expand Down Expand Up @@ -461,6 +462,7 @@
<ClCompile Include="..\..\..\port\common\oc_poll_loop.c" />
<ClCompile Include="..\..\..\port\common\posix\oc_socket.c" />
<ClCompile Include="..\..\..\port\common\posix\oc_tcp_socket.c" />
<ClCompile Include="..\..\..\security\oc_ace.c" />
<ClCompile Include="..\..\..\security\oc_acl.c" />
<ClCompile Include="..\..\..\security\oc_acl_util.c" />
<ClCompile Include="..\..\..\security\oc_ael.c" />
Expand Down
6 changes: 6 additions & 0 deletions port/windows/vs2015/IoTivity-lite.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
<ClCompile Include="..\..\..\security\oc_sp.c">
<Filter>Security</Filter>
</ClCompile>
<ClCompile Include="..\..\..\security\oc_ace.c">
<Filter>Security</Filter>
</ClCompile>
<ClCompile Include="..\..\..\security\oc_acl.c">
<Filter>Security</Filter>
</ClCompile>
Expand Down Expand Up @@ -730,6 +733,9 @@
<ClInclude Include="..\..\..\security\oc_sp_internal.h">
<Filter>Security</Filter>
</ClInclude>
<ClInclude Include="..\..\..\security\oc_ace_internal.h">
<Filter>Security</Filter>
</ClInclude>
<ClInclude Include="..\..\..\security\oc_acl_internal.h">
<Filter>Security</Filter>
</ClInclude>
Expand Down
Loading
Loading