Skip to content

CryptoLib: Testing and Validation

Robert Brown edited this page Dec 2, 2021 · 16 revisions

Unit Tests

TC_APPLYSECURITY


HAPPY_PATH

This is the nominal test case. Optimal inputs are given, and CRYPTO_LIB_SUCCESS is expected from the final output of the TC_APPLY_SECURITY function

NO_CRYPTO_INIT

Testing to verify that CRYPTO_LIB_ERR_NO_INIT is returned when the Crypto_Init() function is not called before attempting to process any other inputs

BAD_SPACE_CRAFT_ID

Validates that proper response is given (CRYPTO_LIB_ERR_INVALID_SCID) when invalid space craft ID is passed as one of the parameters of a data input

BAD_VIRTUAL_CHANNEL_ID

Validates that proper response is given (CRYTPO_LIB_ERR_INVALID_VCID) when invalid virtual channel ID is passed as one of the parameters of a data input

AUTH_ENCRYPTION_TEST

Makes use of the Python3 Cryptodome module to verify that TC_APPLY_SECURITY properly utilizes LibGCrypt to produce the same results as an external third party software. This external Python program is internalized.

VALIDATION_TEST

Makes use if NIST vectors with known outputs to verify that TC_APPLYSECURITY and TC_PROCESSSECURITY generate the output that is expected via known output tests through the NIST standard, and referenced from the following page and document: https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES.

Test Vector 0: Standard 256-bit Key, 96 bit IV, 128 bit plain-text, MAC Length 120 bits

Test Vector 1: Standard 256-bit Key, 96 bit IV, 128 bit plain-text, MAC Length 120 bits

Test Vector 2: Standard 256-bit Key, 96 bit IV, 128 bit plain-text, MAC Length 120 bits

Test Vector 3: Standard 256-bit Key, 96 bit IV, 128 bit plain-text, MAC Length 120 bits

Test Vector 4: Standard 256-bit Key, 96 bit IV, 128 bit plain-text, MAC Length 120 bits

NULL_BUFFER

Verifies the proper OS_ERROR response when an invalid or NULL buffer is passed to the TC_APPLY_SECURITY. This should be verified and checked by external users to be sure this already does not happen, but it tested here to be sure it is handled in this location as well.

Clone this wiki locally