]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/aes.cpp
FIX channel user count stuff. next to do, order the user count list
[user/henk/code/inspircd.git] / src / aes.cpp
index c9189d68f25717351b12be62a05c8ef1fa4db0fb..033d8beb29351710600128a65fbe746c73830547 100644 (file)
@@ -1,5 +1,21 @@
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
+ *                       E-mail:
+ *                <brain@chatspike.net>
+ *                <Craig@chatspike.net>
+ *
+ * Written by Craig Edwards, Craig McLure, and others.
+ * This program is free but copyrighted software; see
+ *            the file COPYING for details.
+ *
+ * ---------------------------------------------------
+ */
 
-//Rijndael.cpp
+// Based on existing implementations of the industry standard AES algorithms
+// in the public domain.
 
 #include <cstring>
 #include "aes.h"
@@ -1389,7 +1405,7 @@ static const char base64val[] = {
     BAD, 26, 27, 28,  29, 30, 31, 32,  33, 34, 35, 36,  37, 38, 39, 40,
      41, 42, 43, 44,  45, 46, 47, 48,  49, 50, 51,BAD, BAD,BAD,BAD,BAD
 };
-#define DECODE64(c)  (isascii(c) ? base64val[c] : BAD)
+#define DECODE64(c)  (c < 128 ? base64val[c] : BAD)
 
 void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
@@ -1451,11 +1467,11 @@ int from64tobits(char *out, const char *in, int maxlen)
        {
            ++len;
            if (maxlen && len > maxlen)
-               return(-1);
+                       return(-1);
            *out++ = ((DECODE64(digit2) << 4) & 0xf0) | (DECODE64(digit3) >> 2);
            if (digit4 != '=')
            {
-               ++len;
+                       ++len;
                if (maxlen && len > maxlen)
                    return(-1);
                *out++ = ((DECODE64(digit3) << 6) & 0xc0) | DECODE64(digit4);