tests/tinycrypt: Fix dead code issue (1st)

This commit fixes the dead code issue reported by Coverity.

Coverity-CID: 151975

Change-Id: I449341d1f540abe149e8ad9197a64d52cd5722cd
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2016-11-16 16:20:13 -06:00 committed by Anas Nashif
commit 7ac025ea14

View file

@ -68,6 +68,7 @@ int sign_vectors(TCSha256State_t hash, char **d_vec, char **k_vec,
int rc = TC_FAIL;
for (int i = 0; i < tests; i++) {
int hash_dwords;
/* use keygen test to generate+validate pubkey */
rc = keygen_vectors(&point, d_vec+i, qx_vec+i, qy_vec+i, 1,
@ -99,11 +100,10 @@ int sign_vectors(TCSha256State_t hash, char **d_vec, char **k_vec,
/* if digest larger than ECC scalar, drop the end
* if digest smaller than ECC scalar, zero-pad front
*/
int hash_dwords = TC_SHA256_DIGEST_SIZE / 4;
if (hash_dwords > NUM_ECC_DIGITS) {
hash_dwords = NUM_ECC_DIGITS;
}
/* Note: here it is assumed that:
* NUM_ECC_DIGITS * 4 == TC_SHA256_DIGEST_SIZE
*/
hash_dwords = TC_SHA256_DIGEST_SIZE / 4;
memset(dig32, 0, NUM_ECC_BYTES - 4 * hash_dwords);
ecc_bytes2native(dig32+(NUM_ECC_DIGITS - hash_dwords), digest);