How SHA1 in signature header is calculated?

Max Lapshin max.lapshin at gmail.com
Thu Jan 9 11:28:50 UTC 2014


I want to pack linux 64bit rpm on macos x.  To do this I make tmproot
folder with all binaries in it and need to pack contents of this folder to
package.

There are problems building rpm4 on mac os x and rpm5 is not compatible
with rpm4 specs, so I'm writing right now implementation of simple rpm
packer:  directory -> rpm.

I can pack lead, signature (with 4 bytes padding), header, but I have
several problems later:

1) how do I need to calculate sha1 header in signature?  md5 is calculated
from header+cpio_payload, but sha1 is more complex.

If I don't put sha1 then vanilla rpm on Centos6 says that:

headerRead failed: Header sanity check: OK

When I compile rpm from source it can install package without sha1 header.


2) I'm packing files with cpio and then call xz on this cpio file, but
still rpm claims that:

unpacking of archive failed: cpio: Bad magic

it happens in fsmSetup function. This cpio.xz file is starting from
bytes: 253,55,122,88,90,0,0,10,225

Why can it be bad magic?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20140109/cfb2343a/attachment.html>


More information about the Rpm-list mailing list