From bf22fab73b6a969d761c8f0f259e5fc67a806f83 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 20 Jan 2016 11:31:24 +0100 Subject: [PATCH] FIX: Coverity Scans complain about uninitialized usage of struct. Setting s->ODD and s->EVEN to zero should do the trick. --- armsrc/crypto1.c | 1 + client/cmdhfmfhard.c | 1 + client/nonce2key/crypto1.c | 1 + tools/mfkey/crypto1.c | 1 + tools/nonce2key/crypto1.c | 1 + 5 files changed, 5 insertions(+) diff --git a/armsrc/crypto1.c b/armsrc/crypto1.c index b218af19..a212ecc4 100644 --- a/armsrc/crypto1.c +++ b/armsrc/crypto1.c @@ -24,6 +24,7 @@ void crypto1_create(struct Crypto1State *s, uint64_t key) { // struct Crypto1State *s = malloc(sizeof(*s)); + s->odd = s->even = 0; int i; for(i = 47;s && i > 0; i -= 2) { diff --git a/client/cmdhfmfhard.c b/client/cmdhfmfhard.c index 95a6f8d7..e2d6da74 100644 --- a/client/cmdhfmfhard.c +++ b/client/cmdhfmfhard.c @@ -687,6 +687,7 @@ static void Check_for_FilterFlipProperties(void) static void simulate_MFplus_RNG(uint32_t test_cuid, uint64_t test_key, uint32_t *nt_enc, uint8_t *par_enc) { struct Crypto1State sim_cs; + sim_cs.odd = sim_cs.even = 0; // init cryptostate with key: for(int8_t i = 47; i > 0; i -= 2) { diff --git a/client/nonce2key/crypto1.c b/client/nonce2key/crypto1.c index f6779a18..e5a3fe73 100644 --- a/client/nonce2key/crypto1.c +++ b/client/nonce2key/crypto1.c @@ -23,6 +23,7 @@ struct Crypto1State * crypto1_create(uint64_t key) { struct Crypto1State *s = malloc(sizeof(*s)); + s->odd = s->even = 0; int i; for(i = 47;s && i > 0; i -= 2) { diff --git a/tools/mfkey/crypto1.c b/tools/mfkey/crypto1.c index d15a40e3..57a6c1df 100755 --- a/tools/mfkey/crypto1.c +++ b/tools/mfkey/crypto1.c @@ -23,6 +23,7 @@ struct Crypto1State * crypto1_create(uint64_t key) { struct Crypto1State *s = malloc(sizeof(*s)); + s->odd = s->even = 0; int i; for(i = 47;s && i > 0; i -= 2) { diff --git a/tools/nonce2key/crypto1.c b/tools/nonce2key/crypto1.c index d15a40e3..57a6c1df 100644 --- a/tools/nonce2key/crypto1.c +++ b/tools/nonce2key/crypto1.c @@ -23,6 +23,7 @@ struct Crypto1State * crypto1_create(uint64_t key) { struct Crypto1State *s = malloc(sizeof(*s)); + s->odd = s->even = 0; int i; for(i = 47;s && i > 0; i -= 2) { -- 2.39.5