From c467cbacaf704095581387fdc409fe7bd6bb6932 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Thu, 26 Sep 2019 21:49:33 -0700 Subject: [PATCH 1/2] Add built tests to .gitignore --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index c960ccc..2032a6e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,14 @@ *.d *.exe *.a +tests/test_aes +tests/test_cbc_mode +tests/test_ccm_mode +tests/test_cmac_mode +tests/test_ctr_mode +tests/test_ctr_prng +tests/test_ecc_dh +tests/test_ecc_dsa +tests/test_hmac +tests/test_hmac_prng +tests/test_sha256 From 159d97a861dea716ee05dd5e6a61e05ed366440c Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 19 Nov 2019 14:07:46 -0800 Subject: [PATCH 2/2] Ensure that structs are platform independent Change unsigned int to uint32_t in places that we are assuming that they are 4 bytes. Signed-off-by: Flavio Ceolin --- lib/include/tinycrypt/aes.h | 2 +- lib/include/tinycrypt/ecc.h | 2 +- lib/include/tinycrypt/sha256.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/include/tinycrypt/aes.h b/lib/include/tinycrypt/aes.h index b612213..a2b6cc7 100644 --- a/lib/include/tinycrypt/aes.h +++ b/lib/include/tinycrypt/aes.h @@ -62,7 +62,7 @@ extern "C" { #define TC_AES_KEY_SIZE (Nb*Nk) typedef struct tc_aes_key_sched_struct { - unsigned int words[Nb*(Nr+1)]; + uint32_t words[Nb*(Nr+1)]; } *TCAesKeySched_t; /** diff --git a/lib/include/tinycrypt/ecc.h b/lib/include/tinycrypt/ecc.h index 8abc949..42287ea 100644 --- a/lib/include/tinycrypt/ecc.h +++ b/lib/include/tinycrypt/ecc.h @@ -91,7 +91,7 @@ typedef int16_t bitcount_t; /* defining data type for comparison result: */ typedef int8_t cmpresult_t; /* defining data type to store ECC coordinate/point in 32bits words: */ -typedef unsigned int uECC_word_t; +typedef uint32_t uECC_word_t; /* defining data type to store an ECC coordinate/point in 64bits words: */ typedef uint64_t uECC_dword_t; diff --git a/lib/include/tinycrypt/sha256.h b/lib/include/tinycrypt/sha256.h index af5e8ba..d4b6d78 100644 --- a/lib/include/tinycrypt/sha256.h +++ b/lib/include/tinycrypt/sha256.h @@ -69,7 +69,7 @@ extern "C" { #define TC_SHA256_STATE_BLOCKS (TC_SHA256_DIGEST_SIZE/4) struct tc_sha256_state_struct { - unsigned int iv[TC_SHA256_STATE_BLOCKS]; + uint32_t iv[TC_SHA256_STATE_BLOCKS]; uint64_t bits_hashed; uint8_t leftover[TC_SHA256_BLOCK_SIZE]; size_t leftover_offset;