All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v5 4/8] crypto: x86/aesni-xctr: Add accelerated implementation of XCTR
@ 2022-04-27  9:56 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-04-27  9:56 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3144 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220427003759.1115361-5-nhuck@google.com>
References: <20220427003759.1115361-5-nhuck@google.com>
TO: Nathan Huckleberry <nhuck@google.com>

Hi Nathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v5.18-rc4 next-20220427]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Nathan-Huckleberry/crypto-HCTR2-support/20220427-084044
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-s002-20220425 (https://download.01.org/0day-ci/archive/20220427/202204271747.9NI6Iyxe-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/intel-lab-lkp/linux/commit/00cd244c8a1bd9623a271407bf10b99c01884ef5
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Nathan-Huckleberry/crypto-HCTR2-support/20220427-084044
        git checkout 00cd244c8a1bd9623a271407bf10b99c01884ef5
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/crypto/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> arch/x86/crypto/aesni-intel_glue.c:1287:1: sparse: sparse: unused label 'unregister_aeads'

vim +/unregister_aeads +1287 arch/x86/crypto/aesni-intel_glue.c

00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1284  
85671860caaca2 Herbert Xu         2016-11-22  1285  	return 0;
85671860caaca2 Herbert Xu         2016-11-22  1286  
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27 @1287  unregister_aeads:
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1288  	simd_unregister_aeads(aesni_aeads, ARRAY_SIZE(aesni_aeads),
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1289  				aesni_simd_aeads);
85671860caaca2 Herbert Xu         2016-11-22  1290  unregister_skciphers:
8b56d3488d8755 Eric Biggers       2019-03-10  1291  	simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
8b56d3488d8755 Eric Biggers       2019-03-10  1292  				  aesni_simd_skciphers);
07269559ac0bf7 Eric Biggers       2019-06-02  1293  unregister_cipher:
07269559ac0bf7 Eric Biggers       2019-06-02  1294  	crypto_unregister_alg(&aesni_cipher_alg);
af05b3009b6b10 Herbert Xu         2015-05-28  1295  	return err;
54b6a1bd5364ac Huang Ying         2009-01-18  1296  }
54b6a1bd5364ac Huang Ying         2009-01-18  1297  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [PATCH v5 4/8] crypto: x86/aesni-xctr: Add accelerated implementation of XCTR
@ 2022-04-27  9:12 kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2022-04-27  9:12 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4746 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220427003759.1115361-5-nhuck@google.com>
References: <20220427003759.1115361-5-nhuck@google.com>
TO: Nathan Huckleberry <nhuck@google.com>

Hi Nathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master linus/master v5.18-rc4 next-20220427]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Nathan-Huckleberry/crypto-HCTR2-support/20220427-084044
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout 00cd244c8a1bd9623a271407bf10b99c01884ef5
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> arch/x86/crypto/aesni-intel_glue.c:1287:1: warning: Label 'unregister_aeads' is not used. There is #if in function body so the label might be used in code that is removed by the preprocessor. [unusedLabelConfiguration]
   unregister_aeads:
   ^
   arch/x86/crypto/aesni-intel_glue.c:831:8: warning: Local variable 'aes_ctx' shadows outer function [shadowFunction]
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:222:38: note: Shadowed declaration
   static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx)
                                        ^
   arch/x86/crypto/aesni-intel_glue.c:831:8: note: Shadow variable
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:859:8: warning: Local variable 'aes_ctx' shadows outer function [shadowFunction]
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:222:38: note: Shadowed declaration
   static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx)
                                        ^
   arch/x86/crypto/aesni-intel_glue.c:859:8: note: Shadow variable
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:1162:8: warning: Local variable 'aes_ctx' shadows outer function [shadowFunction]
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:222:38: note: Shadowed declaration
   static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx)
                                        ^
   arch/x86/crypto/aesni-intel_glue.c:1162:8: note: Shadow variable
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:1179:8: warning: Local variable 'aes_ctx' shadows outer function [shadowFunction]
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^
   arch/x86/crypto/aesni-intel_glue.c:222:38: note: Shadowed declaration
   static inline struct crypto_aes_ctx *aes_ctx(void *raw_ctx)
                                        ^
   arch/x86/crypto/aesni-intel_glue.c:1179:8: note: Shadow variable
    void *aes_ctx = &(ctx->aes_key_expanded);
          ^

vim +/unregister_aeads +1287 arch/x86/crypto/aesni-intel_glue.c

00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1284  
85671860caaca2 Herbert Xu         2016-11-22  1285  	return 0;
85671860caaca2 Herbert Xu         2016-11-22  1286  
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27 @1287  unregister_aeads:
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1288  	simd_unregister_aeads(aesni_aeads, ARRAY_SIZE(aesni_aeads),
00cd244c8a1bd9 Nathan Huckleberry 2022-04-27  1289  				aesni_simd_aeads);
85671860caaca2 Herbert Xu         2016-11-22  1290  unregister_skciphers:
8b56d3488d8755 Eric Biggers       2019-03-10  1291  	simd_unregister_skciphers(aesni_skciphers, ARRAY_SIZE(aesni_skciphers),
8b56d3488d8755 Eric Biggers       2019-03-10  1292  				  aesni_simd_skciphers);
07269559ac0bf7 Eric Biggers       2019-06-02  1293  unregister_cipher:
07269559ac0bf7 Eric Biggers       2019-06-02  1294  	crypto_unregister_alg(&aesni_cipher_alg);
af05b3009b6b10 Herbert Xu         2015-05-28  1295  	return err;
54b6a1bd5364ac Huang Ying         2009-01-18  1296  }
54b6a1bd5364ac Huang Ying         2009-01-18  1297  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH v5 0/8] crypto: HCTR2 support
@ 2022-04-27  0:37 Nathan Huckleberry
  2022-04-27  0:37   ` Nathan Huckleberry
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Huckleberry @ 2022-04-27  0:37 UTC (permalink / raw)
  To: linux-crypto
  Cc: linux-fscrypt.vger.kernel.org, Herbert Xu, David S. Miller,
	linux-arm-kernel, Paul Crowley, Eric Biggers, Sami Tolvanen,
	Ard Biesheuvel, Nathan Huckleberry

HCTR2 is a length-preserving encryption mode that is efficient on
processors with instructions to accelerate AES and carryless
multiplication, e.g. x86 processors with AES-NI and CLMUL, and ARM
processors with the ARMv8 Crypto Extensions.

HCTR2 is specified in https://ia.cr/2021/1441 "Length-preserving encryption
with HCTR2" which shows that if AES is secure and HCTR2 is instantiated
with AES, then HCTR2 is secure.  Reference code and test vectors are at
https://github.com/google/hctr2.

As a length-preserving encryption mode, HCTR2 is suitable for applications
such as storage encryption where ciphertext expansion is not possible, and
thus authenticated encryption cannot be used.  Currently, such applications
usually use XTS, or in some cases Adiantum.  XTS has the disadvantage that
it is a narrow-block mode: a bitflip will only change 16 bytes in the
resulting ciphertext or plaintext.  This reveals more information to an
attacker than necessary.

HCTR2 is a wide-block mode, so it provides a stronger security property: a
bitflip will change the entire message.  HCTR2 is somewhat similar to
Adiantum, which is also a wide-block mode.  However, HCTR2 is designed to
take advantage of existing crypto instructions, while Adiantum targets
devices without such hardware support.  Adiantum is also designed with
longer messages in mind, while HCTR2 is designed to be efficient even on
short messages.

The first intended use of this mode in the kernel is for the encryption of
filenames, where for efficiency reasons encryption must be fully
deterministic (only one ciphertext for each plaintext) and the existing CBC
solution leaks more information than necessary for filenames with common
prefixes.

HCTR2 uses two passes of an ε-almost-∆-universal hash function called
POLYVAL and one pass of a block cipher mode called XCTR.  POLYVAL is a
polynomial hash designed for efficiency on modern processors and was
originally specified for use in AES-GCM-SIV (RFC 8452).  XCTR mode is a
variant of CTR mode that is more efficient on little-endian machines.

This patchset adds HCTR2 to Linux's crypto API, including generic
implementations of XCTR and POLYVAL, hardware accelerated implementations
of XCTR and POLYVAL for both x86-64 and ARM64, a templated implementation
of HCTR2, and an fscrypt policy for using HCTR2 for filename encryption.

Changes in v5:
 * Refactor HCTR2 tweak hashing
 * Remove non-AVX x86-64 XCTR implementation
 * Combine arm64 CTR and XCTR modes
 * Comment and alias CTR and XCTR modes
 * Move generic fallback code for simd POLYVAL into polyval-generic.c
 * Various small style fixes

Changes in v4:
 * Small style fixes in generic POLYVAL and XCTR
 * Move HCTR2 hash exporting/importing to helper functions
 * Rewrite montgomery reduction for x86-64 POLYVAL
 * Rewrite partial block handling for x86-64 POLYVAL
 * Optimize x86-64 POLYVAL loop handling
 * Remove ahash wrapper from x86-64 POLYVAL
 * Add simd-unavailable handling to x86-64 POLYVAL
 * Rewrite montgomery reduction for ARM64 POLYVAL
 * Rewrite partial block handling for ARM64 POLYVAL
 * Optimize ARM64 POLYVAL loop handling
 * Remove ahash wrapper from ARM64 POLYVAL
 * Add simd-unavailable handling to ARM64 POLYVAL

Changes in v3:
 * Improve testvec coverage for XCTR, POLYVAL and HCTR2
 * Fix endianness bug in xctr.c
 * Fix alignment issues in polyval-generic.c
 * Optimize hctr2.c by exporting/importing hash states
 * Fix blockcipher name derivation in hctr2.c
 * Move x86-64 XCTR implementation into aes_ctrby8_avx-x86_64.S
 * Reuse ARM64 CTR mode tail handling in ARM64 XCTR
 * Fix x86-64 POLYVAL comments
 * Fix x86-64 POLYVAL key_powers type to match asm
 * Fix ARM64 POLYVAL comments
 * Fix ARM64 POLYVAL key_powers type to match asm
 * Add XTS + HCTR2 policy to fscrypt


Nathan Huckleberry (8):
  crypto: xctr - Add XCTR support
  crypto: polyval - Add POLYVAL support
  crypto: hctr2 - Add HCTR2 support
  crypto: x86/aesni-xctr: Add accelerated implementation of XCTR
  crypto: arm64/aes-xctr: Add accelerated implementation of XCTR
  crypto: x86/polyval: Add PCLMULQDQ accelerated implementation of
    POLYVAL
  crypto: arm64/polyval: Add PMULL accelerated implementation of POLYVAL
  fscrypt: Add HCTR2 support for filename encryption

 Documentation/filesystems/fscrypt.rst   |   22 +-
 arch/arm64/crypto/Kconfig               |    9 +-
 arch/arm64/crypto/Makefile              |    3 +
 arch/arm64/crypto/aes-glue.c            |   64 +-
 arch/arm64/crypto/aes-modes.S           |  290 +++--
 arch/arm64/crypto/polyval-ce-core.S     |  369 ++++++
 arch/arm64/crypto/polyval-ce-glue.c     |  194 +++
 arch/x86/crypto/Makefile                |    3 +
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S |  232 ++--
 arch/x86/crypto/aesni-intel_glue.c      |  109 ++
 arch/x86/crypto/polyval-clmulni_asm.S   |  330 +++++
 arch/x86/crypto/polyval-clmulni_glue.c  |  200 +++
 crypto/Kconfig                          |   39 +-
 crypto/Makefile                         |    3 +
 crypto/hctr2.c                          |  580 +++++++++
 crypto/polyval-generic.c                |  242 ++++
 crypto/tcrypt.c                         |   10 +
 crypto/testmgr.c                        |   20 +
 crypto/testmgr.h                        | 1536 +++++++++++++++++++++++
 crypto/xctr.c                           |  191 +++
 fs/crypto/fscrypt_private.h             |    2 +-
 fs/crypto/keysetup.c                    |    7 +
 fs/crypto/policy.c                      |   14 +-
 include/crypto/polyval.h                |   26 +
 include/uapi/linux/fscrypt.h            |    3 +-
 25 files changed, 4306 insertions(+), 192 deletions(-)
 create mode 100644 arch/arm64/crypto/polyval-ce-core.S
 create mode 100644 arch/arm64/crypto/polyval-ce-glue.c
 create mode 100644 arch/x86/crypto/polyval-clmulni_asm.S
 create mode 100644 arch/x86/crypto/polyval-clmulni_glue.c
 create mode 100644 crypto/hctr2.c
 create mode 100644 crypto/polyval-generic.c
 create mode 100644 crypto/xctr.c
 create mode 100644 include/crypto/polyval.h

-- 
2.36.0.rc2.479.g8af0fa9b8e-goog


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-01 21:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27  9:56 [PATCH v5 4/8] crypto: x86/aesni-xctr: Add accelerated implementation of XCTR kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-04-27  9:12 kernel test robot
2022-04-27  0:37 [PATCH v5 0/8] crypto: HCTR2 support Nathan Huckleberry
2022-04-27  0:37 ` [PATCH v5 4/8] crypto: x86/aesni-xctr: Add accelerated implementation of XCTR Nathan Huckleberry
2022-04-27  0:37   ` Nathan Huckleberry
2022-04-27  4:26   ` kernel test robot
2022-05-01 21:31   ` Eric Biggers
2022-05-01 21:31     ` Eric Biggers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.