diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2022-01-25 10:35:35 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2022-01-25 10:35:35 +0900 |
commit | 99642f18ccbe45fb4cae55945af49f7884bcaceb (patch) | |
tree | dbb94830e0279287899ad8eefc70ced18515c036 | |
parent | 08f3e0909f8c4fefc2c020dca206037693282186 (diff) | |
download | libgcrypt-99642f18ccbe45fb4cae55945af49f7884bcaceb.tar.gz |
tests: Fix variable initialization for tests.
* tests/t-rsa-15.c (one_test_sexp): Initialize OUT_LEN.
* tests/t-rsa-pss.c (one_test_sexp): Initialize CTX and OUT_LEN.
Fix the if condition.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | tests/t-rsa-15.c | 2 | ||||
-rw-r--r-- | tests/t-rsa-pss.c | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/tests/t-rsa-15.c b/tests/t-rsa-15.c index 63495e9e..67dbd2cc 100644 --- a/tests/t-rsa-15.c +++ b/tests/t-rsa-15.c @@ -171,7 +171,7 @@ one_test_sexp (const char *n, const char *e, const char *d, gcry_sexp_t s_sig= NULL; gcry_sexp_t s_tmp, s_tmp2; unsigned char *out = NULL; - size_t out_len; + size_t out_len = 0; char *sig_string = NULL; if (verbose > 1) diff --git a/tests/t-rsa-pss.c b/tests/t-rsa-pss.c index 521d5734..fa8392e9 100644 --- a/tests/t-rsa-pss.c +++ b/tests/t-rsa-pss.c @@ -167,7 +167,7 @@ one_test_sexp (const char *n, const char *e, const char *d, void *buffer2 = NULL; void *buffer3 = NULL; size_t buflen, buflen2, buflen3; - gcry_ctx_t ctx; + gcry_ctx_t ctx = NULL; int md_algo; char *data_tmpl = NULL; size_t len_data_tmpl; @@ -177,7 +177,7 @@ one_test_sexp (const char *n, const char *e, const char *d, gcry_sexp_t s_sig= NULL; gcry_sexp_t s_tmp, s_tmp2; unsigned char *out = NULL; - size_t out_len; + size_t out_len = 0; char *sig_string = NULL; if (verbose > 1) @@ -275,9 +275,7 @@ one_test_sexp (const char *n, const char *e, const char *d, } /* SaltVal = 00 means no salt. */ - if (buflen2 == 1 && ((char *)buffer2)[0] == 0) - ctx = NULL; - else + if (!(buflen2 == 1 && ((char *)buffer2)[0] == 0)) { err = gcry_pk_random_override_new (&ctx, buffer2, buflen2); if (err) |