summaryrefslogtreecommitdiffstats
path: root/test/drbg_cavs_test.c
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2019-01-08 16:27:27 +1000
committerPauli <paul.dale@oracle.com>2019-01-08 16:27:27 +1000
commit760e2d60e62511a6fb96f547f6730d05eb5f47ec (patch)
treee7b3f944577aa84628371a6e20b97988e2e4f802 /test/drbg_cavs_test.c
parentdf1f538f28c10f2954757164b17781040d2355ef (diff)
Fix CID 1434549: Unchecked return value in test/evp_test.c
5. check_return: Calling EVP_EncodeUpdate without checking return value (as is done elsewhere 4 out of 5 times). Fix CID 1371695, 1371698: Resource leak in test/evp_test.c - leaked_storage: Variable edata going out of scope leaks the storage it points to. - leaked_storage: Variable encode_ctx going out of scope leaks the storage it points to Fix CID 1430437, 1430426, 1430429 : Dereference before null check in test/drbg_cavs_test.c check_after_deref: Null-checking drbg suggests that it may be null, but it has already been dereferenced on all paths leading to the check Fix CID 1440765: Dereference before null check in test/ssltestlib.c check_after_deref: Null-checking ctx suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/7993)
Diffstat (limited to 'test/drbg_cavs_test.c')
-rw-r--r--test/drbg_cavs_test.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/test/drbg_cavs_test.c b/test/drbg_cavs_test.c
index 4bb65f0fd7..99d44725b1 100644
--- a/test/drbg_cavs_test.c
+++ b/test/drbg_cavs_test.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -106,12 +106,9 @@ static int single_kat_no_reseed(const struct drbg_kat *td)
failures++;
err:
- if (buff != NULL)
- OPENSSL_free(buff);
- if (drbg != NULL) {
- RAND_DRBG_uninstantiate(drbg);
- RAND_DRBG_free(drbg);
- }
+ OPENSSL_free(buff);
+ RAND_DRBG_uninstantiate(drbg);
+ RAND_DRBG_free(drbg);
return failures == 0;
}
@@ -176,12 +173,9 @@ static int single_kat_pr_false(const struct drbg_kat *td)
failures++;
err:
- if (buff != NULL)
- OPENSSL_free(buff);
- if (drbg != NULL) {
- RAND_DRBG_uninstantiate(drbg);
- RAND_DRBG_free(drbg);
- }
+ OPENSSL_free(buff);
+ RAND_DRBG_uninstantiate(drbg);
+ RAND_DRBG_free(drbg);
return failures == 0;
}
@@ -249,12 +243,9 @@ static int single_kat_pr_true(const struct drbg_kat *td)
failures++;
err:
- if (buff != NULL)
- OPENSSL_free(buff);
- if (drbg != NULL) {
- RAND_DRBG_uninstantiate(drbg);
- RAND_DRBG_free(drbg);
- }
+ OPENSSL_free(buff);
+ RAND_DRBG_uninstantiate(drbg);
+ RAND_DRBG_free(drbg);
return failures == 0;
}