From 47bec71dd0db1814326f775728cec8d367b73cac Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 13 Jul 2018 18:19:33 +0000 Subject: [PATCH] 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. --- stand/libsa/geli/geliboot_crypto.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/stand/libsa/geli/geliboot_crypto.c b/stand/libsa/geli/geliboot_crypto.c index 2c7270b846ee..82a137c06212 100644 --- a/stand/libsa/geli/geliboot_crypto.c +++ b/stand/libsa/geli/geliboot_crypto.c @@ -59,15 +59,14 @@ geliboot_crypt(u_int algo, int enc, u_char *data, size_t datasize, 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: "