|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/rpmdb/legacy.h.digests 2003-05-08 16:39:31.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/rpmdb/legacy.h 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -18,7 +18,20 @@
|
|
Paul Nasrat |
14e3df |
#endif
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/**
|
|
Paul Nasrat |
14e3df |
- * Return MD5 sum and size of a file.
|
|
Paul Nasrat |
14e3df |
+ * Return digest and size of a file.
|
|
Paul Nasrat |
14e3df |
+ * @param fn file name
|
|
Paul Nasrat |
14e3df |
+ * @retval digest address of md5sum
|
|
Paul Nasrat |
14e3df |
+ * @param asAscii return md5sum as ascii string?
|
|
Paul Nasrat |
14e3df |
+ * @retval *fsizep file size pointer (or NULL)
|
|
Paul Nasrat |
14e3df |
+ * @return 0 on success, 1 on error
|
|
Paul Nasrat |
14e3df |
+ */
|
|
Paul Nasrat |
14e3df |
+int dodigest(int digestalgo, const char * fn, /*@out@*/ unsigned char * digest,
|
|
Paul Nasrat |
14e3df |
+ int asAscii, /*@null@*/ /*@out@*/ size_t *fsizep)
|
|
Paul Nasrat |
14e3df |
+ /*@globals h_errno, fileSystem, internalState @*/
|
|
Paul Nasrat |
14e3df |
+ /*@modifies digest, *fsizep, fileSystem, internalState @*/;
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+/**
|
|
Paul Nasrat |
14e3df |
+ * Return MD5 digest and size of a file.
|
|
Paul Nasrat |
14e3df |
* @param fn file name
|
|
Paul Nasrat |
14e3df |
* @retval digest address of md5sum
|
|
Paul Nasrat |
14e3df |
* @param asAscii return md5sum as ascii string?
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/rpmdb/legacy.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/rpmdb/legacy.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -145,12 +145,12 @@
|
|
Paul Nasrat |
14e3df |
return fdno;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
-int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
|
|
Paul Nasrat |
14e3df |
+int dodigest(int digestalgo, const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
|
|
Paul Nasrat |
14e3df |
{
|
|
Paul Nasrat |
14e3df |
const char * path;
|
|
Paul Nasrat |
14e3df |
urltype ut = urlPath(fn, &path);
|
|
Paul Nasrat |
14e3df |
- unsigned char * md5sum = NULL;
|
|
Paul Nasrat |
14e3df |
- size_t md5len;
|
|
Paul Nasrat |
14e3df |
+ unsigned char * dsum = NULL;
|
|
Paul Nasrat |
14e3df |
+ size_t dlen;
|
|
Paul Nasrat |
14e3df |
unsigned char buf[32*BUFSIZ];
|
|
Paul Nasrat |
14e3df |
FD_t fd;
|
|
Paul Nasrat |
14e3df |
size_t fsize = 0;
|
|
Paul Nasrat |
14e3df |
@@ -193,10 +193,10 @@
|
|
Paul Nasrat |
14e3df |
#endif
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- ctx = rpmDigestInit(PGPHASHALGO_MD5, RPMDIGEST_NONE);
|
|
Paul Nasrat |
14e3df |
+ ctx = rpmDigestInit(digestalgo, RPMDIGEST_NONE);
|
|
Paul Nasrat |
14e3df |
if (fsize)
|
|
Paul Nasrat |
14e3df |
xx = rpmDigestUpdate(ctx, mapped, fsize);
|
|
Paul Nasrat |
14e3df |
- xx = rpmDigestFinal(ctx, (void **)&md5sum, &md5len, asAscii);
|
|
Paul Nasrat |
14e3df |
+ xx = rpmDigestFinal(ctx, (void **)&dsum, &dlen, asAscii);
|
|
Paul Nasrat |
14e3df |
if (fsize)
|
|
Paul Nasrat |
14e3df |
xx = munmap(mapped, fsize);
|
|
Paul Nasrat |
14e3df |
xx = close(fdno);
|
|
Paul Nasrat |
14e3df |
@@ -219,11 +219,11 @@
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- fdInitDigest(fd, PGPHASHALGO_MD5, 0);
|
|
Paul Nasrat |
14e3df |
+ fdInitDigest(fd, digestalgo, 0);
|
|
Paul Nasrat |
14e3df |
fsize = 0;
|
|
Paul Nasrat |
14e3df |
while ((rc = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0)
|
|
Paul Nasrat |
14e3df |
fsize += rc;
|
|
Paul Nasrat |
14e3df |
- fdFiniDigest(fd, PGPHASHALGO_MD5, (void **)&md5sum, &md5len, asAscii);
|
|
Paul Nasrat |
14e3df |
+ fdFiniDigest(fd, digestalgo, (void **)&dsum, &dlen, asAscii);
|
|
Paul Nasrat |
14e3df |
if (Ferror(fd))
|
|
Paul Nasrat |
14e3df |
rc = 1;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -244,13 +244,18 @@
|
|
Paul Nasrat |
14e3df |
if (fsizep)
|
|
Paul Nasrat |
14e3df |
*fsizep = fsize;
|
|
Paul Nasrat |
14e3df |
if (!rc)
|
|
Paul Nasrat |
14e3df |
- memcpy(digest, md5sum, md5len);
|
|
Paul Nasrat |
14e3df |
+ memcpy(digest, dsum, dlen);
|
|
Paul Nasrat |
14e3df |
/*@=boundswrite@*/
|
|
Paul Nasrat |
14e3df |
- md5sum = _free(md5sum);
|
|
Paul Nasrat |
14e3df |
+ dsum = _free(dsum);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
return rc;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
+int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
|
|
Paul Nasrat |
14e3df |
+{
|
|
Paul Nasrat |
14e3df |
+ return dodigest(PGPHASHALGO_MD5, fn, digest, asAscii, fsizep);
|
|
Paul Nasrat |
14e3df |
+}
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
/*@-exportheadervar@*/
|
|
Paul Nasrat |
14e3df |
/*@unchecked@*/
|
|
Paul Nasrat |
14e3df |
int _noDirTokens = 0;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/macros.in.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/macros.in 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -455,6 +455,17 @@
|
|
Paul Nasrat |
14e3df |
#%_fixperms %{__chmod} -Rf @FIXPERMS@
|
|
Paul Nasrat |
14e3df |
#
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
+#
|
|
Paul Nasrat |
14e3df |
+# Choose metadata file digest algorithm:
|
|
Paul Nasrat |
14e3df |
+# 1 MD5
|
|
Paul Nasrat |
14e3df |
+# 2 SHA1
|
|
Paul Nasrat |
14e3df |
+# 8 SHA256
|
|
Paul Nasrat |
14e3df |
+# 9 SHA384
|
|
Paul Nasrat |
14e3df |
+# 10 SHA512
|
|
Paul Nasrat |
14e3df |
+#
|
|
Paul Nasrat |
14e3df |
+# Note: choosing anything but MD5 introduces instant legacy incompatibility.
|
|
Paul Nasrat |
14e3df |
+%_build_file_digest_algo 1
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
#==============================================================================
|
|
Paul Nasrat |
14e3df |
# ---- Database configuration macros.
|
|
Paul Nasrat |
14e3df |
# Macros used to configure Berkley db parameters.
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/build/files.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/build/files.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -30,7 +30,7 @@
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
#include "buildio.h"
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
-#include "legacy.h" /* XXX domd5, expandFileList, compressFileList */
|
|
Paul Nasrat |
14e3df |
+#include "legacy.h" /* XXX dodigest, expandFileList, compressFileList */
|
|
Paul Nasrat |
14e3df |
#include "misc.h"
|
|
Paul Nasrat |
14e3df |
#include "debug.h"
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -1280,12 +1280,37 @@
|
|
Paul Nasrat |
14e3df |
* RPM_INT32_TYPE, &(flp->fl_gid), 1);
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
+ { static uint_32 dalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ static int oneshot = 0;
|
|
Paul Nasrat |
14e3df |
+ if (!oneshot) {
|
|
Paul Nasrat |
14e3df |
+ dalgo = rpmExpandNumeric("%{?_build_file_digest_algo}");
|
|
Paul Nasrat |
14e3df |
+ switch (dalgo) {
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_MD5:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA1:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA256:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA384:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA512:
|
|
Paul Nasrat |
14e3df |
+ break;
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_RIPEMD160:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_MD2:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_TIGER192:
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_HAVAL_5_160:
|
|
Paul Nasrat |
14e3df |
+ default:
|
|
Paul Nasrat |
14e3df |
+ dalgo = PGPHASHALGO_MD5;
|
|
Paul Nasrat |
14e3df |
+ break;
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+ oneshot++;
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
buf[0] = '\0';
|
|
Paul Nasrat |
14e3df |
if (S_ISREG(flp->fl_mode))
|
|
Paul Nasrat |
14e3df |
- (void) domd5(flp->diskURL, buf, 1, NULL);
|
|
Paul Nasrat |
14e3df |
+ (void) dodigest(dalgo, flp->diskURL, (unsigned char *)buf, 1, NULL);
|
|
Paul Nasrat |
14e3df |
s = buf;
|
|
Paul Nasrat |
14e3df |
- (void) headerAddOrAppendEntry(h, RPMTAG_FILEMD5S, RPM_STRING_ARRAY_TYPE,
|
|
Paul Nasrat |
14e3df |
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEDIGESTS, RPM_STRING_ARRAY_TYPE,
|
|
Paul Nasrat |
14e3df |
&s, 1);
|
|
Paul Nasrat |
14e3df |
+ (void) headerAddOrAppendEntry(h, RPMTAG_FILEDIGESTALGOS, RPM_INT32_TYPE,
|
|
Paul Nasrat |
14e3df |
+ &dalgo, 1);
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
buf[0] = '\0';
|
|
Paul Nasrat |
14e3df |
if (S_ISLNK(flp->fl_mode)) {
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/cpio.c.digests 2003-12-25 18:00:45.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/cpio.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -233,7 +233,7 @@
|
|
Paul Nasrat |
14e3df |
case CPIOERR_HDR_SIZE: s = _("Header size too big"); break;
|
|
Paul Nasrat |
14e3df |
case CPIOERR_UNKNOWN_FILETYPE: s = _("Unknown file type"); break;
|
|
Paul Nasrat |
14e3df |
case CPIOERR_MISSING_HARDLINK: s = _("Missing hard link(s)"); break;
|
|
Paul Nasrat |
14e3df |
- case CPIOERR_MD5SUM_MISMATCH: s = _("MD5 sum mismatch"); break;
|
|
Paul Nasrat |
14e3df |
+ case CPIOERR_DIGEST_MISMATCH: s = _("File digest mismatch"); break;
|
|
Paul Nasrat |
14e3df |
case CPIOERR_INTERNAL: s = _("Internal error"); break;
|
|
Paul Nasrat |
14e3df |
case CPIOERR_UNMAPPED_FILE: s = _("Archive file not in header"); break;
|
|
Paul Nasrat |
14e3df |
case CPIOERR_ENOENT: s = strerror(ENOENT); break;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/rpmfi.h.digests 2005-02-10 03:30:28.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/rpmfi.h 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -45,7 +45,9 @@
|
|
Paul Nasrat |
14e3df |
const char ** dnl; /*!< Directory name(s) (from header) */
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*@only@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
- const char ** fmd5s; /*!< File MD5 sum(s) (from header) */
|
|
Paul Nasrat |
14e3df |
+ const char ** fdigests; /*!< File digest(s) (from header) */
|
|
Paul Nasrat |
14e3df |
+/*@only@*/ /*@null@*/
|
|
Paul Nasrat |
14e3df |
+ uint_32 * fdigestalgos; /*!< File digest algorithm(s) (from header) */
|
|
Paul Nasrat |
14e3df |
/*@only@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
const char ** flinks; /*!< File link(s) (from header) */
|
|
Paul Nasrat |
14e3df |
/*@only@*/ /*@null@*/
|
|
Paul Nasrat |
14e3df |
@@ -126,7 +128,9 @@
|
|
Paul Nasrat |
14e3df |
int_32 * odil; /*!< Original dirindex(s) (from header) */
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*@only@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
- unsigned char * md5s; /*!< File md5 sums in binary. */
|
|
Paul Nasrat |
14e3df |
+ unsigned char * digests; /*!< File digest(s) in binary. */
|
|
Paul Nasrat |
14e3df |
+ uint_32 digestalgo; /*!< File digest algorithm. */
|
|
Paul Nasrat |
14e3df |
+ uint_32 digestlen; /*!< No. bytes in binary digest. */
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*@only@*/ /*@null@*/
|
|
Paul Nasrat |
14e3df |
const char * pretrans;
|
|
Paul Nasrat |
14e3df |
@@ -335,7 +339,21 @@
|
|
Paul Nasrat |
14e3df |
/*@*/;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/**
|
|
Paul Nasrat |
14e3df |
+ * Return current file (binary) digest from file info set.
|
|
Paul Nasrat |
14e3df |
+ * @param fi file info set
|
|
Paul Nasrat |
14e3df |
+ * @retval *algop digest algorithm
|
|
Paul Nasrat |
14e3df |
+ * @retval *lenp digest length (in bytes)
|
|
Paul Nasrat |
14e3df |
+ * @return current file digest, NULL on invalid
|
|
Paul Nasrat |
14e3df |
+ */
|
|
Paul Nasrat |
14e3df |
+/*@observer@*/ /*@null@*/
|
|
Paul Nasrat |
14e3df |
+extern const unsigned char * rpmfiDigest(/*@null@*/ rpmfi fi,
|
|
Paul Nasrat |
14e3df |
+ /*@out@*/ /*@null@*/ int * algop,
|
|
Paul Nasrat |
14e3df |
+ /*@out@*/ /*@null@*/ size_t * lenp)
|
|
Paul Nasrat |
14e3df |
+ /*@modifies *algop, *lenp @*/;
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+/**
|
|
Paul Nasrat |
14e3df |
* Return current file (binary) md5 digest from file info set.
|
|
Paul Nasrat |
14e3df |
+ * @deprecated Use rpmfiDigest instead.
|
|
Paul Nasrat |
14e3df |
* @param fi file info set
|
|
Paul Nasrat |
14e3df |
* @return current file md5 digest, NULL on invalid
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/cpio.h.digests 2004-10-20 06:19:34.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/cpio.h 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -46,7 +46,7 @@
|
|
Paul Nasrat |
14e3df |
CPIOERR_HDR_TRAILER = (24 ),
|
|
Paul Nasrat |
14e3df |
CPIOERR_UNKNOWN_FILETYPE= (25 ),
|
|
Paul Nasrat |
14e3df |
CPIOERR_MISSING_HARDLINK= (26 ),
|
|
Paul Nasrat |
14e3df |
- CPIOERR_MD5SUM_MISMATCH = (27 ),
|
|
Paul Nasrat |
14e3df |
+ CPIOERR_DIGEST_MISMATCH = (27 ),
|
|
Paul Nasrat |
14e3df |
CPIOERR_INTERNAL = (28 ),
|
|
Paul Nasrat |
14e3df |
CPIOERR_UNMAPPED_FILE = (29 ),
|
|
Paul Nasrat |
14e3df |
CPIOERR_ENOENT = (30 ),
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/fsm.c.digests 2004-10-09 15:40:09.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/fsm.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -801,14 +801,18 @@
|
|
Paul Nasrat |
14e3df |
{ rpmts ts = fsmGetTs(fsm);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*
|
|
Paul Nasrat |
14e3df |
- * Set file md5 (if not disabled).
|
|
Paul Nasrat |
14e3df |
+ * Set file digest (if not disabled).
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
- if (ts != NULL && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOMD5)) {
|
|
Paul Nasrat |
14e3df |
- fsm->fmd5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
|
|
Paul Nasrat |
14e3df |
- fsm->md5sum = (fi->md5s ? (fi->md5s + (16 * i)) : NULL);
|
|
Paul Nasrat |
14e3df |
+ if (ts != NULL && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOFDIGESTS)) {
|
|
Paul Nasrat |
14e3df |
+ fsm->fdigestalgo = fi->digestalgo;
|
|
Paul Nasrat |
14e3df |
+ fsm->fdigest = (fi->fdigests ? fi->fdigests[i] : NULL);
|
|
Paul Nasrat |
14e3df |
+ fsm->digestlen = fi->digestlen;
|
|
Paul Nasrat |
14e3df |
+ fsm->digest = (fi->digests ? (fi->digests + (fsm->digestlen * i)) : NULL);
|
|
Paul Nasrat |
14e3df |
} else {
|
|
Paul Nasrat |
14e3df |
- fsm->fmd5sum = NULL;
|
|
Paul Nasrat |
14e3df |
- fsm->md5sum = NULL;
|
|
Paul Nasrat |
14e3df |
+ fsm->fdigestalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ fsm->fdigest = NULL;
|
|
Paul Nasrat |
14e3df |
+ fsm->digestlen = 0;
|
|
Paul Nasrat |
14e3df |
+ fsm->digest = NULL;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -823,7 +827,7 @@
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
/*@-compdef@*/
|
|
Paul Nasrat |
14e3df |
static int expandRegular(/*@special@*/ FSM_t fsm)
|
|
Paul Nasrat |
14e3df |
- /*@uses fsm->fmd5sum, fsm->md5sum, fsm->sb, fsm->wfd @*/
|
|
Paul Nasrat |
14e3df |
+ /*@uses fsm->fdigest, fsm->digest, fsm->sb, fsm->wfd @*/
|
|
Paul Nasrat |
14e3df |
/*@globals h_errno, fileSystem, internalState @*/
|
|
Paul Nasrat |
14e3df |
/*@modifies fsm, fileSystem, internalState @*/
|
|
Paul Nasrat |
14e3df |
{
|
|
Paul Nasrat |
14e3df |
@@ -835,8 +839,8 @@
|
|
Paul Nasrat |
14e3df |
if (rc)
|
|
Paul Nasrat |
14e3df |
goto exit;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- if (st->st_size > 0 && (fsm->fmd5sum != NULL || fsm->md5sum != NULL))
|
|
Paul Nasrat |
14e3df |
- fdInitDigest(fsm->wfd, PGPHASHALGO_MD5, 0);
|
|
Paul Nasrat |
14e3df |
+ if (st->st_size > 0 && (fsm->fdigest != NULL || fsm->digest != NULL))
|
|
Paul Nasrat |
14e3df |
+ fdInitDigest(fsm->wfd, fsm->fdigestalgo, 0);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
while (left) {
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -856,26 +860,26 @@
|
|
Paul Nasrat |
14e3df |
(void) fsmNext(fsm, FSM_NOTIFY);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- if (st->st_size > 0 && (fsm->fmd5sum || fsm->md5sum)) {
|
|
Paul Nasrat |
14e3df |
- void * md5sum = NULL;
|
|
Paul Nasrat |
14e3df |
- int asAscii = (fsm->md5sum == NULL ? 1 : 0);
|
|
Paul Nasrat |
14e3df |
+ if (st->st_size > 0 && (fsm->fdigest || fsm->digest)) {
|
|
Paul Nasrat |
14e3df |
+ void * digest = NULL;
|
|
Paul Nasrat |
14e3df |
+ int asAscii = (fsm->digest == NULL ? 1 : 0);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
(void) Fflush(fsm->wfd);
|
|
Paul Nasrat |
14e3df |
- fdFiniDigest(fsm->wfd, PGPHASHALGO_MD5, &md5sum, NULL, asAscii);
|
|
Paul Nasrat |
14e3df |
+ fdFiniDigest(fsm->wfd, fsm->fdigestalgo, &digest, NULL, asAscii);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- if (md5sum == NULL) {
|
|
Paul Nasrat |
14e3df |
- rc = CPIOERR_MD5SUM_MISMATCH;
|
|
Paul Nasrat |
14e3df |
+ if (digest == NULL) {
|
|
Paul Nasrat |
14e3df |
+ rc = CPIOERR_DIGEST_MISMATCH;
|
|
Paul Nasrat |
14e3df |
goto exit;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- if (fsm->md5sum != NULL) {
|
|
Paul Nasrat |
14e3df |
- if (memcmp(md5sum, fsm->md5sum, 16))
|
|
Paul Nasrat |
14e3df |
- rc = CPIOERR_MD5SUM_MISMATCH;
|
|
Paul Nasrat |
14e3df |
+ if (fsm->digest != NULL) {
|
|
Paul Nasrat |
14e3df |
+ if (memcmp(digest, fsm->digest, fsm->digestlen))
|
|
Paul Nasrat |
14e3df |
+ rc = CPIOERR_DIGEST_MISMATCH;
|
|
Paul Nasrat |
14e3df |
} else {
|
|
Paul Nasrat |
14e3df |
- if (strcmp(md5sum, fsm->fmd5sum))
|
|
Paul Nasrat |
14e3df |
- rc = CPIOERR_MD5SUM_MISMATCH;
|
|
Paul Nasrat |
14e3df |
+ if (strcmp(digest, fsm->fdigest))
|
|
Paul Nasrat |
14e3df |
+ rc = CPIOERR_DIGEST_MISMATCH;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- md5sum = _free(md5sum);
|
|
Paul Nasrat |
14e3df |
+ digest = _free(digest);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
exit:
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/signature.c.digests 2005-06-06 19:33:08.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/signature.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -817,7 +817,7 @@
|
|
Paul Nasrat |
14e3df |
case RPMSIGTAG_MD5:
|
|
Paul Nasrat |
14e3df |
pktlen = 16;
|
|
Paul Nasrat |
14e3df |
pkt = memset(alloca(pktlen), 0, pktlen);
|
|
Paul Nasrat |
14e3df |
- if (domd5(file, pkt, 0, NULL)
|
|
Paul Nasrat |
14e3df |
+ if (dodigest(PGPHASHALGO_MD5, file, pkt, 0, NULL)
|
|
Paul Nasrat |
14e3df |
|| !headerAddEntry(sigh, sigTag, RPM_BIN_TYPE, pkt, pktlen))
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
ret = 0;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/poptI.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/poptI.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -129,8 +129,8 @@
|
|
Paul Nasrat |
14e3df |
ia->noDeps = 1;
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- case RPMCLI_POPT_NOMD5:
|
|
Paul Nasrat |
14e3df |
- ia->transFlags |= RPMTRANS_FLAG_NOMD5;
|
|
Paul Nasrat |
14e3df |
+ case RPMCLI_POPT_NOFDIGESTS:
|
|
Paul Nasrat |
14e3df |
+ ia->transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
case RPMCLI_POPT_NOCONTEXTS:
|
|
Paul Nasrat |
14e3df |
@@ -248,8 +248,10 @@
|
|
Paul Nasrat |
14e3df |
&rpmIArgs.transFlags, RPMTRANS_FLAG_NODOCS,
|
|
Paul Nasrat |
14e3df |
N_("do not install documentation"), NULL},
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- { "nomd5", '\0', 0, NULL, RPMCLI_POPT_NOMD5,
|
|
Paul Nasrat |
14e3df |
- N_("don't verify MD5 digest of files"), NULL },
|
|
Paul Nasrat |
14e3df |
+ { "nomd5", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOFDIGESTS,
|
|
Paul Nasrat |
14e3df |
+ N_("don't verify file digests"), NULL },
|
|
Paul Nasrat |
14e3df |
+ { "nofdigests", '\0', 0, NULL, RPMCLI_POPT_NOFDIGESTS,
|
|
Paul Nasrat |
14e3df |
+ N_("don't verify file digests"), NULL },
|
|
Paul Nasrat |
14e3df |
{ "nocontexts", '\0',0, NULL, RPMCLI_POPT_NOCONTEXTS,
|
|
Paul Nasrat |
14e3df |
N_("don't install file security contexts"), NULL},
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/verify.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/verify.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -11,7 +11,7 @@
|
|
Paul Nasrat |
14e3df |
#include "rpmfi.h"
|
|
Paul Nasrat |
14e3df |
#include "rpmts.h"
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
-#include "legacy.h" /* XXX domd5(), uidToUname(), gnameToGid */
|
|
Paul Nasrat |
14e3df |
+#include "legacy.h" /* XXX dodigest(), uidToUname(), gnameToGid */
|
|
Paul Nasrat |
14e3df |
#include "ugid.h"
|
|
Paul Nasrat |
14e3df |
#include "debug.h"
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -82,32 +82,32 @@
|
|
Paul Nasrat |
14e3df |
* Not all attributes of non-regular files can be verified.
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
if (S_ISDIR(sb.st_mode))
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
else if (S_ISLNK(sb.st_mode)) {
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_MODE);
|
|
Paul Nasrat |
14e3df |
#if CHOWN_FOLLOWS_SYMLINK
|
|
Paul Nasrat |
14e3df |
flags &= ~(RPMVERIFY_USER | RPMVERIFY_GROUP);
|
|
Paul Nasrat |
14e3df |
#endif
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
else if (S_ISFIFO(sb.st_mode))
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
else if (S_ISCHR(sb.st_mode))
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
else if (S_ISBLK(sb.st_mode))
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
- else
|
|
Paul Nasrat |
14e3df |
+ else
|
|
Paul Nasrat |
14e3df |
flags &= ~(RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*
|
|
Paul Nasrat |
14e3df |
* Content checks of %ghost files are meaningless.
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
if (fileAttrs & RPMFILE_GHOST)
|
|
Paul Nasrat |
14e3df |
- flags &= ~(RPMVERIFY_MD5 | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
+ flags &= ~(RPMVERIFY_FDIGEST | RPMVERIFY_FILESIZE | RPMVERIFY_MTIME |
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*
|
|
Paul Nasrat |
14e3df |
@@ -117,21 +117,26 @@
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*@=branchstate@*/
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- if (flags & RPMVERIFY_MD5) {
|
|
Paul Nasrat |
14e3df |
- unsigned char md5sum[16];
|
|
Paul Nasrat |
14e3df |
- size_t fsize;
|
|
Paul Nasrat |
14e3df |
-
|
|
Paul Nasrat |
14e3df |
- /* XXX If --nomd5, then prelinked library sizes are not corrected. */
|
|
Paul Nasrat |
14e3df |
- rc = domd5(fn, md5sum, 0, &fsize);
|
|
Paul Nasrat |
14e3df |
- sb.st_size = fsize;
|
|
Paul Nasrat |
14e3df |
- if (rc)
|
|
Paul Nasrat |
14e3df |
- *res |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
|
|
Paul Nasrat |
14e3df |
+ if (flags & RPMVERIFY_FDIGEST) {
|
|
Paul Nasrat |
14e3df |
+ int dalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t dlen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * digest = rpmfiDigest(fi, &dalgo, &dlen);
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+ if (digest == NULL)
|
|
Paul Nasrat |
14e3df |
+ *res |= RPMVERIFY_FDIGEST;
|
|
Paul Nasrat |
14e3df |
else {
|
|
Paul Nasrat |
14e3df |
- const unsigned char * MD5 = rpmfiMD5(fi);
|
|
Paul Nasrat |
14e3df |
- if (MD5 == NULL || memcmp(md5sum, MD5, sizeof(md5sum)))
|
|
Paul Nasrat |
14e3df |
- *res |= RPMVERIFY_MD5;
|
|
Paul Nasrat |
14e3df |
+ /* XXX If --nofdigest, then prelinked library sizes fail to verify. */
|
|
Paul Nasrat |
14e3df |
+ unsigned char * fdigest = memset(alloca(dlen), 0, dlen);
|
|
Paul Nasrat |
14e3df |
+ size_t fsize;
|
|
Paul Nasrat |
14e3df |
+ rc = dodigest(dalgo, fn, fdigest, 0, &fsize);
|
|
Paul Nasrat |
14e3df |
+ sb.st_size = fsize;
|
|
Paul Nasrat |
14e3df |
+ if (rc)
|
|
Paul Nasrat |
14e3df |
+ *res |= (RPMVERIFY_READFAIL|RPMVERIFY_FDIGEST);
|
|
Paul Nasrat |
14e3df |
+ else
|
|
Paul Nasrat |
14e3df |
+ if (memcmp(fdigest, digest, dlen))
|
|
Paul Nasrat |
14e3df |
+ *res |= RPMVERIFY_FDIGEST;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- }
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
if (flags & RPMVERIFY_LINKTO) {
|
|
Paul Nasrat |
14e3df |
char linkto[1024+1];
|
|
Paul Nasrat |
14e3df |
@@ -145,12 +150,12 @@
|
|
Paul Nasrat |
14e3df |
if (flink == NULL || strcmp(linkto, flink))
|
|
Paul Nasrat |
14e3df |
*res |= RPMVERIFY_LINKTO;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- }
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
if (flags & RPMVERIFY_FILESIZE) {
|
|
Paul Nasrat |
14e3df |
if (sb.st_size != rpmfiFSize(fi))
|
|
Paul Nasrat |
14e3df |
*res |= RPMVERIFY_FILESIZE;
|
|
Paul Nasrat |
14e3df |
- }
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
if (flags & RPMVERIFY_MODE) {
|
|
Paul Nasrat |
14e3df |
unsigned short metamode = fmode;
|
|
Paul Nasrat |
14e3df |
@@ -158,7 +163,7 @@
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*
|
|
Paul Nasrat |
14e3df |
* Platforms (like AIX) where sizeof(unsigned short) != sizeof(mode_t)
|
|
Paul Nasrat |
14e3df |
- * need the (unsigned short) cast here.
|
|
Paul Nasrat |
14e3df |
+ * need the (unsigned short) cast here.
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
filemode = (unsigned short)sb.st_mode;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -184,7 +189,7 @@
|
|
Paul Nasrat |
14e3df |
uint_16 frdev = (rpmfiFRdev(fi) & 0xffff);
|
|
Paul Nasrat |
14e3df |
if (st_rdev != frdev)
|
|
Paul Nasrat |
14e3df |
*res |= RPMVERIFY_RDEV;
|
|
Paul Nasrat |
14e3df |
- }
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
if (flags & RPMVERIFY_MTIME) {
|
|
Paul Nasrat |
14e3df |
@@ -301,7 +306,7 @@
|
|
Paul Nasrat |
14e3df |
ec = rc;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
} else if (verifyResult || rpmIsVerbose()) {
|
|
Paul Nasrat |
14e3df |
- const char * size, * MD5, * link, * mtime, * mode;
|
|
Paul Nasrat |
14e3df |
+ const char * size, * digest, * link, * mtime, * mode;
|
|
Paul Nasrat |
14e3df |
const char * group, * user, * rdev;
|
|
Paul Nasrat |
14e3df |
/*@observer@*/ static const char *const aok = ".";
|
|
Paul Nasrat |
14e3df |
/*@observer@*/ static const char *const unknown = "?";
|
|
Paul Nasrat |
14e3df |
@@ -317,7 +322,7 @@
|
|
Paul Nasrat |
14e3df |
((verifyResult & RPMVERIFY_READFAIL) ? unknown : \
|
|
Paul Nasrat |
14e3df |
(verifyResult & _RPMVERIFY_F) ? _C : aok)
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- MD5 = _verifyfile(RPMVERIFY_MD5, "5");
|
|
Paul Nasrat |
14e3df |
+ digest = _verifyfile(RPMVERIFY_FDIGEST, "5");
|
|
Paul Nasrat |
14e3df |
size = _verify(RPMVERIFY_FILESIZE, "S");
|
|
Paul Nasrat |
14e3df |
link = _verifylink(RPMVERIFY_LINKTO, "L");
|
|
Paul Nasrat |
14e3df |
mtime = _verify(RPMVERIFY_MTIME, "T");
|
|
Paul Nasrat |
14e3df |
@@ -331,7 +336,7 @@
|
|
Paul Nasrat |
14e3df |
#undef _verify
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
sprintf(te, "%s%s%s%s%s%s%s%s %c %s",
|
|
Paul Nasrat |
14e3df |
- size, mode, MD5, rdev, link, user, group, mtime,
|
|
Paul Nasrat |
14e3df |
+ size, mode, digest, rdev, link, user, group, mtime,
|
|
Paul Nasrat |
14e3df |
((fileAttrs & RPMFILE_CONFIG) ? 'c' :
|
|
Paul Nasrat |
14e3df |
(fileAttrs & RPMFILE_DOC) ? 'd' :
|
|
Paul Nasrat |
14e3df |
(fileAttrs & RPMFILE_GHOST) ? 'g' :
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/rpmfi.c.digests 2005-02-10 03:30:28.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/rpmfi.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -203,17 +203,36 @@
|
|
Paul Nasrat |
14e3df |
return fstate;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
+const unsigned char * rpmfiDigest(rpmfi fi, int * algop, size_t * lenp)
|
|
Paul Nasrat |
14e3df |
+{
|
|
Paul Nasrat |
14e3df |
+ unsigned char * digest = NULL;
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+ if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
|
|
Paul Nasrat |
14e3df |
+/*@-boundsread@*/
|
|
Paul Nasrat |
14e3df |
+ if (fi->digests != NULL) {
|
|
Paul Nasrat |
14e3df |
+ digest = fi->digests + (fi->digestlen * fi->i);
|
|
Paul Nasrat |
14e3df |
+ if (algop != NULL)
|
|
Paul Nasrat |
14e3df |
+ *algop = (fi->fdigestalgos
|
|
Paul Nasrat |
14e3df |
+ ? fi->fdigestalgos[fi->i] : fi->digestalgo);
|
|
Paul Nasrat |
14e3df |
+ if (lenp != NULL)
|
|
Paul Nasrat |
14e3df |
+ *lenp = fi->digestlen;
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+/*@=boundsread@*/
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+ return digest;
|
|
Paul Nasrat |
14e3df |
+}
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
const unsigned char * rpmfiMD5(rpmfi fi)
|
|
Paul Nasrat |
14e3df |
{
|
|
Paul Nasrat |
14e3df |
- unsigned char * MD5 = NULL;
|
|
Paul Nasrat |
14e3df |
+ unsigned char * digest = NULL;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
|
|
Paul Nasrat |
14e3df |
/*@-boundsread@*/
|
|
Paul Nasrat |
14e3df |
- if (fi->md5s != NULL)
|
|
Paul Nasrat |
14e3df |
- MD5 = fi->md5s + (16 * fi->i);
|
|
Paul Nasrat |
14e3df |
+ if (fi->digests != NULL)
|
|
Paul Nasrat |
14e3df |
+ digest = fi->digests + (fi->digestlen * fi->i);
|
|
Paul Nasrat |
14e3df |
/*@=boundsread@*/
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- return MD5;
|
|
Paul Nasrat |
14e3df |
+ return digest;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
const char * rpmfiFLink(rpmfi fi)
|
|
Paul Nasrat |
14e3df |
@@ -530,12 +549,19 @@
|
|
Paul Nasrat |
14e3df |
if (blink == NULL) return -1;
|
|
Paul Nasrat |
14e3df |
return strcmp(alink, blink);
|
|
Paul Nasrat |
14e3df |
} else if (awhat == REG) {
|
|
Paul Nasrat |
14e3df |
- const unsigned char * amd5 = rpmfiMD5(afi);
|
|
Paul Nasrat |
14e3df |
- const unsigned char * bmd5 = rpmfiMD5(bfi);
|
|
Paul Nasrat |
14e3df |
- if (amd5 == bmd5) return 0;
|
|
Paul Nasrat |
14e3df |
- if (amd5 == NULL) return 1;
|
|
Paul Nasrat |
14e3df |
- if (bmd5 == NULL) return -1;
|
|
Paul Nasrat |
14e3df |
- return memcmp(amd5, bmd5, 16);
|
|
Paul Nasrat |
14e3df |
+ int aalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t alen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * adigest = rpmfiDigest(afi, &aalgo, &alen;;
|
|
Paul Nasrat |
14e3df |
+ int balgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t blen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * bdigest = rpmfiDigest(bfi, &balgo, &blen);
|
|
Paul Nasrat |
14e3df |
+ /* XXX W2DO? changing file digest algo may break rpmfiCompare. */
|
|
Paul Nasrat |
14e3df |
+ if (!(aalgo == balgo && alen == blen))
|
|
Paul Nasrat |
14e3df |
+ return -1;
|
|
Paul Nasrat |
14e3df |
+ if (adigest == bdigest) return 0;
|
|
Paul Nasrat |
14e3df |
+ if (adigest == NULL) return 1;
|
|
Paul Nasrat |
14e3df |
+ if (bdigest == NULL) return -1;
|
|
Paul Nasrat |
14e3df |
+ return memcmp(adigest, bdigest, alen);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
return 0;
|
|
Paul Nasrat |
14e3df |
@@ -592,17 +618,23 @@
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
memset(buffer, 0, sizeof(buffer));
|
|
Paul Nasrat |
14e3df |
if (dbWhat == REG) {
|
|
Paul Nasrat |
14e3df |
- const unsigned char * omd5, * nmd5;
|
|
Paul Nasrat |
14e3df |
- /* XXX avoid md5 on sparse /var/log/lastlog file. */
|
|
Paul Nasrat |
14e3df |
+ int oalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t olen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * odigest;
|
|
Paul Nasrat |
14e3df |
+ int nalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t nlen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * ndigest;
|
|
Paul Nasrat |
14e3df |
+ odigest = rpmfiDigest(ofi, &oalgo, &olen);
|
|
Paul Nasrat |
14e3df |
+ /* XXX avoid digest on sparse /var/log/lastlog file. */
|
|
Paul Nasrat |
14e3df |
if (strcmp(fn, "/var/log/lastlog"))
|
|
Paul Nasrat |
14e3df |
- if (domd5(fn, buffer, 0, NULL))
|
|
Paul Nasrat |
14e3df |
+ if (dodigest(oalgo, fn, buffer, 0, NULL))
|
|
Paul Nasrat |
14e3df |
return FA_CREATE; /* assume file has been removed */
|
|
Paul Nasrat |
14e3df |
- omd5 = rpmfiMD5(ofi);
|
|
Paul Nasrat |
14e3df |
- if (omd5 && !memcmp(omd5, buffer, 16))
|
|
Paul Nasrat |
14e3df |
+ if (odigest && !memcmp(odigest, buffer, olen))
|
|
Paul Nasrat |
14e3df |
return FA_CREATE; /* unmodified config file, replace. */
|
|
Paul Nasrat |
14e3df |
- nmd5 = rpmfiMD5(nfi);
|
|
Paul Nasrat |
14e3df |
+ ndigest = rpmfiDigest(nfi, &nalgo, &nlen;;
|
|
Paul Nasrat |
14e3df |
/*@-nullpass@*/
|
|
Paul Nasrat |
14e3df |
- if (omd5 && nmd5 && !memcmp(omd5, nmd5, 16))
|
|
Paul Nasrat |
14e3df |
+ if (odigest && ndigest && oalgo == nalgo && olen == nlen
|
|
Paul Nasrat |
14e3df |
+ && !memcmp(odigest, ndigest, nlen))
|
|
Paul Nasrat |
14e3df |
return FA_SKIP; /* identical file, don't bother. */
|
|
Paul Nasrat |
14e3df |
/*@=nullpass@*/
|
|
Paul Nasrat |
14e3df |
} else /* dbWhat == LINK */ {
|
|
Paul Nasrat |
14e3df |
@@ -1123,8 +1155,8 @@
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
fi->flinks = hfd(fi->flinks, -1);
|
|
Paul Nasrat |
14e3df |
fi->flangs = hfd(fi->flangs, -1);
|
|
Paul Nasrat |
14e3df |
- fi->fmd5s = hfd(fi->fmd5s, -1);
|
|
Paul Nasrat |
14e3df |
- fi->md5s = _free(fi->md5s);
|
|
Paul Nasrat |
14e3df |
+ fi->fdigests = hfd(fi->fdigests, -1);
|
|
Paul Nasrat |
14e3df |
+ fi->digests = _free(fi->digests);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
fi->cdict = hfd(fi->cdict, -1);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
@@ -1306,27 +1338,53 @@
|
|
Paul Nasrat |
14e3df |
xx = hge(h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
|
|
Paul Nasrat |
14e3df |
xx = hge(h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- fi->fmd5s = NULL;
|
|
Paul Nasrat |
14e3df |
- xx = hge(h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
|
|
Paul Nasrat |
14e3df |
-
|
|
Paul Nasrat |
14e3df |
- fi->md5s = NULL;
|
|
Paul Nasrat |
14e3df |
- if (fi->fmd5s) {
|
|
Paul Nasrat |
14e3df |
- t = xmalloc(fi->fc * 16);
|
|
Paul Nasrat |
14e3df |
- fi->md5s = t;
|
|
Paul Nasrat |
14e3df |
+ fi->digestalgo = PGPHASHALGO_MD5;
|
|
Paul Nasrat |
14e3df |
+ fi->digestlen = 16;
|
|
Paul Nasrat |
14e3df |
+ fi->fdigestalgos = NULL;
|
|
Paul Nasrat |
14e3df |
+ xx = hge(h, RPMTAG_FILEDIGESTALGOS, NULL, (void **) &fi->fdigestalgos, NULL);
|
|
Paul Nasrat |
14e3df |
+ if (fi->fdigestalgos) {
|
|
Paul Nasrat |
14e3df |
+ int dalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ /* XXX Insure that all algorithms are either 0 or constant. */
|
|
Paul Nasrat |
14e3df |
+ for (i = 0; i < fi->fc; i++) {
|
|
Paul Nasrat |
14e3df |
+ if (fi->fdigestalgos[i] == 0)
|
|
Paul Nasrat |
14e3df |
+ continue;
|
|
Paul Nasrat |
14e3df |
+ if (dalgo == 0)
|
|
Paul Nasrat |
14e3df |
+ dalgo = fi->fdigestalgos[i];
|
|
Paul Nasrat |
14e3df |
+ else
|
|
Paul Nasrat |
14e3df |
+assert(dalgo == fi->fdigestalgos[i]);
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+ fi->digestalgo = dalgo;
|
|
Paul Nasrat |
14e3df |
+ switch (dalgo) {
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_MD5: fi->digestlen = 128/8; break;
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA1: fi->digestlen = 160/8; break;
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA256: fi->digestlen = 256/8; break;
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA384: fi->digestlen = 384/8; break;
|
|
Paul Nasrat |
14e3df |
+ case PGPHASHALGO_SHA512: fi->digestlen = 512/8; break;
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+ fi->fdigestalgos = NULL;
|
|
Paul Nasrat |
14e3df |
+ }
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+ fi->fdigests = NULL;
|
|
Paul Nasrat |
14e3df |
+ xx = hge(h, RPMTAG_FILEDIGESTS, NULL, (void **) &fi->fdigests, NULL);
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
+ fi->digests = NULL;
|
|
Paul Nasrat |
14e3df |
+ if (fi->fdigests) {
|
|
Paul Nasrat |
14e3df |
+ t = xmalloc(fi->fc * fi->digestlen);
|
|
Paul Nasrat |
14e3df |
+ fi->digests = t;
|
|
Paul Nasrat |
14e3df |
for (i = 0; i < fi->fc; i++) {
|
|
Paul Nasrat |
14e3df |
- const char * fmd5;
|
|
Paul Nasrat |
14e3df |
+ const char * fdigests;
|
|
Paul Nasrat |
14e3df |
int j;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- fmd5 = fi->fmd5s[i];
|
|
Paul Nasrat |
14e3df |
- if (!(fmd5 && *fmd5 != '\0')) {
|
|
Paul Nasrat |
14e3df |
- memset(t, 0, 16);
|
|
Paul Nasrat |
14e3df |
- t += 16;
|
|
Paul Nasrat |
14e3df |
+ fdigests = fi->fdigests[i];
|
|
Paul Nasrat |
14e3df |
+ if (!(fdigests && *fdigests != '\0')) {
|
|
Paul Nasrat |
14e3df |
+ memset(t, 0, fi->digestlen);
|
|
Paul Nasrat |
14e3df |
+ t += fi->digestlen;
|
|
Paul Nasrat |
14e3df |
continue;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- for (j = 0; j < 16; j++, t++, fmd5 += 2)
|
|
Paul Nasrat |
14e3df |
- *t = (nibble(fmd5[0]) << 4) | nibble(fmd5[1]);
|
|
Paul Nasrat |
14e3df |
+ for (j = 0; j < fi->digestlen; j++, t++, fdigests += 2)
|
|
Paul Nasrat |
14e3df |
+ *t = (nibble(fdigests[0]) << 4) | nibble(fdigests[1]);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
- fi->fmd5s = hfd(fi->fmd5s, -1);
|
|
Paul Nasrat |
14e3df |
+ fi->fdigests = hfd(fi->fdigests, -1);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/* XXX TR_REMOVED doesn;t need fmtimes, frdevs, finodes, or fcontexts */
|
|
Paul Nasrat |
14e3df |
@@ -1401,7 +1459,7 @@
|
|
Paul Nasrat |
14e3df |
/* XXX DYING */
|
|
Paul Nasrat |
14e3df |
if (fi->actions == NULL)
|
|
Paul Nasrat |
14e3df |
fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
|
|
Paul Nasrat |
14e3df |
- /*@-compdef@*/ /* FIX: fi-md5s undefined */
|
|
Paul Nasrat |
14e3df |
+ /*@-compdef@*/ /* FIX: fi->digests undefined */
|
|
Paul Nasrat |
14e3df |
foo = relocateFileList(ts, fi, h, fi->actions);
|
|
Paul Nasrat |
14e3df |
/*@=compdef@*/
|
|
Paul Nasrat |
14e3df |
fi->h = headerFree(fi->h);
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/rpmcli.h.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/rpmcli.h 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -83,7 +83,7 @@
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
#define RPMCLI_POPT_NODEPS -1025
|
|
Paul Nasrat |
14e3df |
#define RPMCLI_POPT_FORCE -1026
|
|
Paul Nasrat |
14e3df |
-#define RPMCLI_POPT_NOMD5 -1027
|
|
Paul Nasrat |
14e3df |
+#define RPMCLI_POPT_NOFDIGESTS -1027
|
|
Paul Nasrat |
14e3df |
#define RPMCLI_POPT_NOSCRIPTS -1028
|
|
Paul Nasrat |
14e3df |
#define RPMCLI_POPT_NOSIGNATURE -1029
|
|
Paul Nasrat |
14e3df |
#define RPMCLI_POPT_NODIGEST -1030
|
|
Paul Nasrat |
14e3df |
@@ -111,7 +111,7 @@
|
|
Paul Nasrat |
14e3df |
RPMQV_SPECFILE, /*!< ... from spec file parse (query only). */
|
|
Paul Nasrat |
14e3df |
RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */
|
|
Paul Nasrat |
14e3df |
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */
|
|
Paul Nasrat |
14e3df |
- RPMQV_FILEID, /*!< ... from file id (file MD5). */
|
|
Paul Nasrat |
14e3df |
+ RPMQV_FILEID, /*!< ... from file id (file digest, usually MD5). */
|
|
Paul Nasrat |
14e3df |
RPMQV_TID, /*!< ... from install transaction id (time stamp). */
|
|
Paul Nasrat |
14e3df |
RPMQV_HDLIST, /*!< ... from system hdlist. */
|
|
Paul Nasrat |
14e3df |
RPMQV_FTSWALK /*!< ... from fts(3) walk. */
|
|
Paul Nasrat |
14e3df |
@@ -122,7 +122,7 @@
|
|
Paul Nasrat |
14e3df |
*/
|
|
Paul Nasrat |
14e3df |
typedef enum rpmVerifyAttrs_e {
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_NONE = 0, /*!< */
|
|
Paul Nasrat |
14e3df |
- RPMVERIFY_MD5 = (1 << 0), /*!< from %verify(md5) */
|
|
Paul Nasrat |
14e3df |
+ RPMVERIFY_FDIGEST = (1 << 0), /*!< from %verify(digest) */
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_FILESIZE = (1 << 1), /*!< from %verify(size) */
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LINKTO = (1 << 2), /*!< from %verify(link) */
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_USER = (1 << 3), /*!< from %verify(user) */
|
|
Paul Nasrat |
14e3df |
@@ -139,6 +139,7 @@
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LSTATFAIL = (1 << 30), /*!< lstat failed */
|
|
Paul Nasrat |
14e3df |
RPMVERIFY_LGETFILECONFAIL = (1 << 31) /*!< lgetfilecon failed */
|
|
Paul Nasrat |
14e3df |
} rpmVerifyAttrs;
|
|
Paul Nasrat |
14e3df |
+#define RPMVERIFY_MD5 RPMVERIFY_FDIGEST
|
|
Paul Nasrat |
14e3df |
#define RPMVERIFY_ALL ~(RPMVERIFY_NONE)
|
|
Paul Nasrat |
14e3df |
#define RPMVERIFY_FAILURES \
|
|
Paul Nasrat |
14e3df |
(RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL|RPMVERIFY_LGETFILECONFAIL)
|
|
Paul Nasrat |
14e3df |
@@ -150,7 +151,7 @@
|
|
Paul Nasrat |
14e3df |
typedef enum rpmQueryFlags_e {
|
|
Paul Nasrat |
14e3df |
/*@-enummemuse@*/
|
|
Paul Nasrat |
14e3df |
QUERY_FOR_DEFAULT = 0, /*!< */
|
|
Paul Nasrat |
14e3df |
- QUERY_MD5 = (1 << 0), /*!< from --nomd5 */
|
|
Paul Nasrat |
14e3df |
+ QUERY_FDIGEST = (1 << 0), /*!< from --nofdigest */
|
|
Paul Nasrat |
14e3df |
QUERY_SIZE = (1 << 1), /*!< from --nosize */
|
|
Paul Nasrat |
14e3df |
QUERY_LINKTO = (1 << 2), /*!< from --nolink */
|
|
Paul Nasrat |
14e3df |
QUERY_USER = (1 << 3), /*!< from --nouser) */
|
|
Paul Nasrat |
14e3df |
@@ -193,7 +194,7 @@
|
|
Paul Nasrat |
14e3df |
/*@-enummemuse@*/
|
|
Paul Nasrat |
14e3df |
VERIFY_DEFAULT = 0, /*!< */
|
|
Paul Nasrat |
14e3df |
/*@=enummemuse@*/
|
|
Paul Nasrat |
14e3df |
- VERIFY_MD5 = (1 << 0), /*!< from --nomd5 */
|
|
Paul Nasrat |
14e3df |
+ VERIFY_FDIGEST = (1 << 0), /*!< from --nofdigest */
|
|
Paul Nasrat |
14e3df |
VERIFY_SIZE = (1 << 1), /*!< from --nosize */
|
|
Paul Nasrat |
14e3df |
VERIFY_LINKTO = (1 << 2), /*!< from --nolinkto */
|
|
Paul Nasrat |
14e3df |
VERIFY_USER = (1 << 3), /*!< from --nouser */
|
|
Paul Nasrat |
14e3df |
@@ -221,7 +222,7 @@
|
|
Paul Nasrat |
14e3df |
} rpmVerifyFlags;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
#define VERIFY_ATTRS \
|
|
Paul Nasrat |
14e3df |
- ( VERIFY_MD5 | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
|
|
Paul Nasrat |
14e3df |
+ ( VERIFY_FDIGEST | VERIFY_SIZE | VERIFY_LINKTO | VERIFY_USER | VERIFY_GROUP | \
|
|
Paul Nasrat |
14e3df |
VERIFY_MTIME | VERIFY_MODE | VERIFY_RDEV | VERIFY_CONTEXTS )
|
|
Paul Nasrat |
14e3df |
#define VERIFY_ALL \
|
|
Paul Nasrat |
14e3df |
( VERIFY_ATTRS | VERIFY_FILES | VERIFY_DEPS | VERIFY_SCRIPT | VERIFY_DIGEST |\
|
|
Paul Nasrat |
14e3df |
@@ -404,7 +405,7 @@
|
|
Paul Nasrat |
14e3df |
fileSystem, internalState @*/;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/** \ingroup rpmcli
|
|
Paul Nasrat |
14e3df |
- * Verify file attributes (including MD5 sum).
|
|
Paul Nasrat |
14e3df |
+ * Verify file attributes (including file digest).
|
|
Paul Nasrat |
14e3df |
* @todo gnorpm and python bindings prevent this from being static.
|
|
Paul Nasrat |
14e3df |
* @param ts transaction set
|
|
Paul Nasrat |
14e3df |
* @param fi file info (with linked header and current file index)
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/fsm.h.digests 2003-12-25 18:00:45.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/fsm.h 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -181,14 +181,16 @@
|
|
Paul Nasrat |
14e3df |
int rc; /*!< External file stage return code. */
|
|
Paul Nasrat |
14e3df |
int commit; /*!< Commit synchronously? */
|
|
Paul Nasrat |
14e3df |
cpioMapFlags mapFlags; /*!< Bit(s) to control mapping. */
|
|
Paul Nasrat |
14e3df |
+ int fdigestalgo; /*!< Digest algorithm (~= PGPHASHALGO_MD5) */
|
|
Paul Nasrat |
14e3df |
+ int digestlen; /*!< No. of bytes in binary digest (~= 16) */
|
|
Paul Nasrat |
14e3df |
/*@shared@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
const char * dirName; /*!< File directory name. */
|
|
Paul Nasrat |
14e3df |
/*@shared@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
const char * baseName; /*!< File base name. */
|
|
Paul Nasrat |
14e3df |
/*@shared@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
- const char * fmd5sum; /*!< Hex MD5 sum (NULL disables). */
|
|
Paul Nasrat |
14e3df |
+ const char * fdigest; /*!< Hex digest (usually MD5, NULL disables). */
|
|
Paul Nasrat |
14e3df |
/*@shared@*/ /*@relnull@*/
|
|
Paul Nasrat |
14e3df |
- const char * md5sum; /*!< Binary MD5 sum (NULL disables). */
|
|
Paul Nasrat |
14e3df |
+ const char * digest; /*!< Bin digest (usually MD5, NULL disables). */
|
|
Paul Nasrat |
14e3df |
/*@dependent@*/ /*@observer@*/ /*@null@*/
|
|
Paul Nasrat |
14e3df |
const char * fcontext; /*!< File security context (NULL disables). */
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/poptQV.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/poptQV.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -222,8 +222,8 @@
|
|
Paul Nasrat |
14e3df |
qva->qva_flags |= VERIFY_DEPS;
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- case RPMCLI_POPT_NOMD5:
|
|
Paul Nasrat |
14e3df |
- qva->qva_flags |= VERIFY_MD5;
|
|
Paul Nasrat |
14e3df |
+ case RPMCLI_POPT_NOFDIGESTS:
|
|
Paul Nasrat |
14e3df |
+ qva->qva_flags |= VERIFY_FDIGEST;
|
|
Paul Nasrat |
14e3df |
break;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
case RPMCLI_POPT_NOCONTEXTS:
|
|
Paul Nasrat |
14e3df |
@@ -315,11 +315,13 @@
|
|
Paul Nasrat |
14e3df |
/* Duplicate file verify flags from packages into command line options. */
|
|
Paul Nasrat |
14e3df |
/** @todo Add --nomd5 alias to rpmpopt, eliminate. */
|
|
Paul Nasrat |
14e3df |
#ifdef DYING
|
|
Paul Nasrat |
14e3df |
- { "nomd5", '\0', POPT_BIT_SET, &rpmQVKArgs.qva_flags, VERIFY_MD5,
|
|
Paul Nasrat |
14e3df |
- N_("don't verify MD5 digest of files"), NULL },
|
|
Paul Nasrat |
14e3df |
+ { "nomd5", '\0', POPT_BIT_SET, &rpmQVKArgs.qva_flags, VERIFY_FDIGEST,
|
|
Paul Nasrat |
14e3df |
+ N_("don't verify file digests"), NULL },
|
|
Paul Nasrat |
14e3df |
#else
|
|
Paul Nasrat |
14e3df |
- { "nomd5", '\0', 0, NULL, RPMCLI_POPT_NOMD5,
|
|
Paul Nasrat |
14e3df |
- N_("don't verify MD5 digest of files"), NULL },
|
|
Paul Nasrat |
14e3df |
+ { "nomd5", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL, RPMCLI_POPT_NOFDIGESTS,
|
|
Paul Nasrat |
14e3df |
+ N_("don't verify file digests"), NULL },
|
|
Paul Nasrat |
14e3df |
+ { "nofdigests", '\0', 0, NULL, RPMCLI_POPT_NOFDIGESTS,
|
|
Paul Nasrat |
14e3df |
+ N_("don't verify file digests"), NULL },
|
|
Paul Nasrat |
14e3df |
#endif
|
|
Paul Nasrat |
14e3df |
{ "nosize", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
|
|
Paul Nasrat |
14e3df |
&rpmQVKArgs.qva_flags, VERIFY_SIZE,
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/psm.c.digests 2005-07-13 07:13:34.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/psm.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -321,9 +321,6 @@
|
|
Paul Nasrat |
14e3df |
*cookie = xstrdup(*cookie);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- /* XXX FIXME: can't do endian neutral MD5 verification yet. */
|
|
Paul Nasrat |
14e3df |
-/*@i@*/ fi->fmd5s = hfd(fi->fmd5s, -1);
|
|
Paul Nasrat |
14e3df |
-
|
|
Paul Nasrat |
14e3df |
/* XXX FIXME: don't do per-file mapping, force global flags. */
|
|
Paul Nasrat |
14e3df |
fi->fmapflags = _free(fi->fmapflags);
|
|
Paul Nasrat |
14e3df |
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/rpmlib.h.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/rpmlib.h 2006-07-05 14:34:53.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -304,7 +304,8 @@
|
|
Paul Nasrat |
14e3df |
RPMTAG_FILEGIDS = 1032, /*!< internal */
|
|
Paul Nasrat |
14e3df |
RPMTAG_FILERDEVS = 1033, /* h */
|
|
Paul Nasrat |
14e3df |
RPMTAG_FILEMTIMES = 1034, /* i */
|
|
Paul Nasrat |
14e3df |
- RPMTAG_FILEMD5S = 1035, /* s[] */
|
|
Paul Nasrat |
14e3df |
+ RPMTAG_FILEDIGESTS = 1035, /* s[] */
|
|
Paul Nasrat |
14e3df |
+#define RPMTAG_FILEMD5S RPMTAG_FILEDIGESTS /* s[] */
|
|
Paul Nasrat |
14e3df |
RPMTAG_FILELINKTOS = 1036, /* s[] */
|
|
Paul Nasrat |
14e3df |
RPMTAG_FILEFLAGS = 1037, /* i */
|
|
Paul Nasrat |
14e3df |
/*@-enummemuse@*/
|
|
Paul Nasrat |
14e3df |
@@ -447,6 +448,8 @@
|
|
Paul Nasrat |
14e3df |
RPMTAG_PRIORITY = 1162, /* i extension placeholder */
|
|
Paul Nasrat |
14e3df |
RPMTAG_CVSID = 1163, /* s */
|
|
Paul Nasrat |
14e3df |
#define RPMTAG_SVNID RPMTAG_CVSID /* s */
|
|
Paul Nasrat |
14e3df |
+ RPMTAG_FILEDIGESTALGOS = 1177, /*!< i[] */
|
|
Paul Nasrat |
14e3df |
+
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/*@-enummemuse@*/
|
|
Paul Nasrat |
14e3df |
RPMTAG_FIRSTFREE_TAG /*!< internal */
|
|
Paul Nasrat |
14e3df |
@@ -997,7 +1000,7 @@
|
|
Paul Nasrat |
14e3df |
RPMTRANS_FLAG_APPLYONLY = (1 << 25),
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
RPMTRANS_FLAG_ANACONDA = (1 << 26), /*!< from --anaconda */
|
|
Paul Nasrat |
14e3df |
- RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */
|
|
Paul Nasrat |
14e3df |
+ RPMTRANS_FLAG_NOFDIGESTS = (1 << 27), /*!< from --nomd5 */
|
|
Paul Nasrat |
14e3df |
RPMTRANS_FLAG_NOSUGGEST = (1 << 28), /*!< from --nosuggest */
|
|
Paul Nasrat |
14e3df |
RPMTRANS_FLAG_ADDINDEPS = (1 << 29), /*!< from --aid */
|
|
Paul Nasrat |
14e3df |
RPMTRANS_FLAG_NOCONFIGS = (1 << 30), /*!< from --noconfigs */
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/query.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/query.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -528,7 +528,7 @@
|
|
Paul Nasrat |
14e3df |
for (i = 0, t = MD5, s = arg; i < 16; i++, t++, s += 2)
|
|
Paul Nasrat |
14e3df |
*t = (nibble(s[0]) << 4) | nibble(s[1]);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
- qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_FILEMD5S, MD5, sizeof(MD5));
|
|
Paul Nasrat |
14e3df |
+ qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_FILEDIGESTS, MD5, sizeof(MD5));
|
|
Paul Nasrat |
14e3df |
if (qva->qva_mi == NULL) {
|
|
Paul Nasrat |
14e3df |
rpmError(RPMERR_QUERYINFO, _("no package matches %s: %s\n"),
|
|
Paul Nasrat |
14e3df |
"fileid", arg);
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/lib/transaction.c.digests 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/lib/transaction.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -27,7 +27,7 @@
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
#include "cpio.h"
|
|
Paul Nasrat |
14e3df |
#include "fprint.h"
|
|
Paul Nasrat |
14e3df |
-#include "legacy.h" /* XXX domd5 */
|
|
Paul Nasrat |
14e3df |
+#include "legacy.h" /* XXX dodigest */
|
|
Paul Nasrat |
14e3df |
#include "misc.h" /* XXX stripTrailingChar, splitString, currentDirectory */
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
#include "debug.h"
|
|
Paul Nasrat |
14e3df |
@@ -641,14 +641,21 @@
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
/* Here is a pre-existing modified config file that needs saving. */
|
|
Paul Nasrat |
14e3df |
- /* XXX avoid md5 on sparse /var/log/lastlog file. */
|
|
Paul Nasrat |
14e3df |
+ /* XXX avoid digest on sparse /var/log/lastlog file. */
|
|
Paul Nasrat |
14e3df |
if (strcmp(fn, "/var/log/lastlog"))
|
|
Paul Nasrat |
14e3df |
- { char md5sum[50];
|
|
Paul Nasrat |
14e3df |
- const unsigned char * MD5 = rpmfiMD5(fi);
|
|
Paul Nasrat |
14e3df |
- if (!domd5(fn, md5sum, 0, NULL) && memcmp(MD5, md5sum, 16)) {
|
|
Paul Nasrat |
14e3df |
- fi->actions[i] = FA_BACKUP;
|
|
Paul Nasrat |
14e3df |
+ { int dalgo = 0;
|
|
Paul Nasrat |
14e3df |
+ size_t dlen = 0;
|
|
Paul Nasrat |
14e3df |
+ const unsigned char * digest = rpmfiDigest(fi, &dalgo, &dlen);
|
|
Paul Nasrat |
14e3df |
+ unsigned char * fdigest;
|
|
Paul Nasrat |
14e3df |
+assert(digest != NULL);
|
|
Paul Nasrat |
14e3df |
+ fdigest = xcalloc(1, dlen);
|
|
Paul Nasrat |
14e3df |
+ if (!dodigest(dalgo, fn, fdigest, 0, NULL)) {
|
|
Paul Nasrat |
14e3df |
+ if (memcmp(digest, fdigest, dlen))
|
|
Paul Nasrat |
14e3df |
+ fi->actions[i] = FA_BACKUP;
|
|
Paul Nasrat |
14e3df |
+ fdigest = _free(fdigest);
|
|
Paul Nasrat |
14e3df |
/*@switchbreak@*/ break;
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
+ fdigest = _free(fdigest);
|
|
Paul Nasrat |
14e3df |
}
|
|
Paul Nasrat |
14e3df |
fi->actions[i] = FA_ERASE;
|
|
Paul Nasrat |
14e3df |
/*@switchbreak@*/ break;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/rpmio/tdigest.c.digests 2003-03-28 17:47:18.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/rpmio/tdigest.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -18,6 +18,9 @@
|
|
Paul Nasrat |
14e3df |
static struct poptOption optionsTable[] = {
|
|
Paul Nasrat |
14e3df |
{ "md5", '\0', POPT_ARG_VAL, &hashalgo, PGPHASHALGO_MD5, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
{ "sha1",'\0', POPT_ARG_VAL, &hashalgo, PGPHASHALGO_SHA1, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
+ { "sha256",'\0', POPT_ARG_VAL, &hashalgo, PGPHASHALGO_SHA256, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
+ { "sha384",'\0', POPT_ARG_VAL, &hashalgo, PGPHASHALGO_SHA384, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
+ { "sha512",'\0', POPT_ARG_VAL, &hashalgo, PGPHASHALGO_SHA512, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
#ifdef DYING
|
|
Paul Nasrat |
14e3df |
{ "reverse",'\0', POPT_BIT_SET, &flags, RPMDIGEST_REVERSE, NULL, NULL },
|
|
Paul Nasrat |
14e3df |
#endif
|
|
Paul Nasrat |
14e3df |
@@ -145,6 +148,7 @@
|
|
Paul Nasrat |
14e3df |
ssize_t nb;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
sdigest = NULL;
|
|
Paul Nasrat |
14e3df |
+ if (hashalgo == PGPHASHALGO_MD5 || hashalgo == PGPHASHALGO_SHA1)
|
|
Paul Nasrat |
14e3df |
{ char *se;
|
|
Paul Nasrat |
14e3df |
FILE * sfp;
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/rpmqv.c.digests 2006-07-05 14:35:11.000000000 -0400
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/rpmqv.c 2006-07-05 14:36:10.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -742,7 +742,7 @@
|
|
Paul Nasrat |
14e3df |
if (!poptPeekArg(optCon)) {
|
|
Paul Nasrat |
14e3df |
if (ia->rbtid == 0)
|
|
Paul Nasrat |
14e3df |
argerror(_("no packages given for erase"));
|
|
Paul Nasrat |
14e3df |
-ia->transFlags |= RPMTRANS_FLAG_NOMD5;
|
|
Paul Nasrat |
14e3df |
+ia->transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
|
|
Paul Nasrat |
14e3df |
ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
|
|
Paul Nasrat |
14e3df |
ec += rpmRollback(ts, ia, NULL);
|
|
Paul Nasrat |
14e3df |
} else {
|
|
Paul Nasrat |
14e3df |
@@ -782,7 +782,7 @@
|
|
Paul Nasrat |
14e3df |
if (!poptPeekArg(optCon)) {
|
|
Paul Nasrat |
14e3df |
if (ia->rbtid == 0)
|
|
Paul Nasrat |
14e3df |
argerror(_("no packages given for install"));
|
|
Paul Nasrat |
14e3df |
-ia->transFlags |= RPMTRANS_FLAG_NOMD5;
|
|
Paul Nasrat |
14e3df |
+ia->transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
|
|
Paul Nasrat |
14e3df |
ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
|
|
Paul Nasrat |
14e3df |
/*@i@*/ ec += rpmRollback(ts, ia, NULL);
|
|
Paul Nasrat |
14e3df |
} else {
|
|
Paul Nasrat |
14e3df |
@@ -821,7 +821,7 @@
|
|
Paul Nasrat |
14e3df |
#ifdef IAM_RPMK
|
|
Paul Nasrat |
14e3df |
case MODE_CHECKSIG:
|
|
Paul Nasrat |
14e3df |
{ rpmVerifyFlags verifyFlags =
|
|
Paul Nasrat |
14e3df |
- (VERIFY_MD5|VERIFY_DIGEST|VERIFY_SIGNATURE);
|
|
Paul Nasrat |
14e3df |
+ (VERIFY_FDIGEST|VERIFY_HDRCHK|VERIFY_DIGEST|VERIFY_SIGNATURE);
|
|
Paul Nasrat |
14e3df |
|
|
Paul Nasrat |
14e3df |
verifyFlags &= ~ka->qva_flags;
|
|
Paul Nasrat |
14e3df |
ka->qva_flags = (rpmQueryFlags) verifyFlags;
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/python/rpmmodule.c.digests 2005-03-07 07:35:04.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/python/rpmmodule.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -376,7 +376,7 @@
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_NOPOSTUN);
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_NOTRIGGERPOSTUN);
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_ANACONDA);
|
|
Paul Nasrat |
14e3df |
- REGISTER_ENUM(RPMTRANS_FLAG_NOMD5);
|
|
Paul Nasrat |
14e3df |
+ REGISTER_ENUM(RPMTRANS_FLAG_NOFDIGESTS);
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_NOSUGGEST);
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_ADDINDEPS);
|
|
Paul Nasrat |
14e3df |
REGISTER_ENUM(RPMTRANS_FLAG_NOCONFIGS);
|
|
Paul Nasrat |
14e3df |
--- rpm-4.4.2/python/rpmts-py.c.digests 2005-02-12 22:12:07.000000000 -0500
|
|
Paul Nasrat |
14e3df |
+++ rpm-4.4.2/python/rpmts-py.c 2006-07-05 14:18:15.000000000 -0400
|
|
Paul Nasrat |
14e3df |
@@ -635,7 +635,7 @@
|
|
Paul Nasrat |
14e3df |
memset(ia, 0, sizeof(*ia));
|
|
Paul Nasrat |
14e3df |
ia->qva_flags = (VERIFY_DIGEST|VERIFY_SIGNATURE|VERIFY_HDRCHK);
|
|
Paul Nasrat |
14e3df |
ia->transFlags |= (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL);
|
|
Paul Nasrat |
14e3df |
- ia->transFlags |= RPMTRANS_FLAG_NOMD5;
|
|
Paul Nasrat |
14e3df |
+ ia->transFlags |= RPMTRANS_FLAG_NOFDIGESTS;
|
|
Paul Nasrat |
14e3df |
ia->installInterfaceFlags = (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL);
|
|
Paul Nasrat |
14e3df |
ia->rbtid = rbtid;
|
|
Paul Nasrat |
14e3df |
ia->relocations = NULL;
|