From patchwork Wed Aug 3 22:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Huckleberry X-Patchwork-Id: 12935943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C677C19F2D for ; Wed, 3 Aug 2022 22:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237159AbiHCWlp (ORCPT ); Wed, 3 Aug 2022 18:41:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236179AbiHCWlp (ORCPT ); Wed, 3 Aug 2022 18:41:45 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E47A17587 for ; Wed, 3 Aug 2022 15:41:44 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-3282fe8f48fso29718477b3.17 for ; Wed, 03 Aug 2022 15:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=N1kHtACpfgmsbMFbEUNB8TGQc2yWFjE8j4fZSVbhCbA=; b=MYrQDEJkJpZU+64tomnIuv6c0l5NBVa4NisQFtD0FqrneE7DihqpSyhx3e69gR2spk yu16ySBifm6pZ9bvYhHzXSCTHVjQsU1npqW5lKfTAvzk6EvnEMUe6SEkNnFBTHFUKaaW M2z8tV0SFYGf8uh5Ct4PtuuY6Ag+RkI0gmOFzdz9UzPsraYLR3UiY1qdK/SDGlXLBsKO f6ss/UyFcMGNDIow2xA2+F5B0f6CsWysuk/usIHIfrAhWnVmo77rflZwxF1vJR51Yc+e 2OPAAIIuJN1sQZN9rQ8oVOpmVfsObaa6RsMPoFEYMoTdPtwiO6+2UFE6xhJllMfIeq2r RI0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=N1kHtACpfgmsbMFbEUNB8TGQc2yWFjE8j4fZSVbhCbA=; b=nnTHXS565CSxmtzQXq+qYVKBT0gPf40ez3GryDuDQGA0I+4PU2PW7TArRuto9oHHkO dT5DXtPsT0Pn0Atv24vcVM+VZ4xOxF3BbZUqLCQRqEYJdmMjXrbuDt7TrHW8XojWfw3S ycZzl+r9arQD2jzN8tp4VGPWmBF/mxnFN5PC+J4L1NmyvjXP3JrZU/q2exlUnZk+kKU4 BMkKUIgaTOv3s64Ylumy8qYv0OqsJ6w3ez+CotM5Rr5PKRdzGwkiEwBzjXgWkUqjqnc8 DeSCJ2a56E8JlAnnr2DWvKXiYi3tLyVEDt1xIJp4SULxVYQUpeJ+LWwGg+vuI5BpUZxD sIgw== X-Gm-Message-State: ACgBeo2VGolEoFNzYb3/ff4GQCGSZ2xhQ7wH/Cv7b4P7MbMRot52gwVJ uwbi8L4AUiU0fPOBHYaohOE46ph9062eLk91NI3pBoUjq4pyyDpdC0qHR1+2JlYzwQIjS29IYd3 OPaqDjmdduNqDJX9LeKs3fNIsW2KA+smrrqKpcUi7Kbb2N5f2pq1aBNT128uG X-Google-Smtp-Source: AA6agR7E6hUXf8P/U7i8yZUhvHwZv/Giuv/zoxarwEYqz75rqExVfFJKDJXfw4ISTo4hI2YfKgc78Q7zbQ== X-Received: from nhuck.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:39cc]) (user=nhuck job=sendgmr) by 2002:a0d:fcc7:0:b0:324:5b7b:5de6 with SMTP id m190-20020a0dfcc7000000b003245b7b5de6mr23086899ywf.506.1659566504273; Wed, 03 Aug 2022 15:41:44 -0700 (PDT) Date: Wed, 3 Aug 2022 15:41:21 -0700 In-Reply-To: <20220803224121.420705-1-nhuck@google.com> Message-Id: <20220803224121.420705-3-nhuck@google.com> Mime-Version: 1.0 References: <20220803224121.420705-1-nhuck@google.com> X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog Subject: [PATCH v5 2/2] generic: add tests for fscrypt policies with HCTR2 From: Nathan Huckleberry To: fstests@vger.kernel.org, linux-fscrypt@vger.kernel.org Cc: Eric Biggers , Sami Tolvanen , Nathan Huckleberry Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org This patch adds fscrypt policy tests for filename encryption using HCTR2. More information on HCTR2 can be found here: "Length-preserving encryption with HCTR2" https://ia.cr/2021/1441 Signed-off-by: Nathan Huckleberry Reviewed-by: Eric Biggers Tested-by: Eric Biggers --- tests/generic/900 | 31 +++++++++++++++++++++++++++++++ tests/generic/900.out | 16 ++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 tests/generic/900 create mode 100644 tests/generic/900.out diff --git a/tests/generic/900 b/tests/generic/900 new file mode 100755 index 00000000..1ff7c512 --- /dev/null +++ b/tests/generic/900 @@ -0,0 +1,31 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2022 Google LLC +# +# FS QA Test No. generic/900 +# +# Verify ciphertext for v2 encryption policies that use AES-256-XTS to encrypt +# file contents and AES-256-HCTR2 to encrypt file names. +# +# HCTR2 was introduced in kernel commit 6b2a51ff03bf ("fscrypt: Add HCTR2 +# support for filename encryption") +# +. ./common/preamble +_begin_fstest auto quick encrypt + +# Import common functions. +. ./common/filter +. ./common/encrypt + +# real QA test starts here +_supported_fs generic + +_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 v2 +_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 \ + v2 iv_ino_lblk_32 +_verify_ciphertext_for_encryption_policy AES-256-XTS AES-256-HCTR2 \ + v2 iv_ino_lblk_64 + +# success, all done +status=0 +exit diff --git a/tests/generic/900.out b/tests/generic/900.out new file mode 100644 index 00000000..a87c80b3 --- /dev/null +++ b/tests/generic/900.out @@ -0,0 +1,16 @@ +QA output created by 900 + +Verifying ciphertext with parameters: + contents_encryption_mode: AES-256-XTS + filenames_encryption_mode: AES-256-HCTR2 + options: v2 + +Verifying ciphertext with parameters: + contents_encryption_mode: AES-256-XTS + filenames_encryption_mode: AES-256-HCTR2 + options: v2 iv_ino_lblk_32 + +Verifying ciphertext with parameters: + contents_encryption_mode: AES-256-XTS + filenames_encryption_mode: AES-256-HCTR2 + options: v2 iv_ino_lblk_64