Merge branch 'maint'
[paraslash.git] / crypt_common.c
index 71aabf53f944eea64d4214fccff354787b7e6f9b..022692adc52ce1cb8fe4ec925e93362e89b4b754 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2014 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2005 Andre Noll <maan@tuebingen.mpg.de>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -90,41 +90,31 @@ int base64_decode(char const *src, unsigned char *target, size_t targsize)
 
                switch (state) {
                case 0:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return -E_BASE64;
-                               target[tarindex] = (pos - Base64) << 2;
-                       }
+                       if (tarindex >= targsize)
+                               return -E_BASE64;
+                       target[tarindex] = (pos - Base64) << 2;
                        state = 1;
                        break;
                case 1:
-                       if (target) {
-                               if (tarindex + 1 >= targsize)
-                                       return -E_BASE64;
-                               target[tarindex]   |=  (pos - Base64) >> 4;
-                               target[tarindex+1]  = ((pos - Base64) & 0x0f)
-                                                       << 4 ;
-                       }
+                       if (tarindex + 1 >= targsize)
+                               return -E_BASE64;
+                       target[tarindex] |= (pos - Base64) >> 4;
+                       target[tarindex + 1] = ((pos - Base64) & 0x0f) << 4;
                        tarindex++;
                        state = 2;
                        break;
                case 2:
-                       if (target) {
-                               if (tarindex + 1 >= targsize)
-                                       return -E_BASE64;
-                               target[tarindex]   |=  (pos - Base64) >> 2;
-                               target[tarindex+1]  = ((pos - Base64) & 0x03)
-                                                       << 6;
-                       }
+                       if (tarindex + 1 >= targsize)
+                               return -E_BASE64;
+                       target[tarindex] |= (pos - Base64) >> 2;
+                       target[tarindex + 1] = ((pos - Base64) & 0x03) << 6;
                        tarindex++;
                        state = 3;
                        break;
                case 3:
-                       if (target) {
-                               if (tarindex >= targsize)
-                                       return -E_BASE64;
-                               target[tarindex] |= (pos - Base64);
-                       }
+                       if (tarindex >= targsize)
+                               return -E_BASE64;
+                       target[tarindex] |= pos - Base64;
                        tarindex++;
                        state = 0;
                        break;
@@ -170,7 +160,7 @@ int base64_decode(char const *src, unsigned char *target, size_t targsize)
                         * zeros.  If we don't check them, they become a
                         * subliminal channel.
                         */
-                       if (target && target[tarindex] != 0)
+                       if (target[tarindex] != 0)
                                return -E_BASE64;
                }
        } else {