00001 #ifndef MD5_H 00002 #define MD5_H 00003 00009 #include <sys/types.h> 00010 00011 typedef unsigned int uint32; 00012 00016 struct MD5Context { 00017 uint32 buf[4]; 00018 uint32 bits[2]; 00019 unsigned char in[64]; 00020 int doByteReverse; 00021 }; 00022 00023 /* 00024 * This is needed to make RSAREF happy on some MS-DOS compilers. 00025 */ 00026 /*@-mutrep@*/ /* FIX: redefine as pointer */ 00027 typedef /*@abstract@*/ struct MD5Context MD5_CTX; 00028 /*@=mutrep@*/ 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00040 void rpmMD5Init( /*@out@*/ struct MD5Context * ctx, int brokenEndian) 00041 /*@modifies *ctx @*/; 00042 00050 void rpmMD5Update(struct MD5Context * ctx, unsigned char const *buf, 00051 unsigned len) 00052 /*@modifies ctx @*/; 00058 /*@-fixedformalarray@*/ 00059 void rpmMD5Final(unsigned char digest[16], struct MD5Context * ctx) 00060 /*@modifies digest, ctx @*/; 00061 /*@=fixedformalarray@*/ 00062 00070 /*@-fixedformalarray -exportlocal@*/ 00071 void rpmMD5Transform(uint32 buf[4], uint32 const in[16]) 00072 /*@modifies *buf @*/; 00073 /*@=fixedformalarray =exportlocal@*/ 00074 00081 int mdfile(const char * fn, /*@out@*/ unsigned char * digest) 00082 /*@modifies digest @*/; 00083 00090 int mdbinfile(const char * fn, /*@out@*/ unsigned char * bindigest) 00091 /*@modifies *bindigest @*/; 00092 00093 /* These assume a little endian machine and return incorrect results! 00094 They are here for compatibility with old (broken) versions of RPM */ 00095 00103 int mdfileBroken(const char * fn, /*@out@*/ unsigned char * digest) 00104 /*@modifies *digest @*/; 00105 00113 int mdbinfileBroken(const char * fn, /*@out@*/ unsigned char * bindigest) 00114 /*@modifies *bindigest @*/; 00115 00116 #ifdef __cplusplus 00117 } 00118 #endif 00119 00120 #endif /* MD5_H */