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: 10115687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F01936019C for ; Fri, 15 Dec 2017 17:46:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE01929F27 for ; Fri, 15 Dec 2017 17:46:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEE7129EE1; Fri, 15 Dec 2017 17:46:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D70229EE1 for ; Fri, 15 Dec 2017 17:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755910AbdLORqw (ORCPT ); Fri, 15 Dec 2017 12:46:52 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:34650 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755977AbdLORqq (ORCPT ); Fri, 15 Dec 2017 12:46:46 -0500 Received: by mail-pg0-f67.google.com with SMTP id j4so6263883pgp.1; Fri, 15 Dec 2017 09:46:46 -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=Q2zHHzrqjwfC3vt0d1jcv8Mhcy8E8RWWfPHG+jbBuyp7tR1XI9KxLp+oDilfPLkp0u cgskhmMp6qm8an0qKnkzgnIfCg0EyDxyZnjkEQ6fN22tOA/Rqa4+v50zcHhBqHnhB+3F gn9nZJ3oMy/ERg+ONv0C6MLZDdnLWqXBWH5ceFxiy5SeZ5Z4I0OP7YAG13SJ1kqJlsGs w5Kv3Gow51a8BfrGSHLpaFUR4yoDhBHygLzyvkwnPcAEVmllpxFVOER9I+uuD0iGADVf b2cqNITf9aU0sm0AYQHAglZMOHxur1lJLgBU26FpqoNhJk85yh77CpxHvzSuhAUnX6D5 FHKQ== X-Gm-Message-State: AKGB3mImuNCcFqmbvlsJCXQoktDsA1QntMd+74sgmIEaZgyPaphZ19hy lA3AkUW+7qyVRO1XpF75BMdsxSsrW70= 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 Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers 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> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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] == '.')