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.
This commit is contained in:
Warner Losh 2018-07-13 18:19:33 +00:00
parent fd4d775773
commit 47bec71dd0

View File

@ -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: "