From patchwork Wed Jul 12 21:00:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9837399 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 EB16E602D8 for ; Wed, 12 Jul 2017 21:02:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD1C428697 for ; Wed, 12 Jul 2017 21:02:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1948286BF; Wed, 12 Jul 2017 21:02:31 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 851B928697 for ; Wed, 12 Jul 2017 21:02:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753293AbdGLVCL (ORCPT ); Wed, 12 Jul 2017 17:02:11 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33041 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027AbdGLVCH (ORCPT ); Wed, 12 Jul 2017 17:02:07 -0400 Received: by mail-pg0-f67.google.com with SMTP id u62so4335065pgb.0; Wed, 12 Jul 2017 14:02:07 -0700 (PDT) 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=6E+m1fa+yAG9Si11faOWIN0NzOOtvOiCqXVGa8KMD10=; b=gETcKBzq9Apxo+vX6gpvMAiqJvBo720eEkTYk/wmQ/t4+AkwrjhJ733xPb+YURndz0 ge0iqDi6Zbr0j1T0Vlyb15sxAnf1zCublxznhmPU9zVAncTZYy2qz9PgR7bZe3WSOX/m aTxwKAVMPNfc/PHBX7YDl79MVEHqt9H1giKR1hZc7X5lL2rRlb1eGWydNh37JM9KYap1 8Oc8UEIhiYEw/CmjYUiBy35r+s5CvAydHezUYP9VXcMcJ6sDqB7nTmx8bIst9usEg45P 4YlZJkat8G9ckniyjh/nE+dlLq/9yHm666maXuv3Uw1iqzw2Q0SGsyZCkb3uqjm43TNy qmLg== 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=6E+m1fa+yAG9Si11faOWIN0NzOOtvOiCqXVGa8KMD10=; b=tUI57VKK2AkBj2W6sNZn0SExuS/Jk4Gbu+whxwKg9KuedQmmnKo1xd4HXIP740rEW4 8+Y9Smlohgd9qMmw+W9SPy6T3WWayKOmQOoL9bgIgC1KLEYo70t4343nLOyX+nxhqDRf ifGtEFb5nJTf1vaKt9rjxi0DNjOA73kjWlMItUgDQ9rP87fdwaW9Wn57kKgj4iQA2kDq cOeWp/6+Q9FUvbRqJ+g/wbMsLZNO3NI7rMf/HzAe4EPe8vazD2zwO/naBFVjJN+kwQl7 JUPoY5eccUDVuxUHKqEL75CpwYlks4QVj2c1TG3UhTSpO3ozj6Mim2XHGPjMQmQy7xQk 2BCA== X-Gm-Message-State: AIVw110d0m4AK+0bXhfoZdjB5/PR5HWoj/DLEkYdClMniiGdavmVqcFb CmbPQAAx6VxEJSPi737uRw== X-Received: by 10.99.108.134 with SMTP id h128mr5859466pgc.29.1499893326814; Wed, 12 Jul 2017 14:02:06 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id m16sm8002488pfj.130.2017.07.12.14.02.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Jul 2017 14:02:06 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-crypto@vger.kernel.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Alex Cope , Eric Biggers Subject: [PATCH 2/6] fscrypt: rename ->ci_master_key to ->ci_master_key_descriptor Date: Wed, 12 Jul 2017 14:00:31 -0700 Message-Id: <20170712210035.51534-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.13.2.932.g7449e964c-goog In-Reply-To: <20170712210035.51534-1-ebiggers3@gmail.com> References: <20170712210035.51534-1-ebiggers3@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers In struct fscrypt_info, ->ci_master_key is the master key descriptor, not the master key itself. In preparation for introducing a struct fscrypt_master_key and making ->ci_master_key point to it, rename the existing ->ci_master_key to ->ci_master_key_descriptor. Signed-off-by: Eric Biggers Acked-by: Michael Halcrow --- fs/crypto/fscrypt_private.h | 2 +- fs/crypto/keyinfo.c | 4 ++-- fs/crypto/policy.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h index ef6909035823..5470aac82cab 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -107,7 +107,7 @@ struct fscrypt_info { u8 ci_data_mode; u8 ci_filename_mode; u8 ci_flags; - u8 ci_master_key[FS_KEY_DESCRIPTOR_SIZE]; + u8 ci_master_key_descriptor[FS_KEY_DESCRIPTOR_SIZE]; }; typedef enum { diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 7e664a11340a..5591fd24e4b2 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -293,8 +293,8 @@ int fscrypt_get_encryption_info(struct inode *inode) crypt_info->ci_data_mode = ctx.contents_encryption_mode; crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; crypt_info->ci_flags = ctx.flags; - memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, - sizeof(crypt_info->ci_master_key)); + memcpy(crypt_info->ci_master_key_descriptor, ctx.master_key_descriptor, + FS_KEY_DESCRIPTOR_SIZE); res = determine_cipher_type(crypt_info, inode, &cipher_str, &keysize); if (res) diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index 044f23fadb5a..81c59f8e45c0 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -224,7 +224,8 @@ int fscrypt_has_permitted_context(struct inode *parent, struct inode *child) child_ci = child->i_crypt_info; if (parent_ci && child_ci) { - return memcmp(parent_ci->ci_master_key, child_ci->ci_master_key, + return memcmp(parent_ci->ci_master_key_descriptor, + child_ci->ci_master_key_descriptor, FS_KEY_DESCRIPTOR_SIZE) == 0 && (parent_ci->ci_context_version == child_ci->ci_context_version) && @@ -282,7 +283,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child, ctx.contents_encryption_mode = ci->ci_data_mode; ctx.filenames_encryption_mode = ci->ci_filename_mode; ctx.flags = ci->ci_flags; - memcpy(ctx.master_key_descriptor, ci->ci_master_key, + memcpy(ctx.master_key_descriptor, ci->ci_master_key_descriptor, FS_KEY_DESCRIPTOR_SIZE); get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE); if (ctx.version != FSCRYPT_CONTEXT_V1)