Skip to content

Commit daa49af

Browse files
committed
fix clang-scan complaints
Signed-off-by: Stephan Mueller <smueller@chronox.de>
1 parent feb0e48 commit daa49af

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

drng/tests/cshake_drng_tester.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static int cshake_drng_selftest(struct lc_rng_ctx *cshake_ctx)
117117

118118
static int cshake_drng_test(void)
119119
{
120-
struct lc_rng_ctx *cshake_ctx_heap;
120+
struct lc_rng_ctx *cshake_ctx_heap = NULL;
121121
int ret;
122122
LC_CSHAKE256_DRNG_CTX_ON_STACK(cshake_ctx);
123123

drng/tests/kmac_drng_tester.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static int kmac_drng_selftest(struct lc_rng_ctx *kmac_ctx)
114114

115115
static int kmac_test(void)
116116
{
117-
struct lc_rng_ctx *kmac_ctx_heap;
117+
struct lc_rng_ctx *kmac_ctx_heap = NULL;
118118
int ret;
119119
LC_KMAC256_DRNG_CTX_ON_STACK(kmac_ctx);
120120

drng/tests/xdrbg128_tester.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int xdrbg128_drng_selftest(struct lc_rng_ctx *xdrbg128_ctx)
178178

179179
static int xdrbg128_drng_test(void)
180180
{
181-
struct lc_rng_ctx *xdrbg128_ctx_heap;
181+
struct lc_rng_ctx *xdrbg128_ctx_heap = NULL;
182182
int ret;
183183
LC_XDRBG128_DRNG_CTX_ON_STACK(xdrbg128_ctx);
184184

drng/tests/xdrbg256_tester.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static int xdrbg256_drng_selftest(struct lc_rng_ctx *xdrbg256_ctx)
200200

201201
static int xdrbg256_drng_test(void)
202202
{
203-
struct lc_rng_ctx *xdrbg256_ctx_heap;
203+
struct lc_rng_ctx *xdrbg256_ctx_heap = NULL;
204204
int ret;
205205
LC_XDRBG256_DRNG_CTX_ON_STACK(xdrbg256_ctx);
206206

kdf/tests/kdf_ctr_tester.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static int kdf_ctr_tester(void)
112112
"CTR KDF failed\n");
113113

114114
ret = lc_compare(act, exp, sizeof(exp), "CTR KDF SHA-256");
115+
if (ret)
116+
goto out;
115117

116118
CKINT_LOG(lc_rng_seed(ctr_kdf_rng, key, sizeof(key), NULL, 0),
117119
"Counter KDF extract stack failed\n");
@@ -120,13 +122,17 @@ static int kdf_ctr_tester(void)
120122
sizeof(act)),
121123
"Counter KDF expand stack failed\n");
122124

123-
ret += lc_compare(act, exp, sizeof(exp), "CTR KDF SHA-256 RNG");
125+
ret = lc_compare(act, exp, sizeof(exp), "CTR KDF SHA-256 RNG");
126+
if (ret)
127+
goto out;
124128

125129
CKINT_LOG(lc_kdf_ctr(lc_sha256, key2, sizeof(key2), label2,
126130
sizeof(label2), act2, sizeof(act2)),
127131
"CTR KDF failed\n");
128132

129-
ret += lc_compare(act2, exp2, sizeof(exp2), "CTR KDF SHA-256");
133+
ret = lc_compare(act2, exp2, sizeof(exp2), "CTR KDF SHA-256");
134+
if (ret)
135+
goto out;
130136

131137
CKINT_LOG(lc_kdf_ctr_rng_alloc(&ctr_kdf_rng_heap, lc_sha256),
132138
"Allocation of heap CTR KDF RNG context failed: %d\n", ret);
@@ -138,7 +144,7 @@ static int kdf_ctr_tester(void)
138144
act2, sizeof(act2)),
139145
"Counter KDF expand stack failed\n");
140146

141-
ret += lc_compare(act2, exp2, sizeof(exp2), "CTR KDF SHA-256 RNG");
147+
ret = lc_compare(act2, exp2, sizeof(exp2), "CTR KDF SHA-256 RNG");
142148

143149
out:
144150
lc_rng_zero_free(ctr_kdf_rng_heap);

0 commit comments

Comments
 (0)