107 lines
3.1 KiB
Diff
107 lines
3.1 KiB
Diff
--- simgear/package/md5.h 2015-02-18 21:10:39.000000000 +0100
|
|
+++ simgear/package/md5.h 2015-11-01 01:47:16.218143005 +0100
|
|
@@ -19,27 +19,23 @@
|
|
extern "C" {
|
|
#endif
|
|
|
|
-#if defined(_MSC_VER)
|
|
-typedef unsigned char u_int8_t;
|
|
-typedef unsigned int u_int32_t;
|
|
-typedef unsigned __int64 u_int64_t;
|
|
-#endif
|
|
+#include <stdint.h>
|
|
|
|
#define MD5_BLOCK_LENGTH 64
|
|
#define MD5_DIGEST_LENGTH 16
|
|
#define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1)
|
|
|
|
typedef struct MD5Context {
|
|
- u_int32_t state[4]; /* state */
|
|
- u_int64_t count; /* number of bits, mod 2^64 */
|
|
- u_int8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
|
|
+ uint32_t state[4]; /* state */
|
|
+ uint64_t count; /* number of bits, mod 2^64 */
|
|
+ uint8_t buffer[MD5_BLOCK_LENGTH]; /* input buffer */
|
|
} SG_MD5_CTX;
|
|
|
|
void SG_MD5Init(SG_MD5_CTX *);
|
|
-void SG_MD5Update(SG_MD5_CTX *, const u_int8_t *, size_t);
|
|
+void SG_MD5Update(SG_MD5_CTX *, const uint8_t *, size_t);
|
|
void SG_MD5Pad(SG_MD5_CTX *);
|
|
-void SG_MD5Final(u_int8_t [MD5_DIGEST_LENGTH], SG_MD5_CTX *);
|
|
-void SG_MD5Transform(u_int32_t [4], const u_int8_t [MD5_BLOCK_LENGTH]);
|
|
+void SG_MD5Final(uint8_t [MD5_DIGEST_LENGTH], SG_MD5_CTX *);
|
|
+void SG_MD5Transform(uint32_t [4], const uint8_t [MD5_BLOCK_LENGTH]);
|
|
|
|
#ifdef __cplusplus
|
|
} // of extern C
|
|
@@ -49,4 +45,4 @@
|
|
|
|
|
|
|
|
-
|
|
\ Kein Zeilenumbruch am Dateiende.
|
|
+
|
|
--- simgear/package/md5.c 2015-02-18 21:10:39.000000000 +0100
|
|
+++ simgear/package/md5.c 2015-11-01 01:46:42.843144810 +0100
|
|
@@ -39,7 +39,7 @@
|
|
(cp)[1] = (value) >> 8; \
|
|
(cp)[0] = (value); } while (0)
|
|
|
|
-static u_int8_t PADDING[MD5_BLOCK_LENGTH] = {
|
|
+static uint8_t PADDING[MD5_BLOCK_LENGTH] = {
|
|
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
@@ -73,7 +73,7 @@
|
|
need = MD5_BLOCK_LENGTH - have;
|
|
|
|
/* Update bitcount */
|
|
- ctx->count += (u_int64_t)len << 3;
|
|
+ ctx->count += (uint64_t)len << 3;
|
|
|
|
if (len >= need) {
|
|
if (have != 0) {
|
|
@@ -104,7 +104,7 @@
|
|
void
|
|
SG_MD5Pad(SG_MD5_CTX *ctx)
|
|
{
|
|
- u_int8_t count[8];
|
|
+ uint8_t count[8];
|
|
size_t padlen;
|
|
|
|
/* Convert count to 8 bytes in little endian order. */
|
|
@@ -154,19 +154,19 @@
|
|
* the data and converts bytes into longwords for this routine.
|
|
*/
|
|
void
|
|
-SG_MD5Transform(u_int32_t state[4], const u_int8_t block[MD5_BLOCK_LENGTH])
|
|
+SG_MD5Transform(uint32_t state[4], const uint8_t block[MD5_BLOCK_LENGTH])
|
|
{
|
|
- u_int32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
|
|
+ uint32_t a, b, c, d, in[MD5_BLOCK_LENGTH / 4];
|
|
|
|
#ifndef WORDS_BIGENDIAN
|
|
memcpy(in, block, sizeof(in));
|
|
#else
|
|
for (a = 0; a < MD5_BLOCK_LENGTH / 4; a++) {
|
|
- in[a] = (u_int32_t)(
|
|
- (u_int32_t)(block[a * 4 + 0]) |
|
|
- (u_int32_t)(block[a * 4 + 1]) << 8 |
|
|
- (u_int32_t)(block[a * 4 + 2]) << 16 |
|
|
- (u_int32_t)(block[a * 4 + 3]) << 24);
|
|
+ in[a] = (uint32_t)(
|
|
+ (uint32_t)(block[a * 4 + 0]) |
|
|
+ (uint32_t)(block[a * 4 + 1]) << 8 |
|
|
+ (uint32_t)(block[a * 4 + 2]) << 16 |
|
|
+ (uint32_t)(block[a * 4 + 3]) << 24);
|
|
}
|
|
#endif
|
|
|
|
@@ -247,4 +247,4 @@
|
|
state[1] += b;
|
|
state[2] += c;
|
|
state[3] += d;
|
|
-}
|
|
\ Kein Zeilenumbruch am Dateiende.
|
|
+}
|