Skip to content

Commit

Permalink
Ut tc apply enctests (#21)
Browse files Browse the repository at this point in the history
* Rebasing to collab_main, Bug Fixes, additional tests

* Added Dat files, and minor ut fixes - still faulting atm

* UT/EVT refactoring

* Fixing CMake & Refactoring - broken validation

* Fixing another CMake

* Bug Fixes, UT Fixed with new layout, TODO: Find FECF Issue

* WIP

* Updates to error codes and unit tests

* WIP - AES-GCM test vector working

* WIP - improving NIST KAT

* WIP - Troubleshooting commit

* Revert "WIP - Troubleshooting commit"

This reverts commit e24dac9.

* Initial UT/Validation tests working

* WIP UT modify ek_ring from hex string

* Key Functionality

* Test Cleanup

* Adding more NIST AES-GCM 256 encryption test vectors

* Added NIST authentication tag test

* WIP: FECF Issues

* Fixed IV_SIZE, FECF_CALC, Added DEC Tests, TODO: AUT Dec + Test, more FECF Fix, MAC Test, Remove Dat Files

* Fixed Unit Tests, Cleaning up Tests, Renamed et_xxx to et_dt_xxx, TODO: Finish removing dat files, finish validation tests

* renamed c/h files

* WIP: AUTH Decryption

* WIP: All Tests working but MAC Only AUTH Apply/Process

* Encryption and decryption tests completed

* Cleanup for CR 12/6

* Revert "Cleanup for CR 12/6"

This reverts commit 50506d6.

* Cleanup after CR for merge

Co-authored-by: Robert Brown <[email protected]>
  • Loading branch information
dccutrig and rjbrown6 authored Dec 6, 2021
1 parent 0239cb5 commit 47e3e56
Show file tree
Hide file tree
Showing 21 changed files with 1,983 additions and 163 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build
venv
*.dat
.vscode
__pycache__

#CMake.gitignore
CMakeLists.txt.user
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")

OPTION(DEBUG "Debug" OFF) # Disabled by default, enable with: -DDEBUG=ON
OPTION(MYSQL "Mysql" OFF) # Disabled by default, enable with: -DMYSQL=ON
OPTION(ENCTEST "Encryption-Tests" OFF) # Disabled by default, enable with: -DENCTEST=ON

IF(DEBUG)
ADD_DEFINITIONS(-DDEBUG -DOCF_DEBUG -DFECF_DEBUG -DSA_DEBUG -DPDU_DEBUG -DCCSDS_DEBUG -DTC_DEBUG -DMAC_DEBUG -DTM_DEBUG)
add_compile_options(-ggdb)
ENDIF(DEBUG)

IF(ENCTEST)
ADD_DEFINITIONS(-DENCTEST)
ENDIF(ENCTEST)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
enable_testing()
Expand Down
14 changes: 10 additions & 4 deletions fsw/crypto_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@

set(PROJECT_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})

add_test(NAME Process_Security
COMMAND ${PROJECT_BINARY_DIR}/bin/process_security tc ${PROJECT_TEST_DIR}/data/tc4.1.dat
WORKING_DIRECTORY ${PROJECT_TEST_DIR})
# add_test(NAME Process_Security
# COMMAND ${PROJECT_BINARY_DIR}/bin/process_security tc ${PROJECT_TEST_DIR}/data/tc4.1.dat
# WORKING_DIRECTORY ${PROJECT_TEST_DIR})

add_test(NAME UT_TC_APPLY
COMMAND ${PROJECT_BINARY_DIR}/bin/ut_tc_apply
WORKING_DIRECTORY ${PROJECT_TEST_DIR})
WORKING_DIRECTORY ${PROJECT_TEST_DIR})

if(${ENCTEST})
add_test(NAME ET_DT_VALIDATION
COMMAND ${PROJECT_BINARY_DIR}/bin/et_dt_validation
WORKING_DIRECTORY ${PROJECT_TEST_DIR})
endif()
1 change: 0 additions & 1 deletion fsw/crypto_tests/data/raw_tc_sdls_ping.txt

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion fsw/crypto_tests/data/raw_tc_sdls_ping_bad_scid.txt

This file was deleted.

Empty file.
1 change: 0 additions & 1 deletion fsw/crypto_tests/data/raw_tc_sdls_ping_bad_vcid.txt

This file was deleted.

30 changes: 21 additions & 9 deletions fsw/crypto_util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,40 @@
# NASA IV&V
# [email protected]



include_directories(include)
include_directories(../crypto/public_inc)
include_directories(../crypto/public_inc)

if(ENCTEST)
find_package (Python3 REQUIRED COMPONENTS Interpreter Development)
endif(ENCTEST)

aux_source_directory(src UTIL_SRC_FILES)
aux_source_directory(app APP_SRC_FILES)
aux_source_directory(app APP_SRC_FILES)

file( GLOB SOURCE_FILES app/*.c )
foreach(SOURCE_PATH ${SOURCE_FILES})

get_filename_component(EXECUTABLE_NAME ${SOURCE_PATH} NAME_WE)

add_executable(${EXECUTABLE_NAME} ${SOURCE_PATH})
if((NOT ${ENCTEST}) AND ${EXECUTABLE_NAME} STREQUAL et_dt_validation)
continue()
else()
add_executable(${EXECUTABLE_NAME} ${SOURCE_PATH})
target_sources(${EXECUTABLE_NAME} PRIVATE src/shared_util.c)
target_link_libraries(${EXECUTABLE_NAME} LINK_PUBLIC Crypto)
endif()

target_sources(${EXECUTABLE_NAME} PRIVATE src/shared_util.c)
target_link_libraries(${EXECUTABLE_NAME} LINK_PUBLIC Crypto)
if(${ENCTEST} AND ${EXECUTABLE_NAME} STREQUAL et_dt_validation)
target_link_libraries(${EXECUTABLE_NAME} PUBLIC ${Python3_LIBRARIES})
target_include_directories(${EXECUTABLE_NAME} PUBLIC ${Python3_INCLUDE_DIRS})
endif()

add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${EXECUTABLE_NAME}> ${PROJECT_BINARY_DIR}/bin/${EXECUTABLE_NAME}
COMMAND ${CMAKE_COMMAND} -E remove $<TARGET_FILE:${EXECUTABLE_NAME}>
COMMENT "Created ${PROJECT_BINARY_DIR}/bin/${EXECUTABLE_NAME}"
)
endforeach(SOURCE_PATH ${SOURCE_FILES})

target_include_directories (Crypto PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(SOURCE_PATH ${SOURCE_FILES})

target_include_directories (Crypto PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Loading

0 comments on commit 47e3e56

Please sign in to comment.