]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - lib/encrypt.c
SourceFormat Enforcement
[thirdparty/squid.git] / lib / encrypt.c
index f90c4e5b123abffac80fc4ba81deb2b59affb17b..46be7ab8fb5a61c4dc94d59976dda6374655f99c 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * 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
  *
@@ -15,6 +23,8 @@
  * 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>
@@ -28,7 +38,6 @@
 
 static char schluessel[16][KS];
 
-
 static char PC1[] = {
     56, 48, 40, 32, 24, 16, 8, 0,
     57, 49, 41, 33, 25, 17, 9, 1,
@@ -40,7 +49,6 @@ static char PC1[] = {
     27, 19, 11, 3
 };
 
-
 static char PC2[] = {
     13, 16, 10, 23, 0, 4, 2, 27,
     14, 5, 20, 9, 22, 18, 11, 3,
@@ -50,7 +58,6 @@ static char PC2[] = {
     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,7 +69,6 @@ static char IP[] = {
     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,
@@ -74,7 +80,6 @@ static char EP[] = {
     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,
@@ -84,10 +89,8 @@ static char E0[] = {
     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,
@@ -95,7 +98,6 @@ static char PERM[] = {
     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,
@@ -154,7 +156,7 @@ register char *pc;
 int n;
 {
     for (; n--; pc++, a++)
-        *a = e[*pc];
+        *a = e[(int)*pc];
 }
 
 static void
@@ -170,7 +172,7 @@ register char *schl;
 
     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;
@@ -179,7 +181,7 @@ register char *schl;
 
     e = PERM;
     for (i = 0; i < BS2; i++)
-        *nachr_l++ ^= tmp[*e++];
+        *nachr_l++ ^= tmp[(int)*e++];
 }
 
 void
@@ -300,3 +302,4 @@ crypt(const char *wort, const char *salt)
 
     return retkey;
 }
+