summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-11-15 20:38:58 +0000
committerjbj <devnull@localhost>2000-11-15 20:38:58 +0000
commit2d09e6c9da6ff24bcffb837ea2f88e92f75d63d4 (patch)
tree57b758a4502f600421f3dd66d5ae4d988d7b9c6b
parent4718cca58c9befe4041c054e819ec917592d40ef (diff)
downloadlibrpm-tizen-2d09e6c9da6ff24bcffb837ea2f88e92f75d63d4.tar.gz
librpm-tizen-2d09e6c9da6ff24bcffb837ea2f88e92f75d63d4.tar.bz2
librpm-tizen-2d09e6c9da6ff24bcffb837ea2f88e92f75d63d4.zip
Sanity.
CVS patchset: 4276 CVS date: 2000/11/15 20:38:58
-rw-r--r--lib/header.h44
-rw-r--r--lib/rpmchecksig.c2
-rw-r--r--lib/signature.c24
3 files changed, 46 insertions, 24 deletions
diff --git a/lib/header.h b/lib/header.h
index bc851d6c0..ab78b128b 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -499,29 +499,49 @@ void headerCopyTags(Header headerFrom, Header headerTo, int_32 *tagstocopy)
/*@modifies headerFrom, headerTo @*/;
/** \ingroup header
- * @todo Add RPM_XREF_TYPE to carry (hdrNum,tagNum,valNum) cross reference.
+ * The basic types of data in tags from headers.
*/
typedef enum rpmTagType_e {
#define RPM_MIN_TYPE 0
- RPM_NULL_TYPE = 0,
- RPM_CHAR_TYPE = 1,
- RPM_INT8_TYPE = 2,
- RPM_INT16_TYPE = 3,
- RPM_INT32_TYPE = 4,
-/* RPM_INT64_TYPE = 5, ---- These aren't supported (yet) */
- RPM_STRING_TYPE = 6,
- RPM_BIN_TYPE = 7,
- RPM_STRING_ARRAY_TYPE = 8,
- RPM_I18NSTRING_TYPE = 9
+ RPM_NULL_TYPE = 0,
+ RPM_CHAR_TYPE = 1,
+ RPM_INT8_TYPE = 2,
+ RPM_INT16_TYPE = 3,
+ RPM_INT32_TYPE = 4,
+/* RPM_INT64_TYPE = 5, ---- These aren't supported (yet) */
+ RPM_STRING_TYPE = 6,
+ RPM_BIN_TYPE = 7,
+ RPM_STRING_ARRAY_TYPE = 8,
+ RPM_I18NSTRING_TYPE = 9
#define RPM_MAX_TYPE 9
} rpmTagType;
+/** \ingroup header
+ * New rpm data types under consideration/development.
+ * These data types may (or may not) be added to rpm at some point. In order
+ * to avoid incompatibility with legacy versions of rpm, these data (sub-)types
+ * are introduced into the header by overloading RPM_BIN_TYPE, with the binary
+ * value of the tag a 16 byte image of what should/will be in the header index,
+ * followed by per-tag private data.
+ */
+typedef enum rpmSubTagType_e {
+ RPM_REGION_TYPE = -10,
+ RPM_BIN_ARRAY_TYPE = -11,
+ /*!<@todo Implement, kinda like RPM_STRING_ARRAY_TYPE for known (but variable)
+ length binary data. */
+ RPM_XREF_TYPE = -12
+ /*!<@todo Implement, intent is to to carry a (???,tagNum,valNum) cross
+ reference to retrieve data from other tags. */
+} rpmSubTagType;
/**
* Header private tags.
* @note General use tags should start at 1000 (RPM's tag space starts there).
*/
-#define HEADER_IMAGE 90
+#define HEADER_IMAGE 61
+#define HEADER_SIGNATURES 62
+#define HEADER_IMMUTABLE 63
+#define HEADER_REGIONS 64
#define HEADER_I18NTABLE 100
#ifdef __cplusplus
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index b255fecbc..660d40a53 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -235,7 +235,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
Header sig;
HeaderIterator sigIter;
int_32 tag, type, count;
- void *ptr;
+ const void * ptr;
int res = 0;
while ((rpm = *argv++) != NULL) {
diff --git a/lib/signature.c b/lib/signature.c
index ecea5b1ba..1bf662851 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -27,7 +27,9 @@
/*@access Header@*/ /* XXX compared with NULL */
-typedef int (*md5func)(const char * fn, /*@out@*/unsigned char * digest);
+typedef unsigned char byte;
+
+typedef int (*md5func)(const char * fn, /*@out@*/ byte * digest);
int rpmLookupSignatureType(int action)
{
@@ -124,7 +126,7 @@ static int checkSize(FD_t fd, int size, int sigsize)
int rpmReadSignature(FD_t fd, Header *headerp, short sig_type)
{
- unsigned char buf[2048];
+ byte buf[2048];
int sigSize, pad;
int_32 type, count;
int_32 *archSize;
@@ -188,7 +190,7 @@ int rpmReadSignature(FD_t fd, Header *headerp, short sig_type)
int rpmWriteSignature(FD_t fd, Header header)
{
int sigSize, pad;
- unsigned char buf[8];
+ byte buf[8];
int rc = 0;
rc = headerWrite(fd, header, HEADER_MAGIC_YES);
@@ -387,7 +389,7 @@ int rpmAddSignature(Header header, const char *file, int_32 sigTag, const char *
{
struct stat statbuf;
int_32 size;
- unsigned char buf[16];
+ byte buf[16];
void *sig;
int ret = -1;
@@ -441,10 +443,10 @@ verifySizeSignature(const char *datafile, int_32 size, char *result)
#define X(_x) (unsigned)((_x) & 0xff)
static rpmVerifySignatureReturn
-verifyMD5Signature(const char *datafile, unsigned char *sig,
+verifyMD5Signature(const char *datafile, const byte *sig,
char *result, md5func fn)
{
- unsigned char md5sum[16];
+ byte md5sum[16];
fn(datafile, md5sum);
if (memcmp(md5sum, sig, 16)) {
@@ -475,12 +477,12 @@ verifyMD5Signature(const char *datafile, unsigned char *sig,
}
static rpmVerifySignatureReturn
-verifyPGPSignature(const char *datafile, void *sig, int count, char *result)
+verifyPGPSignature(const char *datafile, const void * sig, int count, char *result)
{
int pid, status, outpipe[2];
FD_t sfd;
char *sigfile;
- unsigned char buf[BUFSIZ];
+ byte buf[BUFSIZ];
FILE *file;
int res = RPMSIG_OK;
const char *path;
@@ -587,12 +589,12 @@ verifyPGPSignature(const char *datafile, void *sig, int count, char *result)
}
static rpmVerifySignatureReturn
-verifyGPGSignature(const char *datafile, void *sig, int count, char *result)
+verifyGPGSignature(const char *datafile, const void * sig, int count, char *result)
{
int pid, status, outpipe[2];
FD_t sfd;
char *sigfile;
- unsigned char buf[8192];
+ byte buf[BUFSIZ];
FILE *file;
int res = RPMSIG_OK;
@@ -784,7 +786,7 @@ char *rpmGetPassPhrase(const char *prompt, const int sigTag)
}
rpmVerifySignatureReturn
-rpmVerifySignature(const char *file, int_32 sigTag, void *sig, int count,
+rpmVerifySignature(const char *file, int_32 sigTag, const void * sig, int count,
char *result)
{
switch (sigTag) {