diff options
-rw-r--r-- | URPM.xs | 73 |
1 files changed, 0 insertions, 73 deletions
@@ -266,79 +266,6 @@ void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int flags) /* end of incoporated rpmio_internal.h */ -static unsigned char header_magic[8] = { - 0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00 -}; -static int readFile(FD_t fd, const char * fn, pgpDig dig) -{ - unsigned char buf[4*BUFSIZ]; - ssize_t count; - int rc = 1; - int i; - - dig->nbytes = 0; - - /* Read the header from the package. */ - { Header h = headerRead(fd, HEADER_MAGIC_YES); - if (h == NULL) { - rpmError(RPMERR_FREAD, _("%s: headerRead failed\n"), fn); - goto exit; - } - - dig->nbytes += headerSizeof(h, HEADER_MAGIC_YES); - - if (headerIsEntry(h, RPMTAG_HEADERIMMUTABLE)) { - void * uh; - int_32 uht, uhc; - - if (!headerGetEntry(h, RPMTAG_HEADERIMMUTABLE, &uht, &uh, &uhc) - || uh == NULL) - { - h = headerFree(h); - rpmError(RPMERR_FREAD, _("%s: headerGetEntry failed\n"), fn); - goto exit; - } - dig->hdrsha1ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE); - (void) rpmDigestUpdate(dig->hdrsha1ctx, header_magic, sizeof(header_magic)); - (void) rpmDigestUpdate(dig->hdrsha1ctx, uh, uhc); - uh = headerFreeData(uh, uht); - } - h = headerFree(h); - } - - /* Read the payload from the package. */ - while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0) - dig->nbytes += count; - if (count < 0) { - rpmError(RPMERR_FREAD, _("%s: Fread failed: %s\n"), fn, Fstrerror(fd)); - goto exit; - } - - /* XXX Steal the digest-in-progress from the file handle. */ - for (i = fd->ndigests - 1; i >= 0; i--) { - FDDIGEST_t fddig = fd->digests + i; - if (fddig->hashctx == NULL) - continue; - if (fddig->hashalgo == PGPHASHALGO_MD5) { -assert(dig->md5ctx == NULL); - dig->md5ctx = fddig->hashctx; - fddig->hashctx = NULL; - continue; - } - if (fddig->hashalgo == PGPHASHALGO_SHA1) { -assert(dig->sha1ctx == NULL); - dig->sha1ctx = fddig->hashctx; - fddig->hashctx = NULL; - continue; - } - } - - rc = 0; - -exit: - return rc; -} - int rpmReadSignature(FD_t fd, Header *header, short sig_type, const char **msg); /* needed for importing keys (from rpmio) */ |