From patchwork Wed Jul 26 18:19:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9865671 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 CBF326038F for ; Wed, 26 Jul 2017 18:22:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C74D623201 for ; Wed, 26 Jul 2017 18:22:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBDF6287BD; Wed, 26 Jul 2017 18:22:54 +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 6EA6A23201 for ; Wed, 26 Jul 2017 18:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751445AbdGZSWv (ORCPT ); Wed, 26 Jul 2017 14:22:51 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33468 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751089AbdGZSWP (ORCPT ); Wed, 26 Jul 2017 14:22:15 -0400 Received: by mail-pf0-f194.google.com with SMTP id k72so12665904pfj.0; Wed, 26 Jul 2017 11:22:15 -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=TelPvfd74tMu2bNGeUNxTrU7hJTJZaKLJGuVzRZXgDA=; b=cewt7B3Zr335+4geOwZ4YFLVzZrUg012rTjIm9fP8PTaGqLMUGRDvE0mqyR8rcC+zg BDHWEXJ4UTrLK/8FyF1pXDwmgc4J+MqiJE9DYcqIgkstNQjZYFXXgFVKukp1wraVEV4b CE2xbRdNw5WvGyQO7LAI+/tOZjV1Lz3hXmmYjXVoKHYK1OtJHPX/ZsjXWsu6EBeiNjyg TkQmRKwt1G9ZSfdlRWrfgkWfJnGA14OGZ7IeCVB1Nv+Xoh6pbF5x13aLQuIGNgoZl6pA BCuZ9uDPWCqVV8JhTGnlQbwLaR9xDHh66+pb90giYXu7sS387UAvBe7s6Gd9eJXA9CTj zfJw== 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=TelPvfd74tMu2bNGeUNxTrU7hJTJZaKLJGuVzRZXgDA=; b=B5zJnF4xe/7Nf6FrZ2oVIWGxCAQPE6D+5D+5FGEbpIVLFAsT8cSk7PF9bDMTaRk7a0 sTYFV5xOf8tlewTC72FKPEGZUh8YY5o8xWdUv4LMS3fyrR9O17ssrZUDejOI7Ewh5z4q WwbR67uGd8+S158BPbKpQRYVpXlRq6YMej4R4oON9/NDOp1ou9yhbDWHwOCSfJedCSy/ rDyKk/sg2p1UJ9a6mePFiAmK3934USSh/na9kn2gcPJRJr+JrbBdQ4+jgC3YywTje/Tj rMYN3IK0pbmRsufEYyLv5LFKagXXZH06EabcVgWc7l8g0NEc/57oP2zl0i03Qx4aG4Kx yGqw== X-Gm-Message-State: AIVw112ojiGpj/C+SKw4pE6hfAn7nEqfvJaKNM70dBDyQMS3WU95Pj61 lCh2ZRwLAyck5F1daXU= X-Received: by 10.98.204.22 with SMTP id a22mr1622319pfg.59.1501093334608; Wed, 26 Jul 2017 11:22:14 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id b4sm28394064pgc.9.2017.07.26.11.22.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Jul 2017 11:22:14 -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 , Michael Halcrow , Eric Biggers Subject: [PATCH v2 2/7] fscrypt: rename ->ci_master_key to ->ci_master_key_descriptor Date: Wed, 26 Jul 2017 11:19:24 -0700 Message-Id: <20170726181929.99880-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.14.0.rc0.400.g1c36432dff-goog In-Reply-To: <20170726181929.99880-1-ebiggers3@gmail.com> References: <20170726181929.99880-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. Acked-by: Michael Halcrow Signed-off-by: Eric Biggers --- 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 8329fb905ac6..4b0205accae9 100644 --- a/fs/crypto/fscrypt_private.h +++ b/fs/crypto/fscrypt_private.h @@ -110,7 +110,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 d6beb48f08fc..fe525da9e79c 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -226,7 +226,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) && @@ -284,7 +285,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)