diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2017-03-08 14:06:42 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2017-03-08 14:10:25 +0200 |
commit | 3cfd031832dd62459a5532f8b98021bb13820a9d (patch) | |
tree | 09748af9588bc4124735d9f020f4cd80b016380a | |
parent | 0a8746dc7eaf90d62378371e49f615f737f971f6 (diff) | |
download | rpm-3cfd031832dd62459a5532f8b98021bb13820a9d.tar.gz |
Make SHA1 and MD5 optional in rpmGenerateSignature()
Currently all callers are supplying them but we'll want to get rid
of especially MD5 eventually.
-rw-r--r-- | lib/signature.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/signature.c b/lib/signature.c index 20735785e..e5e9c5214 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -232,19 +232,23 @@ rpmRC rpmGenerateSignature(char *SHA1, uint8_t *MD5, rpm_loff_t size, int gpgSize = rpmExpandNumeric("%{__gpg_reserved_space}"); /* Prepare signature */ - rpmtdReset(&td); - td.tag = RPMSIGTAG_SHA1; - td.count = 1; - td.type = RPM_STRING_TYPE; - td.data = SHA1; - headerPut(sig, &td, HEADERPUT_DEFAULT); + if (SHA1) { + rpmtdReset(&td); + td.tag = RPMSIGTAG_SHA1; + td.count = 1; + td.type = RPM_STRING_TYPE; + td.data = SHA1; + headerPut(sig, &td, HEADERPUT_DEFAULT); + } - rpmtdReset(&td); - td.tag = RPMSIGTAG_MD5; - td.count = 16; - td.type = RPM_BIN_TYPE; - td.data = MD5; - headerPut(sig, &td, HEADERPUT_DEFAULT); + if (MD5) { + rpmtdReset(&td); + td.tag = RPMSIGTAG_MD5; + td.count = 16; + td.type = RPM_BIN_TYPE; + td.data = MD5; + headerPut(sig, &td, HEADERPUT_DEFAULT); + } rpmtdReset(&td); td.count = 1; |