tests: crypto: Do not use unitialized variable

The `z` vector was not initialized in the call to
uECC_vli_nativeToBytes(), resulting in undefined behavior.  Use the
properly initialized `exp_z` array instead.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
Leandro Pereira 2017-08-18 11:09:55 -07:00 committed by Anas Nashif
parent eb0dccdb94
commit dd740c164b
1 changed files with 1 additions and 1 deletions

View File

@ -94,7 +94,7 @@ int ecdh_vectors(char **qx_vec, char **qy_vec, char **d_vec, char **z_vec,
uint8_t private_bytes[NUM_ECC_BYTES]; uint8_t private_bytes[NUM_ECC_BYTES];
uECC_vli_nativeToBytes(private_bytes, NUM_ECC_BYTES, prv); uECC_vli_nativeToBytes(private_bytes, NUM_ECC_BYTES, prv);
uint8_t z_bytes[NUM_ECC_BYTES]; uint8_t z_bytes[NUM_ECC_BYTES];
uECC_vli_nativeToBytes(z_bytes, NUM_ECC_BYTES, z); uECC_vli_nativeToBytes(z_bytes, NUM_ECC_BYTES, exp_z);
rc = uECC_shared_secret(pub_bytes, private_bytes, z_bytes, curve); rc = uECC_shared_secret(pub_bytes, private_bytes, z_bytes, curve);