Skip to content

Commit

Permalink
Merge pull request nasa#291 from nasa#202
Browse files Browse the repository at this point in the history
[nasa#202] TC commanding and SSP telemetry
  • Loading branch information
jlucas9 authored Apr 30, 2024
2 parents 2a246c6 + 0333916 commit dc18099
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 41 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
BUILDTYPE ?= debug
INSTALLPREFIX ?= exe
FSWBUILDDIR ?= $(CURDIR)/fsw/build
GSWBUILDDIR ?= $(CURDIR)/gsw/build
SIMBUILDDIR ?= $(CURDIR)/sims/build

export CFS_APP_PATH = ../components
Expand Down Expand Up @@ -45,6 +46,11 @@ all:
$(MAKE) sim
$(MAKE) gsw

build-cryptolib:
mkdir -p $(GSWBUILDDIR)
cd $(GSWBUILDDIR) && cmake $(PREP_OPTS) -DSUPPORT=1 ../../components/cryptolib
$(MAKE) --no-print-directory -C $(GSWBUILDDIR)

build-fsw:
mkdir -p $(FSWBUILDDIR)
cd $(FSWBUILDDIR) && cmake $(PREP_OPTS) ../cfe
Expand Down Expand Up @@ -72,6 +78,7 @@ clean-sim:
rm -rf sims/build

clean-gsw:
rm -rf gsw/build
rm -rf gsw/cosmos/build
rm -rf /tmp/nos3

Expand All @@ -85,6 +92,7 @@ fsw:
./scripts/docker_build_fsw.sh

gsw:
./scripts/docker_build_cryptolib.sh
./cfg/build/gsw_build.sh

launch:
Expand Down
2 changes: 1 addition & 1 deletion cfg/nos3_defs/cpu1_cfe_es_startup.scr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CFE_LIB, crypto, Crypto_SC_Init, CRYPTO, 0, 0, 0x0, 0;
CFE_LIB, hwlib, hwlib_Init, HW_LIB, 0, 0, 0x0, 0;
CFE_LIB, io_lib, IO_LibInit, IO_LIB, 0, 0, 0x0, 0;

Expand Down Expand Up @@ -33,7 +34,6 @@ CFE_APP, generic_st, ST_AppMain, ST,
CFE_APP, syn, SYN_AppMain, SYN, 72, 32768, 0x0, 0;

CFE_LIB, cfs_lib, CFS_LibInit, CFS_LIB, 0, 0, 0x0, 0;
CFE_LIB, crypto, Crypto_TC_Init, CRYPTO, 0, 0, 0x0, 0;
CFE_APP, cs, CS_AppMain, CS, 55, 16384, 0x0, 0;
CFE_APP, hk, HK_AppMain, HK, 63, 16384, 0x0, 0;
CFE_APP, hs, HS_AppMain, HS, 56, 16384, 0x0, 0;
Expand Down
2 changes: 1 addition & 1 deletion cfg/nos3_defs/targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ list(APPEND MISSION_GLOBAL_APPLIST
#
# Libraries
#
#cryptolib
cryptolib
hwlib
io_lib
#
Expand Down
4 changes: 2 additions & 2 deletions cfg/nos3_defs/toolchain-amd64-linux-gnu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ add_definitions(-DBYTE_ORDER_LE)
add_definitions(-D_LINUX_OS_)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(CI_TRANSPORT udp)
set(TO_TRANSPORT udp)
set(CI_TRANSPORT udp_tf)
set(TO_TRANSPORT udp) # Note udp_tf used for Transfer Frames required for CryptoLib
63 changes: 35 additions & 28 deletions cfg/sims/nos3-simulator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
<type>SAMPLE_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4242</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
</data-provider>
</hardware-model>
Expand All @@ -158,8 +158,8 @@
<type>GPS42SOCKET</type>
<hostname>fortytwo</hostname>
<port>4245</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<GPS>0</GPS>
<leap-seconds>37</leap-seconds>
Expand Down Expand Up @@ -218,8 +218,8 @@
<type>GENERIC_EPS_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4283</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
</data-provider>
<physical>
Expand Down Expand Up @@ -299,8 +299,8 @@
<hostname>fortytwo</hostname>
<port>4277</port>
<command-port>4278</command-port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<reactionwheel>0</reactionwheel>
</data-provider>
Expand All @@ -325,8 +325,8 @@
<hostname>fortytwo</hostname>
<port>4377</port>
<command-port>4378</command-port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<reactionwheel>1</reactionwheel>
</data-provider>
Expand All @@ -351,8 +351,8 @@
<hostname>fortytwo</hostname>
<port>4477</port>
<command-port>4478</command-port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<reactionwheel>2</reactionwheel>
</data-provider>
Expand All @@ -376,8 +376,8 @@
<type>GENERIC_CSS_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4227</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<42-css-scale-factor>1.0</42-css-scale-factor>
</data-provider>
Expand Down Expand Up @@ -405,8 +405,8 @@
<type>GENERIC_TORQUER_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<command-port>4279</command-port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
</data-provider>
<params>
<num-mtbs>3</num-mtbs>
Expand Down Expand Up @@ -437,8 +437,8 @@
<type>TRUTH42PROVIDER</type>
<hostname>fortytwo</hostname>
<port>9999</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<orbit>0</orbit>
<spacecraft>0</spacecraft>
</data-provider>
Expand All @@ -462,8 +462,8 @@
<type>GENERIC_FSS_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4281</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
</data-provider>
</hardware-model>
Expand Down Expand Up @@ -495,12 +495,19 @@
</connection>
<connection>
<name>gsw</name>
<ip>cosmos</ip>
<!-- Direct to ground -->
<!--
<ip>cosmos</ip>
<cmd-port>6010</cmd-port>
<tlm-port>6011</tlm-port>
<!-- CryptoLib Standalone -->
-->
<!-- CryptoLib TC Only -->
<ip>cosmos</ip>
<cmd-port>8010</cmd-port>
<tlm-port>6011</tlm-port>
<!-- CryptoLib TC & TM -->
<!--
<ip>cryptolib</ip>
<cmd-port>8010</cmd-port>
<tlm-port>8011</tlm-port>
-->
Expand Down Expand Up @@ -540,8 +547,8 @@
<type>GENERIC_IMU_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4280</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
</data-provider>
</hardware-model>
Expand All @@ -567,8 +574,8 @@
<type>GENERIC_MAG_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4234</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
</data-provider>
</hardware-model>
Expand All @@ -594,8 +601,8 @@
<type>GENERIC_STAR_TRACKER_42_PROVIDER</type>
<hostname>fortytwo</hostname>
<port>4282</port>
<max-connection-attempts>20</max-connection-attempts>
<retry-wait-seconds>5</retry-wait-seconds>
<max-connection-attempts>30</max-connection-attempts>
<retry-wait-seconds>1</retry-wait-seconds>
<spacecraft>0</spacecraft>
<star-tracker>0</star-tracker>
</data-provider>
Expand Down
2 changes: 1 addition & 1 deletion components/cryptolib
Submodule cryptolib updated 71 files
+68 −3 .github/workflows/build.yml
+1 −0 .gitignore
+8 −3 CMakeLists.txt
+5 −3 README.md
+ doc/CryptoLib_Indv_CLA.pdf
+88 −9 include/crypto.h
+23 −9 include/crypto_config.h
+56 −16 include/crypto_config_structs.h
+3 −0 include/crypto_error.h
+1 −1 include/crypto_print.h
+107 −24 include/crypto_structs.h
+1 −0 include/cryptography_interface.h
+1 −0 include/mc_interface.h
+20 −0 src/CMakeLists.txt
+208 −90 src/core/crypto.c
+1,579 −18 src/core/crypto_aos.c
+95 −49 src/core/crypto_config.c
+41 −67 src/core/crypto_error.c
+2 −2 src/core/crypto_print.c
+1,562 −936 src/core/crypto_tc.c
+1,140 −636 src/core/crypto_tm.c
+35 −30 src/crypto/kmc/base64url.c
+1 −4 src/crypto/kmc_stub/cryptography_interface_kmc.stub.c
+88 −48 src/crypto/libgcrypt/cryptography_interface_libgcrypt.template.c
+1 −4 src/crypto/libgcrypt_stub/cryptography_interface_libgcrypt.stub.c
+740 −0 src/crypto/wolfssl/cryptography_interface_wolfssl.template.c
+20 −0 src/crypto/wolfssl_stub/cryptography_interface_wolfssl.stub.c
+63 −0 src/mc/disabled/mc_interface_disabled.template.c
+29 −0 src/mc/disabled_stub/mc_interface_disabled_stub.template.c
+269 −90 src/sa/internal/sa_interface_inmemory.template.c
+2 −2 src/sa/mariadb/sa_interface_mariadb.template.c
+38 −7 support/Dockerfile
+3 −3 support/scripts/build_internal.sh
+4 −4 support/scripts/build_kmc.sh
+3 −3 support/scripts/build_minimal.sh
+12 −0 support/scripts/build_rhel.sh
+3 −3 support/scripts/build_support.sh
+12 −0 support/scripts/build_wolf.sh
+13 −0 support/scripts/docker_build.sh
+13 −0 support/scripts/docker_debug.sh
+1 −1 support/scripts/env.sh
+2 −3 support/scripts/internal_docker_build.sh
+2 −3 support/scripts/kmc_docker_build.sh
+21 −0 support/scripts/wolf_docker_build.sh
+460 −254 support/standalone/standalone.c
+26 −4 support/standalone/standalone.h
+6 −2 test/CMakeLists.txt
+1 −1 test/encryption_test.py
+3 −3 test/include/ut_aos_apply.h
+12 −34 test/include/ut_aos_process.h
+26 −26 test/kmc/ut_kmc_crypto.c
+18 −18 test/kmc/ut_kmc_crypto_auth_only.c
+38 −38 test/kmc/ut_kmc_crypto_cam.c
+20 −20 test/kmc/ut_kmc_crypto_with_mtls_sadb.c
+8 −8 test/kmc/ut_mariadb.c
+74 −74 test/kmc/ut_tc_kmc.c
+24 −24 test/performance/pt_auth_as.c
+24 −24 test/performance/pt_auth_enc_as.c
+24 −24 test/performance/pt_auth_enc_ps.c
+100 −84 test/unit/et_dt_validation.c
+597 −0 test/unit/ut_aos_apply.c
+789 −0 test/unit/ut_aos_process.c
+13 −12 test/unit/ut_crypto.c
+50 −63 test/unit/ut_crypto_config.c
+2 −2 test/unit/ut_mysql_m_tls_connection.c
+2 −2 test/unit/ut_mysql_tls_connection.c
+20 −20 test/unit/ut_sadb_err_cases_kmc_crypto.c
+43 −43 test/unit/ut_tc_apply.c
+23 −116 test/unit/ut_tc_process.c
+264 −284 test/unit/ut_tm_apply.c
+41 −20 test/unit/ut_tm_process.c
2 changes: 1 addition & 1 deletion fsw/apps/ci
31 changes: 31 additions & 0 deletions scripts/docker_build_cryptolib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -i
#
# Convenience script for NOS3 development
# Use with the Dockerfile in the deployment repository
# https://github.com/nasa-itc/deployment
#

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/env.sh

# Check that local NOS3 directory exists
if [ ! -d $USER_NOS3_DIR ]; then
echo ""
echo " Need to run make prep first!"
echo ""
exit 1
fi

# Check that configure build directory exists
if [ ! -d $BASE_DIR/cfg/build ]; then
echo ""
echo " Need to run make config first!"
echo ""
exit 1
fi

# Make ground software build directory
mkdir -p $BASE_DIR/gsw/build

# Build
$DFLAGS_CPUS -v $BASE_DIR:$BASE_DIR --name "nos_build_cryptolib" -w $BASE_DIR $DBOX make -j$NUM_CPUS build-cryptolib
7 changes: 4 additions & 3 deletions scripts/docker_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ do
# Debugging
# Replace `--tab` with `--window-with-profile=KeepOpen` once you've created this gnome-terminal profile manually

echo $SC_NUM " - CryptoLib..."
gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_cryptolib" --network=$SC_NETNAME --network-alias=cryptolib -w $BASE_DIR/gsw/build $DBOX ./support/standalone
echo ""

echo $SC_NUM " - Simulators..."
cd $SIM_BIN
gnome-terminal --tab --title=$SC_NUM" - NOS Engine Server" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_nos_engine_server" -h nos_engine_server --network=$SC_NETNAME -w $SIM_BIN $DBOX /usr/bin/nos_engine_server_standalone -f $SIM_BIN/nos_engine_server_config.json
Expand All @@ -126,9 +130,6 @@ do
gnome-terminal --tab --title=$SC_NUM" - Sample Sim" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_sample_sim" --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE sample_sim
gnome-terminal --tab --title=$SC_NUM" - StarTrk Sim" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_startrk_sim" --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_star_tracker_sim
gnome-terminal --tab --title=$SC_NUM" - Torquer Sim" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_torquer_sim" --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_torquer_sim

# Note: Can keep open if desired after a new gnome-profile is manually created
#gnome-terminal --window-with-profile=KeepOpen --tab --title=$SC_NUM" - Sample Sim" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_sample_sim" --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE sample_sim
echo ""
done

Expand Down
2 changes: 1 addition & 1 deletion scripts/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ OPENC3_PATH=$OPENC3_DIR/openc3.sh
DNETWORK="docker network"
#fi

DBOX="ivvitc/nos3-64:20240306"
DBOX="ivvitc/nos3-64:dev"

# Debugging
#echo "Script directory = " $SCRIPT_DIR
Expand Down

0 comments on commit dc18099

Please sign in to comment.