-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#197] Added aes_gcm_siv unit test files (utest throwing errors, in p…
…rogress)
- Loading branch information
1 parent
a29dd8f
commit 15c0364
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef CRYPTOLIB_UT_AES_GCM_SIV_H | ||
#define CRYPTOLIB_UT_AES_GCM_SIV_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
{ | ||
#endif | ||
|
||
#include "crypto.h" | ||
#include "shared_util.h" | ||
#include <stdio.h> | ||
#include "cryptography_interface.h" | ||
|
||
#ifdef __cplusplus | ||
} /* Close scope of 'extern "C"' declaration which encloses file. */ | ||
#endif | ||
|
||
#endif //CRYPTOLIB_UT_AES_GCM_SIV_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// /* Copyright (C) 2009 - 2022 National Aeronautics and Space Administration. | ||
// All Foreign Rights are Reserved to the U.S. Government. | ||
|
||
// This software is provided "as is" without any warranty of any kind, either expressed, implied, or statutory, | ||
// including, but not limited to, any warranty that the software will conform to specifications, any implied warranties | ||
// of merchantability, fitness for a particular purpose, and freedom from infringement, and any warranty that the | ||
// documentation will conform to the program, or any warranty that the software will be error free. | ||
|
||
// In no event shall NASA be liable for any damages, including, but not limited to direct, indirect, special or | ||
// consequential damages, arising out of, resulting from, or in any way connected with the software or its | ||
// documentation, whether or not based upon warranty, contract, tort or otherwise, and whether or not loss was sustained | ||
// from, or arose out of the results of, or use of, the software, documentation or services provided hereunder. | ||
|
||
// ITC Team | ||
// NASA IV&V | ||
// [email protected] | ||
// */ | ||
|
||
#include "ut_aes_gcm_siv.h" | ||
#include "crypto.h" | ||
#include "crypto_error.h" | ||
#include "sa_interface.h" | ||
#include "utest.h" | ||
|
||
/** | ||
* @brief Unit Test: Crypto ECS Get Algorithm response for AES-GCM-SIV | ||
**/ | ||
UTEST(AES_GCM_SIV, GET_ECS_ALGO_SIV) | ||
{ | ||
remove("sa_save_file.bin"); | ||
int32_t libgcrypt_algo = -1; | ||
int8_t crypto_algo = CRYPTO_CIPHER_AES256_GCM_SIV; | ||
|
||
// Convert CRYPTOAES enum to GCRY_CIPHER_AES256 | ||
//libgcrypt_algo = cryptography_if->cryptography_get_ecs_algo(crypto_algo); | ||
//ASSERT_EQ(libgcrypt_algo, GCRY_CIPHER_AES256); | ||
|
||
libgcrypt_algo = cryptography_if->cryptography_get_ecs_algo(crypto_algo); | ||
ASSERT_EQ(libgcrypt_algo, 9); | ||
} | ||
|
||
/** | ||
* @brief Unit Test: Crypto ECS Get Algorithm key length response for AES-GCM-SIV | ||
**/ | ||
UTEST(AES_GCM_SIV, GET_ECS_ALGO_KEY_LEN_SIV) | ||
{ | ||
remove("sa_save_file.bin"); | ||
int32_t algo_keylen = -1; | ||
uint8_t crypto_algo = CRYPTO_CIPHER_AES256_GCM_SIV; | ||
algo_keylen = Crypto_Get_ACS_Algo_Keylen(crypto_algo); | ||
ASSERT_EQ(algo_keylen, 32); | ||
} |