test/crypto: Update ECC DH test case

The ECC DH test case was updated in TinyCrypt 0.2.6.

This patch adds two helper arrays for the Monte Carlo routine.

Change-Id: If28292512b351feffc3fe470942cd97b18851a57
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2017-03-11 00:06:10 -06:00 committed by Anas Nashif
commit 3692aed6a8

View file

@ -356,6 +356,8 @@ int cavp_pkv(int verbose)
int montecarlo_ecdh(uint32_t num, int verbose)
{
EccPoint l_Q1, l_Q2; /* public keys */
uint32_t l_random1[2 * NUM_ECC_DIGITS];
uint32_t l_random2[2 * NUM_ECC_DIGITS];
uint32_t l_secret1[NUM_ECC_DIGITS];
uint32_t l_secret2[NUM_ECC_DIGITS];
@ -365,11 +367,11 @@ int montecarlo_ecdh(uint32_t num, int verbose)
int rc = TC_FAIL;
for (uint32_t i = 0; i < num; ++i) {
random_bytes(l_secret1, NUM_ECC_DIGITS);
random_bytes(l_secret2, NUM_ECC_DIGITS);
random_bytes(l_random1, 2 * NUM_ECC_DIGITS);
random_bytes(l_random2, 2 * NUM_ECC_DIGITS);
ecc_make_key(&l_Q1, l_secret1, l_secret1);
ecc_make_key(&l_Q2, l_secret2, l_secret2);
ecc_make_key(&l_Q1, l_secret1, l_random1);
ecc_make_key(&l_Q2, l_secret2, l_random2);
if (!ecdh_shared_secret(l_shared1, &l_Q1, l_secret2)) {
TC_PRINT("shared_secret() failed (1)\n");