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: 794079 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cewt7B3Z"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xHk4D4gBGz9s75 for ; Thu, 27 Jul 2017 04:22:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbdGZSWv (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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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)