From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kOpMw-0003VK-Ks for mharc-grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOpMu-0003Ss-KS for grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:04 -0400 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]:32818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kOpMs-0002KD-Oy for grub-devel@gnu.org; Sat, 03 Oct 2020 17:47:04 -0400 Received: by mail-ot1-x344.google.com with SMTP id m12so5018130otr.0 for ; Sat, 03 Oct 2020 14:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MurjfgJq8Xj5T7uAyFe6s+Zd7OT3EhlvJq6MrL2KYyA=; b=xueeSfqUHyOxUKwg+1HNL/BYZ6g/XRMdyEQg90OX50ziga9hJko0nuQuvHWNCX2DuP w1R06Mesj66kcZI4bmidXsWx6S7VCTBawbg+fhoRTa7GwHwknMlaL7ApPs9L0W2TeU4Z 8teOZwZxVHrk4ayyQqPnE7jRgA8Lfjc5YOyyQi+pjOLJO+4wkm4jdBt/km4SbgdVzR0w z73sWq72UJhklunJfTPUiAWn4XdWDwU3EotUnV538UuJvdfyFZu3SM2g+0BZZn2/ZzWh rzXEAoU2O/xwD7iy8go8Zx4rGBGy3wWnQwI2qvvaILLN4hK74ImOS120DDvsEqUib7d9 sPwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MurjfgJq8Xj5T7uAyFe6s+Zd7OT3EhlvJq6MrL2KYyA=; b=obS94xLKx9aUJHi2EMyfCZ2F3VCA8WHiXYfjDog1udsBy/luNSRJvVU41IFQrhc375 wmBhsmRSpEMwrqr4GCCR6dk/i+h54NX5pBa3CoD0yX3Y7Y8bvLB8G9B6+81AXDJCTKrQ FwMnXWZ0lTxFrwdgfK6pifuAG3aRrUJY7jb25wkqBQPTgs1n0ZHRjHgx/BhbxrUo/dSz XJMWdUIGB0YLlJFctpP9JYCI9nXg1MKhfwciW7uMwA/riwdSs5qPCzZLqu8HqlJXB9AP FU7HL6t3ttX6hspNqRpU4b7tC3Ur63HYqyYrv+fl5oI8g53Mn1FE0Xl0s/NEcqwJJ48F +XfQ== X-Gm-Message-State: AOAM530RbF/ZZ5gclNiNvQ4fxs8J2TrWE+88UvC4Xxton397hbB5tIgT J5Q5AS8A5NOocGped9c5MiANz8UEnMK3kQ== X-Google-Smtp-Source: ABdhPJzn8EgJFvwD86W6ublEX2x5SbG7PmNWCtv+3SP8nwNRqyg4aVSL/uoifIoTvS8Xbby2CZiQkQ== X-Received: by 2002:a9d:600a:: with SMTP id h10mr6672842otj.170.1601761621509; Sat, 03 Oct 2020 14:47:01 -0700 (PDT) Received: from crass-HP-ZBook-15-G2.lan ([136.49.44.103]) by smtp.gmail.com with ESMTPSA id f26sm1495415otq.50.2020.10.03.14.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 14:47:01 -0700 (PDT) From: Glenn Washburn To: grub-devel@gnu.org Cc: Daniel Kiper , Patrick Steinhardt , Glenn Washburn Subject: [PATCH 05/10] cryptodisk: Fix cipher IV mode 'plain64' always being set as 'plain'. Date: Sat, 3 Oct 2020 16:45:58 -0500 Message-Id: <9cfbb3373b02ab0d6de89fae3669bf3158cc6e69.1601760922.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::344; envelope-from=development@efficientek.com; helo=mail-ot1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Oct 2020 21:47:05 -0000 When setting cipher IV mode, detection is done by prefix matching the cipher IV mode part of the cipher mode string. Since "plain" matches "plain64", we must check for "plain64" first. Otherwise, "plain64" will be detected as "plain". Signed-off-by: Glenn Washburn Reviewed-by: Patrick Steinhardt --- grub-core/disk/cryptodisk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 13af84dd1..a3d672f68 100644 --- a/grub-core/disk/cryptodisk.c +++ b/grub-core/disk/cryptodisk.c @@ -501,10 +501,10 @@ grub_cryptodisk_setcipher (grub_cryptodisk_t crypt, const char *ciphername, cons if (cipheriv == NULL) ; - else if (grub_memcmp (cipheriv, "plain", sizeof ("plain") - 1) == 0) - mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN; else if (grub_memcmp (cipheriv, "plain64", sizeof ("plain64") - 1) == 0) mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN64; + else if (grub_memcmp (cipheriv, "plain", sizeof ("plain") - 1) == 0) + mode_iv = GRUB_CRYPTODISK_MODE_IV_PLAIN; else if (grub_memcmp (cipheriv, "benbi", sizeof ("benbi") - 1) == 0) { if (cipher->cipher->blocksize & (cipher->cipher->blocksize - 1) -- 2.27.0