Commit Graph

98 Commits

Author SHA1 Message Date
Till Maas bdd4365bdf Add comments for SHA-2 file digest variants 2017-05-31 14:29:56 +03:00
Panu Matilainen 4bbeec134a Fixup ages old confusion wrt OpenPGP fingerprint vs Key ID
Originally introduced in commit f5203aea8b
in 2004, pgpPubkeyFingerprint() has been returning the 64 bits long
Key ID from the tail of 160 bits long fingerprint, not the actual
fingerprint.

Add a new public API for retrieving the Key ID specifically, adjust
the handful of internal users to use it and make pgpPubkeyFingerprint()
return the actual fingerprint. It's an API break sure but there are
unlikely to be any callers outside rpm and we're breaking the API + ABI
left and right in this release so doesn't matter...
2017-04-12 16:26:47 +03:00
Panu Matilainen c3edd8946b Remove pgpExtractPubkeyFingerprint()
The sole user within rpm was removed over six years ago, never seen
a single user outside rpm, and even then it's just a wrapper around
rpmBase64Decode() and pgpPubkeyFingerprint() with a bizarre
return code. Bye bye...
2017-04-12 14:42:23 +03:00
Panu Matilainen 67de3956ea Remove bunch of ancient OpenPGP related @todo's
Support for insecure V3 public keys was dropped six years ago, not
something todo... Also we have supported SHA256 for a good while now.
2017-04-12 14:39:13 +03:00
Panu Matilainen 6046386afd Use arbitrary ids instead of algorithm number to identify digests in bundles
Change the way individual digests within bundles are stored and accessed:
Previously the digest algo number was used directly as the index into
the bundle. Which works, but limits you to a single digest per algo,
and the array is likely to be rather sparse. To address both issues, use
an arbitrary integer ID to address the digests and always add new
digests in the first available slot. And yes the implementation is
a bit simplistic and taking some shortcuts, but so was the previous one.

Abstracting out the actual algorithm allows using eg rpm tag values
as the identifier, and also makes it possible to do multiple digests
of the same type on overlapping ranges. This is entirely backwards
compatible however if you simply use algorithm number also as the id,
so callers *need* to be updated.
2017-02-21 14:30:39 +02:00
Lubos Kardos 355c9b069f Add rpmGetSubkeys() and pgpPrtParamsSubkeys() for getting gpg subkeys.
pgpPrtParamSubkeys() parses gpg packets to get gpg subkeys parameters.
rpmGetSubkeys() uses pgpPrtParamSubkeys() and it creates rpmPubkey
objects that can be insterted into rpm keyring.
2015-07-23 10:55:03 +02:00
Lubos Kardos 168a6a2f14 Add pgpPubKeyCertLen() to get the length of the pub key certificate. 2015-07-14 09:12:48 +02:00
Ville Skyttä 8002b3f985 Spelling fixes.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-19 21:35:40 +02:00
Panu Matilainen 345a061240 Add an alternative API for parsing PGP packets
- pgpPrtParams() returns a pointer to an allocated pgpDigParams
  on success, eliminating the need for callers to worry about
  freeing "target buffer" on failure and bypassing the now rather
  useless pgpDig middleman. Also allows specifying the expected
  packet type so if we expect a key we'll error out if we get a signature
  instead.
- pgpPrtPkts() is basically just a wrapper to pgpPrtParams()
- Further pre-requisites for separating key and signature management.
- Yes, pgpPrtParams() is a stupid name for this. However all the saner
  ones are already taken for other purposes (for which the names are
  just as bad/misleading, sigh)
2011-11-09 11:54:40 +02:00
Panu Matilainen a6f25aff43 Add ad API for retrieving algorithm values from digest parameter containers
- Mildly annoying but necessary in order to make pgpDigParams properly
  opaque some day (and also allow sane access to this data)
2011-11-07 14:42:31 +02:00
Panu Matilainen 45c880304b Add an API for comparing two digest parameter containers
- Lift the digest parameter comparison from librpmsign to rpmpgp.c
  where it really belongs.
2011-11-07 13:29:29 +02:00
Panu Matilainen b04cdcb459 Add a dumb API to retrieve pubkey / signature params from pgpDig 2011-11-07 12:52:42 +02:00
Panu Matilainen dc3f313b66 Add another pgpVerify variant which takes key and sig as separate args
- pgpVerifySig() is now just a dumb wrapper around pgpVerifySignature()
  which does the real work.
- Update the sole caller to use the new interface instead, deprecate
  the old dig interface.
- First steps towards getting rig of pgpDig which always was a
  strange creature and now is nothing but a nuisance and obfuscation.
  Yes keys and signatures walk hand in hand much of the time, but
  they come from different sources and want to be handled as
  separate data really.
2011-11-07 08:05:34 +02:00
Panu Matilainen a2d14f6b65 Eliminate broken pgpLen() from the API
- pgpLen() only works for new format packets, and even for those
  its unsafe and cannot be fixed without breaking the API. Start
  by taking it behind the barn for further, err, operations. Rpm has
  no users outside rpmpgp.c now and anybody else using it will be
  better off not doing so.
2011-10-24 12:52:26 +03:00
Panu Matilainen e104b67237 Eliminate use of pgpHashAlgo in rpmio interface arguments
- While its use would seem kinda obvious here, in rpm context this
  information often comes from header tags which are plain integers
  and would require conversion/casting to the enum. What matters is
  the integral value, not it being actual enum.
2010-10-22 12:22:44 +03:00
Panu Matilainen 2fb15a5443 Stop abusing enum typedefs for bitfield types
- Enums are fine for defining the bitfield flags, but the bitfield
  itself is not an enumeration. Add a separate typedef on "rpmFlags"
  type (presenting a bitfield of flags) for all of these. Compilers
  hardly care, but the typedefs give a nice visual clue for
  us humans using these flags far away from ho^H^H definitions.
2010-09-21 11:10:14 +03:00
Jiri Kastner 20cfa7d2b4 Tell rpm about SHA-224 existence (RhBug:608599)
- Fixes "Unknown hash algorithm" message but this is cosmetic only as
  NSS doesn't currently support SHA-224.
2010-06-29 09:48:43 +03:00
Panu Matilainen 2be413810c Add public pgpValString() function + enum for the various types
- The equivalent used to be possible in 4.4.x era as the value tables
  were all exported, but this way we need to export far less
  and the implementation details stay internal.
2010-05-19 15:32:54 +03:00
Panu Matilainen 072815887f Bury struct pgpValTbl_s definition inside rpmpgp.c
- as all the value tables are static inside rpmpgp.c, exposing this
  is pointless (should've been unexported long time ago)
2010-05-19 14:59:02 +03:00
Panu Matilainen 4c8afeef14 Add an interface to parse armored OpenPGP from memory
- refactor the decoding part out of pgpReadPkts() to separate helper,
  and add pgpParsePkts() around that
2009-10-09 08:48:13 +03:00
Panu Matilainen 04ec8e9fca Couple of documentation typos 2009-05-22 13:54:08 +03:00
Panu Matilainen bdd73e4180 Push signature identification to librpmio / pgp handling
- retrieve names from pgp tables instead of manually duplicated strings
2009-03-25 16:30:20 +02:00
Panu Matilainen d65c178785 Push signature verification down to librpmio
- new pgpVerifySig() call to perform the lowlevel verify, use for
  verifying DSA/RSA signatures
- librpm is now free of NSS specifics (apart from what still leaks through
  including rpmio/digest.h), remove linkage
2009-03-25 15:16:59 +02:00
Panu Matilainen c9146aa580 Add a type + basic api for bundle of digests (on same data)
- in various places we need to calculate different digests of the same
  data, having them stored in a single container makes managing easier
- can hold as many digest types as we support
- remembers how much input data it has handled
2009-03-25 13:08:09 +02:00
Panu Matilainen 27a6edd36d Add a new legacy compatibility header, kill rpmints.h
- build-time generated rpmints.h causes issues with distcheck and is
  not really worth the trouble
- we have all sorts of legacy junk to deal with, sticking them all into
  rpmints.h would be just wrong...
2008-07-08 18:54:28 +03:00
Panu Matilainen 9594f656d4 Unexport all the umphteen pgp related tables
- nothing outside rpmpgp.c needs
2008-07-01 11:09:15 +03:00
Panu Matilainen c2efff1486 Make every pgp function not needed by other parts of rpm static 2008-07-01 11:09:15 +03:00
Panu Matilainen 2cbe2c3f5a Document rpmDigestLength() error behavior 2008-06-02 11:48:22 +03:00
Panu Matilainen c227b9ebf9 Remove some leftover doxygen @todo markers 2008-05-22 11:25:15 +03:00
Panu Matilainen b6d8ac89b8 Include stdlib.h for free() 2008-05-21 16:05:29 +03:00
Panu Matilainen 9bb88f4088 Remove static print buffer from pgpMpiStr(), return malloc'd data instead
- convert callers
- only rpmpgp.c internal needs, move it there and make static?
2008-04-07 13:37:56 +03:00
Panu Matilainen 41a32765bd Merge pgpHexCvt() into pgpHexPrt(), removing it from public headers 2008-04-07 13:29:48 +03:00
Panu Matilainen 8909c05434 Minimally convert all pgpHexCvt() users to use pgpHexStr() instead 2008-04-07 13:26:46 +03:00
Panu Matilainen a3a1a45c51 Remove static print buffer from pgpHexStr, return malloc'ed memory instead
- inlined to get xmalloc() from system.h for consistent malloc fail behavior
- convert callers for new behavior, apart from some debug fprintf()'s
2008-04-07 13:02:18 +03:00
Panu Matilainen 53bc909971 Remove bunch of double consts. What have I've been thinking? 2008-03-19 09:30:33 +02:00
Panu Matilainen 5b32005575 Further read-only tables in rpmpgp.. 2008-03-06 19:24:56 +02:00
Panu Matilainen 84ff15177d Mark various pgp value tables read-only as they should be 2008-03-06 18:56:38 +02:00
Panu Matilainen 76d8c76836 pgpHexStr() returns pointer to static buffer, return const char * 2008-01-10 13:35:03 +02:00
Panu Matilainen d4676384db Hum, NSS needs to be shut down too
- some ~80 bytes are still leaked apparently from somewhere within nss/nspr
2007-12-19 18:53:14 +02:00
Panu Matilainen acdbac335e pgpReadPkts returns malloced memory, unconstify 2007-12-16 23:05:21 +02:00
Panu Matilainen 0c8401abff Yet more type-pedantry...
- use rpm_tag_t for signature tag types too
- size_t, not rpm_count_t in signature generation
- add couple of explicit casts to rpmpgp.h to avoid spurious noise from
  inlined functions
2007-12-14 12:54:35 +02:00
Panu Matilainen c76674a257 Big bunch of int -> size_t corrections for various signature items 2007-12-13 21:18:37 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Panu Matilainen 89ecfb96d0 Include sanity
- don't pull in rpmio into rpmpgp.h
- make rpmpgp.h standalone (needs rpmints and stdio)
- rpmfileutil needs rpmio (makes sense, huh...)
2007-12-01 12:47:30 +02:00
Panu Matilainen e01888a403 rpmpgp doxygen tagging 2007-11-30 21:58:18 +02:00
Panu Matilainen a798f725eb Define and use pgpTime_t for pgp creation time(s) 2007-11-26 14:42:14 +02:00
Panu Matilainen 399dca5c05 Define and use pgpKeyID_t for pgp key id's 2007-11-26 14:19:38 +02:00
Ralf Corsépius 95c55a1af9 Type pedantery. 2007-11-26 10:53:47 +01:00
Ralf Corsépius 96e7f513cd Eliminate type "byte" 2007-11-26 10:42:39 +01:00
Panu Matilainen b32cca3480 Move pgpDig typedefs to a more obvious place.. 2007-11-22 14:48:07 +02:00