-#include "config.h"
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
/* encrypt.c - providing 56 bit DES encryption
* Copyright (C) 1991 Jochen Obalek
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include "squid.h"
+
#include <time.h>
#include <string.h>
#include <stdlib.h>
static char schluessel[16][KS];
-
static char PC1[] = {
56, 48, 40, 32, 24, 16, 8, 0,
57, 49, 41, 33, 25, 17, 9, 1,
27, 19, 11, 3
};
-
static char PC2[] = {
13, 16, 10, 23, 0, 4, 2, 27,
14, 5, 20, 9, 22, 18, 11, 3,
33, 52, 45, 41, 49, 35, 28, 31
};
-
static char IP[] = {
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
62, 54, 46, 38, 30, 22, 14, 6
};
-
static char EP[] = {
7, 39, 15, 47, 23, 55, 31, 63,
6, 38, 14, 46, 22, 54, 30, 62,
0, 32, 8, 40, 16, 48, 24, 56
};
-
static char E0[] = {
31, 0, 1, 2, 3, 4, 3, 4,
5, 6, 7, 8, 7, 8, 9, 10,
27, 28, 27, 28, 29, 30, 31, 0
};
-
static char E[KS];
-
static char PERM[] = {
15, 6, 19, 20, 28, 11, 27, 16,
0, 14, 22, 25, 4, 17, 30, 9,
18, 12, 29, 5, 21, 10, 3, 24
};
-
static char S_BOX[][64] = {
{
14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
int n;
{
for (; n--; pc++, a++)
- *a = e[*pc];
+ *a = e[(int)*pc];
}
static void
for (i = 0; i < 8; i++) {
for (j = 0, sbval = 0; j < 6; j++)
- sbval = (sbval << 1) | (nachr_r[*e++] ^ *schl++);
+ sbval = (sbval << 1) | (nachr_r[(int)*e++] ^ *schl++);
sbval = S_BOX[i][sbval];
for (tp += 4, j = 4; j--; sbval >>= 1)
*--tp = sbval & 1;
e = PERM;
for (i = 0; i < BS2; i++)
- *nachr_l++ ^= tmp[*e++];
+ *nachr_l++ ^= tmp[(int)*e++];
}
void
return retkey;
}
+