aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-29 17:05:51 -0700
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-29 17:16:51 -0700
commitf48dc74c3657e5564895d23adac35433b9898ff2 (patch)
tree3f7b9a0daecab98ebffcc0a444e182ecb187cf93
parent052b8792e27d3f80b978c51652d15522b7d79c39 (diff)
downloadcrda-f48dc74c3657e5564895d23adac35433b9898ff2.tar.gz
crda: use gcry_sexp_release() on crda_verify_db_signature()
This fixes 6 of 10 reported valgrind errors when crda_verify_db_signature() is used through regdbdump. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--reglib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/reglib.c b/reglib.c
index 17e3f31..634525b 100644
--- a/reglib.c
+++ b/reglib.c
@@ -135,13 +135,14 @@ int crda_verify_db_signature(uint8_t *db, int dblen, int siglen)
if (gcry_sexp_build(&data, NULL, "(data (flags pkcs1) (hash sha1 %b))",
20, hash)) {
fprintf(stderr, "Failed to build data S-expression.\n");
- goto out;
+ return ok;
}
if (gcry_sexp_build(&signature, NULL, "(sig-val (rsa (s %b)))",
siglen, db + dblen)) {
fprintf(stderr, "Failed to build signature S-expression.\n");
- goto out;
+ gcry_sexp_release(data);
+ return ok;
}
for (i = 0; (i < sizeof(keys)/sizeof(keys[0])) && (!ok); i++) {
@@ -161,12 +162,15 @@ int crda_verify_db_signature(uint8_t *db, int dblen, int siglen)
}
ok = gcry_pk_verify(signature, data, rsa) == 0;
+ gcry_sexp_release(rsa);
}
if (!ok)
fprintf(stderr, "Database signature verification failed.\n");
out:
+ gcry_sexp_release(data);
+ gcry_sexp_release(signature);
return ok;
}
#endif /* USE_GCRYPT */