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

[set_model][ca_traid_test]: Simplify the tool #1

Merged
merged 5 commits into from
Dec 28, 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
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,20 @@
nuttx_add_subdirectory()

nuttx_generate_kconfig(MENUDESC "Security")

# ##############################################################################
# Include Directory
# ##############################################################################

set(EXPORT_INCDIR ${CMAKE_CURRENT_LIST_DIR}/include)

# ##############################################################################
# Global FLAG
# ##############################################################################

if(TARGET nuttx)
set_property(
TARGET nuttx
APPEND
PROPERTY NUTTX_INCLUDE_DIRECTORIES ${EXPORT_INCDIR})
endif(TARGET nuttx)
23 changes: 23 additions & 0 deletions ca/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ##############################################################################
# frameworks/security/ca/CMakeList.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

nuttx_add_subdirectory()

nuttx_generate_kconfig(MENUDESC "Client applications")
71 changes: 71 additions & 0 deletions ca/alipay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ##############################################################################
# frameworks/security/ca/alipay/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_ALIPAY_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS alipay_ca APP_TARGETS ${CONFIG_CA_ALIPAY_TEST_PROGNAME}
EXPORT_FILES ../../include/alipay_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT alipay_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(alipay_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_alipay")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_ALIPAY_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_ALIPAY_TEST_PROGNAME}
SRCS
alipay_test.c
STACKSIZE
${CONFIG_CA_ALIPAY_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_ALIPAY_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_ALIPAY_TEST)

endif()
75 changes: 75 additions & 0 deletions ca/comsst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ##############################################################################
# frameworks/security/ca/comsst/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

# ##############################################################################
# Source files
# ##############################################################################

if(CONFIG_CA_COMSST_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS comsst_ca APP_TARGETS ${CONFIG_CA_COMSST_TEST_PROGNAME}
EXPORT_FILES ../../include/comsst_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT comsst_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(comsst_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_comsst")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_COMSST_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_COMSST_TEST_PROGNAME}
SRCS
comsst_test.c
STACKSIZE
${CONFIG_CA_COMSST_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_COMSST_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_COMSST_TEST)

endif()
10 changes: 4 additions & 6 deletions ca/comsst/comsst_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ int main(int argc, FAR char* argv[])
uint32_t res;
clock_t start = clock();

if (argc == 5 && strcmp(argv[1], "check") != 0) {
if (argc == 5 && strcmp(argv[1], "check") == 0) {
res = is_comsst_data_exited(scope, name, is_deletable);
if (res == 0) {
printf("item is exited.\n");
} else if (res == 0xffff0008) {
printf("item is not exited.\n");
printf("item is notexisted.\n");
} else {
printf("item check fail.\n");
printf("item isexisted\n");
}
} else if (argc == 5 && strcmp(argv[1], "delete") == 0) {
if (comsst_data_delete(scope, name, is_deletable) == 0) {
Expand Down Expand Up @@ -105,7 +103,7 @@ int main(int argc, FAR char* argv[])
if (res == 0) {
printf("item verify successfully.\n");
} else if (res == 0xffff0008) {
printf("item is not exited.\n");
printf("item is notexisted.\n");
} else {
printf("item verify failed.\n");
}
Expand Down
52 changes: 52 additions & 0 deletions ca/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ##############################################################################
# frameworks/security/ca/hello_world/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_HELLO_WORLD)

# ############################################################################
# Flags always set
# ############################################################################

set(CFLAGS)
list(APPEND CFLAGS -DBINARY_PREFIX="ca_hello_world")

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()

nuttx_add_application(
NAME
${CONFIG_CA_HELLO_WORLD_PROGNAME}
SRCS
hello_world_ns.c
STACKSIZE
${CONFIG_CA_HELLO_WORLD_STACKSIZE}
PRIORITY
${CONFIG_CA_HELLO_WORLD_PRIORITY}
COMPILE_FLAGS
${CFLAGS})

endif(CONFIG_CA_HELLO_WORLD)
71 changes: 71 additions & 0 deletions ca/pin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ##############################################################################
# frameworks/security/ca/pin/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

if(CONFIG_CA_PIN_API)

# vela CMake build process
nuttx_add_prebuilt(
BIN_TARGETS pin_ca APP_TARGETS ${CONFIG_CA_PIN_TEST_PROGNAME} EXPORT_FILES
../../include/pin_ca_api.h)

nuttx_library_ifndef(SKIP_PREBUILT pin_ca)

# ############################################################################
# Source files
# ############################################################################

nuttx_sources(pin_ca_api.c)

# ############################################################################
# Flags always set
# ############################################################################

if(CONFIG_DEBUG_INFO)
list(APPEND CFLAGS -DDEBUGLEVEL=3)
elseif(CONFIG_DEBUG_WARN)
list(APPEND CFLAGS -DDEBUGLEVEL=2)
elseif(CONFIG_DEBUG_ERROR)
list(APPEND CFLAGS -DDEBUGLEVEL=1)
else()
list(APPEND CFLAGS -DDEBUGLEVEL=1)
endif()
list(APPEND CFLAGS -DBINARY_PREFIX="ca_pin")

nuttx_compile_options(${CFLAGS})

# ############################################################################
# Application add
# ############################################################################

if(CONFIG_CA_PIN_TEST)
nuttx_add_application(
NAME
${CONFIG_CA_PIN_TEST_PROGNAME}
SRCS
pin_test.c
STACKSIZE
${CONFIG_CA_PIN_TEST_STACKSIZE}
PRIORITY
${CONFIG_CA_PIN_TEST_PRIORITY}
COMPILE_FLAGS
${CFLAGS})
endif(CONFIG_CA_PIN_TEST)

endif()
Loading
Loading