summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-11-02 10:11:54 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-11-02 10:11:54 +0200
commit524262f6f83cc98407597b35924aff7eba3a754c (patch)
tree98328866461eb93fbe19b0af3cb4426446fb0c2c
parent8afe81c21445f96e4f5430b05304242c958a9ad0 (diff)
downloadrpm-524262f6f83cc98407597b35924aff7eba3a754c.tar.gz
rpm-524262f6f83cc98407597b35924aff7eba3a754c.tar.bz2
rpm-524262f6f83cc98407597b35924aff7eba3a754c.zip
Resurrect tax from NSS switchover
-rw-r--r--rpmio/tax.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/rpmio/tax.c b/rpmio/tax.c
index 474cf17e5..5c55957b8 100644
--- a/rpmio/tax.c
+++ b/rpmio/tax.c
@@ -1,5 +1,6 @@
#include "system.h"
+#include "rpmpgp.h"
#include "base64.h"
#include <popt.h>
@@ -31,43 +32,6 @@ AjjDx3lJnQBXUDmxM484YXLXZjWFXCiY8GJt6whjf7/2c3rIoT3Z7PQpEvPmM\
1MXU9cv4NL59Y/q0OAVQ38foOz7eGAhfvjOsCnHU25aik7/7ToIYt1tyVtap/kA==\
";
-/**
- * Convert to hex.
- * @param t target buffer (returned)
- * @param s source bytes
- * @param nbytes no. of bytes
- * @return target buffer
- */
-static inline
-char * pgpHexCvt(char *t, const byte *s, int nbytes)
-{
- static char hex[] = "0123456789abcdef";
- while (nbytes-- > 0) {
- unsigned int i;
- i = *s++;
- *t++ = hex[ (i >> 4) & 0xf ];
- *t++ = hex[ (i ) & 0xf ];
- }
- *t = '\0';
- return t;
-}
-
-/**
- * Return hex formatted representation of bytes.
- * @todo Remove static buffer.
- * @param p bytes
- * @param plen no. of bytes
- * @return hex formatted string
- */
-static inline
-char * pgpHexStr(const byte *p, unsigned int plen)
-{
- static char prbuf[2048];
- char *t = prbuf;
- t = pgpHexCvt(t, p, plen);
- return prbuf;
-}
-
static int doit(const char * msg, const char * sig)
{
unsigned char * dec;
@@ -79,7 +43,7 @@ static int doit(const char * msg, const char * sig)
return rc;
}
- fprintf(stderr, "*** %p[%d] %s\n", dec, declen, msg);
+ fprintf(stderr, "*** %p[%zd] %s\n", dec, declen, msg);
if (declen == 256) {
fprintf(stderr, "%s\n", pgpHexStr(dec, declen/2));
fprintf(stderr, "%s\n", pgpHexStr(dec+declen/2, declen/2));
@@ -99,4 +63,5 @@ main (int argc, char *argv[])
doit("rsaaeskey", rsaaeskey);
doit("aesiv", aesiv);
doit("appleresponse", appleresponse);
+ return 0;
}