summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-10-05 20:39:50 +0000
committerjbj <devnull@localhost>2001-10-05 20:39:50 +0000
commit71dff1a731923b405a9a189cb087f7fe5e013290 (patch)
tree7a5f33afe64e021ba26081c5fdafd0af24a342c8 /rpmio
parent726fff1bd1dc3f74a1f4b7f900c1075b6f32ca31 (diff)
downloadrpm-71dff1a731923b405a9a189cb087f7fe5e013290.tar.gz
rpm-71dff1a731923b405a9a189cb087f7fe5e013290.tar.bz2
rpm-71dff1a731923b405a9a189cb087f7fe5e013290.zip
- proof-of-concept GPG/DSA verification for legacy signatures.
CVS patchset: 5097 CVS date: 2001/10/05 20:39:50
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/digest.c8
-rw-r--r--rpmio/rpmio_internal.h18
-rw-r--r--rpmio/rpmpgp.c8
-rw-r--r--rpmio/rpmpgp.h12
4 files changed, 36 insertions, 10 deletions
diff --git a/rpmio/digest.c b/rpmio/digest.c
index 13a3b9236..6fcf1f512 100644
--- a/rpmio/digest.c
+++ b/rpmio/digest.c
@@ -35,6 +35,14 @@ struct DIGEST_CTX_s {
};
DIGEST_CTX
+rpmDigestDup(DIGEST_CTX octx)
+{
+ DIGEST_CTX nctx = xcalloc(1, sizeof(*nctx));
+ memcpy(nctx, octx, sizeof(*nctx));
+ return nctx;
+}
+
+DIGEST_CTX
rpmDigestInit(rpmDigestFlags flags)
{
DIGEST_CTX ctx = xcalloc(1, sizeof(*ctx));
diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h
index 766caa706..ee95f7f0a 100644
--- a/rpmio/rpmio_internal.h
+++ b/rpmio/rpmio_internal.h
@@ -63,17 +63,27 @@ typedef enum rpmDigestFlags_e {
typedef /*@abstract@*/ struct DIGEST_CTX_s * DIGEST_CTX;
/** \ingroup rpmio
+ * Duplicate a digest context.
+ * @param ctx existing digest context
+ * @return duplicated digest context
+ */
+/*@only@*/
+DIGEST_CTX rpmDigestDup(DIGEST_CTX octx)
+ /*@*/;
+
+/** \ingroup rpmio
* Initialize digest.
* Set bit count to 0 and buffer to mysterious initialization constants.
* @param flags bit(s) to control digest operation
- * @return digest private data
+ * @return digest context
*/
+/*@only@*/
DIGEST_CTX rpmDigestInit(rpmDigestFlags flags)
/*@*/;
/** \ingroup rpmio
- * Update context to with next plain text buffer.
- * @param private private data
+ * Update context with next plain text buffer.
+ * @param ctx digest context
* @param data next data buffer
* @param len no. bytes of data
*/
@@ -85,7 +95,7 @@ void rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*
- * @param private private data
+ * @param ctx digest context
* @retval datap address of returned digest
* @retval lenp address of digest length
* @param asAscii return digest as ascii string?
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index eeec3a786..83ce53458 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -9,7 +9,7 @@
static int _debug = 0;
static int _print = 0;
-static struct pgpSig_s * _dig = NULL;
+/*@null@*/ static struct pgpSig_s * _dig = NULL;
/*@-readonlytrans@*/
/* This is the unarmored RPM-GPG-KEY public key. */
@@ -256,6 +256,7 @@ void pgpPrtVal(const char * pre, pgpValTbl vs, byte val)
fprintf(stderr, "%s(%u)", pgpValStr(vs, val), (unsigned)val);
}
+/*@-varuse -readonlytrans @*/
static const char * pgpSigRSA[] = {
" m**d =",
NULL,
@@ -266,6 +267,7 @@ static const char * pgpSigDSA[] = {
" s =",
NULL,
};
+/*@=varuse =readonlytrans @*/
int pgpPrtPktSigV3(pgpPkt pkt, const byte *h, unsigned int hlen)
{
@@ -515,6 +517,7 @@ int pgpPrtPktSig(pgpPkt pkt, const byte *h, unsigned int hlen)
return 0;
}
+/*@-varuse -readonlytrans @*/
static const char * pgpPublicRSA[] = {
" n =",
" e =",
@@ -553,6 +556,7 @@ static const char * pgpSecretELGAMAL[] = {
" x =",
NULL,
};
+/*@=varuse =readonlytrans @*/
int pgpPrtKeyV3(pgpPkt pkt, const byte *h, unsigned int hlen)
{
@@ -776,7 +780,7 @@ int pgpPrtUserID(pgpPkt pkt, const byte *h, unsigned int hlen)
{
pgpPrtVal("", pgpPktTbl, pkt);
if (_print)
- fprintf(stderr, " \"%.*s\"", hlen, (const char *)h);
+ fprintf(stderr, " \"%.*s\"", (int)hlen, (const char *)h);
pgpPrtNL();
return 0;
}
diff --git a/rpmio/rpmpgp.h b/rpmio/rpmpgp.h
index 51d690032..18519cb82 100644
--- a/rpmio/rpmpgp.h
+++ b/rpmio/rpmpgp.h
@@ -14,6 +14,7 @@
#include "rsapk.h"
#include "rsa.h"
#include "dsa.h"
+#include "mp32.h"
/*@-typeuse -fielduse@*/
/**
@@ -850,18 +851,21 @@ extern const char * redhatPubKeyRSA;
/**
*/
-struct pgpSig_s {
+typedef struct pgpSig_s {
union {
struct pgpPktSigV3_s v3;
struct pgpPktSigV4_s v4;
} sig;
+/*@only@*/ /*@null@*/ void * ctx;
+
int hash_datalen;
/*@only@*/ /*@null@*/ byte *hash_data;
int size; /*!< No. bytes in digest. */
/*@only@*/ /*@null@*/ void * data; /*!< Digest data. */
+
/* DSA parameters. */
mp32barrett p;
mp32barrett q;
@@ -900,8 +904,8 @@ unsigned int pgpGrab(const byte *s, int nbytes)
/**
*/
/*@unused@*/ static inline
-int pgpLen(const byte *s, unsigned int *lenp)
- /*@*/
+int pgpLen(const byte *s, /*@out@*/ unsigned int *lenp)
+ /*@modifies *lenp @*/
{
if (*s < 192) {
(*lenp) = *s++;
@@ -1046,7 +1050,6 @@ int pgpPrtKey(pgpPkt pkt, const byte *h, unsigned int hlen)
*/
int pgpPrtUserID(pgpPkt pkt, const byte *h, unsigned int hlen)
/*@modifies fileSystem @*/;
-/*@=exportlocal@*/
/**
*/
@@ -1056,6 +1059,7 @@ int pgpPrtComment(pgpPkt pkt, const byte *h, unsigned int hlen)
/**
*/
int pgpPrtPkt(const byte *p);
+/*@=exportlocal@*/
/**
*/