Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 244480 | Differences between
and this patch

Collapse All | Expand All

(-)ssmtp/md5auth/global.h (-6 lines)
Lines 13-24 Link Here
13
/* POINTER defines a generic pointer type */
13
/* POINTER defines a generic pointer type */
14
typedef unsigned char *POINTER;
14
typedef unsigned char *POINTER;
15
15
16
/* UINT2 defines a two byte word */
17
typedef unsigned short int UINT2;
18
19
/* UINT4 defines a four byte word */
20
typedef unsigned long int UINT4;
21
22
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
16
/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
23
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
17
If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
24
  returns an empty list.
18
  returns an empty list.
(-)ssmtp/md5auth/hmac_md5.c (-2 / +2 lines)
Lines 1-7 Link Here
1
#include "global.h"
2
#include "md5.h"
3
#include <string.h>
1
#include <string.h>
4
#include <sys/types.h>
2
#include <sys/types.h>
3
#include "global.h"
4
#include "md5.h"
5
5
6
/*
6
/*
7
** Function: hmac_md5 (RFC 2104)
7
** Function: hmac_md5 (RFC 2104)
(-)ssmtp/md5auth/md5c.c (-18 / +19 lines)
Lines 23-28 Link Here
23
documentation and/or software.
23
documentation and/or software.
24
 */
24
 */
25
25
26
#include <sys/types.h>
26
#include "global.h"
27
#include "global.h"
27
#include "md5.h"
28
#include "md5.h"
28
29
Lines 45-55 Link Here
45
#define S43 15
46
#define S43 15
46
#define S44 21
47
#define S44 21
47
48
48
static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
49
static void MD5Transform PROTO_LIST ((u_int32_t [4], unsigned char [64]));
49
static void Encode PROTO_LIST
50
static void Encode PROTO_LIST
50
  ((unsigned char *, UINT4 *, unsigned int));
51
  ((unsigned char *, u_int32_t *, unsigned int));
51
static void Decode PROTO_LIST
52
static void Decode PROTO_LIST
52
  ((UINT4 *, unsigned char *, unsigned int));
53
  ((u_int32_t *, unsigned char *, unsigned int));
53
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
54
static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
54
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
55
static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
55
56
Lines 74-95 Link Here
74
Rotation is separate from addition to prevent recomputation.
75
Rotation is separate from addition to prevent recomputation.
75
 */
76
 */
76
#define FF(a, b, c, d, x, s, ac) { \
77
#define FF(a, b, c, d, x, s, ac) { \
77
 (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
78
 (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
78
 (a) = ROTATE_LEFT ((a), (s)); \
79
 (a) = ROTATE_LEFT ((a), (s)); \
79
 (a) += (b); \
80
 (a) += (b); \
80
  }
81
  }
81
#define GG(a, b, c, d, x, s, ac) { \
82
#define GG(a, b, c, d, x, s, ac) { \
82
 (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
83
 (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
83
 (a) = ROTATE_LEFT ((a), (s)); \
84
 (a) = ROTATE_LEFT ((a), (s)); \
84
 (a) += (b); \
85
 (a) += (b); \
85
  }
86
  }
86
#define HH(a, b, c, d, x, s, ac) { \
87
#define HH(a, b, c, d, x, s, ac) { \
87
 (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
88
 (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
88
 (a) = ROTATE_LEFT ((a), (s)); \
89
 (a) = ROTATE_LEFT ((a), (s)); \
89
 (a) += (b); \
90
 (a) += (b); \
90
  }
91
  }
91
#define II(a, b, c, d, x, s, ac) { \
92
#define II(a, b, c, d, x, s, ac) { \
92
 (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
93
 (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
93
 (a) = ROTATE_LEFT ((a), (s)); \
94
 (a) = ROTATE_LEFT ((a), (s)); \
94
 (a) += (b); \
95
 (a) += (b); \
95
  }
96
  }
Lines 123-132 Link Here
123
  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
124
  index = (unsigned int)((context->count[0] >> 3) & 0x3F);
124
125
125
  /* Update number of bits */
126
  /* Update number of bits */
126
  if ((context->count[0] += ((UINT4)inputLen << 3))
127
  if ((context->count[0] += ((u_int32_t)inputLen << 3))
127
   < ((UINT4)inputLen << 3))
128
   < ((u_int32_t)inputLen << 3))
128
 context->count[1]++;
129
 context->count[1]++;
129
  context->count[1] += ((UINT4)inputLen >> 29);
130
  context->count[1] += ((u_int32_t)inputLen >> 29);
130
131
131
  partLen = 64 - index;
132
  partLen = 64 - index;
132
133
Lines 183-192 Link Here
183
/* MD5 basic transformation. Transforms state based on block.
184
/* MD5 basic transformation. Transforms state based on block.
184
 */
185
 */
185
static void MD5Transform (state, block)
186
static void MD5Transform (state, block)
186
UINT4 state[4];
187
u_int32_t state[4];
187
unsigned char block[64];
188
unsigned char block[64];
188
{
189
{
189
  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
190
  u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
190
191
191
  Decode (x, block, 64);
192
  Decode (x, block, 64);
192
193
Lines 272-283 Link Here
272
  MD5_memset ((POINTER)x, 0, sizeof (x));
273
  MD5_memset ((POINTER)x, 0, sizeof (x));
273
}
274
}
274
275
275
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
276
/* Encodes input (u_int32_t) into output (unsigned char). Assumes len is
276
  a multiple of 4.
277
  a multiple of 4.
277
 */
278
 */
278
static void Encode (output, input, len)
279
static void Encode (output, input, len)
279
unsigned char *output;
280
unsigned char *output;
280
UINT4 *input;
281
u_int32_t *input;
281
unsigned int len;
282
unsigned int len;
282
{
283
{
283
  unsigned int i, j;
284
  unsigned int i, j;
Lines 290-308 Link Here
290
  }
291
  }
291
}
292
}
292
293
293
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
294
/* Decodes input (unsigned char) into output (u_int32_t). Assumes len is
294
  a multiple of 4.
295
  a multiple of 4.
295
 */
296
 */
296
static void Decode (output, input, len)
297
static void Decode (output, input, len)
297
UINT4 *output;
298
u_int32_t *output;
298
unsigned char *input;
299
unsigned char *input;
299
unsigned int len;
300
unsigned int len;
300
{
301
{
301
  unsigned int i, j;
302
  unsigned int i, j;
302
303
303
  for (i = 0, j = 0; j < len; i++, j += 4)
304
  for (i = 0, j = 0; j < len; i++, j += 4)
304
 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
305
 output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) |
305
   (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
306
   (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24);
306
}
307
}
307
308
308
/* Note: Replace "for loop" with standard memcpy if possible.
309
/* Note: Replace "for loop" with standard memcpy if possible.
(-)ssmtp/md5auth/md5.h (-2 / +2 lines)
Lines 25-32 Link Here
25
25
26
/* MD5 context. */
26
/* MD5 context. */
27
typedef struct {
27
typedef struct {
28
  UINT4 state[4];                                   /* state (ABCD) */
28
  u_int32_t state[4];                                   /* state (ABCD) */
29
  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
29
  u_int32_t count[2];        /* number of bits, modulo 2^64 (lsb first) */
30
  unsigned char buffer[64];                         /* input buffer */
30
  unsigned char buffer[64];                         /* input buffer */
31
} MD5_CTX;
31
} MD5_CTX;
32
32

Return to bug 244480