summaryrefslogtreecommitdiff
path: root/lib/misc.h
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-09-25 16:21:44 +0000
committerjbj <devnull@localhost>2001-09-25 16:21:44 +0000
commitcb216009409823affa8e24c880b910fdd9531fb0 (patch)
treee299b61e761786b2f506bfb0b060e2062380d046 /lib/misc.h
parenta2830a271c2486a266dfc18490989f0e41cf9d10 (diff)
downloadlibrpm-tizen-cb216009409823affa8e24c880b910fdd9531fb0.tar.gz
librpm-tizen-cb216009409823affa8e24c880b910fdd9531fb0.tar.bz2
librpm-tizen-cb216009409823affa8e24c880b910fdd9531fb0.zip
- drop rpmio/base64.[ch] in favor of beecrypt.
- drop lib/md5*.[ch] files in favor of beecrypt. CVS patchset: 5081 CVS date: 2001/09/25 16:21:44
Diffstat (limited to 'lib/misc.h')
-rw-r--r--lib/misc.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/misc.h b/lib/misc.h
index 9ad8483cb..dc4e91e6e 100644
--- a/lib/misc.h
+++ b/lib/misc.h
@@ -12,11 +12,88 @@
#include "header.h"
#include "ugid.h"
+typedef unsigned char byte;
+typedef unsigned int uint32;
+typedef int (*md5func)(const char * fn, /*@out@*/ byte * digest);
+
#ifdef __cplusplus
extern "C" {
#endif
/**
+ * Calculate MD5 sum for file.
+ * @todo Eliminate, use beecrypt instead.
+ * @param fn file name
+ * @retval digest address of md5sum
+ * @param asAscii return md5sum as ascii string?
+ * @param brokenEndian calculate broken MD5 sum?
+ * @return 0 on success, 1 on error
+ */
+/*@-exportlocal@*/
+int domd5(const char * fn, /*@out@*/ unsigned char * digest, int asAscii,
+ int brokenEndian)
+ /*@modifies digest, fileSystem @*/;
+/*@=exportlocal@*/
+
+/**
+ * Return MD5 sum of file as ASCII string.
+ * @todo Eliminate, use beecrypt instead.
+ * @param fn file name
+ * @retval digest MD5 digest
+ * @return 0 on success, 1 on error
+ */
+/*@unused@*/ static inline
+int mdfile(const char * fn, /*@out@*/ unsigned char * digest)
+ /*@modifies digest, fileSystem @*/
+{
+ return domd5(fn, digest, 1, 0);
+}
+
+/**
+ * Return MD5 sum of file as binary data.
+ * @todo Eliminate, use beecrypt instead.
+ * @param fn file name
+ * @retval bindigest MD5 digest
+ * @return 0 on success, 1 on error
+ */
+/*@unused@*/ static inline
+int mdbinfile(const char * fn, /*@out@*/ unsigned char * bindigest)
+ /*@modifies bindigest, fileSystem @*/
+{
+ return domd5(fn, bindigest, 0, 0);
+}
+
+/**
+ * Return (broken!) MD5 sum of file as ASCII string.
+ * @deprecated Here for compatibility with old (broken) versions of RPM.
+ * @todo Eliminate, use beecrypt instead.
+ * @param fn file name
+ * @retval digest MD5 digest
+ * @return 0 on success, 1 on error
+ */
+/*@unused@*/ static inline
+int mdfileBroken(const char * fn, /*@out@*/ unsigned char * digest)
+ /*@modifies digest, fileSystem @*/
+{
+ return domd5(fn, digest, 1, 1);
+}
+
+/**
+ * Return (broken!) MD5 sum of file as binary data.
+ * @deprecated Here for compatibility with old (broken) versions of RPM.
+ * @todo Eliminate, use beecrypt instead.
+ * @param fn file name
+ * @retval bindigest MD5 digest
+ * @return 0 on success, 1 on error
+ */
+/*@unused@*/ static inline
+int mdbinfileBroken(const char * fn, /*@out@*/ unsigned char * bindigest)
+ /*@modifies bindigest, fileSystem @*/
+{
+ return domd5(fn, bindigest, 0, 1);
+}
+
+/**
*/
/*@only@*/ char ** splitString(const char * str, int length, char sep)
/*@*/;