Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2018 18:19:33 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336254 - head/stand/libsa/geli
Message-ID:  <201807131819.w6DIJXRq039826@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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: "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807131819.w6DIJXRq039826>