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:
parent
ad96aa9a5d
commit
7ac025ea14
1 changed files with 5 additions and 5 deletions
|
@ -68,6 +68,7 @@ int sign_vectors(TCSha256State_t hash, char **d_vec, char **k_vec,
|
||||||
int rc = TC_FAIL;
|
int rc = TC_FAIL;
|
||||||
|
|
||||||
for (int i = 0; i < tests; i++) {
|
for (int i = 0; i < tests; i++) {
|
||||||
|
int hash_dwords;
|
||||||
|
|
||||||
/* use keygen test to generate+validate pubkey */
|
/* use keygen test to generate+validate pubkey */
|
||||||
rc = keygen_vectors(&point, d_vec+i, qx_vec+i, qy_vec+i, 1,
|
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 larger than ECC scalar, drop the end
|
||||||
* if digest smaller than ECC scalar, zero-pad front
|
* if digest smaller than ECC scalar, zero-pad front
|
||||||
*/
|
*/
|
||||||
int hash_dwords = TC_SHA256_DIGEST_SIZE / 4;
|
/* Note: here it is assumed that:
|
||||||
|
* NUM_ECC_DIGITS * 4 == TC_SHA256_DIGEST_SIZE
|
||||||
if (hash_dwords > NUM_ECC_DIGITS) {
|
*/
|
||||||
hash_dwords = NUM_ECC_DIGITS;
|
hash_dwords = TC_SHA256_DIGEST_SIZE / 4;
|
||||||
}
|
|
||||||
|
|
||||||
memset(dig32, 0, NUM_ECC_BYTES - 4 * hash_dwords);
|
memset(dig32, 0, NUM_ECC_BYTES - 4 * hash_dwords);
|
||||||
ecc_bytes2native(dig32+(NUM_ECC_DIGITS - hash_dwords), digest);
|
ecc_bytes2native(dig32+(NUM_ECC_DIGITS - hash_dwords), digest);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue