From patchwork Fri Dec 15 17:42:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 849309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K6Tl+/hC"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="gUHg+5vF"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Xi3XQ0V/"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyyd053Q1z9ryk for ; Sat, 16 Dec 2017 04:50:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qGh2lxIgKmSuBmPL2+bvAlIlYz5aZl74YuCVOX6y+6g=; b=K6Tl+/hCnEw9duFDyizSqvn2kE kNdbF672QQmrC+sEkb32amCOV6kuhxBhZzDPACqfPVu9Bagosbkhw2FnLLQKpP4jk7C9xE739Ozux dBoUZYai3zFc6iZxl6xFWi49ABd889G1KYXHDyqzmGKxD56n3r92V8SFx9qAAyshe3Ox48oqm5bIr /COeBxcogb3+AiLN6GRfqb2OgCDHzUPiY/FcPgqpNeR00RDilnp6KI2wkyscdFfPwMzXX7hgj6ULu L71VT2e2zZhH7QdK1a6A2ptr4dOimTWBcAxNoXB6EMYMGf+AKVvCZlTI3/JR3DYo6ZS8v8bT4HQ62 Hq7XZPPQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ePu7F-0000yq-3Z; Fri, 15 Dec 2017 17:49:45 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ePu4n-0008OY-UQ for linux-mtd@bombadil.infradead.org; Fri, 15 Dec 2017 17:47:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DyGC+3EL+jZm4eSULT3f/YKGV3foBF04etky/7TeDC4=; b=gUHg+5vFrUSF9Kv9l0kx+jLAZ yoq+4+3LD/hBog5rIJUpw+A5K9L6YNjROjrqGgDVp6DG48zRoKLuEQLQN1PYursVzmzevPBvFy9vP tMTnYOoTdmUPN9RPEq+S+MIlxaektjxFSCC8umgj8oYC65ps8LZMH5oyUpyP0xDuP5aYdOq5CvQHe G16/yDezDUz8lIdoO0EJPRGmfcVRlyz+f57RQxJXPczP2yI6iMGhEPCJBcWKxEQd9jLKB+VRgVbE2 s0t6DWrFOnAjSddqSSNAFYFXWA7H1XaWFtkDZrhOjAre7jherav4THSH9i3ZzNBjNX5takS3+PuAy GPdlneNBA==; Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ePu4j-0004ko-4d for linux-mtd@lists.infradead.org; Fri, 15 Dec 2017 17:47:10 +0000 Received: by mail-pg0-x242.google.com with SMTP id o2so6250569pgc.8 for ; Fri, 15 Dec 2017 09:46:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DyGC+3EL+jZm4eSULT3f/YKGV3foBF04etky/7TeDC4=; b=Xi3XQ0V/NYnQYbQfPW9oh8vVUw3OSAiz/xh6YrSoU+apzGaeMVWW3DmgFTlrb5AGi5 7x5DgQeaKIjPJM88lCf6tnKex2BB2sCJnte+OnzBTRj0qCUTiy0TLpZG0F3srYeGJT+9 gX1vTA8wmcpVYn4uHHlH+xzlySXGFJn7R6tTdaXUk4s8nB0kWrAVfWuhZHeS6vdQskAt uah8eq9XKLoPJsJCPRqZmJUiEwX8NiN539ppWkijASQ1k3ytInPuwgzY1IQsvIOmJhBO 4apbC/pBKX3n+U4DMrFL22gBg3LDipXxLsVUGGiB62K5rDhkmRH5X6SP0oC2MIdaVC8c rR3Q== 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; bh=DyGC+3EL+jZm4eSULT3f/YKGV3foBF04etky/7TeDC4=; b=KQ4GkrEWiz82e2XfZZr7MylQE28u5TBW12vHJW+ZvCzQ8p5DXdISrh1YeYwcZhZnts +Z32OdCruJV7zducofPPbhjq1bt25FRjVGth9S0Lu0mdPmd1UF2eeD+eVZL9+8UXV4kG Nk0952cW3sdx7tcWunDvelXAD0PbueOt8IB9FHoSxhwjQ9J4MCEnCrKntMeAb4n9V5CH 7TvFMR5BhNkBXYFaaml9zejoDpcOuD1BFYwSzs2zlVicRD7VGSDD/Es9t5S4yQIME8xq OA2s4od5awfM6x0oLfJsSWephY4ofP87qyB1Yq4TfwRsOqUK1/SbZsfpdNb08X5+sCMU YWpQ== X-Gm-Message-State: AKGB3mJ46ZDZ2lGMTl0+DhQDAgvvmbTJz9THG+p/FDuDLh1YYCtcZM3e wCbxWkhRLJU+eorEgzLPwWnkFSX4y24= X-Google-Smtp-Source: ACJfBotFRp5obrqljJ7JuUj04UeRU39++mgRvPsIcIQLCewdH7JRPDsiZ4sQ00jnhliolUaYVUdDBw== X-Received: by 10.98.18.88 with SMTP id a85mr13978404pfj.141.1513360005138; Fri, 15 Dec 2017 09:46:45 -0800 (PST) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id j62sm12980149pfc.18.2017.12.15.09.46.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 09:46:44 -0800 (PST) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Subject: [PATCH 07/24] fscrypt: move fscrypt_valid_enc_modes() to fscrypt_private.h Date: Fri, 15 Dec 2017 09:42:08 -0800 Message-Id: <20171215174225.31583-8-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171215174225.31583-1-ebiggers3@gmail.com> References: <20171215174225.31583-1-ebiggers3@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171215_174709_328855_1238AF50 X-CRM114-Status: GOOD ( 10.21 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ebiggers3[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ebiggers3[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Theodore Y . Ts'o" , Eric Biggers , linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Jaegeuk Kim , linux-ext4@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Eric Biggers The encryption modes are validated by fs/crypto/, not by individual filesystems. Therefore, move fscrypt_valid_enc_modes() from fscrypt.h to fscrypt_private.h. Signed-off-by: Eric Biggers --- fs/crypto/fscrypt_private.h | 14 ++++++++++++++ include/linux/fscrypt.h | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index 823c43a00bf7..2b848e7c92f0 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -71,6 +71,20 @@ typedef enum { #define FS_CTX_REQUIRES_FREE_ENCRYPT_FL 0x00000001 #define FS_CTX_HAS_BOUNCE_BUFFER_FL 0x00000002 +static inline bool fscrypt_valid_enc_modes(u32 contents_mode, + u32 filenames_mode) +{ + if (contents_mode == FS_ENCRYPTION_MODE_AES_128_CBC && + filenames_mode == FS_ENCRYPTION_MODE_AES_128_CTS) + return true; + + if (contents_mode == FS_ENCRYPTION_MODE_AES_256_XTS && + filenames_mode == FS_ENCRYPTION_MODE_AES_256_CTS) + return true; + + return false; +} + /* crypto.c */ extern struct kmem_cache *fscrypt_info_cachep; extern int fscrypt_initialize(unsigned int cop_flags); diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index 33b95a91f720..2e4dce0365cf 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -57,20 +57,6 @@ struct fscrypt_name { /* Maximum value for the third parameter of fscrypt_operations.set_context(). */ #define FSCRYPT_SET_CONTEXT_MAX_SIZE 28 -static inline bool fscrypt_valid_enc_modes(u32 contents_mode, - u32 filenames_mode) -{ - if (contents_mode == FS_ENCRYPTION_MODE_AES_128_CBC && - filenames_mode == FS_ENCRYPTION_MODE_AES_128_CTS) - return true; - - if (contents_mode == FS_ENCRYPTION_MODE_AES_256_XTS && - filenames_mode == FS_ENCRYPTION_MODE_AES_256_CTS) - return true; - - return false; -} - static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) { if (str->len == 1 && str->name[0] == '.')