Author: imp
Date: Fri Jul 13 18:19:33 2018
New Revision: 336254
URL: https://svnweb.freebsd.org/changeset/base/336254

Log:
  Use if rather than case for a simple boolean. gcc thinks blks is
  undefined sometimes with the case, but enc is always 0 or 1, so
  and if / else is better anyway.

Modified:
  head/stand/libsa/geli/geliboot_crypto.c

Modified: head/stand/libsa/geli/geliboot_crypto.c
==============================================================================
--- head/stand/libsa/geli/geliboot_crypto.c     Fri Jul 13 18:00:13 2018        
(r336253)
+++ head/stand/libsa/geli/geliboot_crypto.c     Fri Jul 13 18:19:33 2018        
(r336254)
@@ -59,15 +59,14 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size
                        return (err);
                }
 
-               switch (enc) {
-               case 0: /* decrypt */
+               if (enc == 0) {
+                       /* decrypt */
                        blks = rijndael_blockDecrypt(&cipher, &aeskey, data, 
                            datasize * 8, data);
-                       break;
-               case 1: /* encrypt */
+               } else {
+                       /* encrypt */
                        blks = rijndael_blockEncrypt(&cipher, &aeskey, data, 
                            datasize * 8, data);
-                       break;
                }
                if (datasize != (blks / 8)) {
                        printf("Failed to decrypt the entire input: "
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to