Fix compilation errors when building sign_with_k test function

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2020-12-07 07:01:22 -05:00
parent bef771bf50
commit 3e80b1a657
4 changed files with 8 additions and 9 deletions

View File

@ -115,7 +115,7 @@ int uECC_sign(const uint8_t *p_private_key, const uint8_t *p_message_hash,
* Refer to uECC_sign() function for real applications.
*/
int uECC_sign_with_k(const uint8_t *private_key, const uint8_t *message_hash,
unsigned int hash_size, uECC_word_t *k, uint8_t *signature)
unsigned int hash_size, uECC_word_t *k, uint8_t *signature);
#endif
/**

View File

@ -97,7 +97,7 @@ baremetal_build_gcc()
if [ $check -ne 0 ]; then
CFLAGS_BAREMETAL="$CFLAGS_BAREMETAL -Werror"
fi
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG -DENABLE_TESTS"
echo "GCC version: $gcc_ver"
echo "Flags: $CFLAGS_BAREMETAL"
@ -132,7 +132,7 @@ baremetal_build_armc5()
fi
CFLAGS_BAREMETAL="$OPTIM_CFLAGS_ARMC5 --thumb --cpu Cortex-m0plus"
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG -DENABLE_TESTS"
WARNING_CFLAGS="--strict --c99"
if [ $check -ne 0 ]; then
@ -175,7 +175,7 @@ baremetal_build_armc6()
if [ $check -ne 0 ]; then
CFLAGS_BAREMETAL="$CFLAGS_BAREMETAL -Werror"
fi
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG"
CFLAGS="$CFLAGS_BAREMETAL $CFLAGS_CONFIG -DENABLE_TESTS"
echo "ARMC6 version: $armc6_ver"
echo "Flags: $CFLAGS_BAREMETAL"
@ -204,7 +204,7 @@ baremetal_ram_build() {
echo "Cleanup..."
make clean
CFLAGS="$BASE_CFLAGS $CFLAGS_CONFIG $CFLAGS_USER_CONFIG"
CFLAGS="$BASE_CFLAGS $CFLAGS_CONFIG $CFLAGS_USER_CONFIG -DENABLE_TESTS"
if [ "$build_only" -eq 1 ]; then
CFLAGS="$CFLAGS -Werror"
fi

View File

@ -1765,7 +1765,7 @@ component_test_default_tinycrypt_without_legacy_ecc () {
scripts/config.pl unset MBEDTLS_ECP_DP_SECP192K1_ENABLED
scripts/config.pl unset MBEDTLS_ECP_DP_SECP224K1_ENABLED
scripts/config.pl unset MBEDTLS_ECP_DP_SECP256K1_ENABLED
make CC=gcc CFLAGS='-Werror -Wall -Wextra'
make CC=gcc CFLAGS='-Werror -Wall -Wextra -DENABLE_TESTS'
msg "test: default config with tinycrypt enabled and legacy ECC disabled"
make test
@ -1813,7 +1813,7 @@ component_test_hardcoded_pk_type () {
scripts/config.pl unset MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
scripts/config.pl unset MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
scripts/config.pl unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
make CFLAGS='-Werror -O1'
make CFLAGS='-Werror -O1 -DENABLE_TESTS'
msg "test: default config + single PK type harcoded (tinycrypt)"
make test

View File

@ -60,7 +60,6 @@ void test_ecdsa()
/* BEGIN_CASE depends_on:MBEDTLS_USE_TINYCRYPT */
void ecdh_primitive_vector( data_t * qx_str, data_t * qy_str,
data_t * d_str, data_t * z_str )
{
uint8_t public[2*NUM_ECC_BYTES] = {0};
uint8_t private[NUM_ECC_BYTES] = {0};
@ -138,7 +137,7 @@ void ecdsa_sig( data_t * message, data_t * d_str, data_t * k_str,
k[i] = k_str->x[NUM_ECC_BYTES - i - 1];
}
TEST_ASSERT( mbedtls_sha256_ret( message->x, message->len, hash, 0 ) == 0 );
TEST_ASSERT( uECC_sign_with_k( d_str->x, hash, sizeof(hash), k,
TEST_ASSERT( uECC_sign_with_k( d_str->x, hash, sizeof(hash), (uECC_word_t*) k,
sig_bytes ) == UECC_SUCCESS );
TEST_ASSERT( memcmp( sig_bytes, r_str->x, NUM_ECC_BYTES) == 0 );
TEST_ASSERT( memcmp( sig_bytes + NUM_ECC_BYTES, s_str->x, NUM_ECC_BYTES ) == 0 );