Make rpmVerifyFile() honor rpmfi digest algorithm
This commit is contained in:
parent
a1e49ce26b
commit
7b696eb1a9
24
lib/verify.c
24
lib/verify.c
|
@ -92,18 +92,24 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
|
||||||
|
|
||||||
|
|
||||||
if (flags & RPMVERIFY_MD5) {
|
if (flags & RPMVERIFY_MD5) {
|
||||||
unsigned char md5sum[16];
|
const unsigned char *digest;
|
||||||
rpm_off_t fsize;
|
pgpHashAlgo algo;
|
||||||
|
size_t diglen;
|
||||||
|
|
||||||
/* XXX If --nomd5, then prelinked library sizes are not corrected. */
|
/* XXX If --nomd5, then prelinked library sizes are not corrected. */
|
||||||
rc = rpmDoDigest(PGPHASHALGO_MD5, fn, 0, md5sum, &fsize);
|
if ((digest = rpmfiDigest(fi, &algo, &diglen))) {
|
||||||
sb.st_size = fsize;
|
unsigned char fdigest[diglen];
|
||||||
if (rc)
|
rpm_off_t fsize;
|
||||||
*res |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
|
|
||||||
else {
|
rc = rpmDoDigest(algo, fn, 0, fdigest, &fsize);
|
||||||
const unsigned char * MD5 = rpmfiMD5(fi);
|
sb.st_size = fsize;
|
||||||
if (MD5 == NULL || memcmp(md5sum, MD5, sizeof(md5sum)))
|
if (rc) {
|
||||||
|
*res |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
|
||||||
|
} else if (memcmp(fdigest, digest, diglen)) {
|
||||||
*res |= RPMVERIFY_MD5;
|
*res |= RPMVERIFY_MD5;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*res |= RPMVERIFY_MD5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue